From owner-svn-src-all@freebsd.org Sun Jun 19 00:06:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A5CFA79BB9; Sun, 19 Jun 2016 00:06:37 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E9B4216E0; Sun, 19 Jun 2016 00:06:36 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id EQFvbNWpVN9d0EQFwb3vwr; Sat, 18 Jun 2016 18:06:29 -0600 X-Authority-Analysis: v=2.2 cv=QZUkhYTv c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=pD_ry4oyNxEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=6bjs4j2-ulXUaOp-ORUA:9 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 0479913752; Sat, 18 Jun 2016 17:06:27 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u5J06Qk6009591; Sat, 18 Jun 2016 17:06:26 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201606190006.u5J06Qk6009591@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Niclas Zeising cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288291 - head/etc In-Reply-To: Message from Niclas Zeising of "Sun, 19 Jun 2016 00:06:32 +0200." <2171b966-35c7-2dad-2c0f-f23061cb677a@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 18 Jun 2016 17:06:26 -0700 X-CMAE-Envelope: MS4wfNEk94othDyAawdxAUUBXXWjvvMz70gz8uaG1KddphgPc9DOGr+uUBu8MUpaxq2X6PrqyQHlS0rDO865IGakQubgFFtuGkxuyOqLI5cTCwM6r8xiiY0h zh3m+w1pFLMSVG2kYBOj/KCEgIbdqVM+yvyRG7tK97iBDsFKMFraFCMqc2OPTpf+V1mwuLrvOkgWRrp+7sGCtkHPjxS7eF8voPqcW2j56rt2SOfygPcwG3XG A5X5hrUaeOWyNAtI+gF6JU78K7Hl5Jfyke8viTnj9gekkr9NV1sOTanODa3nNPJri6OqeWiL9n/kIHwEDQmNYA== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 00:06:37 -0000 In message <2171b966-35c7-2dad-2c0f-f23061cb677a@freebsd.org>, Niclas Zeising w rites: > On 09/27/15 06:03, Adrian Chadd wrote: > > Author: adrian > > Date: Sun Sep 27 04:03:11 2015 > > New Revision: 288291 > > URL: https://svnweb.freebsd.org/changeset/base/288291 > > > > Log: > > Enforce consistent limits of daemons run from rc.subr: > > > > * Allow the user to configure the login class to use in rc.conf > > by using {daemon}_login_class, which; > > * Use the daemon class by default; > > * .. and then use 'limits' to set the login class so it works both > > via init at startup (which runs this in 'daemon' class) and via > > whichever root environment (eg command line, other daemons, etc.) > > > > Reviewed by: dteske > > Differential Revision: https://reviews.freebsd.org/D3630 > > > > Modified: > > head/etc/rc.subr > > > > Modified: head/etc/rc.subr > > =========================================================================== > === > > --- head/etc/rc.subr Sun Sep 27 03:46:55 2015 (r288290) > > +++ head/etc/rc.subr Sun Sep 27 04:03:11 2015 (r288291) > > @@ -768,6 +768,8 @@ check_startmsgs() > > # > > # ${name}_prepend n Command added before ${command}. > > # > > +# ${name}_login_class n Login class to use, else "daemon". > > +# > > # ${rc_arg}_cmd n If set, use this as the method when invoked; > > # Otherwise, use default command (see below) > > # > > @@ -942,7 +944,7 @@ run_rc_command() > > _nice=\$${name}_nice _user=\$${name}_user \ > > _group=\$${name}_group _groups=\$${name}_groups \ > > _fib=\$${name}_fib _env=\$${name}_env \ > > - _prepend=\$${name}_prepend > > + _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-da > emon} > > > > if [ -n "$_user" ]; then # unset $_user if running as that user > > if [ "$_user" = "$(eval $IDCMD)" ]; then > > @@ -1050,6 +1052,9 @@ $command $rc_flags $command_args" > > fi > > fi > > > > + # Prepend default limits > > + _doit="limits -C $_login_class $_doit" > ^^^^^^^^^^ > > + > > # run the full command > > # > > if ! _run_rc_doit "$_doit"; then > > Apologies for waking so late. > This breaks the start of scripts running before file systems are > mounted, for example /etc/rc.d/ddb, if / and /usr are on separate > partitions. The issue is that limits is /usr/bin/limits, and for > obvious reasons can't be found before /usr is mounted. > I suggest either move /usr/bin/limits to /bin/limits or avoid using it > altogether. > Do you want me to open a PR to track this issue? > Regards! A simple solution might be, Index: rc.subr =================================================================== --- rc.subr (revision 302001) +++ rc.subr (working copy) @@ -1071,8 +1071,13 @@ fi fi + # Before we prepend limits, test if limits is + # available (/usr is mounted) so that limits can + # be run. + if limits >/dev/null 2>&1; then # Prepend default limits - _doit="limits -C $_login_class $_doit" + _doit="limits -C $_login_class $_doit" + fi # run the full command # -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sun Jun 19 00:39:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97E91A78344; Sun, 19 Jun 2016 00:39:24 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FC252264; Sun, 19 Jun 2016 00:39:24 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5J0dNNE008713; Sun, 19 Jun 2016 00:39:23 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5J0dN8D008711; Sun, 19 Jun 2016 00:39:23 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201606190039.u5J0dN8D008711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 19 Jun 2016 00:39: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: r302015 - stable/10/sys/contrib/ipfilter/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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 00:39:24 -0000 Author: cy Date: Sun Jun 19 00:39:23 2016 New Revision: 302015 URL: https://svnweb.freebsd.org/changeset/base/302015 Log: MFC r300259: Enable the two ip_frag tuneables. The code is there but the two ip_frag tuneables aren't registered in the ipf_tuners linked list. This commmit enables the two existing ip_frag tuneables by registering them. MFC r300260: Remove extraneous blank line. Modified: stable/10/sys/contrib/ipfilter/netinet/ip_frag.c stable/10/sys/contrib/ipfilter/netinet/ip_frag.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_frag.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_frag.c Sat Jun 18 23:18:04 2016 (r302014) +++ stable/10/sys/contrib/ipfilter/netinet/ip_frag.c Sun Jun 19 00:39:23 2016 (r302015) @@ -112,7 +112,7 @@ static void ipf_frag_free __P((ipf_frag_ static frentry_t ipfr_block; -const ipftuneable_t ipf_tuneables[] = { +static ipftuneable_t ipf_frag_tuneables[] = { { { (void *)offsetof(ipf_frag_softc_t, ipfr_size) }, "frag_size", 1, 0x7fffffff, stsizeof(ipf_frag_softc_t, ipfr_size), @@ -189,6 +189,18 @@ ipf_frag_soft_create(softc) RWLOCK_INIT(&softf->ipfr_frag, "ipf fragment rwlock"); RWLOCK_INIT(&softf->ipfr_natfrag, "ipf NAT fragment rwlock"); + softf->ipf_frag_tune = ipf_tune_array_copy(softf, + sizeof(ipf_frag_tuneables), + ipf_frag_tuneables); + if (softf->ipf_frag_tune == NULL) { + ipf_frag_soft_destroy(softc, softf); + return NULL; + } + if (ipf_tune_array_link(softc, softf->ipf_frag_tune) == -1) { + ipf_frag_soft_destroy(softc, softf); + return NULL; + } + softf->ipfr_size = IPFT_SIZE; softf->ipfr_ttl = IPF_TTLVAL(60); softf->ipfr_lock = 1; @@ -219,6 +231,12 @@ ipf_frag_soft_destroy(softc, arg) RW_DESTROY(&softf->ipfr_frag); RW_DESTROY(&softf->ipfr_natfrag); + if (softf->ipf_frag_tune != NULL) { + ipf_tune_array_unlink(softc, softf->ipf_frag_tune); + KFREES(softf->ipf_frag_tune, sizeof(ipf_frag_tuneables)); + softf->ipf_frag_tune = NULL; + } + KFREE(softf); } Modified: stable/10/sys/contrib/ipfilter/netinet/ip_frag.h ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_frag.h Sat Jun 18 23:18:04 2016 (r302014) +++ stable/10/sys/contrib/ipfilter/netinet/ip_frag.h Sun Jun 19 00:39:23 2016 (r302015) @@ -78,6 +78,7 @@ typedef struct ipf_frag_softc_s { int ipfr_ttl; int ipfr_lock; int ipfr_inited; + ipftuneable_t *ipf_frag_tune; ipfr_t *ipfr_list; ipfr_t **ipfr_tail; ipfr_t *ipfr_natlist; From owner-svn-src-all@freebsd.org Sun Jun 19 03:32:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DED2A7A319; Sun, 19 Jun 2016 03:32:28 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 630522B48; Sun, 19 Jun 2016 03:32:28 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-io0-x22e.google.com with SMTP id f30so98107825ioj.2; Sat, 18 Jun 2016 20:32:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=P1JsJPb3unPZtLMZIZSL20vvHQcYN9ktddSV4IIQ05M=; b=E/le8PaySYylMSmzkaX+GF4UjWsi3Mpn3HwtAhzrqsRAFRiN+A6W8TWzGlWkBjjN3y 2vQahlO+RHOrRiALcX8LlnwA/DNJryqMO1p3oV4EjJzTJUJbZ93AmBQ9jEtdcUP8xbse f8SnLP9/8Uk+bGpY6YUL2n6wbpc5A4rPqsYaOcQuZuvaVHZYbr2QoDLHuQR8Z5cDMmIz tk2wUGH4ylmEPPJq3VM57+dF2v2NSNtHpcUSuW8ZThQ9t3xDs3HDjVYhhcRTC+yAUfol 45c5bgkbOCZleCaHRACH5WeXvFdmg2PKVmlphWONdp09u01bSsNW7OarHgqeowS07Q6F bbMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=P1JsJPb3unPZtLMZIZSL20vvHQcYN9ktddSV4IIQ05M=; b=BodpDUsQ+PDH3OmGs4SC9yOVapsmu5ESNuCsUmh1LOo3iqoS37FDUUiMauK2wpWvUb mD+lStfAEF+QfCSJ9vAcbzdjCFwILAKrrfq0e0OgR8tJC/cNWrVzQWIQWUkJfX0baH9Z OhzRszW9T5bUgBmCDS270MACZEXJbd9kc1WpTayhsveiSqvkIekqeSXBT/6diymtcsJ2 /XCLApqdWXr6cue59xg9wliaOdRirXKntWNxBY1C2Bjz4ONGUU8s53RXfrc1IVDFRaiZ wtGSizyleFKDW6SCcsuA3ss8OgC0nR4wyk1ar6D7BNrvqauNVEDr+qU7aULnuwpMsby9 N6QQ== X-Gm-Message-State: ALyK8tKW9KdIhbASJfRbP3NpnuHZ4iAS85ETUicQlpNmF3OLQycb8fkeIteHGBd9oeQoZ4uLFpr5C+PHzWmbng== X-Received: by 10.107.144.2 with SMTP id s2mr12322349iod.165.1466307147600; Sat, 18 Jun 2016 20:32:27 -0700 (PDT) MIME-Version: 1.0 Sender: adrian.chadd@gmail.com Received: by 10.36.113.3 with HTTP; Sat, 18 Jun 2016 20:32:26 -0700 (PDT) In-Reply-To: <201606190006.u5J06Qk6009591@slippy.cwsent.com> References: <2171b966-35c7-2dad-2c0f-f23061cb677a@freebsd.org> <201606190006.u5J06Qk6009591@slippy.cwsent.com> From: Adrian Chadd Date: Sat, 18 Jun 2016 20:32:26 -0700 X-Google-Sender-Auth: pGY9XasTuOiq20l4LYAMBYCbDds Message-ID: Subject: Re: svn commit: r288291 - head/etc To: Cy Schubert Cc: Niclas Zeising , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 03:32:28 -0000 i think that's fine for -11. I'd like to just move limits to /bin for 12. (I mean, it's 2016, why are you splitting / and /usr again? But..) I don't want to see differing system behaviour between limits but it's likely unavoidable for 11 and could do with some errata notice so people know what to expect. Thanks, -adrian On 18 June 2016 at 17:06, Cy Schubert wrote: > In message <2171b966-35c7-2dad-2c0f-f23061cb677a@freebsd.org>, Niclas > Zeising w > rites: >> On 09/27/15 06:03, Adrian Chadd wrote: >> > Author: adrian >> > Date: Sun Sep 27 04:03:11 2015 >> > New Revision: 288291 >> > URL: https://svnweb.freebsd.org/changeset/base/288291 >> > >> > Log: >> > Enforce consistent limits of daemons run from rc.subr: >> > >> > * Allow the user to configure the login class to use in rc.conf >> > by using {daemon}_login_class, which; >> > * Use the daemon class by default; >> > * .. and then use 'limits' to set the login class so it works both >> > via init at startup (which runs this in 'daemon' class) and via >> > whichever root environment (eg command line, other daemons, etc.) >> > >> > Reviewed by: dteske >> > Differential Revision: https://reviews.freebsd.org/D3630 >> > >> > Modified: >> > head/etc/rc.subr >> > >> > Modified: head/etc/rc.subr >> > =========================================================================== >> === >> > --- head/etc/rc.subr Sun Sep 27 03:46:55 2015 (r288290) >> > +++ head/etc/rc.subr Sun Sep 27 04:03:11 2015 (r288291) >> > @@ -768,6 +768,8 @@ check_startmsgs() >> > # >> > # ${name}_prepend n Command added before ${command}. >> > # >> > +# ${name}_login_class n Login class to use, else "daemon". >> > +# >> > # ${rc_arg}_cmd n If set, use this as the method when invoked; >> > # Otherwise, use default command (see below) >> > # >> > @@ -942,7 +944,7 @@ run_rc_command() >> > _nice=\$${name}_nice _user=\$${name}_user \ >> > _group=\$${name}_group _groups=\$${name}_groups \ >> > _fib=\$${name}_fib _env=\$${name}_env \ >> > - _prepend=\$${name}_prepend >> > + _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-da >> emon} >> > >> > if [ -n "$_user" ]; then # unset $_user if running as that user >> > if [ "$_user" = "$(eval $IDCMD)" ]; then >> > @@ -1050,6 +1052,9 @@ $command $rc_flags $command_args" >> > fi >> > fi >> > >> > + # Prepend default limits >> > + _doit="limits -C $_login_class $_doit" >> ^^^^^^^^^^ >> > + >> > # run the full command >> > # >> > if ! _run_rc_doit "$_doit"; then >> >> Apologies for waking so late. >> This breaks the start of scripts running before file systems are >> mounted, for example /etc/rc.d/ddb, if / and /usr are on separate >> partitions. The issue is that limits is /usr/bin/limits, and for >> obvious reasons can't be found before /usr is mounted. >> I suggest either move /usr/bin/limits to /bin/limits or avoid using it >> altogether. >> Do you want me to open a PR to track this issue? >> Regards! > > A simple solution might be, > > Index: rc.subr > =================================================================== > --- rc.subr (revision 302001) > +++ rc.subr (working copy) > @@ -1071,8 +1071,13 @@ > fi > fi > > + # Before we prepend limits, test if limits is > + # available (/usr is mounted) so that limits can > + # be run. > + if limits >/dev/null 2>&1; then > # Prepend default limits > - _doit="limits -C $_login_class $_doit" > + _doit="limits -C $_login_class $_doit" > + fi > > # run the full command > # > > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > > From owner-svn-src-all@freebsd.org Sun Jun 19 03:44:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5DD4A7A4B7; Sun, 19 Jun 2016 03:44:36 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86C8F2F97; Sun, 19 Jun 2016 03:44:36 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5J3iZ2D079685; Sun, 19 Jun 2016 03:44:35 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5J3iWO6079652; Sun, 19 Jun 2016 03:44:32 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201606190344.u5J3iWO6079652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Sun, 19 Jun 2016 03:44:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 03:44:36 -0000 Author: ume Date: Sun Jun 19 03:44:32 2016 New Revision: 302016 URL: https://svnweb.freebsd.org/changeset/base/302016 Log: - Prefer to use %d over %e where the day of the month should be zero filled. - Since %e means the day of the month as well, regard %e as same as %d in md_order. Reported by: vangyzen Approved by: re (gjb) Modified: head/share/timedef/ar_JO.UTF-8.src head/share/timedef/ar_MA.UTF-8.src head/share/timedef/ar_SA.UTF-8.src head/share/timedef/be_BY.CP1131.src head/share/timedef/be_BY.CP1251.src head/share/timedef/be_BY.ISO8859-5.src head/share/timedef/be_BY.UTF-8.src head/share/timedef/bg_BG.CP1251.src head/share/timedef/bg_BG.UTF-8.src head/share/timedef/ca_IT.ISO8859-15.src head/share/timedef/ca_IT.UTF-8.src head/share/timedef/el_GR.ISO8859-7.src head/share/timedef/el_GR.UTF-8.src head/share/timedef/en_SG.UTF-8.src head/share/timedef/en_US.UTF-8.src head/share/timedef/es_AR.ISO8859-1.src head/share/timedef/es_CR.UTF-8.src head/share/timedef/es_ES.ISO8859-15.src head/share/timedef/es_ES.UTF-8.src head/share/timedef/fi_FI.ISO8859-15.src head/share/timedef/fi_FI.UTF-8.src head/share/timedef/fr_BE.ISO8859-15.src head/share/timedef/fr_BE.UTF-8.src head/share/timedef/he_IL.UTF-8.src head/share/timedef/hi_IN.ISCII-DEV.src head/share/timedef/hi_IN.UTF-8.src head/share/timedef/is_IS.ISO8859-15.src head/share/timedef/is_IS.UTF-8.src head/share/timedef/ko_KR.UTF-8.src head/share/timedef/ko_KR.eucKR.src head/share/timedef/nl_BE.UTF-8.src head/share/timedef/sl_SI.ISO8859-2.src head/share/timedef/sl_SI.UTF-8.src head/share/timedef/sr_Cyrl_RS.ISO8859-5.src head/share/timedef/sr_Latn_RS.ISO8859-2.src head/share/timedef/sr_Latn_RS.UTF-8.src head/share/timedef/tr_TR.ISO8859-9.src head/share/timedef/tr_TR.UTF-8.src head/share/timedef/zh_Hans_CN.GB2312.src head/share/timedef/zh_Hans_CN.GBK.src head/share/timedef/zh_Hans_CN.UTF-8.src head/share/timedef/zh_Hans_CN.eucCN.src head/share/timedef/zh_Hant_HK.UTF-8.src head/share/timedef/zh_Hant_TW.Big5.src head/share/timedef/zh_Hant_TW.UTF-8.src head/tools/tools/locale/tools/cldr2def.pl Modified: head/share/timedef/ar_JO.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/ar_MA.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/ar_SA.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/be_BY.CP1131.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/be_BY.CP1251.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/be_BY.ISO8859-5.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/be_BY.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/bg_BG.CP1251.src ============================================================================== --- head/share/timedef/bg_BG.CP1251.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/bg_BG.CP1251.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ %H:%M:%S # # x_fmt -%e.%m.%y г. +%d.%m.%y г. # # c_fmt %A %e %B %Y . %H:%M:%S @@ -80,7 +80,7 @@ # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/bg_BG.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/ca_IT.ISO8859-15.src ============================================================================== --- head/share/timedef/ca_IT.ISO8859-15.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/ca_IT.ISO8859-15.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ dissabte %H:%M:%S # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %A %e %B de %Y, %H:%M:%S @@ -80,7 +80,7 @@ de novembre de desembre # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/ca_IT.UTF-8.src ============================================================================== --- head/share/timedef/ca_IT.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/ca_IT.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ dissabte %H:%M:%S # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %A %e %B de %Y, %H:%M:%S @@ -80,7 +80,7 @@ de novembre de desembre # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/el_GR.ISO8859-7.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/el_GR.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/en_SG.UTF-8.src ============================================================================== --- head/share/timedef/en_SG.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/en_SG.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ Saturday %I:%M:%S %p # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %A %e %B %Y at %I:%M:%S %p @@ -80,7 +80,7 @@ November December # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/en_US.UTF-8.src ============================================================================== --- head/share/timedef/en_US.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/en_US.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ Saturday %I:%M:%S %p # # x_fmt -%m/%e/%y +%m/%d/%y # # c_fmt %A, %B %e, %Y at %I:%M:%S %p @@ -80,7 +80,7 @@ November December # # md_order -m +md # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/es_AR.ISO8859-1.src ============================================================================== --- head/share/timedef/es_AR.ISO8859-1.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/es_AR.ISO8859-1.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ sbado %I:%M:%S %p # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %e de %B de %Y, %I:%M:%S %p @@ -80,7 +80,7 @@ noviembre diciembre # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/es_CR.UTF-8.src ============================================================================== --- head/share/timedef/es_CR.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/es_CR.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ sábado %I:%M:%S %p # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %e de %B de %Y, %I:%M:%S %p @@ -80,7 +80,7 @@ noviembre diciembre # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/es_ES.ISO8859-15.src ============================================================================== --- head/share/timedef/es_ES.ISO8859-15.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/es_ES.ISO8859-15.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ sbado %H:%M:%S # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %e de %B de %Y, %H:%M:%S @@ -80,7 +80,7 @@ noviembre diciembre # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/es_ES.UTF-8.src ============================================================================== --- head/share/timedef/es_ES.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/es_ES.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ sábado %H:%M:%S # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %e de %B de %Y, %H:%M:%S @@ -80,7 +80,7 @@ noviembre diciembre # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/fi_FI.ISO8859-15.src ============================================================================== --- head/share/timedef/fi_FI.ISO8859-15.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/fi_FI.ISO8859-15.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ lauantaina %H.%M.%S # # x_fmt -%e.%m.%Y +%d.%m.%Y # # c_fmt %e. %B %Y klo %H.%M.%S @@ -80,7 +80,7 @@ marraskuuta joulukuuta # # md_order -m +dm # # ampm_fmt %I.%M.%S %p Modified: head/share/timedef/fi_FI.UTF-8.src ============================================================================== --- head/share/timedef/fi_FI.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/fi_FI.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ lauantaina %H.%M.%S # # x_fmt -%e.%m.%Y +%d.%m.%Y # # c_fmt %e. %B %Y klo %H.%M.%S @@ -80,7 +80,7 @@ marraskuuta joulukuuta # # md_order -m +dm # # ampm_fmt %I.%M.%S %p Modified: head/share/timedef/fr_BE.ISO8859-15.src ============================================================================== --- head/share/timedef/fr_BE.ISO8859-15.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/fr_BE.ISO8859-15.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ samedi %H:%M:%S # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %A %e %B %Y %H:%M:%S @@ -80,7 +80,7 @@ novembre dcembre # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/fr_BE.UTF-8.src ============================================================================== --- head/share/timedef/fr_BE.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/fr_BE.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ samedi %H:%M:%S # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %A %e %B %Y %H:%M:%S @@ -80,7 +80,7 @@ novembre décembre # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/he_IL.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/hi_IN.ISCII-DEV.src ============================================================================== --- head/share/timedef/hi_IN.ISCII-DEV.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/hi_IN.ISCII-DEV.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ %I:%M:%S %p # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %A %e %B %Y %I:%M:%S %p @@ -80,7 +80,7 @@ ע # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/hi_IN.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/is_IS.ISO8859-15.src ============================================================================== --- head/share/timedef/is_IS.ISO8859-15.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/is_IS.ISO8859-15.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ laugardagur %H:%M:%S # # x_fmt -%e.%m.%Y +%d.%m.%Y # # c_fmt %e. %B %Y kl. %H:%M:%S @@ -80,7 +80,7 @@ nvember desember # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/is_IS.UTF-8.src ============================================================================== --- head/share/timedef/is_IS.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/is_IS.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ laugardagur %H:%M:%S # # x_fmt -%e.%m.%Y +%d.%m.%Y # # c_fmt %e. %B %Y kl. %H:%M:%S @@ -80,7 +80,7 @@ nóvember desember # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/ko_KR.UTF-8.src ============================================================================== --- head/share/timedef/ko_KR.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/ko_KR.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -80,7 +80,7 @@ 12월 # # md_order -m +md # # ampm_fmt %p %I:%M:%S Modified: head/share/timedef/ko_KR.eucKR.src ============================================================================== --- head/share/timedef/ko_KR.eucKR.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/ko_KR.eucKR.src Sun Jun 19 03:44:32 2016 (r302016) @@ -80,7 +80,7 @@ 12 # # md_order -m +md # # ampm_fmt %p %I:%M:%S Modified: head/share/timedef/nl_BE.UTF-8.src ============================================================================== --- head/share/timedef/nl_BE.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/nl_BE.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ zaterdag %H:%M:%S # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %A %e %B %Y %H:%M:%S @@ -80,7 +80,7 @@ november december # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/sl_SI.ISO8859-2.src ============================================================================== --- head/share/timedef/sl_SI.ISO8859-2.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/sl_SI.ISO8859-2.src Sun Jun 19 03:44:32 2016 (r302016) @@ -80,7 +80,7 @@ november december # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/sl_SI.UTF-8.src ============================================================================== --- head/share/timedef/sl_SI.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/sl_SI.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -80,7 +80,7 @@ november december # # md_order -m +dm # # ampm_fmt %I:%M:%S %p Modified: head/share/timedef/sr_Cyrl_RS.ISO8859-5.src ============================================================================== --- head/share/timedef/sr_Cyrl_RS.ISO8859-5.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/sr_Cyrl_RS.ISO8859-5.src Sun Jun 19 03:44:32 2016 (r302016) @@ -87,7 +87,7 @@ subota %H.%M.%S""%H.%M.%S # # x_fmt -%e.%m.%y.""%e.%m.%y. +%d.%m.%y.""%e.%m.%y. # # c_fmt %d. %B %Y. %H.%M.%S""%d. %B %Y. %H.%M.%S %Z @@ -126,7 +126,7 @@ novembar decembar # # md_order -mm +dmdm # # ampm_fmt %I.%M.%S %p""%I.%M.%S %p Modified: head/share/timedef/sr_Latn_RS.ISO8859-2.src ============================================================================== --- head/share/timedef/sr_Latn_RS.ISO8859-2.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/sr_Latn_RS.ISO8859-2.src Sun Jun 19 03:44:32 2016 (r302016) @@ -87,7 +87,7 @@ subota %H.%M.%S""%H.%M.%S # # x_fmt -%e.%m.%y.""%e.%m.%y. +%d.%m.%y.""%d.%m.%y. # # c_fmt %d. %B %Y. %H.%M.%S""%d. %B %Y. %H.%M.%S %Z @@ -126,7 +126,7 @@ novembar decembar # # md_order -mm +dmdm # # ampm_fmt %I.%M.%S %p""%I.%M.%S %p Modified: head/share/timedef/sr_Latn_RS.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/tr_TR.ISO8859-9.src ============================================================================== --- head/share/timedef/tr_TR.ISO8859-9.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/tr_TR.ISO8859-9.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ Cumartesi %H:%M:%S # # x_fmt -%e.%m.%Y +%d.%m.%Y # # c_fmt %A %e %B %Y %H:%M:%S @@ -80,7 +80,7 @@ Kasm Aralk # # md_order -m +dm # # ampm_fmt %p %I:%M:%S Modified: head/share/timedef/tr_TR.UTF-8.src ============================================================================== --- head/share/timedef/tr_TR.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/tr_TR.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ Cumartesi %H:%M:%S # # x_fmt -%e.%m.%Y +%d.%m.%Y # # c_fmt %A %e %B %Y %H:%M:%S @@ -80,7 +80,7 @@ Kasım Aralık # # md_order -m +dm # # ampm_fmt %p %I:%M:%S Modified: head/share/timedef/zh_Hans_CN.GB2312.src ============================================================================== --- head/share/timedef/zh_Hans_CN.GB2312.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/zh_Hans_CN.GB2312.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ PGFZAy %p%I:%M:%S # # x_fmt -%y#/%m#/%e +%y#/%m#/%d # # c_fmt %YDj%mTB%eHU %p%I:%M:%S @@ -80,7 +80,7 @@ J.R;TB J.6~TB # # md_order -m +md # # ampm_fmt %p%I:%M:%S Modified: head/share/timedef/zh_Hans_CN.GBK.src ============================================================================== --- head/share/timedef/zh_Hans_CN.GBK.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/zh_Hans_CN.GBK.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ %p%I:%M:%S # # x_fmt -%y/%m/%e +%y/%m/%d # # c_fmt %Y%m%e %p%I:%M:%S @@ -80,7 +80,7 @@ ʮ # # md_order -m +md # # ampm_fmt %p%I:%M:%S Modified: head/share/timedef/zh_Hans_CN.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/share/timedef/zh_Hans_CN.eucCN.src ============================================================================== --- head/share/timedef/zh_Hans_CN.eucCN.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/zh_Hans_CN.eucCN.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ %p%I:%M:%S # # x_fmt -%y%m%e +%y%m%d # # c_fmt %Y%m%e %p%I:%M:%S @@ -80,7 +80,7 @@ ʮ # # md_order -m +md # # ampm_fmt %p%I:%M:%S Modified: head/share/timedef/zh_Hant_HK.UTF-8.src ============================================================================== --- head/share/timedef/zh_Hant_HK.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/zh_Hant_HK.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ %p%I:%M:%S # # x_fmt -%e/%m/%y +%d/%m/%y # # c_fmt %Y年%m月%e日 %p%I:%M:%S [%Z] @@ -80,7 +80,7 @@ 12月 # # md_order -m +dm # # ampm_fmt %p%I:%M:%S Modified: head/share/timedef/zh_Hant_TW.Big5.src ============================================================================== --- head/share/timedef/zh_Hant_TW.Big5.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/zh_Hant_TW.Big5.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ %p%I:%M:%S # # x_fmt -%YA%mA%e +%YA%mA%d # # c_fmt %Y~%m%e %p%I:%M:%S [%Z] @@ -80,7 +80,7 @@ # # md_order -m +md # # ampm_fmt %p%I:%M:%S Modified: head/share/timedef/zh_Hant_TW.UTF-8.src ============================================================================== --- head/share/timedef/zh_Hant_TW.UTF-8.src Sun Jun 19 00:39:23 2016 (r302015) +++ head/share/timedef/zh_Hant_TW.UTF-8.src Sun Jun 19 03:44:32 2016 (r302016) @@ -53,7 +53,7 @@ %p%I:%M:%S # # x_fmt -%Y/%m/%e +%Y/%m/%d # # c_fmt %Y年%m月%e日 %p%I:%M:%S [%Z] @@ -80,7 +80,7 @@ 12月 # # md_order -m +md # # ampm_fmt %p%I:%M:%S Modified: head/tools/tools/locale/tools/cldr2def.pl ============================================================================== --- head/tools/tools/locale/tools/cldr2def.pl Sun Jun 19 00:39:23 2016 (r302015) +++ head/tools/tools/locale/tools/cldr2def.pl Sun Jun 19 03:44:32 2016 (r302016) @@ -68,6 +68,7 @@ my %callback = ( mdorder => \&callback_mdorder, altmon => \&callback_altmon, cformat => \&callback_cformat, + dformat => \&callback_dformat, dtformat => \&callback_dtformat, cbabmon => \&callback_abmon, cbampm => \&callback_ampm, @@ -183,10 +184,9 @@ if ($TYPE eq "timedef") { "abday" => "as", "day" => "as", "t_fmt" => "s", - "d_fmt" => "s", + "d_fmt" => " " " "s", "d_t_fmt" => " " "|[-.]))%e/$1%d/; + $s =~ s/%e((|[-.])%m)/%d$1/; + return $s; +}; + sub callback_dtformat { my $s = shift; my $nl = $callback{data}{l} . "_" . $callback{data}{c}; @@ -241,7 +249,8 @@ sub callback_dtformat { sub callback_mdorder { my $s = shift; return undef if (!defined $s); - $s =~ s/[^dm]//g; + $s =~ s/[^dem]//g; + $s =~ s/e/d/g; return $s; }; From owner-svn-src-all@freebsd.org Sun Jun 19 03:45:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCB65A7A516; Sun, 19 Jun 2016 03:45:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7C091237; Sun, 19 Jun 2016 03:45:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5J3jW4S079769; Sun, 19 Jun 2016 03:45:32 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5J3jWKi079768; Sun, 19 Jun 2016 03:45:32 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606190345.u5J3jWKi079768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 19 Jun 2016 03:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302017 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 03:45:34 -0000 Author: adrian Date: Sun Jun 19 03:45:32 2016 New Revision: 302017 URL: https://svnweb.freebsd.org/changeset/base/302017 Log: [ath] add support for batching frames to the general TX queues. It turns out the frame scheduling policies (eg DBA_GATED) operate on a single TX FIFO entry. ASAP scheduling is fine; those frames always go out. DBA-gated sets the TX queue ready when the DBA timer fires, which triggers a beacon transmit. Normally this is used for content-after-beacon queue (CABQ) work, which needs to burst out immediately after a beacon. (eg broadcast, multicast, etc frames.) This is a general policy that you can use for any queue, and Sam's TDMA code uses it. When DBA_GATED is used and something like say, an 11e TX burst window, it only operates on a single TX FIFO entry. If you have a single frame per TX FIFO entry and say, a 2.5ms long burst window (eg TDMA!) then it'll only burst a single frame every 2.5ms. If there's no gating (eg ASAP) then the burst window is fine, and multiple TX FIFO slots get used. The CABQ code does pack in a list of frames (ie, the whole cabq) but up until this commit, the normal TX queues didn't. It showed up when I started to debug TDMA on the AR9380 and later. This commit doesn't fix the TDMA case - that's still broken here, because all I'm doing here is allowing 'some' frames to be bursting, but I'm certainly not filling the whole TX FIFO slot entry with frames. Doing that 'properly' kind of requires me to take into account how long packets should take to transmit and say, doing 1.5 or something times that per TX FIFO slot, as if you partially transmit a slot, when it's next gated it'll just finish that TX FIFO slot, then not advance to the next one. Now, I /also/ think queuing a new packet restarts DMA, but you have to push new frames into the TX FIFO. I need to experiment some more with this because if it's really the case, I will be able to do TDMA support without the egregious hacks I have in my local tree. Sam's TDMA code for previous chips would just kick the TXE bit to push along DMA again, but we can't do that for EDMA chips - we /have/ to push a new frame into the TX FIFO to restart DMA. Ugh. Tested: * AR9380, STA mode * AR9380, hostap mode * AR9580, hostap mode Approved by: re (gjb) Modified: head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Sun Jun 19 03:44:32 2016 (r302016) +++ head/sys/dev/ath/if_ath_tx_edma.c Sun Jun 19 03:45:32 2016 (r302017) @@ -138,79 +138,186 @@ MALLOC_DECLARE(M_ATHDEV); static void ath_edma_tx_processq(struct ath_softc *sc, int dosched); -/* - * Push some frames into the TX FIFO if we have space. - */ +#ifdef ATH_DEBUG_ALQ static void -ath_edma_tx_fifo_fill(struct ath_softc *sc, struct ath_txq *txq) +ath_tx_alq_edma_push(struct ath_softc *sc, int txq, int nframes, + int fifo_depth, int frame_cnt) +{ + struct if_ath_alq_tx_fifo_push aq; + + aq.txq = htobe32(txq); + aq.nframes = htobe32(nframes); + aq.fifo_depth = htobe32(fifo_depth); + aq.frame_cnt = htobe32(frame_cnt); + + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TX_FIFO_PUSH, + sizeof(aq), + (const char *) &aq); +} +#endif /* ATH_DEBUG_ALQ */ + +static void +ath_tx_edma_push_staging_list(struct ath_softc *sc, struct ath_txq *txq, + int limit) { struct ath_buf *bf, *bf_last; - int i = 0; + struct ath_buf *bfi, *bfp; + int i, sqdepth; + TAILQ_HEAD(axq_q_f_s, ath_buf) sq; ATH_TXQ_LOCK_ASSERT(txq); - DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: Q%d: called\n", - __func__, - txq->axq_qnum); + /* + * Don't bother doing any work if it's full. + */ + if (txq->axq_fifo_depth >= HAL_TXFIFO_DEPTH) + return; - TAILQ_FOREACH(bf, &txq->axq_q, bf_list) { - if (txq->axq_fifo_depth >= HAL_TXFIFO_DEPTH) - break; + if (TAILQ_EMPTY(&txq->axq_q)) + return; - /* - * We have space in the FIFO - so let's push a frame - * into it. - */ + TAILQ_INIT(&sq); - /* - * Remove it from the normal list - */ + /* + * First pass - walk sq, queue up to 'limit' entries, + * subtract them from the staging queue. + */ + sqdepth = 0; + for (i = 0; i < limit; i++) { + /* Grab the head entry */ + bf = ATH_TXQ_FIRST(txq); + if (bf == NULL) + break; ATH_TXQ_REMOVE(txq, bf, bf_list); - /* - * XXX for now, we only dequeue a frame at a time, so - * that's only one buffer. Later on when we just - * push this staging _list_ into the queue, we'll - * set bf_last to the end pointer in the list. - */ - bf_last = bf; - DPRINTF(sc, ATH_DEBUG_TX_PROC, - "%s: Q%d: depth=%d; pushing %p->%p\n", - __func__, - txq->axq_qnum, - txq->axq_fifo_depth, - bf, - bf_last); + /* Queue it into our staging list */ + TAILQ_INSERT_TAIL(&sq, bf, bf_list); + sqdepth++; + } - /* - * Append it to the FIFO staging list - */ - ATH_TXQ_INSERT_TAIL(&txq->fifo, bf, bf_list); + /* + * Ok, so now we have a staging list of up to 'limit' + * frames from the txq. Now let's wrap that up + * into its own list and pass that to the hardware + * as one FIFO entry. + */ - /* - * Set fifo start / fifo end flags appropriately - * - */ - bf->bf_flags |= ATH_BUF_FIFOPTR; - bf_last->bf_flags |= ATH_BUF_FIFOEND; + bf = TAILQ_FIRST(&sq); + bf_last = TAILQ_LAST(&sq, axq_q_s); - /* - * Push _into_ the FIFO. - */ - ath_hal_puttxbuf(sc->sc_ah, txq->axq_qnum, bf->bf_daddr); + /* + * Ok, so here's the gymnastics reqiured to make this + * all sensible. + */ + + /* + * Tag the first/last buffer appropriately. + */ + bf->bf_flags |= ATH_BUF_FIFOPTR; + bf_last->bf_flags |= ATH_BUF_FIFOEND; + + /* + * Walk the descriptor list and link them appropriately. + */ + bfp = NULL; + TAILQ_FOREACH(bfi, &sq, bf_list) { + if (bfp != NULL) { + ath_hal_settxdesclink(sc->sc_ah, bfp->bf_lastds, + bfi->bf_daddr); + } + bfp = bfi; + } + + i = 0; + TAILQ_FOREACH(bfi, &sq, bf_list) { #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_XMIT_DESC) - ath_printtxbuf(sc, bf, txq->axq_qnum, i, 0); + ath_printtxbuf(sc, bfi, txq->axq_qnum, i, 0); #endif/* ATH_DEBUG */ #ifdef ATH_DEBUG_ALQ if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXDESC)) - ath_tx_alq_post(sc, bf); + ath_tx_alq_post(sc, bfi); #endif /* ATH_DEBUG_ALQ */ - txq->axq_fifo_depth++; i++; } - if (i > 0) - ath_hal_txstart(sc->sc_ah, txq->axq_qnum); + + /* + * We now need to push this set of frames onto the tail + * of the FIFO queue. We don't adjust the aggregate + * count, only the queue depth counter(s). + * We also need to blank the link pointer now. + */ + + TAILQ_CONCAT(&txq->fifo.axq_q, &sq, bf_list); + /* Bump total queue tracking in FIFO queue */ + txq->fifo.axq_depth += sqdepth; + + /* Bump FIFO queue */ + txq->axq_fifo_depth++; + DPRINTF(sc, ATH_DEBUG_XMIT, + "%s: queued %d packets; depth=%d, fifo depth=%d\n", + __func__, sqdepth, txq->fifo.axq_depth, txq->axq_fifo_depth); + + /* Push the first entry into the hardware */ + ath_hal_puttxbuf(sc->sc_ah, txq->axq_qnum, bf->bf_daddr); + + /* Push start on the DMA if it's not already started */ + ath_hal_txstart(sc->sc_ah, txq->axq_qnum); + +#ifdef ATH_DEBUG_ALQ + ath_tx_alq_edma_push(sc, txq->axq_qnum, sqdepth, + txq->axq_fifo_depth, + txq->fifo.axq_depth); +#endif /* ATH_DEBUG_ALQ */ +} + +/* + * Push some frames into the TX FIFO if we have space. + */ +static void +ath_edma_tx_fifo_fill(struct ath_softc *sc, struct ath_txq *txq) +{ + + ATH_TXQ_LOCK_ASSERT(txq); + + DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: Q%d: called\n", + __func__, + txq->axq_qnum); + + /* + * For now, push up to 4 frames per TX FIFO slot. + * If more are in the hardware queue then they'll + * get populated when we try to send another frame + * or complete a frame - so at most there'll be + * 32 non-AMPDU frames per TXQ. + * + * Note that the hardware staging queue will limit + * how many frames in total we will have pushed into + * here. + * + * Later on, we'll want to push less frames into + * the TX FIFO since we don't want to necessarily + * fill tens or hundreds of milliseconds of potential + * frames. + * + * However, we need more frames right now because of + * how the MAC implements the frame scheduling policy. + * It only ungates a single FIFO entry at a time, + * and will run that until CHNTIME expires or the + * end of that FIFO entry descriptor list is reached. + * So for TDMA we suffer a big performance penalty - + * single TX FIFO entries mean the MAC only sends out + * one frame per DBA event, which turned out on average + * 6ms per TX frame. + * + * So, for aggregates it's okay - it'll push two at a + * time and this will just do them more efficiently. + * For non-aggregates it'll do 4 at a time, up to the + * non-aggr limit (non_aggr, which is 32.) They should + * be time based rather than a hard count, but I also + * do need sleep. + */ + ath_tx_edma_push_staging_list(sc, txq, 4); } /* From owner-svn-src-all@freebsd.org Sun Jun 19 03:45:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84410A7A53C; Sun, 19 Jun 2016 03:45:43 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) by mx1.freebsd.org (Postfix) with ESMTP id 66AC91391; Sun, 19 Jun 2016 03:45:42 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [10.1.1.2]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 33493DE21; Sun, 19 Jun 2016 03:45:36 +0000 (UTC) Subject: Re: svn commit: r288291 - head/etc To: Adrian Chadd , Cy Schubert References: <2171b966-35c7-2dad-2c0f-f23061cb677a@freebsd.org> <201606190006.u5J06Qk6009591@slippy.cwsent.com> Cc: Niclas Zeising , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Allan Jude Message-ID: <9ca0ba1b-d9b3-6028-5645-d8d03e730f5e@freebsd.org> Date: Sat, 18 Jun 2016 23:45:35 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 03:45:43 -0000 On 2016-06-18 23:32, Adrian Chadd wrote: > i think that's fine for -11. I'd like to just move limits to /bin for > 12. (I mean, it's 2016, why are you splitting / and /usr again? But..) > bsdinstall for UFS just uses one big /, and ZFS does something similar for boot environments. Only people who have partitioned manually, or upgraded in place from 8.x or earlier, will still have separate / and /usr. We can't throw those people under the bus, but, it is reasonable to consider switching things around for 12. > I don't want to see differing system behaviour between limits but it's > likely unavoidable for 11 and could do with some errata notice so > people know what to expect. > > Thanks, > > > -adrian > -- Allan Jude From owner-svn-src-all@freebsd.org Sun Jun 19 04:57:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76613A7801B for ; Sun, 19 Jun 2016 04:57:59 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2699A2C40 for ; Sun, 19 Jun 2016 04:57:58 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f48.google.com with SMTP id h129so18789332lfh.1 for ; Sat, 18 Jun 2016 21:57:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=gUz0urVfuDPnzYt754mRo+HTlub/Of3e/6PtZ/GXshI=; b=JI6RETZubynVhb//pBPSd8cCHHvilB0GeruEvvOkdVeq5BSHkJbqeo1icKCjczGjjV uz3LucV1oDMdp1tSeTWRd72qcKQ0kukEAdLajqrxxZLzKhoITNHh0tXyNSdyk0P38cwA TEmKDDxPONoeW2udqnGGuH8lx7USBEwgXzZWqpMBLOqp3gaxzqsMvHzXlrY2UoOrTu0E ooexFoMYr3BLD3lXnNAOY1v+DnFgb3j695JAGgpP7YNiROFU+O2rbhDz9C5ZuKL0+F6W pD4JiizA/nE6U6alxgOdbMVmLTRkr3oIw7MCjnWPIYNooLlMBgZ7fxnaw8bwFsokZOJD Ae4Q== X-Gm-Message-State: ALyK8tIcUf0KXltEPtMT7wJ53GgjHS8L4/fHvnZMlYRyjvwrHwuSqIE0Itrp9bn4hrpBzQ== X-Received: by 10.25.153.148 with SMTP id b142mr2696747lfe.61.1466312271479; Sat, 18 Jun 2016 21:57:51 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id m71sm2931372lfb.48.2016.06.18.21.57.50 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 18 Jun 2016 21:57:50 -0700 (PDT) Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools To: Hajimu UMEMOTO , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201606190344.u5J3iWO6079652@repo.freebsd.org> From: Andrey Chernov Message-ID: <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> Date: Sun, 19 Jun 2016 07:57:49 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <201606190344.u5J3iWO6079652@repo.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 04:57:59 -0000 On 19.06.2016 6:44, Hajimu UMEMOTO wrote: > Log: > - Prefer to use %d over %e where the day of the month should be zero > filled. > - Since %e means the day of the month as well, regard %e as same as %d > in md_order. Nonsense doubled formats in sr_*_RS locales and nonsense md_order there too. From owner-svn-src-all@freebsd.org Sun Jun 19 05:12:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78750A78603; Sun, 19 Jun 2016 05:12:45 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E7FC1689; Sun, 19 Jun 2016 05:12:44 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id EV2CbY2XWEWlrEV2Dbvmlr; Sat, 18 Jun 2016 23:12:38 -0600 X-Authority-Analysis: v=2.2 cv=P7p4vWIu c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=pD_ry4oyNxEA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=zi7m5VRXUajJoAgkUkEA:9 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 6493013753; Sat, 18 Jun 2016 22:12:36 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u5J5CYoL045032; Sat, 18 Jun 2016 22:12:34 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201606190512.u5J5CYoL045032@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Adrian Chadd cc: Cy Schubert , Niclas Zeising , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r288291 - head/etc In-Reply-To: Message from Adrian Chadd of "Sat, 18 Jun 2016 20:32:26 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 18 Jun 2016 22:12:34 -0700 X-CMAE-Envelope: MS4wfIh0upPgUsAsKi6HCn3NWleg9IS/MG2ZlAltD4zcGFHu5S9F3ENwmt+ReZqY9urSxqax4P9F/xX4HK8tjE0tnGpaua+lm14eQ3fmzNCypRtDsUyUDIl/ aFGRMReGFKZZLUoIO2RN2OUA4m7njyxQqPbhbKDPZYFAJ4OAs6mdvriwIYBT3KE3uZm9pRfyYWkEnMMUfqMMAQhC+sOW6y14XrFYkB+JgrUHIGrPuZe7bJIu s9Fttz73yQHGEnPSyM+JtHBBuONBWnSvEaRixIxAEceGj9ukdsE5I97n2k8lrTdywue/+YjVKSk/F/J0Ity0nQ== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 05:12:45 -0000 In message , Adrian Chadd writes: > i think that's fine for -11. I'd like to just move limits to /bin for > 12. (I mean, it's 2016, why are you splitting / and /usr again? But..) > > I don't want to see differing system behaviour between limits but it's > likely unavoidable for 11 and could do with some errata notice so > people know what to expect. There aren't any daemons started prior to critical local filesystems being mounted. I suppose one day there could be but none at this point in time. Setting limits before filesystems are mounted is practically a NOP anyway. (Except it could negatively affect fsck of huge UFS filesystems some day.) -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sun Jun 19 05:31:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A75EA788B6; Sun, 19 Jun 2016 05:31:19 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id F11351CC0; Sun, 19 Jun 2016 05:31:18 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id EVK9bOiRXN9d0EVKAb4eTu; Sat, 18 Jun 2016 23:31:11 -0600 X-Authority-Analysis: v=2.2 cv=QZUkhYTv c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=pD_ry4oyNxEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=L_FtLdo2QMd5WKjfqdYA:9 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 2E1AF13753; Sat, 18 Jun 2016 22:31:09 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u5J5V84J049670; Sat, 18 Jun 2016 22:31:08 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201606190531.u5J5V84J049670@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Allan Jude cc: Adrian Chadd , Cy Schubert , Niclas Zeising , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r288291 - head/etc In-Reply-To: Message from Allan Jude of "Sat, 18 Jun 2016 23:45:35 -0400." <9ca0ba1b-d9b3-6028-5645-d8d03e730f5e@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 18 Jun 2016 22:31:08 -0700 X-CMAE-Envelope: MS4wfJoYz4WasfekSuvV3THq/bVs8YiCUJVbLbf10grECaKsaHo661eKwuAKeif0/+y7BbU1gCWMGWrBBEKa+YRw9QCzeUWjDuKE+sOpgzeJ1U6cQJyMUd/S ztXQFlnMUD7DgOb4P1l8RACINVJrMIM/3Qpzlojpq0WcPLKA7ITD9rmSm1ZNSceedPCNkOQNgdsEDGHaS6t//yk3hthOT2IRRumAkYfJvW2tp9erMGoFE3iQ kRQ3PCnxWGbIoqut7RMZGBvM32wY6Tp4/qiUv8mk/ZU5ZjvETsBfY6VeIg6WYGhf42r3biCY0wFoCYQYrwIbNjujyM2Tiy8YC4rLWILHmIXh4qSGKRXA2QZ7 Tlj2DT0a X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 05:31:19 -0000 In message <9ca0ba1b-d9b3-6028-5645-d8d03e730f5e@freebsd.org>, Allan Jude write s: > On 2016-06-18 23:32, Adrian Chadd wrote: > > i think that's fine for -11. I'd like to just move limits to /bin for > > 12. (I mean, it's 2016, why are you splitting / and /usr again? But..) > > > > bsdinstall for UFS just uses one big /, and ZFS does something similar > for boot environments. Only people who have partitioned manually, or > upgraded in place from 8.x or earlier, will still have separate / and > /usr. We can't throw those people under the bus, but, it is reasonable > to consider switching things around for 12. This is only an issue legacy systems, systems that have had their disks be installed on faster systems and systems which have been cloned from older systems (dump | restore). There's something to be said about an O/S that doesn't need to be re-imaged every hardware/software upgrade or migration. It's also an issue for systems which have a small local root/ramdisk, and mount /usr via NFS. I managed a setup like this (not FreeBSD) once. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sun Jun 19 05:32:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D772A78A3C; Sun, 19 Jun 2016 05:32:37 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from mail.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "asuka.mahoroba.org", Issuer "ca.mahoroba.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BEE9A1EF0; Sun, 19 Jun 2016 05:32:36 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from vsuiko.mahoroba.org (vsuiko.mahoroba.org [IPv6:2001:2f0:104:8010:a00:27ff:feb0:c2e]) (user=ume mech=DIGEST-MD5 bits=0) by mail.mahoroba.org (8.15.2/8.15.2) with ESMTPSA/inet6 id u5J5WUQG085806 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sun, 19 Jun 2016 14:32:31 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Sun, 19 Jun 2016 14:31:53 +0900 Message-ID: From: Hajimu UMEMOTO To: Andrey Chernov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools In-Reply-To: <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> User-Agent: xcite1.60> Wanderlust/2.15.9 (Almost Unreal) Emacs/24.5 Mule/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 10.3-STABLE X-PGP-Key: http://www.mahoroba.org/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6 (mail.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Sun, 19 Jun 2016 14:32:31 +0900 (JST) X-Virus-Scanned: clamav-milter 0.99.2 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on asuka.mahoroba.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 05:32:37 -0000 Hi, >>>>> On Sun, 19 Jun 2016 07:57:49 +0300 >>>>> Andrey Chernov said: ache> Nonsense doubled formats in sr_*_RS locales and nonsense md_order there too. It seems there was the problem before my commit. Only saw a little, I'm not sure were it comes. Sincerely, -- Hajimu UMEMOTO ume@mahoroba.org ume@FreeBSD.org http://www.mahoroba.org/~ume/ From owner-svn-src-all@freebsd.org Sun Jun 19 07:31:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EABF4A7AEF8; Sun, 19 Jun 2016 07:31:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B908D28FE; Sun, 19 Jun 2016 07:31:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5J7V36W063668; Sun, 19 Jun 2016 07:31:03 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5J7V22Q063663; Sun, 19 Jun 2016 07:31:02 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606190731.u5J7V22Q063663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 19 Jun 2016 07:31:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302018 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 07:31:04 -0000 Author: adrian Date: Sun Jun 19 07:31:02 2016 New Revision: 302018 URL: https://svnweb.freebsd.org/changeset/base/302018 Log: [net80211] remove node scan lock / generation number + fix few LORs Drop scan generation number and node table scan lock - the only place where ni_scangen is checked is in ieee80211_timeout_stations() (and it is used to prevent duplicate checking of the same node); node scan lock protects only this variable + node table scan generation number. This will fix (at least) next LOR (hostap mode): lock order reversal: 1st 0xc175f84c urtwm0_scan_loc (urtwm0_scan_loc) @ /usr/src/sys/modules/wlan/../../net80211/ieee80211_node.c:2019 2nd 0xc175e018 urtwm0_com_lock (urtwm0_com_lock) @ /usr/src/sys/modules/wlan/../../net80211/ieee80211_node.c:2693 stack backtrace: #0 0xa070d1c5 at witness_debugger+0x75 #1 0xa070d0f6 at witness_checkorder+0xd46 #2 0xa0694cce at __mtx_lock_flags+0x9e #3 0xb03ad9ef at ieee80211_node_leave+0x12f #4 0xb03afd13 at ieee80211_timeout_stations+0x483 #5 0xb03aa1c2 at ieee80211_node_timeout+0x42 #6 0xa06c6fa1 at softclock_call_cc+0x1e1 #7 0xa06c7518 at softclock+0xc8 #8 0xa06789ae at intr_event_execute_handlers+0x8e #9 0xa0678fa0 at ithread_loop+0x90 #10 0xa0675fbe at fork_exit+0x7e #11 0xa08af910 at fork_trampoline+0x8 In addition to the above: * switch to ieee80211_iterate_nodes(); * do not assert that node table lock is held, while calling node_age(); that's not really needed (there are no resources, which can be protected by this lock) + this fixes LOR/deadlock between ieee80211_timeout_stations() and ieee80211_set_tim() (easy to reproduce in HOSTAP mode while sending something to an STA with enabled power management). Tested: * (avos) urtwn0, hostap mode * (adrian) AR9380, STA mode * (adrian) AR9380, AR9331, AR9580, hostap mode Notes: * This changes the net80211 internals, so you have to recompile all of it and the wifi drivers. Submitted by: avos Approved by: re (delphij) Differential Revision: https://reviews.freebsd.org/D6833 Modified: head/sys/net80211/ieee80211_ddb.c head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_node.h head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_ddb.c ============================================================================== --- head/sys/net80211/ieee80211_ddb.c Sun Jun 19 03:45:32 2016 (r302017) +++ head/sys/net80211/ieee80211_ddb.c Sun Jun 19 07:31:02 2016 (r302018) @@ -233,9 +233,8 @@ _db_show_sta(const struct ieee80211_node db_printf("\tvap %p wdsvap %p ic %p table %p\n", ni->ni_vap, ni->ni_wdsvap, ni->ni_ic, ni->ni_table); db_printf("\tflags=%b\n", ni->ni_flags, IEEE80211_NODE_BITS); - db_printf("\tscangen %u authmode %u ath_flags 0x%x ath_defkeyix %u\n", - ni->ni_scangen, ni->ni_authmode, - ni->ni_ath_flags, ni->ni_ath_defkeyix); + db_printf("\tauthmode %u ath_flags 0x%x ath_defkeyix %u\n", + ni->ni_authmode, ni->ni_ath_flags, ni->ni_ath_defkeyix); db_printf("\tassocid 0x%x txpower %u vlan %u\n", ni->ni_associd, ni->ni_txpower, ni->ni_vlan); db_printf("\tjointime %d (%lu secs) challenge %p\n", @@ -688,8 +687,6 @@ _db_show_node_table(const char *tag, con db_printf("%s%s@%p:\n", tag, nt->nt_name, nt); db_printf("%s nodelock %p", tag, &nt->nt_nodelock); db_printf(" inact_init %d", nt->nt_inact_init); - db_printf(" scanlock %p", &nt->nt_scanlock); - db_printf(" scangen %u\n", nt->nt_scangen); db_printf("%s keyixmax %d keyixmap %p\n", tag, nt->nt_keyixmax, nt->nt_keyixmap); for (i = 0; i < nt->nt_keyixmax; i++) { Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Sun Jun 19 03:45:32 2016 (r302017) +++ head/sys/net80211/ieee80211_freebsd.h Sun Jun 19 07:31:02 2016 (r302018) @@ -107,28 +107,6 @@ typedef struct { mtx_assert(IEEE80211_NODE_LOCK_OBJ(_nt), MA_OWNED) /* - * Node table iteration locking definitions; this protects the - * scan generation # used to iterate over the station table - * while grabbing+releasing the node lock. - */ -typedef struct { - char name[16]; /* e.g. "ath0_scan_lock" */ - struct mtx mtx; -} ieee80211_scan_lock_t; -#define IEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do { \ - ieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock; \ - snprintf(sl->name, sizeof(sl->name), "%s_scan_lock", _name); \ - mtx_init(&sl->mtx, sl->name, NULL, MTX_DEF); \ -} while (0) -#define IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt) (&(_nt)->nt_scanlock.mtx) -#define IEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \ - mtx_destroy(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) -#define IEEE80211_NODE_ITERATE_LOCK(_nt) \ - mtx_lock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) -#define IEEE80211_NODE_ITERATE_UNLOCK(_nt) \ - mtx_unlock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) - -/* * Power-save queue definitions. */ typedef struct mtx ieee80211_psq_lock_t; Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Sun Jun 19 03:45:32 2016 (r302017) +++ head/sys/net80211/ieee80211_node.c Sun Jun 19 07:31:02 2016 (r302018) @@ -1099,8 +1099,6 @@ node_age(struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; - IEEE80211_NODE_LOCK_ASSERT(&vap->iv_ic->ic_sta); - /* * Age frames on the power save queue. */ @@ -1922,10 +1920,8 @@ ieee80211_node_table_init(struct ieee802 nt->nt_ic = ic; IEEE80211_NODE_LOCK_INIT(nt, ic->ic_name); - IEEE80211_NODE_ITERATE_LOCK_INIT(nt, ic->ic_name); TAILQ_INIT(&nt->nt_node); nt->nt_name = name; - nt->nt_scangen = 1; nt->nt_inact_init = inact; nt->nt_keyixmax = keyixmax; if (nt->nt_keyixmax > 0) { @@ -1994,159 +1990,137 @@ ieee80211_node_table_cleanup(struct ieee IEEE80211_FREE(nt->nt_keyixmap, M_80211_NODE); nt->nt_keyixmap = NULL; } - IEEE80211_NODE_ITERATE_LOCK_DESTROY(nt); IEEE80211_NODE_LOCK_DESTROY(nt); } -/* - * Timeout inactive stations and do related housekeeping. - * Note that we cannot hold the node lock while sending a - * frame as this would lead to a LOR. Instead we use a - * generation number to mark nodes that we've scanned and - * drop the lock and restart a scan if we have to time out - * a node. Since we are single-threaded by virtue of - * controlling the inactivity timer we can be sure this will - * process each node only once. - */ static void -ieee80211_timeout_stations(struct ieee80211com *ic) +timeout_stations(void *arg __unused, struct ieee80211_node *ni) { - struct ieee80211_node_table *nt = &ic->ic_sta; - struct ieee80211vap *vap; - struct ieee80211_node *ni; - int gen = 0; + struct ieee80211com *ic = ni->ni_ic; + struct ieee80211vap *vap = ni->ni_vap; - IEEE80211_NODE_ITERATE_LOCK(nt); - gen = ++nt->nt_scangen; -restart: - IEEE80211_NODE_LOCK(nt); - TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { - if (ni->ni_scangen == gen) /* previously handled */ - continue; - ni->ni_scangen = gen; - /* - * Ignore entries for which have yet to receive an - * authentication frame. These are transient and - * will be reclaimed when the last reference to them - * goes away (when frame xmits complete). - */ - vap = ni->ni_vap; - /* - * Only process stations when in RUN state. This - * insures, for example, that we don't timeout an - * inactive station during CAC. Note that CSA state - * is actually handled in ieee80211_node_timeout as - * it applies to more than timeout processing. - */ - if (vap->iv_state != IEEE80211_S_RUN) - continue; - /* XXX can vap be NULL? */ - if ((vap->iv_opmode == IEEE80211_M_HOSTAP || - vap->iv_opmode == IEEE80211_M_STA) && - (ni->ni_flags & IEEE80211_NODE_AREF) == 0) - continue; + /* + * Only process stations when in RUN state. This + * insures, for example, that we don't timeout an + * inactive station during CAC. Note that CSA state + * is actually handled in ieee80211_node_timeout as + * it applies to more than timeout processing. + */ + if (vap->iv_state != IEEE80211_S_RUN) + return; + /* + * Ignore entries for which have yet to receive an + * authentication frame. These are transient and + * will be reclaimed when the last reference to them + * goes away (when frame xmits complete). + */ + if ((vap->iv_opmode == IEEE80211_M_HOSTAP || + vap->iv_opmode == IEEE80211_M_STA) && + (ni->ni_flags & IEEE80211_NODE_AREF) == 0) + return; + /* + * Free fragment if not needed anymore + * (last fragment older than 1s). + * XXX doesn't belong here, move to node_age + */ + if (ni->ni_rxfrag[0] != NULL && + ticks > ni->ni_rxfragstamp + hz) { + m_freem(ni->ni_rxfrag[0]); + ni->ni_rxfrag[0] = NULL; + } + if (ni->ni_inact > 0) { + ni->ni_inact--; + IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, + "%s: inact %u inact_reload %u nrates %u", + __func__, ni->ni_inact, ni->ni_inact_reload, + ni->ni_rates.rs_nrates); + } + /* + * Special case ourself; we may be idle for extended periods + * of time and regardless reclaiming our state is wrong. + * XXX run ic_node_age + */ + /* XXX before inact decrement? */ + if (ni == vap->iv_bss) + return; + if (ni->ni_associd != 0 || + (vap->iv_opmode == IEEE80211_M_IBSS || + vap->iv_opmode == IEEE80211_M_AHDEMO)) { /* - * Free fragment if not needed anymore - * (last fragment older than 1s). - * XXX doesn't belong here, move to node_age + * Age/drain resources held by the station. */ - if (ni->ni_rxfrag[0] != NULL && - ticks > ni->ni_rxfragstamp + hz) { - m_freem(ni->ni_rxfrag[0]); - ni->ni_rxfrag[0] = NULL; - } - if (ni->ni_inact > 0) { - ni->ni_inact--; - IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, - "%s: inact %u inact_reload %u nrates %u", - __func__, ni->ni_inact, ni->ni_inact_reload, - ni->ni_rates.rs_nrates); - } + ic->ic_node_age(ni); /* - * Special case ourself; we may be idle for extended periods - * of time and regardless reclaiming our state is wrong. - * XXX run ic_node_age + * Probe the station before time it out. We + * send a null data frame which may not be + * universally supported by drivers (need it + * for ps-poll support so it should be...). + * + * XXX don't probe the station unless we've + * received a frame from them (and have + * some idea of the rates they are capable + * of); this will get fixed more properly + * soon with better handling of the rate set. */ - if (ni == vap->iv_bss) - continue; - if (ni->ni_associd != 0 || - (vap->iv_opmode == IEEE80211_M_IBSS || - vap->iv_opmode == IEEE80211_M_AHDEMO)) { - /* - * Age/drain resources held by the station. - */ - ic->ic_node_age(ni); - /* - * Probe the station before time it out. We - * send a null data frame which may not be - * universally supported by drivers (need it - * for ps-poll support so it should be...). - * - * XXX don't probe the station unless we've - * received a frame from them (and have - * some idea of the rates they are capable - * of); this will get fixed more properly - * soon with better handling of the rate set. - */ - if ((vap->iv_flags_ext & IEEE80211_FEXT_INACT) && - (0 < ni->ni_inact && - ni->ni_inact <= vap->iv_inact_probe) && - ni->ni_rates.rs_nrates != 0) { - IEEE80211_NOTE(vap, - IEEE80211_MSG_INACT | IEEE80211_MSG_NODE, - ni, "%s", - "probe station due to inactivity"); - /* - * Grab a reference before unlocking the table - * so the node cannot be reclaimed before we - * send the frame. ieee80211_send_nulldata - * understands we've done this and reclaims the - * ref for us as needed. - */ - ieee80211_ref_node(ni); - IEEE80211_NODE_UNLOCK(nt); - ieee80211_send_nulldata(ni); - /* XXX stat? */ - goto restart; - } - } if ((vap->iv_flags_ext & IEEE80211_FEXT_INACT) && - ni->ni_inact <= 0) { + (0 < ni->ni_inact && + ni->ni_inact <= vap->iv_inact_probe) && + ni->ni_rates.rs_nrates != 0) { IEEE80211_NOTE(vap, - IEEE80211_MSG_INACT | IEEE80211_MSG_NODE, ni, - "station timed out due to inactivity " - "(refcnt %u)", ieee80211_node_refcnt(ni)); + IEEE80211_MSG_INACT | IEEE80211_MSG_NODE, + ni, "%s", + "probe station due to inactivity"); /* - * Send a deauthenticate frame and drop the station. - * This is somewhat complicated due to reference counts - * and locking. At this point a station will typically - * have a reference count of 1. ieee80211_node_leave - * will do a "free" of the node which will drop the - * reference count. But in the meantime a reference - * wil be held by the deauth frame. The actual reclaim - * of the node will happen either after the tx is - * completed or by ieee80211_node_leave. - * - * Separately we must drop the node lock before sending - * in case the driver takes a lock, as this can result - * in a LOR between the node lock and the driver lock. + * Grab a reference so the node cannot + * be reclaimed before we send the frame. + * ieee80211_send_nulldata understands + * we've done this and reclaims the + * ref for us as needed. */ + /* XXX fix this (not required anymore). */ ieee80211_ref_node(ni); - IEEE80211_NODE_UNLOCK(nt); - if (ni->ni_associd != 0) { - IEEE80211_SEND_MGMT(ni, - IEEE80211_FC0_SUBTYPE_DEAUTH, - IEEE80211_REASON_AUTH_EXPIRE); - } - ieee80211_node_leave(ni); - ieee80211_free_node(ni); - vap->iv_stats.is_node_timeout++; - goto restart; + /* XXX useless */ + ieee80211_send_nulldata(ni); + /* XXX stat? */ + return; } } - IEEE80211_NODE_UNLOCK(nt); + if ((vap->iv_flags_ext & IEEE80211_FEXT_INACT) && + ni->ni_inact <= 0) { + IEEE80211_NOTE(vap, + IEEE80211_MSG_INACT | IEEE80211_MSG_NODE, ni, + "station timed out due to inactivity " + "(refcnt %u)", ieee80211_node_refcnt(ni)); + /* + * Send a deauthenticate frame and drop the station. + * This is somewhat complicated due to reference counts + * and locking. At this point a station will typically + * have a reference count of 2. ieee80211_node_leave + * will do a "free" of the node which will drop the + * reference count. But in the meantime a reference + * wil be held by the deauth frame. The actual reclaim + * of the node will happen either after the tx is + * completed or by ieee80211_node_leave. + */ + if (ni->ni_associd != 0) { + IEEE80211_SEND_MGMT(ni, + IEEE80211_FC0_SUBTYPE_DEAUTH, + IEEE80211_REASON_AUTH_EXPIRE); + } + ieee80211_node_leave(ni); + vap->iv_stats.is_node_timeout++; + } +} - IEEE80211_NODE_ITERATE_UNLOCK(nt); +/* + * Timeout inactive stations and do related housekeeping. + */ +static void +ieee80211_timeout_stations(struct ieee80211com *ic) +{ + struct ieee80211_node_table *nt = &ic->ic_sta; + + ieee80211_iterate_nodes(nt, timeout_stations, NULL); } /* @@ -2247,23 +2221,12 @@ int ieee80211_iterate_nt(struct ieee80211_node_table *nt, struct ieee80211_node **ni_arr, uint16_t max_aid) { - u_int gen; int i, j, ret; struct ieee80211_node *ni; - IEEE80211_NODE_ITERATE_LOCK(nt); IEEE80211_NODE_LOCK(nt); - gen = ++nt->nt_scangen; i = ret = 0; - - /* - * We simply assume here that since the node - * scan generation doesn't change (as - * we are holding both the node table and - * node table iteration locks), we can simply - * assign it to the node here. - */ TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { if (i >= max_aid) { ret = E2BIG; @@ -2272,7 +2235,6 @@ ieee80211_iterate_nt(struct ieee80211_no break; } ni_arr[i] = ieee80211_ref_node(ni); - ni_arr[i]->ni_scangen = gen; i++; } @@ -2287,7 +2249,6 @@ ieee80211_iterate_nt(struct ieee80211_no * ieee80211_free_node(). */ IEEE80211_NODE_UNLOCK(nt); - IEEE80211_NODE_ITERATE_UNLOCK(nt); /* * If ret is non-zero, we hit some kind of error. @@ -2362,8 +2323,8 @@ ieee80211_dump_node(struct ieee80211_nod { printf("0x%p: mac %s refcnt %d\n", ni, ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)); - printf("\tscangen %u authmode %u flags 0x%x\n", - ni->ni_scangen, ni->ni_authmode, ni->ni_flags); + printf("\tauthmode %u flags 0x%x\n", + ni->ni_authmode, ni->ni_flags); printf("\tassocid 0x%x txpower %u vlan %u\n", ni->ni_associd, ni->ni_txpower, ni->ni_vlan); printf("\ttxseq %u rxseq %u fragno %u rxfragstamp %u\n", Modified: head/sys/net80211/ieee80211_node.h ============================================================================== --- head/sys/net80211/ieee80211_node.h Sun Jun 19 03:45:32 2016 (r302017) +++ head/sys/net80211/ieee80211_node.h Sun Jun 19 07:31:02 2016 (r302018) @@ -115,7 +115,6 @@ struct ieee80211_node { TAILQ_ENTRY(ieee80211_node) ni_list; /* list of all nodes */ LIST_ENTRY(ieee80211_node) ni_hash; /* hash collision list */ u_int ni_refcnt; /* count of held references */ - u_int ni_scangen; /* gen# for timeout scan */ u_int ni_flags; #define IEEE80211_NODE_AUTH 0x000001 /* authorized for data */ #define IEEE80211_NODE_QOS 0x000002 /* QoS enabled */ @@ -360,8 +359,6 @@ struct ieee80211_node_table { struct ieee80211_node **nt_keyixmap; /* key ix -> node map */ int nt_keyixmax; /* keyixmap size */ const char *nt_name; /* table name for debug msgs */ - ieee80211_scan_lock_t nt_scanlock; /* on nt_scangen */ - u_int nt_scangen; /* gen# for iterators */ int nt_inact_init; /* initial node inact setting */ }; Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Sun Jun 19 03:45:32 2016 (r302017) +++ head/sys/net80211/ieee80211_superg.c Sun Jun 19 07:31:02 2016 (r302018) @@ -912,6 +912,12 @@ ieee80211_ff_node_init(struct ieee80211_ ieee80211_ff_node_cleanup(ni); } +/* + * Note: this comlock acquisition LORs with the node lock: + * + * 1: sta_join1 -> NODE_LOCK -> node_free -> node_cleanup -> ff_node_cleanup -> COM_LOCK + * 2: TBD + */ void ieee80211_ff_node_cleanup(struct ieee80211_node *ni) { From owner-svn-src-all@freebsd.org Sun Jun 19 07:37:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86564A7A11A for ; Sun, 19 Jun 2016 07:37:51 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 140FD2CF3 for ; Sun, 19 Jun 2016 07:37:50 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f45.google.com with SMTP id q132so20532990lfe.3 for ; Sun, 19 Jun 2016 00:37:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=0yZ7SQdGgFDYv/BaM95cN1x2JaYHZpLAaWLNfO4NRUQ=; b=TXPwdDdpmCZxiS2gZ+M5FGoj0Y1xna6SHCwvORLbWV3SLVEXAhwJUkwce7ZSnAxOwg Wv0uOICnM3hml+3zQoqoT2r1qxCksWNu4uIkwz83r2avO1mOBpxcjZmhW3c0dRlqJxBG Zi+hB8TSma/f7NCkJ3kC8qzvteHxjXVGlf1TQyyvIjR0uRloGEgzgIugdrmQzzU5NHK6 EBChoW7DPSX4juHYrBW17Ai1DUwVZqlDu1ON8v3tenAweRNA7fS8FsC4sGlgxkGhEg1+ J3tjgiSWSOrdd4EXVRAmz/htSFxcz8wHkF6hqGtJ/I6k5SURY/ULsmbDQQPlLALxcnFv qA+g== X-Gm-Message-State: ALyK8tLpf65B0Hy3DcUIw0wCbgaVbA5FidhForFwsDmnw2boULyTQvKxL50eGPPCnxuzaQ== X-Received: by 10.25.88.146 with SMTP id m140mr90377lfb.217.1466321863185; Sun, 19 Jun 2016 00:37:43 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id l79sm3445870lfi.40.2016.06.19.00.37.42 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2016 00:37:42 -0700 (PDT) Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools To: Hajimu UMEMOTO References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Andrey Chernov Message-ID: Date: Sun, 19 Jun 2016 10:37:41 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 07:37:51 -0000 On 19.06.2016 8:31, Hajimu UMEMOTO wrote: > Hi, > >>>>>> On Sun, 19 Jun 2016 07:57:49 +0300 >>>>>> Andrey Chernov said: > > ache> Nonsense doubled formats in sr_*_RS locales and nonsense md_order there too. > > It seems there was the problem before my commit. Only saw a little, > I'm not sure were it comes. I understand, just notice that. From owner-svn-src-all@freebsd.org Sun Jun 19 08:08:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6F0BA7ACEF; Sun, 19 Jun 2016 08:08:10 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 78913205F; Sun, 19 Jun 2016 08:08:10 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm0-x232.google.com with SMTP id 187so1314544wmz.1; Sun, 19 Jun 2016 01:08:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=eV8cLX63cu50liV5LaGw+PfR1n8tUcPnjb5lEZkY4L8=; b=a8nqQUG8iMEhY7dFF7QURmqEQAMi4gKXaUCSiz6l2IBcWvXlr48QieSeuusStwHlAx tqNI7uJ1y6fXjawSVHRMBY86lB6xjF4UoXhRrqAAQSbSFFF12UxIDkaXOMwttYwi+8yB EVQwnhgOSzbnwzhh/pGPH+bGIQ9RCyA7Te0P2dBtLukcLOXv8BFrDb2sf2JuNUKgTdn6 qjv++2fLZQxLmggnkqqbaFdwyjxzyYYzBzAkhR8/fG+V3RZyor6EU8djY4EvrptCLOLo oLC6Z3IDAh52hhKqPOv3hppZFh39CLAtfEuw0/5MBWmShZ7NOCSdBwTsYjmPLPOuYCvN rCWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=eV8cLX63cu50liV5LaGw+PfR1n8tUcPnjb5lEZkY4L8=; b=CWMhMeR38zl6IMfPUKq31SAceq61lS8gWmmnd5CTH47eocMiph0MDkoDdXFG1+2r+J wQ1dZ8WSb5etEcBxal1HYsjebYrBK1qrSW7u38zzVANssaww1mZPm6qbaa8BUu8+dIOr vjdCxZG4XsWAD5KkqVmR54DNHIQxXdM2EzqPXMIdoTKvoSvJaIIg/X3tN/BRZKOwp2ij KeMOdapVnlr99EnIUSoOkhV9UIJamalM4tRHeWl6T0/Gj5pqUjgBibcWxgaH22JFVEg9 LplSWXKYENfBjEF6s79VYSddCTnN7q+/WIBnHHW1xtJIYTcKH9H9sDjw8RFf8w4AmjRM Jxkg== X-Gm-Message-State: ALyK8tLc+z3Pttes87+ngFsS+7J9ALZQaAYellSdlFlSerDDGxxW4CRroGhLD6sTVBLT8A== X-Received: by 10.194.81.72 with SMTP id y8mr9997771wjx.83.1466323688074; Sun, 19 Jun 2016 01:08:08 -0700 (PDT) Received: from brick (abpy178.neoplus.adsl.tpnet.pl. [83.8.66.178]) by smtp.gmail.com with ESMTPSA id e5sm57365008wjj.10.2016.06.19.01.08.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2016 01:08:07 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Sun, 19 Jun 2016 10:08:03 +0200 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Jan Beich Cc: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r299448 - in head/sys/cddl/contrib/opensolaris: common/acl uts/common/fs/zfs uts/common/sys Message-ID: <20160619080803.GA1638@brick> Mail-Followup-To: Jan Beich , Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201605111343.u4BDhKhp076695@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 08:08:11 -0000 On 0614T0232, Jan Beich wrote: > Alexander Motin writes: > > > Author: mav > > Date: Wed May 11 13:43:20 2016 > > New Revision: 299448 > > URL: https://svnweb.freebsd.org/changeset/base/299448 > > > > Log: > > MFV r299442: 6762 POSIX write should imply DELETE_CHILD on directories - and > > some additional considerations > > > > Reviewed by: Gordon Ross > > Reviewed by: Yuri Pankov > > Author: Kevin Crowe > > > > openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916 > > This commit confuses acl_is_trivial_np(3). Notice '+' in ls(1) and 'D' > in getfacl(1) outputs. It's not just that. Those changes: 1. Confuse acl_is_trivial_np(3), as you say. It's hard to fix in libc, because they make trivial ACLs different for files and directories, and acl_is_trivial_np(3) has no way of telling which is which. 2. They make delete deny permission take precedence over the containing directory write allow permission, which is rather different from what people expect in unix systems, and is against the NFSv4 specification, even though it might be a better fit for Windows. 3. They make umask apply to inherit_only permissions, and 4. I don't fully understand this one yet, but from the ACL regression test suite (which lives in tests/sys/acl/, and I'd appreciate people actually ran this before committing ACL-related changes) it looks like it makes umask not apply to the stuff it should. The #1 could be fixed by making ZFS not setting delete_child on write, basically reverting to the previous behaviour in that aspect. As for the others... I'm not saying each one of those is wrong, but they certainly warrant further discussion, especially #2 and #4. Basically, what I'm trying to say is that we should consider backing this out for 11.0-RELEASE, reverting to the previous semantics, verified by passing the regression tests. From owner-svn-src-all@freebsd.org Sun Jun 19 08:15:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4AE3A7AE85; Sun, 19 Jun 2016 08:15:39 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from mail.daemonic.se (cloud.daemonic.se [185.34.0.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D0D5253F; Sun, 19 Jun 2016 08:15:38 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from cloud.daemonic.se (localhost [IPv6:::1]) by mail.daemonic.se (Postfix) with ESMTP id 3rXRd370rhz27L1; Sun, 19 Jun 2016 08:15:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at daemonic.se Received: from mail.daemonic.se ([IPv6:::1]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256) by cloud.daemonic.se (mailscanner.daemonic.se [IPv6:::1]) (amavisd-new, port 10587) with ESMTPS id tR8ic_DR6-FE; Sun, 19 Jun 2016 08:15:35 +0000 (UTC) Received: from [IPv6:2001:470:dca9:2::3] (celes.daemonic.se [IPv6:2001:470:dca9:2::3]) by mail.daemonic.se (Postfix) with ESMTPSA id 3rXRd24lX5z27C0; Sun, 19 Jun 2016 08:15:34 +0000 (UTC) Subject: Re: svn commit: r288291 - head/etc To: Allan Jude , Adrian Chadd , Cy Schubert References: <2171b966-35c7-2dad-2c0f-f23061cb677a@freebsd.org> <201606190006.u5J06Qk6009591@slippy.cwsent.com> <9ca0ba1b-d9b3-6028-5645-d8d03e730f5e@freebsd.org> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Niclas Zeising Message-ID: <19333e20-7242-220f-8553-07b828d462e0@freebsd.org> Date: Sun, 19 Jun 2016 10:15:25 +0200 User-Agent: Mutt/1.5.21 MIME-Version: 1.0 In-Reply-To: <9ca0ba1b-d9b3-6028-5645-d8d03e730f5e@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 08:15:39 -0000 On 2016-06-19 05:45, Allan Jude wrote: > On 2016-06-18 23:32, Adrian Chadd wrote: >> i think that's fine for -11. I'd like to just move limits to /bin for >> 12. (I mean, it's 2016, why are you splitting / and /usr again? But..) >> > > bsdinstall for UFS just uses one big /, and ZFS does something similar > for boot environments. Only people who have partitioned manually, or > upgraded in place from 8.x or earlier, will still have separate / and > /usr. We can't throw those people under the bus, but, it is reasonable > to consider switching things around for 12. > I have several systems with separate /usr, done either manually or upgraded in place since forever, so this is an issue, and I expect there are several others out there in the same situation. Regards! -- Niclas From owner-svn-src-all@freebsd.org Sun Jun 19 08:18:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90D1CA7AF90; Sun, 19 Jun 2016 08:18:17 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from mail.daemonic.se (mail.daemonic.se [IPv6:2a00:d1e0:1000:c00::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A75E2842; Sun, 19 Jun 2016 08:18:17 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from cloud.daemonic.se (localhost [IPv6:::1]) by mail.daemonic.se (Postfix) with ESMTP id 3rXRh66Dqhz27L1; Sun, 19 Jun 2016 08:18:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at daemonic.se Received: from mail.daemonic.se ([127.0.0.1]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256) by cloud.daemonic.se (mailscanner.daemonic.se [127.0.0.1]) (amavisd-new, port 10587) with ESMTPS id eBNDttigPqsU; Sun, 19 Jun 2016 08:18:14 +0000 (UTC) Received: from [IPv6:2001:470:dca9:2::3] (celes.daemonic.se [IPv6:2001:470:dca9:2::3]) by mail.daemonic.se (Postfix) with ESMTPSA id 3rXRh62V03z27C0; Sun, 19 Jun 2016 08:18:14 +0000 (UTC) Subject: Re: svn commit: r288291 - head/etc To: Cy Schubert , Adrian Chadd References: <201606190512.u5J5CYoL045032@slippy.cwsent.com> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Niclas Zeising Message-ID: <4e985ab9-0d98-a160-bdad-fa4924ddc5b3@freebsd.org> Date: Sun, 19 Jun 2016 10:18:12 +0200 User-Agent: Mutt/1.5.21 MIME-Version: 1.0 In-Reply-To: <201606190512.u5J5CYoL045032@slippy.cwsent.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 08:18:17 -0000 On 2016-06-19 07:12, Cy Schubert wrote: > In message om> > , Adrian Chadd writes: >> i think that's fine for -11. I'd like to just move limits to /bin for >> 12. (I mean, it's 2016, why are you splitting / and /usr again? But..) >> >> I don't want to see differing system behaviour between limits but it's >> likely unavoidable for 11 and could do with some errata notice so >> people know what to expect. > > There aren't any daemons started prior to critical local filesystems being > mounted. I suppose one day there could be but none at this point in time. > Setting limits before filesystems are mounted is practically a NOP anyway. > (Except it could negatively affect fsck of huge UFS filesystems some day.) > > This is wrong, and how I discovered it. ddb (/etc/rc.d/ddb) starts before disks, and currently refuses to start on my systems with this issue. This means no crash dumps, unless I remember to manually start it later in the boot process, so this is an issue. Regards! Niclas From owner-svn-src-all@freebsd.org Sun Jun 19 14:08:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3A17A7A284; Sun, 19 Jun 2016 14:08:43 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DF48177B; Sun, 19 Jun 2016 14:08:42 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id EdOrb3cQeBLFmEdOsbCrgq; Sun, 19 Jun 2016 08:08:36 -0600 X-Authority-Analysis: v=2.2 cv=W5d6blek c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=pD_ry4oyNxEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=T2o6xq4IccvRw0ohEP4A:9 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 581C413753; Sun, 19 Jun 2016 07:08:33 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u5JE8W5w053656; Sun, 19 Jun 2016 07:08:32 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201606191408.u5JE8W5w053656@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Niclas Zeising cc: Cy Schubert , Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r288291 - head/etc In-Reply-To: Message from Niclas Zeising of "Sun, 19 Jun 2016 10:18:12 +0200." <4e985ab9-0d98-a160-bdad-fa4924ddc5b3@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 19 Jun 2016 07:08:32 -0700 X-CMAE-Envelope: MS4wfE8vIl5LajPyEMkBxO/D4UDqn/AFHLKvfemYSVSJnMCSt4Vif5W05056u7CHYmI+rXGD94dnv6EUfeUO/cDIXpphISdg1SZ+D7pdNPLGaTU35e1/1JWz KUfL2r7v1DZsiazoPWQVdomUO9OIaUfpoVp8YQfi07aYB8PumpIeImPLZwr0C20lHfL0hMjubbvXYSKxanZr1SfwCiyBPgQlzJViF89gvBP3wlGIZdQVVyZR z9FswSR/FoVSqZppfvFx/eEQjquiBITzA7JSkSzcE9NxWQd/1DzNx6dTDLZfQuyDRq/khPdqveZjo+u1LJ6Paw== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 14:08:43 -0000 In message <4e985ab9-0d98-a160-bdad-fa4924ddc5b3@freebsd.org>, Niclas Zeising w rites: > On 2016-06-19 07:12, Cy Schubert wrote: > > In message c > > om> > > , Adrian Chadd writes: > >> i think that's fine for -11. I'd like to just move limits to /bin for > >> 12. (I mean, it's 2016, why are you splitting / and /usr again? But..) > >> > >> I don't want to see differing system behaviour between limits but it's > >> likely unavoidable for 11 and could do with some errata notice so > >> people know what to expect. > > > > There aren't any daemons started prior to critical local filesystems being > > mounted. I suppose one day there could be but none at this point in time. > > Setting limits before filesystems are mounted is practically a NOP anyway. > > (Except it could negatively affect fsck of huge UFS filesystems some day.) > > > > > > This is wrong, and how I discovered it. ddb (/etc/rc.d/ddb) starts > before disks, and currently refuses to start on my systems with this > issue. This means no crash dumps, unless I remember to manually start > it later in the boot process, so this is an issue. ddb isn't a daemon. It's an interface into the kernel that configures DDB properties. It runs and completes. And, yes, it is affected by limits not being found in the path. My point is, since there are no daemons, as per the definition of a daemon (processes that become daemons and run in the background) prior to the filesystems being run, to say that there would be differing systems behavior before and after filesystems are started is presently false (though technically true because one day we might have daemons started before critical filesystems are mounted). I can see Adrian's point but not in the present day. In the future, possibly. Another option might be to move ddb after filesytems are mounted or this should circumvent the problem too: Index: ddb =================================================================== --- ddb (revision 302001) +++ ddb (working copy) @@ -15,6 +15,7 @@ rcvar="ddb_enable" command="/sbin/${name}" start_precmd="ddb_prestart" +start_cmd="ddb_start" stop_cmd=":" ddb_prestart() @@ -25,6 +26,11 @@ fi } +ddb_start() +{ + ${command} ${command_args} +} + load_rc_config $name required_files="${ddb_config}" -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sun Jun 19 14:28:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37CF4A7A648; Sun, 19 Jun 2016 14:28:48 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F09F1F43; Sun, 19 Jun 2016 14:28:47 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id EdiIbXkmTwsAcEdiJbCKkZ; Sun, 19 Jun 2016 08:28:40 -0600 X-Authority-Analysis: v=2.2 cv=U7HQNqju c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=pD_ry4oyNxEA:10 a=6I5d2MoRAAAA:8 a=U4EAvKDJAAAA:8 a=YxBL1-UpAAAA:8 a=FxgTLzK3pLkextSvKCcA:9 a=IjZwj45LgO3ly-622nXo:22 a=LH9_I48XOzAQGoZ0y7Dq:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id C3E9413753; Sun, 19 Jun 2016 07:28:37 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u5JESbbs053857; Sun, 19 Jun 2016 07:28:37 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201606191428.u5JESbbs053857@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jan Beich , Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r299448 - in head/sys/cddl/contrib/opensolaris: common/acl uts/common/fs/zfs uts/common/sys In-Reply-To: Message from Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= of "Sun, 19 Jun 2016 10:08:03 +0200." <20160619080803.GA1638@brick> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 19 Jun 2016 07:28:37 -0700 X-CMAE-Envelope: MS4wfHVzaaSYuuHJQfKv8fjCDd2YDUlKQedRFglDS71I8eGOdDx2kADClzqZpOsPpoNdX5PGpj7khpRsxBGOkf3WSSHC0hcrhBc56mk1KMGgVZDAYmflLa8Y VnHSPg52EVfp5hRGpEVxBzMzIDr6PS2qT1mvKFIGGvlluod1sMaZFznNY1rhPM/75tJjqPvvGHNacaYvyW448aivE0XqnY9RqeKP1SHT/FBxlZHlntNixHts +SDLD2XmAisXZM4FQjkTN7Tu0m0njh5QLUCmDVCkI8FxUjA0+eeu6vMzHSRDZ7JxaAsgE3eq81gsNz4R+JwllA== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 14:28:48 -0000 In message <20160619080803.GA1638@brick>, Edward Tomasz =?utf-8?Q?Napiera=C5=82 a?= writes: > On 0614T0232, Jan Beich wrote: > > Alexander Motin writes: > > > > > Author: mav > > > Date: Wed May 11 13:43:20 2016 > > > New Revision: 299448 > > > URL: https://svnweb.freebsd.org/changeset/base/299448 > > > > > > Log: > > > MFV r299442: 6762 POSIX write should imply DELETE_CHILD on directories > - and > > > some additional considerations > > > > > > Reviewed by: Gordon Ross > > > Reviewed by: Yuri Pankov > > > Author: Kevin Crowe > > > > > > openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916 > > > > This commit confuses acl_is_trivial_np(3). Notice '+' in ls(1) and 'D' > > in getfacl(1) outputs. > > It's not just that. > > Those changes: > > 1. Confuse acl_is_trivial_np(3), as you say. It's hard to fix in libc, > because they make trivial ACLs different for files and directories, > and acl_is_trivial_np(3) has no way of telling which is which. > > 2. They make delete deny permission take precedence over the containing > directory write allow permission, which is rather different from what > people expect in unix systems, and is against the NFSv4 specification, > even though it might be a better fit for Windows. This is Windows behavior and inconsistent with the rest of FreeBSD and any UNIX or Linux system. > > 3. They make umask apply to inherit_only permissions, and > > 4. I don't fully understand this one yet, but from the ACL regression > test suite (which lives in tests/sys/acl/, and I'd appreciate people > actually ran this before committing ACL-related changes) it looks > like it makes umask not apply to the stuff it should. > > The #1 could be fixed by making ZFS not setting delete_child on write, > basically reverting to the previous behaviour in that aspect. As for > the others... I'm not saying each one of those is wrong, but they > certainly warrant further discussion, especially #2 and #4. I think #2 is wrong behavior on any UNIX-like or POSIX system. > > Basically, what I'm trying to say is that we should consider backing > this out for 11.0-RELEASE, reverting to the previous semantics, verified > by passing the regression tests. Agreed. What in FreeBSD was this patch supposed to solve in the first place? -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sun Jun 19 14:33:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C563A7A876; Sun, 19 Jun 2016 14:33:51 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE55724F0; Sun, 19 Jun 2016 14:33:50 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-lf0-x232.google.com with SMTP id l188so23580222lfe.2; Sun, 19 Jun 2016 07:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=PFgkSJ/ao4/s1xg/wsYbkKKmrVMkj8zIQgpBKKs/OSU=; b=QvLYL9qwpmLWTAY4bmgHAsEo2fVXBOEjmjBWekpidnIxyOTD4rSbuHRqwx45nVwA2L lvveK5HyqQWpc8BrTNCV7I2y9bzv6qCUszHBEl7Odecu8h2WTCnNWmyzi+ewUs4gCoX+ V9Tb7q+iye7d8heG8afQrdNFw45ueaBmyaS7kjxAOPDuEuREbO03IKGDZH0JGV06DWhB /pUtTeKgzc226m2QQ4TU9Ypq9KcgkWtmP+5EWx146vWsYgCwsxqFO5iOM+nsrbn2FX9F OGM2Bv7QnMLE+FYYzR4zYc8Iyz2r+fjVYmqB31b3AKeQkwfcEnl45SDvXdleSUwVt5eS a0zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=PFgkSJ/ao4/s1xg/wsYbkKKmrVMkj8zIQgpBKKs/OSU=; b=N03Cd8xB9B0014yMbVwGA5BgrG5hxq8qVdJ71zwgg63E7WMDiZUQQw7dNC23E51+s2 9DBS5qMp0CEzN55EIj08E75/+thB2YSN/JVYlJNApeb1UHq0/BkSvmcz2IOoWCEZltF8 t43lGip6GY+XH1TXZ4kZoo+bG4TuHt/5XlPIFlOUzTjIYx6Y2SiYWy2pBRuJ1lcAk/Ml Av2xTAnKVKrpsN1pDrBEc7P4HvOAQb4UjqceFoILvYYc31hXmFHCKY56h8ulgyam8VrS 8nCCsSdkpQRJ50VrLvxEXYH/aFi4NkTeaXETtQ8BHpFmQM9YKSoYPFvc0z87fIa/8mZA OVfA== X-Gm-Message-State: ALyK8tK9FhHExzbIFs2YOsRX7PAORJZfahJNFAaa9vHXdpk+2ivrzQmExi3UJ0TVziz0oQ== X-Received: by 10.46.9.2 with SMTP id 2mr2897272ljj.1.1466346828570; Sun, 19 Jun 2016 07:33:48 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by smtp.gmail.com with ESMTPSA id y124sm5960396lfd.0.2016.06.19.07.33.47 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2016 07:33:47 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r299448 - in head/sys/cddl/contrib/opensolaris: common/acl uts/common/fs/zfs uts/common/sys To: Cy Schubert , Jan Beich , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201606191428.u5JESbbs053857@slippy.cwsent.com> From: Alexander Motin Message-ID: <49d3d34d-ba91-ebdf-497f-cbe1614bec53@FreeBSD.org> Date: Sun, 19 Jun 2016 17:33:45 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <201606191428.u5JESbbs053857@slippy.cwsent.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 14:33:51 -0000 On 19.06.16 17:28, Cy Schubert wrote: > In message <20160619080803.GA1638@brick>, Edward Tomasz > =?utf-8?Q?Napiera=C5=82 > a?= writes: >> On 0614T0232, Jan Beich wrote: >>> Alexander Motin writes: >>> >>>> Author: mav >>>> Date: Wed May 11 13:43:20 2016 >>>> New Revision: 299448 >>>> URL: https://svnweb.freebsd.org/changeset/base/299448 >>>> >>>> Log: >>>> MFV r299442: 6762 POSIX write should imply DELETE_CHILD on directories >> - and >>>> some additional considerations >>>> >>>> Reviewed by: Gordon Ross >>>> Reviewed by: Yuri Pankov >>>> Author: Kevin Crowe >>>> >>>> openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916 >>> >>> This commit confuses acl_is_trivial_np(3). Notice '+' in ls(1) and 'D' >>> in getfacl(1) outputs. >> >> It's not just that. >> >> Those changes: >> >> 1. Confuse acl_is_trivial_np(3), as you say. It's hard to fix in libc, >> because they make trivial ACLs different for files and directories, >> and acl_is_trivial_np(3) has no way of telling which is which. >> >> 2. They make delete deny permission take precedence over the containing >> directory write allow permission, which is rather different from what >> people expect in unix systems, and is against the NFSv4 specification, >> even though it might be a better fit for Windows. > > This is Windows behavior and inconsistent with the rest of FreeBSD and any > UNIX or Linux system. > >> >> 3. They make umask apply to inherit_only permissions, and >> >> 4. I don't fully understand this one yet, but from the ACL regression >> test suite (which lives in tests/sys/acl/, and I'd appreciate people >> actually ran this before committing ACL-related changes) it looks >> like it makes umask not apply to the stuff it should. >> >> The #1 could be fixed by making ZFS not setting delete_child on write, >> basically reverting to the previous behaviour in that aspect. As for >> the others... I'm not saying each one of those is wrong, but they >> certainly warrant further discussion, especially #2 and #4. > > I think #2 is wrong behavior on any UNIX-like or POSIX system. > >> >> Basically, what I'm trying to say is that we should consider backing >> this out for 11.0-RELEASE, reverting to the previous semantics, verified >> by passing the regression tests. > > Agreed. > > What in FreeBSD was this patch supposed to solve in the first place? Growing divergence from OpenZFS upstream. I am not advocating this patch, but it would be good, if possible, to not revert it completely, but block wrong behavior with some minimal ifdefs to make further ZFS merges easier. Help would be appreciated. ;) -- Alexander Motin From owner-svn-src-all@freebsd.org Sun Jun 19 14:52:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C67AA7AD47; Sun, 19 Jun 2016 14:52:38 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1AB62D62; Sun, 19 Jun 2016 14:52:37 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x241.google.com with SMTP id c82so5425599wme.3; Sun, 19 Jun 2016 07:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dCzQxX+81megEQQS5IEFg+jJ0xZc5zaaR/UAF5sjsLs=; b=bk+IqefUAHgj9eFWQnU9MrxHaY9TUKkg+nNkXNz0z06Jfootl3QYGVteWBPPssQETb Kct8fQ3vXxZEUNGVUi7arhXWXezyhByjDA7QcBnM7OfqB884QLMclV6WRKLfWEkg4XPq RGXisbr0qWB2hYx2kxzvswhpFu76bTGGa/47Ti/ninYkjUVoE+fP/fEUs8Eh8bXGD2Yf ZjKL4EtDZRwRHch8m2ld6TskedyVPNPi2jix2cRH0QGKI7izDQPr0+orzp3tqPeaO9IS mHmPEo+VWtaLKL8/R6v87ck28QYwdJSvfctdkNjRfkTSrik7/GGtciXX+cxLrYNbRX9i y0bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=dCzQxX+81megEQQS5IEFg+jJ0xZc5zaaR/UAF5sjsLs=; b=Y96JuEVFIMQP2tEbqT23C07o88Rca1TOqhmQrcCI+MvEL1jws0BMcZbZCmQQmZTst8 3U6kl1UNFOLr4d45ghCF/3YSdsI2GcSlsX+/7b7JkO31RT8HObh/2JfGccjU5EQoR9jk /Q3Z2Aaq1QdlERd9xSEBzV8Coz2g68VrDtB0Q2PgsHGZFdN3XIpTr+N6K7Z2ts4s8xMF pAPOg+N6VxQXS1BwunJFuDSv8oZEy1EV+VH28UdCJBFs+xYugHGpJDGoTSOrIhdq/A+P vju10+5677NAI+PYA8MKJgIWE+82g8E25tkSy/uepkX7uE5voX2YRE7KiPmJcrpaBYTH 7QNA== X-Gm-Message-State: ALyK8tJ3DLMrn2i41EUkcui/uXU6CQWcqPXPqAl5iS78zk7wCRAz0GJ6DTS/3youcYMDUQ== X-Received: by 10.28.129.197 with SMTP id c188mr7555574wmd.46.1466347955995; Sun, 19 Jun 2016 07:52:35 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id a84sm8898535wma.0.2016.06.19.07.52.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2016 07:52:35 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 19 Jun 2016 16:52:34 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: Hajimu UMEMOTO , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools Message-ID: <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uemritr6a2t6vnd4" Content-Disposition: inline In-Reply-To: <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> User-Agent: Mutt/1.6.1-neo (2016-06-11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 14:52:38 -0000 --uemritr6a2t6vnd4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: > On 19.06.2016 6:44, Hajimu UMEMOTO wrote: > > Log: > > - Prefer to use %d over %e where the day of the month should be zero > > filled. > > - Since %e means the day of the month as well, regard %e as same as %d > > in md_order. >=20 > Nonsense doubled formats in sr_*_RS locales and nonsense md_order there t= oo. Crap I'll dig into it, thanks for spotting it. Best regards, Bapt --uemritr6a2t6vnd4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXZrGxAAoJEGOJi9zxtz5aokYP/RWpDVKmRAkS8UjyUAQQ+/60 RgnqvbXwMd8Hv4lCOJZSkIxY9cyVaKCI+PdwhlTBIzEPxFM3RfZHon2jyg5Mf6/7 KbnmHAlvx/bJ+aBrmBoarSGBpHpwsI7GPGF7ull3utFAshWRiotyA7HvSL95XgQm ch982O4JMZWfIMDlRRLytNPVrUMSmEF8nFwj3ftP5fMU8g6iE/gz2Jo2s3fZD4pk oafyTRbRcmbyiibldCPNxeq1E7DyOAdy8wI62YlzwjovL+t8HYwUaIxgySX1mKIP QnuZwFI6Su2FIbwRZkkIdS46+g/wxKk6PtlmOYlfXfVppaQQsT8MqNF/IqZ3zZzr wzMgjV+Y8X7PotgA+LqOIWsbVFL7tN8AveOrJy/5k85jrKVqrfhTbIzny8CHM0nt QlcccbbrYHjNtMNrBpN5jzcnGiG+kuDMCfHJjBHxAIgNhGsO+6dbaBsshD5I8px1 /JqbZgPyZYMczpKL9qjy8C0/OMixijIA2Yl1HmWiBUNO6URMZvJMVLTGoxwq2dRl 2Z/sQF3NADyj0o35EmSaycsYJLmzutxTuP8hELm6cqghy3evIc2tyiyUxhM1jXrh BfYtyTnNI5KCMkeikrYCT8lTtw0t7tLVDDEZKZL+xj8QHCsT7Tjs+mZBOR/qArUt qJWnlvNef9GzKn7NCU/0 =125R -----END PGP SIGNATURE----- --uemritr6a2t6vnd4-- From owner-svn-src-all@freebsd.org Sun Jun 19 14:59:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEA45A7AE27; Sun, 19 Jun 2016 14:59:35 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from mail.daemonic.se (cloud.daemonic.se [185.34.0.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FEE22F80; Sun, 19 Jun 2016 14:59:35 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from cloud.daemonic.se (localhost [IPv6:::1]) by mail.daemonic.se (Postfix) with ESMTP id 3rXcb800fzz27L1; Sun, 19 Jun 2016 14:59:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at daemonic.se Received: from mail.daemonic.se ([127.0.0.1]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256) by cloud.daemonic.se (mailscanner.daemonic.se [127.0.0.1]) (amavisd-new, port 10587) with ESMTPS id n7JrC19zxNsu; Sun, 19 Jun 2016 14:59:31 +0000 (UTC) Received: from [IPv6:2001:470:dca9:2::3] (celes.daemonic.se [IPv6:2001:470:dca9:2::3]) by mail.daemonic.se (Postfix) with ESMTPSA id 3rXcb65jpdz27C0; Sun, 19 Jun 2016 14:59:30 +0000 (UTC) Subject: Re: svn commit: r288291 - head/etc To: Cy Schubert References: <201606191408.u5JE8W5w053656@slippy.cwsent.com> Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Niclas Zeising Message-ID: <658f8bf1-6ded-903f-7469-55bc4b6798fd@freebsd.org> Date: Sun, 19 Jun 2016 16:59:28 +0200 User-Agent: Mutt/1.5.21 MIME-Version: 1.0 In-Reply-To: <201606191408.u5JE8W5w053656@slippy.cwsent.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 14:59:35 -0000 On 2016-06-19 16:08, Cy Schubert wrote: > In message <4e985ab9-0d98-a160-bdad-fa4924ddc5b3@freebsd.org>, Niclas > Zeising writes: >> >> This is wrong, and how I discovered it. ddb (/etc/rc.d/ddb) starts >> before disks, and currently refuses to start on my systems with this >> issue. This means no crash dumps, unless I remember to manually start >> it later in the boot process, so this is an issue. > > ddb isn't a daemon. It's an interface into the kernel that configures DDB > properties. It runs and completes. And, yes, it is affected by limits not > being found in the path. I think I misunderstood what you mean, I thought you meant nothing is affected by this. Apologies for that. > > My point is, since there are no daemons, as per the definition of a daemon > (processes that become daemons and run in the background) prior to the > filesystems being run, to say that there would be differing systems > behavior before and after filesystems are started is presently false > (though technically true because one day we might have daemons started > before critical filesystems are mounted). Agreed. I understand if we are too late in the release cycle for 11 to move limits to /bin, which seems like the best solutions. Are there any other reasons not to move /usr/bin/limits? I wanted to bring this to attention, since it seems noone else has noticed it, or cared enough about it. It is nothing that stops me from using FreeBSD, I will just have to remember to start ddb manually, or run the commands in case of a panic. Regards! -- Niclas From owner-svn-src-all@freebsd.org Sun Jun 19 15:49:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1822BA7996B; Sun, 19 Jun 2016 15:49:23 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D75A2C6E; Sun, 19 Jun 2016 15:49:22 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x243.google.com with SMTP id a66so3465501wme.2; Sun, 19 Jun 2016 08:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=V04uj9prdxixxVKGQ7M8d0TRwNWtRaUJb/sSnZj02Dc=; b=k3VchkvlF9GDu6oxny9d8Z2T4rhs5RZo/SuI3OzGssJbJHGSmzu4coK744AAPR72vN FodacZslj5IsISFLnPeBbmHtjdwiI19ps91Q8bdtgglKXFN6AkUQ6MurEw26eP7t1cC2 CSLD/llLv6Dogl4wEz7JLQ17qd2vVcGwFwkJIaPbo747RN/LvgamENKxfkCcO6VX6wZA 14AByAd1dLXZ2zDbqZ0e5C5jFLOb2SMHW+OTsq1guAmjsZ34DXeG2YidXklWa8s0okEJ teThbao3HzWWB8KFFy9urb30Kq9Ed7F02zhnhzDVApYxodLZ/eaLCsVmEDM8yyQpA6DI 3g2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=V04uj9prdxixxVKGQ7M8d0TRwNWtRaUJb/sSnZj02Dc=; b=fkZJkNzAOqm4Wnrwc3d2cRtkEZTkQ0f43Uj6cXxHc6D+V2XmYOxo22FoxdAeSwC+9n NoyvOqjUtJVuMbtLEC1+7wNQ/k6TnJEk12vjaJ6GLlut0ulYvEKsS4Cvz4OGHYnDVwFj gYlb6IKFcUh+yz2Mm1zZxkv8WhYta7Jt8QJp0F1YxstEr+6/Yw4o2uPAk0KCGoqOm5KS hZLHqE0YPXzlb1P75gw4wzLSb+3SMkkyacEbBMes12RnyXRYEXnkEFkixFKy/VzdiJSB QHQmLbBmNSbXUbhVnq3CCnb6bTP3nOVptvTmymZdU9ebNQXFCvA2vjYhphAdYADcys8u BECQ== X-Gm-Message-State: ALyK8tIZB6il5UUbfaunubxPsv7Ofl5pCa9EgAdJijEgKGB/thQADo9V2ksBYr53XJANRA== X-Received: by 10.194.88.106 with SMTP id bf10mr4991134wjb.37.1466351360466; Sun, 19 Jun 2016 08:49:20 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id yr4sm47735395wjc.18.2016.06.19.08.49.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2016 08:49:19 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 19 Jun 2016 17:49:19 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools Message-ID: <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pc7s4e6evzu5cliy" Content-Disposition: inline In-Reply-To: <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> User-Agent: Mutt/1.6.1-neo (2016-06-11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 15:49:23 -0000 --pc7s4e6evzu5cliy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote: > On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: > > On 19.06.2016 6:44, Hajimu UMEMOTO wrote: > > > Log: > > > - Prefer to use %d over %e where the day of the month should be zero > > > filled. > > > - Since %e means the day of the month as well, regard %e as same as= %d > > > in md_order. > >=20 > > Nonsense doubled formats in sr_*_RS locales and nonsense md_order there= too. >=20 > Crap I'll dig into it, thanks for spotting it. >=20 > Best regards, > Bapt Should be fixed by: https://people.freebsd.org/~bapt/locale-triple-components.diff The perl script generating the locales was badly handling locales with 3 components, fixed now. Sorry about that Best regards, Bapt --pc7s4e6evzu5cliy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXZr7+AAoJEGOJi9zxtz5aiYcP/0yH1RQV4ivjWBKaIh+G+rZS 2PD/n1P0mMcP/LQ7seQT2P23lJHEbdxCFriYFz8w8DXwQd/RQzX7nKW/5sLI9YTM ddI4ISHC0MM8icQVnDD1xMD7H4UbcI57lAI3KV7DYhnO1yFT3AM9ttQC2RqBFKJN PHpkLU8wx3GKK0qsL6wYa8I6OulYK+/NjKeJtoeqPdVSnMnC7bWR3PNaBh0/7wMJ djUT6Ghaso1xaMjWwDbe9njsnYQj6f67E62LqmuQsY8cPKu2I6a3ovm7DVntzq3D Fj9L9zC7Dx6fQFCE89RfGH9w/Mm2CMa+aFv8GzSu4hz6dclF3qdTLjpv2FCAyHXW Mq6N/VmuBC8PxGCWBSZVV4ijnwn/SX14AtZ8mh3KRuSpZDbxrSFW1FUbNzXKsGs/ MeyuuPqMJN4IAPdL8uuZ7dNwh1tGL+p7Zq/g5HT7nmDrD8e/lcq5XIVevAKvRPt3 pFLgQ3MAP+tpwN6tEHPBO0VyWqVSVohMTokcxYPNFnk67hwqTiCYisyUNty4K4N3 JMBag8P2dRPx7iR5oR/gOD9uV7GSjYPaM3j2peoTaD+hIql1oEDr/HAGQfy6tUaB p85Bzqir+I4YJIL30V4IoN3equDTWbC9cr5YMVITaerYxgqxBG1DOhmTSU4ZPK15 GQbDwAwuLQtj2ky2mZMO =Ftn0 -----END PGP SIGNATURE----- --pc7s4e6evzu5cliy-- From owner-svn-src-all@freebsd.org Sun Jun 19 16:21:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 062F1A7A49D; Sun, 19 Jun 2016 16:21:26 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) by mx1.freebsd.org (Postfix) with ESMTP id DD7112292; Sun, 19 Jun 2016 16:21:25 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [10.1.1.2]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id D8C65D758; Sun, 19 Jun 2016 16:21:24 +0000 (UTC) Subject: Re: svn commit: r288291 - head/etc To: Cy Schubert , Niclas Zeising References: <201606191408.u5JE8W5w053656@slippy.cwsent.com> Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Allan Jude Message-ID: Date: Sun, 19 Jun 2016 12:21:24 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <201606191408.u5JE8W5w053656@slippy.cwsent.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 16:21:26 -0000 On 2016-06-19 10:08, Cy Schubert wrote: > In message <4e985ab9-0d98-a160-bdad-fa4924ddc5b3@freebsd.org>, Niclas > Zeising w > rites: >> On 2016-06-19 07:12, Cy Schubert wrote: >>> In message > c >>> om> >>> , Adrian Chadd writes: >>>> i think that's fine for -11. I'd like to just move limits to /bin for >>>> 12. (I mean, it's 2016, why are you splitting / and /usr again? But..) >>>> >>>> I don't want to see differing system behaviour between limits but it's >>>> likely unavoidable for 11 and could do with some errata notice so >>>> people know what to expect. >>> >>> There aren't any daemons started prior to critical local filesystems being >>> mounted. I suppose one day there could be but none at this point in time. >>> Setting limits before filesystems are mounted is practically a NOP anyway. >>> (Except it could negatively affect fsck of huge UFS filesystems some day.) >>> >>> >> >> This is wrong, and how I discovered it. ddb (/etc/rc.d/ddb) starts >> before disks, and currently refuses to start on my systems with this >> issue. This means no crash dumps, unless I remember to manually start >> it later in the boot process, so this is an issue. > > ddb isn't a daemon. It's an interface into the kernel that configures DDB > properties. It runs and completes. And, yes, it is affected by limits not > being found in the path. > > My point is, since there are no daemons, as per the definition of a daemon > (processes that become daemons and run in the background) prior to the > filesystems being run, to say that there would be differing systems > behavior before and after filesystems are started is presently false > (though technically true because one day we might have daemons started > before critical filesystems are mounted). > > I can see Adrian's point but not in the present day. In the future, > possibly. > > Another option might be to move ddb after filesytems are mounted or this > should circumvent the problem too: > I think you still want ddb early, because it configures crash dumps, and another daemon or process that starts might cause a crash. -- Allan Jude From owner-svn-src-all@freebsd.org Sun Jun 19 16:25:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91D63A7A662; Sun, 19 Jun 2016 16:25:43 +0000 (UTC) (envelope-from jean-sebastien.pedron@dumbbell.fr) Received: from mail.made4.biz (mail.made4.biz [IPv6:2001:41d0:2:c018::1:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52E59271D; Sun, 19 Jun 2016 16:25:42 +0000 (UTC) (envelope-from jean-sebastien.pedron@dumbbell.fr) Received: from 141.7.19.93.rev.sfr.net ([93.19.7.141] helo=magellan.dumbbell.fr) by mail.made4.biz with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2 (FreeBSD)) (envelope-from ) id 1bEfXY-000HhY-9J; Sun, 19 Jun 2016 18:25:40 +0200 Subject: Re: svn commit: r288291 - head/etc To: Niclas Zeising , Cy Schubert References: <201606191408.u5JE8W5w053656@slippy.cwsent.com> <658f8bf1-6ded-903f-7469-55bc4b6798fd@freebsd.org> Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Message-ID: Date: Sun, 19 Jun 2016 18:25:30 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <658f8bf1-6ded-903f-7469-55bc4b6798fd@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="awAWXl9rb8G1sPlaXoFQCxafg6Qs2naNv" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 16:25:43 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --awAWXl9rb8G1sPlaXoFQCxafg6Qs2naNv Content-Type: multipart/mixed; boundary="QOVdWKCaBSo7tKojpUcOJ8KIvU3oRtHac" From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= To: Niclas Zeising , Cy Schubert Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: Subject: Re: svn commit: r288291 - head/etc References: <201606191408.u5JE8W5w053656@slippy.cwsent.com> <658f8bf1-6ded-903f-7469-55bc4b6798fd@freebsd.org> In-Reply-To: <658f8bf1-6ded-903f-7469-55bc4b6798fd@freebsd.org> --QOVdWKCaBSo7tKojpUcOJ8KIvU3oRtHac Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 19/06/2016 16:59, Niclas Zeising wrote: > I wanted to bring this to attention, since it seems noone else has > noticed it, or cared enough about it. It is nothing that stops me from= > using FreeBSD, I will just have to remember to start ddb manually, or > run the commands in case of a panic. There is a bug filed to track this issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206291 I have the same problem because the system was installed a long time ago.= --=20 Jean-S=E9bastien P=E9dron --QOVdWKCaBSo7tKojpUcOJ8KIvU3oRtHac-- --awAWXl9rb8G1sPlaXoFQCxafg6Qs2naNv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJXZseDAAoJEDnpl2Gl/ZTM9QsQAJU8xYwd0qyN9hdCCIOuWfT4 fr+hCgp7+a0zrakiVQ8oGDxk7Hekuw7xmwWLDJeUmBLDpY24lsQWQWIr12h4cnaX 9medWYB+9wN7bbPWrAgRihdBJ2dl4cRqIuLi1HWzECPs3FBOQ+T2IXsQUNAfpT4r BdxrrGgy7qIey1PoYGGRm19ntmZE2gAAwBtQVNfVXuCr++T+w2oGt9IuZ2bOKz8T OHyBWoLWiLpKEt0gVfC1uV26gcWmyvQvY6JOzP1pbqgENoIytGEho8al2NV93fmP zcSblH0EQoDihoG1qy3KUETcyes4uZNgLi1xlj9rQk8OUg3+1tFNOE5zh2DZuYgg v63mTGT6lYmVXDI/pwYPbaCCpMTaSae6NlWBIroWiyEKFYLES3WkJ5HZcbUh/mxn 9GdqN5mvbOcaHpJIFfWLsmi6NonsvopfTk1d2ooyNoI79OWRjWrJKYU57dl4LwGL u9UC0IG9zjLnnXK8LnNk4/kSAXG4tecbxpASA6nuP9oBMZzSi3Nns4ofH/IDYLPW 9hexRyqIaEu2HTinEiL9JsTkOkFu3/0WqpfcIfHBxxLqzoO8bVMRPH43QUfvJOtj tZQsfHg2HRaJnj8+/stHteY3b/oFZHKv0qmiMogmvxjJwg6zH4buwG6GhEBeByt6 e/rwyUP7V4tA6rDxihyB =Zy73 -----END PGP SIGNATURE----- --awAWXl9rb8G1sPlaXoFQCxafg6Qs2naNv-- From owner-svn-src-all@freebsd.org Sun Jun 19 16:52:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 288DBA7AD40 for ; Sun, 19 Jun 2016 16:52:26 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4347183D for ; Sun, 19 Jun 2016 16:52:25 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f48.google.com with SMTP id h129so23857633lfh.1 for ; Sun, 19 Jun 2016 09:52:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=zEk+RXEjTCJlmJ+7g5VOH+GUhANwz+t9xPh7PyJMXsM=; b=KPtudmX8pFXeyx6fcOqln+1gQT9cjuihXAgQf2Bwdod+CB5xp3pQe9cpdycjmTf1KI hBsiLLx60SCHz90weEWLETgS1outAYEJgR0BiC0Wezj8aHAJv3I07b4GnU8LzlIeff5Z QacmNNAN7wVVwBHyl54Nz88hnwX27RgAHIesd2TAbUh1IA60acuJ71RRgbdT61B0mmbv lkmrQvRvrWa9rpvI7lB40CybNkJBO0pbQje4KWYy4IUap/6FdWut02VkOF5YHxnesTfh D2/X60hqXB41kYrutMgAEadfyir7QzHoTB2HKz49/9t4P0o/p8ueaqpeMAS2XDhaQvWS 0dcQ== X-Gm-Message-State: ALyK8tLHkKNFu+WGi46pFrs3L2hYAQbXeFtuSzWm+o7eC3Cw6LRI42NZiVM9OmyW/1D+zg== X-Received: by 10.25.22.217 with SMTP id 86mr3232037lfw.100.1466355138771; Sun, 19 Jun 2016 09:52:18 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id z10sm260644lbr.12.2016.06.19.09.52.17 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2016 09:52:18 -0700 (PDT) Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools To: Baptiste Daroussin References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO From: Andrey Chernov Message-ID: Date: Sun, 19 Jun 2016 19:52:17 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="eW515PGpxbVjNUPRXLlTLhRjABBiMR5if" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 16:52:26 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --eW515PGpxbVjNUPRXLlTLhRjABBiMR5if Content-Type: multipart/mixed; boundary="tAbqLOkI4CX1nd1Nx5sK2VmDhm5hseT78" From: Andrey Chernov To: Baptiste Daroussin Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Message-ID: Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> In-Reply-To: --tAbqLOkI4CX1nd1Nx5sK2VmDhm5hseT78 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19.06.2016 19:47, Andrey Chernov wrote: > On 19.06.2016 18:49, Baptiste Daroussin wrote: >> On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote: >>> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: >>>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: >>>>> Log: >>>>> - Prefer to use %d over %e where the day of the month should be z= ero >>>>> filled. >>>>> - Since %e means the day of the month as well, regard %e as same = as %d >>>>> in md_order. >>>> >>>> Nonsense doubled formats in sr_*_RS locales and nonsense md_order th= ere too. >>> >>> Crap I'll dig into it, thanks for spotting it. >>> >>> Best regards, >>> Bapt >> >> Should be fixed by: >> https://people.freebsd.org/~bapt/locale-triple-components.diff >> >> The perl script generating the locales was badly handling locales with= 3 >> components, fixed now. >> >> Sorry about that >> >> Best regards, >> Bapt >> >=20 > sr locales are badly named before anything else, proper format is > language[_COUNTRY][.encoding][@variant] > I.e. > sr_RS.UTF-8@Latn > sr_RS.ISO8859-2@Latn > sr_RS.ISO8859-t@Cyrl >=20 > I don't know, if out utilities (f.e. locale(1)) can handle @variant suf= fix. >=20 >=20 =3Dsr_RS.ISO8859-5@Cyrl =3Dour, and not utilities only but libc too --tAbqLOkI4CX1nd1Nx5sK2VmDhm5hseT78-- --eW515PGpxbVjNUPRXLlTLhRjABBiMR5if Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJXZs3BAAoJEKUckv0MjfbKgC4H/0OogkzEPP42VCqvpVK+573t CNqK6VqlDJHSKB1YBrW2nTC5GjLlvLUFpcp32UM7INMxLTTS80XvEsN1vOnjsuWX c32UYSChng7W4H3qolADiK0m4Rm9pjmBeIhtM+igDq3XzRTlUv8MyB27tdJD1nyt t8tMvDPgWBFNz22TR/Bij9LJvFhQFxL5hMMlatjd1BBvT61EbKrnoyLA+7WJoE/L 4pd/0LY43OImT7aGek1fLn4IF2bq3mZIkk3aZuUkIZjE3tuT4lkaTkhtK/yOW70h wCakjNevg1gg2ESrsUYXLsP+w1aLnwI5+5+C/pn7wsCoIcG8DAccyDpwoRNoHLg= =QxXX -----END PGP SIGNATURE----- --eW515PGpxbVjNUPRXLlTLhRjABBiMR5if-- From owner-svn-src-all@freebsd.org Sun Jun 19 16:53:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13BE9A7ADCF for ; Sun, 19 Jun 2016 16:53:26 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EEB61A1E for ; Sun, 19 Jun 2016 16:53:25 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f47.google.com with SMTP id l188so24666715lfe.2 for ; Sun, 19 Jun 2016 09:53:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=3LpkDs9hCcTRoLtT6x9WnGgiO+9oNTcNVTmueb/D4xo=; b=JsukaZQCqPEdykQgTORKlZL/yQNzI6f4z/NJV0RidUORPEKvw8FbKyGGexXBdjVOFw eCSG0SRe+rtiuJ2EaVCWzK+8oN7PSeERpOwmeLGVSsfBmmXgqwCBmchmDO0KraEN3arn QabQEKA9YvXn0aSjKZe9kAz1mvCfo8f+dNoa1HM747gGXrI8EF+IkrBPzu33/snBIlOL VfGRQRyrg2dOZ4seBExTn160LciYxfo7DkXTnemNBucqqj4+/gOeRuNERZ2D6oKdYcJa gMf7XRMfM65Uawt+hboXX8D1LHuLm8ZvKkQU+KITvya3KtokXyQ0dBXS04wi6w1a6gGK dXUQ== X-Gm-Message-State: ALyK8tL0DbJN2R/UZIode6mojPp932qw+kQIU04jwMEjEVIKFUDFqDnncQD642YYAdRl+g== X-Received: by 10.46.32.28 with SMTP id g28mr2979736ljg.34.1466354849289; Sun, 19 Jun 2016 09:47:29 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id 25sm3685393lft.24.2016.06.19.09.47.28 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2016 09:47:28 -0700 (PDT) Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools To: Baptiste Daroussin References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO From: Andrey Chernov Message-ID: Date: Sun, 19 Jun 2016 19:47:27 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="owAtx50hIioIj6EgeutMGddJcBkh7GGR6" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 16:53:26 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --owAtx50hIioIj6EgeutMGddJcBkh7GGR6 Content-Type: multipart/mixed; boundary="o9vC4UbdPgfPscj79O59kWQ7hnehiBrT4" From: Andrey Chernov To: Baptiste Daroussin Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Message-ID: Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> In-Reply-To: <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> --o9vC4UbdPgfPscj79O59kWQ7hnehiBrT4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19.06.2016 18:49, Baptiste Daroussin wrote: > On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote: >> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: >>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: >>>> Log: >>>> - Prefer to use %d over %e where the day of the month should be ze= ro >>>> filled. >>>> - Since %e means the day of the month as well, regard %e as same a= s %d >>>> in md_order. >>> >>> Nonsense doubled formats in sr_*_RS locales and nonsense md_order the= re too. >> >> Crap I'll dig into it, thanks for spotting it. >> >> Best regards, >> Bapt >=20 > Should be fixed by: > https://people.freebsd.org/~bapt/locale-triple-components.diff >=20 > The perl script generating the locales was badly handling locales with = 3 > components, fixed now. >=20 > Sorry about that >=20 > Best regards, > Bapt >=20 sr locales are badly named before anything else, proper format is language[_COUNTRY][.encoding][@variant] I.e. sr_RS.UTF-8@Latn sr_RS.ISO8859-2@Latn sr_RS.ISO8859-t@Cyrl I don't know, if out utilities (f.e. locale(1)) can handle @variant suffi= x. --o9vC4UbdPgfPscj79O59kWQ7hnehiBrT4-- --owAtx50hIioIj6EgeutMGddJcBkh7GGR6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJXZsyfAAoJEKUckv0MjfbKLFgH/RaDpaqA3TRHUH11YqkclUAj cnsfaN5UET0TQMfP2E0wnx/ZjxDic2FMLDcynA2N6l+2AuwRq1Y1KER7jOBpQPr7 q5HqlpCKXj0Utqst02xEUGox6PWx/HI3PGle1l1SwcFNmJLCnpiNIosdPBYw6pMd pKXA/jQaWnr1tA+uzkkYTTBe/jEKPrMDzOK2SumpY7Uxup1oQZBTqSubhua4pmLF eAJxUUiDoDOmenjnal67PZKyWWShT+6nclNcSfDDQsH9PjJj/x2r2Vn1TqsV2l82 NRi2hgWn3F0vaWRriMiHEcEn1ilHEhgeGwjG4taltcAdMxxBWbIkBa3JEcuYY2A= =/+CM -----END PGP SIGNATURE----- --owAtx50hIioIj6EgeutMGddJcBkh7GGR6-- From owner-svn-src-all@freebsd.org Sun Jun 19 17:05:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE228A7A2AB for ; Sun, 19 Jun 2016 17:05:34 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3340C200E for ; Sun, 19 Jun 2016 17:05:33 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f42.google.com with SMTP id f6so24829153lfg.0 for ; Sun, 19 Jun 2016 10:05:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=X/KhJLcTFWSqZ+VwnDufhH4HJ8HvyNhrSMEUyIyI9P0=; b=EemSM1A7x4D3lH+mxdBg5+ZRNnPVwO3xgxqQBvFsWU/VLE7bfF4en2xvUeNLrgcU08 AJ2vhzyL5DL0YM0EgZKEXHw5I4d4ogZAaS3hSWh+gxowV0MTwvgl614RKNFGdveLqaE+ DoVObD8KqbT/aKkWBfao5jA2BAuu/3/zVJvaoXAPQc2aqw+5H/bFGRiyVoXYpL83CBpD 4UfYzGGq3Dy44oTZACYHAuQnMe6JRFjWI9yQ/GqJzJ292LsHRBMbQaHY9rPj3QFlncjt 3UXayqS4nhX6I2c3GRbDhl3slI8rzCXP0sBbHpqvx2E3Lzb2EMquK+x1jfqBsqkEHKGM MFPg== X-Gm-Message-State: ALyK8tKvDc94WR7DcVR5LQN7xktHeRQmIxuW8WDtO2KMZONsFdvZr67FKMV3NHdoyOLjCw== X-Received: by 10.25.18.234 with SMTP id 103mr3583249lfs.118.1466355931852; Sun, 19 Jun 2016 10:05:31 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id f17sm6035591lfg.35.2016.06.19.10.05.30 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2016 10:05:31 -0700 (PDT) Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools To: Baptiste Daroussin References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO From: Andrey Chernov Message-ID: <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> Date: Sun, 19 Jun 2016 20:05:30 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2qEDkAXlhRDV2rTRvnDjE0Mu4qdMjdnvX" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:05:34 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2qEDkAXlhRDV2rTRvnDjE0Mu4qdMjdnvX Content-Type: multipart/mixed; boundary="Qlb6DpaT3WRgTOvCfutkB45THtThh99ir" From: Andrey Chernov To: Baptiste Daroussin Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Message-ID: <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> In-Reply-To: --Qlb6DpaT3WRgTOvCfutkB45THtThh99ir Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19.06.2016 19:52, Andrey Chernov wrote: > On 19.06.2016 19:47, Andrey Chernov wrote: >> On 19.06.2016 18:49, Baptiste Daroussin wrote: >>> On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote: >>>> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: >>>>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: >>>>>> Log: >>>>>> - Prefer to use %d over %e where the day of the month should be = zero >>>>>> filled. >>>>>> - Since %e means the day of the month as well, regard %e as same= as %d >>>>>> in md_order. >>>>> >>>>> Nonsense doubled formats in sr_*_RS locales and nonsense md_order t= here too. >>>> >>>> Crap I'll dig into it, thanks for spotting it. >>>> >>>> Best regards, >>>> Bapt >>> >>> Should be fixed by: >>> https://people.freebsd.org/~bapt/locale-triple-components.diff >>> >>> The perl script generating the locales was badly handling locales wit= h 3 >>> components, fixed now. >>> >>> Sorry about that >>> >>> Best regards, >>> Bapt >>> >> >> sr locales are badly named before anything else, proper format is >> language[_COUNTRY][.encoding][@variant] >> I.e. >> sr_RS.UTF-8@Latn >> sr_RS.ISO8859-2@Latn >> sr_RS.ISO8859-t@Cyrl >> >> I don't know, if out utilities (f.e. locale(1)) can handle @variant su= ffix. >> >> > =3Dsr_RS.ISO8859-5@Cyrl > =3Dour, and not utilities only but libc too Since right now we have only single @variant per each encoding, and no @variant for other locales, we can just drop it and use right names like:= sr_RS.UTF-8 sr_RS.ISO8859-2 sr_RS.ISO8859-5 --Qlb6DpaT3WRgTOvCfutkB45THtThh99ir-- --2qEDkAXlhRDV2rTRvnDjE0Mu4qdMjdnvX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJXZtDaAAoJEKUckv0MjfbKobsIAMuAx1/nEwCJkLFsA/2BbLbQ TQei43xsVX5jIgYErVaH3B/nk0jTJJMC8KQdJh6yqchz5uj5xAGDsQ5YsjKepcCy 38p9tzi28TXPnQhe4bT0VFEJ8E9PacoW7hQYkvetQjUCT5ec/6lQ3wj50tXSRuOn uNIVqO0YmkLHK3QCzEUSbToNl3O78yAJ7O381Pb/eab8gwVG0MbjmScGE11DIhkQ ievblj+gw9hC3CoWNq2rnhVtt4RFqty8J4fv8JqseS3IpAvclT60MuLwYDFLGy2m jc7UQD9kMQIF6Mx968VRb8LP6jUm/MGRTDfJkBArJFA0YLtc16PAviPtxVd+/Qs= =Ndqx -----END PGP SIGNATURE----- --2qEDkAXlhRDV2rTRvnDjE0Mu4qdMjdnvX-- From owner-svn-src-all@freebsd.org Sun Jun 19 17:05:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39220A7A2C9; Sun, 19 Jun 2016 17:05:42 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1DFD2095; Sun, 19 Jun 2016 17:05:41 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x243.google.com with SMTP id a66so3748584wme.2; Sun, 19 Jun 2016 10:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cQwnudjChlRHrrpHku6vh1UeGH0HtxVFTRC+lPgpVvU=; b=JjiqNOVnAd1QvwJUNt8e98B2rMOuPpzX9nv1ofvZie8j442+ECZ/7oqtHnzX6uwkhI HSOwgpusQNsuXrOM6a1hqzWTuw7x+Sgs8C+2l0mgRsC2QSESX2bkbu2Old/dVWEPW0jN QrXoWKzO7ur/hJf7B3T2VKGHTWcVJ+CPopHDaCBtNnt/DpuxJ6w5/1DoTmoGiSJ98cHA dJ6UnxeeZdvfTB6Wqp5kwwHy9wLHSXuipXVdrxSFBcbTTjMfdHxUzr/17bJaXYIPP7RU hs0r4XiTk0OShuBi2rH/68Yq5BTGj6pxvhtUzFTo2l3Ug0pxqFqikOw0gfYjr9WL+Rx3 gYvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=cQwnudjChlRHrrpHku6vh1UeGH0HtxVFTRC+lPgpVvU=; b=f4gn1Gge8iZr7uEZImVRCssn/QCRaxC98Ev9hgEvtoWmdt2LSW+91JqN8G4BAeu/Vu fD8UBSXbRD+9nHPI5ppdpFIyryMpBOmn/khT3X0R0WtxcLqD8uHcNG9sjdDs/MoVZSzl QKec5wFgNdBpHYr23EQxaPJHCtSQD0t8qO06uCbvcJhWqRbV9xHw5BWMOnZkNX6cs2Mt FQ88e487K9oc65eufVh4eei2x4cLXuswKL1Os+b5ZjVasIyzUVZvgEzvyVaY8P7xVJ6u kWjk/4uZPLCqFznD3E/4jiTIccfYm6/UjqqQ9pENHkUDmkU6qbd1yuWGploHOIr3H/Vr KevQ== X-Gm-Message-State: ALyK8tJsR4hB1AMIMxs+dn+NpqqT/T1nyZNmb6DpX4Y1d70lHKk8CESc59OzuXZbqK9adA== X-Received: by 10.28.228.69 with SMTP id b66mr6928379wmh.25.1466355940005; Sun, 19 Jun 2016 10:05:40 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id o10sm22607784wjs.38.2016.06.19.10.05.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2016 10:05:39 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 19 Jun 2016 19:05:38 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools Message-ID: <20160619170538.qt2kmzr5fo34ekvj@ivaldir.etoilebsd.net> References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fh7brfnogevkb7bw" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1-neo (2016-06-11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:05:42 -0000 --fh7brfnogevkb7bw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 19, 2016 at 07:47:27PM +0300, Andrey Chernov wrote: > On 19.06.2016 18:49, Baptiste Daroussin wrote: > > On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote: > >> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: > >>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: > >>>> Log: > >>>> - Prefer to use %d over %e where the day of the month should be ze= ro > >>>> filled. > >>>> - Since %e means the day of the month as well, regard %e as same a= s %d > >>>> in md_order. > >>> > >>> Nonsense doubled formats in sr_*_RS locales and nonsense md_order the= re too. > >> > >> Crap I'll dig into it, thanks for spotting it. > >> > >> Best regards, > >> Bapt > >=20 > > Should be fixed by: > > https://people.freebsd.org/~bapt/locale-triple-components.diff > >=20 > > The perl script generating the locales was badly handling locales with 3 > > components, fixed now. > >=20 > > Sorry about that > >=20 > > Best regards, > > Bapt > >=20 >=20 > sr locales are badly named before anything else, proper format is > language[_COUNTRY][.encoding][@variant] > I.e. > sr_RS.UTF-8@Latn > sr_RS.ISO8859-2@Latn > sr_RS.ISO8859-t@Cyrl According to what? >=20 > I don't know, if out utilities (f.e. locale(1)) can handle @variant suffi= x. >=20 Our syntax is the syntax for the variants that has been the widly adopted: Microsoft, ICU, java, python's babel internationalisation thing, cldr (of course), CPAN components (Datime::Locales for example) This is respecting RFC 3066 with the little difference that we use '_' inst= ead of '-' Best regards, Bapt --fh7brfnogevkb7bw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXZtDfAAoJEGOJi9zxtz5atQYP/jMq+j78/JFlN/yBbJO9lMzn SLCRl594TJ7H6sAqB9lfzNsKCsHkhsHlHVvabsLQ2viQAYf7admZd3JTVOExwR6l otAZhUfLF8PFM6Sm2NZmcBPNQ+a3CYjrwueZF7P2OxYR/seSSPRLsx2/AFlmm25U w108Uhv/GatttIO+rWvQBMJIHuytv15mlfSF60I2q9I/aVufStHpp2xP+uagXC+n aNt71m3IQC1yAUOldNFBi70d48ZEOqrj6/0fCrIUy6tCd1rhNmAnKEINJr7D8Fo1 dRRzjsfBsNdmd0nATR9rI9FBe4sclUhauZTtFVNluLfd/VcT9pAnc1V9GQTU/3jb Ep5z8nzPc7vzFnTtfyz+3BvbjL4eueiKDCeY2FBDFqP6Keq5WjszApXYEoVdaxep CER8Unp/Juv6T9aeUQ+Vbhja+hO5/ckZQNRLDAqJ9qzOlUBeqbfh/YJJfgjzc4mi fCGm6GYSxo88Z2KPO4AoI+SH9oYXUvwPrEBrZOqfMbRR/SR/QwVlfzWFFxsGtPB4 37scBATDm141o1Rli7PRe7k7QGsgSRtTtr010Gyk3nfPI27CE1uPi1la6YK4mhgs RtCaJ+VKOysX4uMSjXtPs00YOgtG9z8MrvehRbCT+6lvx0znbKxC4MbKnV8Fec7X hlPDOnlCFuvlXpzIVkYC =6UFc -----END PGP SIGNATURE----- --fh7brfnogevkb7bw-- From owner-svn-src-all@freebsd.org Sun Jun 19 17:10:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF4D7A7A4A2; Sun, 19 Jun 2016 17:10:24 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E0DC24ED; Sun, 19 Jun 2016 17:10:24 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x229.google.com with SMTP id r201so32336329wme.1; Sun, 19 Jun 2016 10:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qHJpJx9ortWOx28KLDXqUo/N7Q49z6Wb0Pd0w02zmds=; b=EYWhyiDR2LkDIoYv/kAPeQ7pMLPpAmWLing7LTO3kIwy+TrNe9ZITUris0yLsOdZ8g A4BxeijJtX3kXeogpv3x/3a0rYHyo8ekbB3RA6QSWmv7H8+vKRYxCukXt8kCwRxURf8x DVF6EWFBpDtiuZUFuA0mTLOgcsrdTS10WIXc2fvSgBK+O8lsrf/q/cv80DHhYHxpEO/9 luroeGR+L/gTaSdEZ0nyqNpf85mFUFksyso0HfMcrGG97uLOi2U/tTvxMhQlgPNisaMq cv/7acznoJxXTqSHW/+Kl3t79z7TH5yTOEQFfNA5ZTr/z3+Xz/31LBhNCkBaiBfFKVtB xrxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=qHJpJx9ortWOx28KLDXqUo/N7Q49z6Wb0Pd0w02zmds=; b=AgrsVCzY/tl6cmGReUckjmMIeS3v1697ZCN0qeUHTH796PuVl040jrfrZplZyLxbA7 qWQfbWl8nQk6/vRU7EY6b5Jvi8KLtHVjupd4rdLVgKfuIBgt8aBSWspG4LuSiDmU30sH IEg9+++swaf3EozhlO+pWEMWFdSiE5OfPHZZ0vQyy5PiaPtTGtwiCBuGXzsUffc1TxrG 3sxK3DjvoriOiwOF+EdVan5Ue4jMn1yDsw9nIVKLDZGwkdtTKrhWqpnDkj/bgxHBtjCL 2rBzzLXoucFzxL1P/YIRe6g+O4WAj3/QcDYatGCUir3GnemCY7bGllLW+dKTqn4pyIXU mRaQ== X-Gm-Message-State: ALyK8tIdrw8Sd3xBONCjPtCQa7cO7MwxYnjd47GvkCsO2eSJhIF2N6JNzt8qXvlIo2VkPQ== X-Received: by 10.194.203.105 with SMTP id kp9mr11463431wjc.70.1466356222765; Sun, 19 Jun 2016 10:10:22 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id jf3sm28563493wjb.41.2016.06.19.10.10.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2016 10:10:22 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 19 Jun 2016 19:10:21 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools Message-ID: <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="imdvuh4tgkvycob7" Content-Disposition: inline In-Reply-To: <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> User-Agent: Mutt/1.6.1-neo (2016-06-11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:10:25 -0000 --imdvuh4tgkvycob7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 19, 2016 at 08:05:30PM +0300, Andrey Chernov wrote: > On 19.06.2016 19:52, Andrey Chernov wrote: > > On 19.06.2016 19:47, Andrey Chernov wrote: > >> On 19.06.2016 18:49, Baptiste Daroussin wrote: > >>> On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote: > >>>> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: > >>>>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: > >>>>>> Log: > >>>>>> - Prefer to use %d over %e where the day of the month should be = zero > >>>>>> filled. > >>>>>> - Since %e means the day of the month as well, regard %e as same= as %d > >>>>>> in md_order. > >>>>> > >>>>> Nonsense doubled formats in sr_*_RS locales and nonsense md_order t= here too. > >>>> > >>>> Crap I'll dig into it, thanks for spotting it. > >>>> > >>>> Best regards, > >>>> Bapt > >>> > >>> Should be fixed by: > >>> https://people.freebsd.org/~bapt/locale-triple-components.diff > >>> > >>> The perl script generating the locales was badly handling locales wit= h 3 > >>> components, fixed now. > >>> > >>> Sorry about that > >>> > >>> Best regards, > >>> Bapt > >>> > >> > >> sr locales are badly named before anything else, proper format is > >> language[_COUNTRY][.encoding][@variant] > >> I.e. > >> sr_RS.UTF-8@Latn > >> sr_RS.ISO8859-2@Latn > >> sr_RS.ISO8859-t@Cyrl > >> > >> I don't know, if out utilities (f.e. locale(1)) can handle @variant su= ffix. > >> > >> > > =3Dsr_RS.ISO8859-5@Cyrl > > =3Dour, and not utilities only but libc too >=20 > Since right now we have only single @variant per each encoding, and no > @variant for other locales, we can just drop it and use right names like: > sr_RS.UTF-8 We have 2 for the above the Cyrl version and the Latn version > sr_RS.ISO8859-2 > sr_RS.ISO8859-5 We can make aliases easily for that is that is what people want, not the we= have the same for other locales: zh_Hans_CN.GB18030 zh_Hans_CN.GB2312 zh_Hans_CN.GBK zh_Hans_CN.UTF-8 zh_Hans_CN.eucCN zh_Hant_HK.UTF-8 zh_Hant_TW.Big5 zh_Hant_TW.UTF-8 With some aliases for some of the previously existing ones: zh_TW.Big5 zh_TW.UTF-8 zh_CN.GB18030 zh_CN.GB2312 zh_CN.GBK zh_CN.UTF-8 zh_CN.eucCN zh_HK.UTF-8 Some of the new locales (that didn't exist before) I have only imported the= new name format: kk_Cyrl_KZ.UTF-8 mn_Cyrl_MN.UTF-8 sr_Cyrl_RS.ISO8859-5 sr_Cyrl_RS.UTF-8 sr_Latn_RS.ISO8859-2 sr_Latn_RS.UTF-8 I would prefer staying on the new syntax given it is allowed by some RFC an= d it is slowly being adopted everywhere else. Btw another RFC: https://www.ietf.org/rfc/rfc5646.txt Best regards, Bapt --imdvuh4tgkvycob7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXZtH9AAoJEGOJi9zxtz5atOwP/jF5+B26EI6I0w3pafvZDbQz 9ZPLoJxWBxKEoX2y57IPOGlbSZfMf3j0OEyEUuZHMxCTO6M8lETmD/GoNOG5m2x2 txuZctZ77wJo5IQChu5MWTLYXeDi8jr0HJvKyAngkN8dJxBbDyjPQFHZPcqh8AKZ ULSBH0MakGKzAXrgwAZf7uv+52JWO+cO5YV8uyqkXWWwlma7UnrrqaEKR5zvqx59 NZ3fxz8a2AQazxQcepnh55sflUBkPRX0ycFrMpUWf4a4lJvub15oKHxfEW8lO3DY AJzNI4nXdyZFV6K7r280AaaK+CVaC2hmVZJQ/Poob+R5wkVF5fnQoBouVizKRMQw 7lfJmGlA4x+hMulsv60bNhjmQLWXj8pqr3RbFFvQxN/1oCUKZxRIUcInqNxbJkE7 CfBcDlcTDdImIZ57ORdKMNVJyp6q0g34t6oXr0blNXsANB+7FHSIGcvQgXnafTVi O0NiPxfnvAng1m6rUaB7XD4NAVekgPAqdVy4QPPRmEq8TlRWUSQNqiHNYX/kkLbJ opxIb47ofmPWf2BPujcGPRSuTkEaSLrXHFfSYAcnEKN9igRRCN0G9iVGGE492Or5 PD3uQy7Y2KRG4x0jtrfiBZXOvwrQyHSuDTyRz0rCf2eD32fG+V1JN+5mqmaBzTcv v/PsstkK1c2NPOiTjO8l =/nxt -----END PGP SIGNATURE----- --imdvuh4tgkvycob7-- From owner-svn-src-all@freebsd.org Sun Jun 19 17:16:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04567A7A67A for ; Sun, 19 Jun 2016 17:16:59 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 84A71288E for ; Sun, 19 Jun 2016 17:16:58 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f54.google.com with SMTP id h129so24049170lfh.1 for ; Sun, 19 Jun 2016 10:16:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=KxseqSs9p8RhPX+r7OHyvsrlV2G92pWdL5+avZ3YuFM=; b=ZgT1UpGWvFZGMAX1MAA8FFGBrUJcFHRlDTI5UawrnvJi7HWiJpuBa0m/fOQUbI9skg O5zouhf0Tn2B+JytyUwDinYb9HRPVa60aqC5EKpkiWeIIPUMJcBPYpW8UaW8GfdFHXZ2 E+cbri2FyTOKyx8LeU2Zne/mFelmvqNrzDAt3CH5TF+W405ymjqSHc1jmM2Z9shQ3vvT u8l9HIPNJlOeuLAQHe1gsn4adyclAuL+hOBYqKDuVK5TU/W0xqbo2uC80F6BOUkyIUmv OiM4iYfmN5mdCXbdnGhYK1ONeQPhNUL43UoXciHnP3ldGaZGc8V3lne1DuLryEpIuxr+ w+aw== X-Gm-Message-State: ALyK8tKUXcNoAsO2ohiurfxvDDXqoxXeQmLTnHl80sRkQZ96gKczaSYZzPa7R9CtAr82Ig== X-Received: by 10.25.148.200 with SMTP id w191mr518788lfd.2.1466356616240; Sun, 19 Jun 2016 10:16:56 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id o93sm5308824lfi.5.2016.06.19.10.16.55 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2016 10:16:55 -0700 (PDT) Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools To: Baptiste Daroussin References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <20160619170538.qt2kmzr5fo34ekvj@ivaldir.etoilebsd.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO From: Andrey Chernov Message-ID: <73ce250f-71f6-7bde-9340-e6b6bf7ce749@freebsd.org> Date: Sun, 19 Jun 2016 20:16:54 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160619170538.qt2kmzr5fo34ekvj@ivaldir.etoilebsd.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9Chb07Aorhm3nSW9RXFxUV8wR4owxwHAV" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:16:59 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --9Chb07Aorhm3nSW9RXFxUV8wR4owxwHAV Content-Type: multipart/mixed; boundary="flFCXQtdfuMgdi61K12UDpQaNU4Tbi9O3" From: Andrey Chernov To: Baptiste Daroussin Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Message-ID: <73ce250f-71f6-7bde-9340-e6b6bf7ce749@freebsd.org> Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <20160619170538.qt2kmzr5fo34ekvj@ivaldir.etoilebsd.net> In-Reply-To: <20160619170538.qt2kmzr5fo34ekvj@ivaldir.etoilebsd.net> --flFCXQtdfuMgdi61K12UDpQaNU4Tbi9O3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19.06.2016 20:05, Baptiste Daroussin wrote: > On Sun, Jun 19, 2016 at 07:47:27PM +0300, Andrey Chernov wrote: >> On 19.06.2016 18:49, Baptiste Daroussin wrote: >>> On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote: >>>> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: >>>>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: >>>>>> Log: >>>>>> - Prefer to use %d over %e where the day of the month should be = zero >>>>>> filled. >>>>>> - Since %e means the day of the month as well, regard %e as same= as %d >>>>>> in md_order. >>>>> >>>>> Nonsense doubled formats in sr_*_RS locales and nonsense md_order t= here too. >>>> >>>> Crap I'll dig into it, thanks for spotting it. >>>> >>>> Best regards, >>>> Bapt >>> >>> Should be fixed by: >>> https://people.freebsd.org/~bapt/locale-triple-components.diff >>> >>> The perl script generating the locales was badly handling locales wit= h 3 >>> components, fixed now. >>> >>> Sorry about that >>> >>> Best regards, >>> Bapt >>> >> >> sr locales are badly named before anything else, proper format is >> language[_COUNTRY][.encoding][@variant] >> I.e. >> sr_RS.UTF-8@Latn >> sr_RS.ISO8859-2@Latn >> sr_RS.ISO8859-t@Cyrl >=20 > According to what? >> >> I don't know, if out utilities (f.e. locale(1)) can handle @variant su= ffix. >> > Our syntax is the syntax for the variants that has been the widly adopt= ed: > Microsoft, ICU, java, python's babel internationalisation thing, > cldr (of course), CPAN components (Datime::Locales for example) >=20 > This is respecting RFC 3066 with the little difference that we use '_' = instead > of '-' >=20 > Best regards, > Bapt >=20 According to POSIX, but I can't find the reference right now, it is related to XPG3 or XPG4. It was already many years. First reference from Google http://www.boost.org/doc/libs/1_60_0/libs/locale/doc/html/locale_gen.html= Next from Gentoo: https://wiki.gentoo.org/wiki/Localization/Guide Microsoft, Linux and GNU iconv understand @-syntax --flFCXQtdfuMgdi61K12UDpQaNU4Tbi9O3-- --9Chb07Aorhm3nSW9RXFxUV8wR4owxwHAV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJXZtOGAAoJEKUckv0MjfbKtiAH/RO4AWLQDvdvUHsIyi8amFDM QdsZjWAcW3ZBwLp0T7FRQLh6Et197pVJ4jaPIApR0Z5ALTg41H0ZWYsqy19iktbE tkC8rxj3fqWctkwnxnHVGeAuk8FQ5uV8GI1hffjMsVqYc7adovqO1gcIkBiGS9ZQ qqTZ1e/aoPjENbno1X5KwuA/ZpY3YYyesGB0/x8513L9h1mLM6jiaD2+pbcHhX6k kqeI7tHjihgB8aOYMz5to8LiRZ4KbzCEiyG3iMj+Y4QjFYdBqTfxl9+2hNK4pt65 PQOrDw2nGs2PwKKlUYdM+ER44BtF+QX93RdIqdXsqsOvO9QCJgAE0+aoiIJKc9U= =vXYA -----END PGP SIGNATURE----- --9Chb07Aorhm3nSW9RXFxUV8wR4owxwHAV-- From owner-svn-src-all@freebsd.org Sun Jun 19 17:19:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D523A7A744; Sun, 19 Jun 2016 17:19:38 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBE772A01; Sun, 19 Jun 2016 17:19:37 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id 187so8922501wmz.1; Sun, 19 Jun 2016 10:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Uoh/iEoW4Qb3yOet5UgpmAem8U8Tlu1aw1/5rwYyZZc=; b=IwncSFsn51y6ZARx3X9hKwuELr0elfilYxIlqecaqSUEohwIBFHblpGmuJIvnQCO5F Lco2V0I295B3h688lPfX32LsW7+kXs/JEDdT2g1AHyJi94hrSW1pwzk3sHakb5BboSBq Ix34O8N42I+Mbr3uQm5HTOkFL6tNw8LXvraLznOGmN7SLYVDTxR5b3Eiuhs2ZBsGXLqd 4EdT+U8HeBLe2H/bt7pOZUQ/icO2BUgSma9681ShMpRmsswHBSb8jnNVL9RlD8Q8/HlH ortl93QYt/lUvodGKhaGCUzSiu4xtmQwqOVZFzf2KN1moIlJrjwCiN9mio/0pob5WQUl HrmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Uoh/iEoW4Qb3yOet5UgpmAem8U8Tlu1aw1/5rwYyZZc=; b=cLOitJHVLI6XPjBmHOewJ8dBwaudhyocoH10wzXH2+G/TaOgoaCKJUfMSlsSF1J1L1 zXUL0xfGHSc0ni8dO2WZqJghou/yitPUSn/YxC7jmskaDhozvxjRBJivKMIEHMclncFg uULNckPKnwK03JqixiRN/enOPVABBt3voruV/u3nb+zX1qojDKbZpUQ1y3hVK0SpHu0u X8+pRs9qA3vqDI+Zembw4HMqQah5zAnXUswCRRYPvmup4F+orSARAlIODiIo29ilv07V hDhoXAbZLTHHO+Ry0j1aIWJ4YAJOpVU4GUhFAghEVlWMWn29/7qAxyjPfPNV7b4ZSvlQ cBHA== X-Gm-Message-State: ALyK8tLnXs8kcZmtFoCy/Pl5uXAGM+Nsi30PWuBoy5Nt8GOHWiC2Od/PpeWNkHsRSYOUvg== X-Received: by 10.28.140.194 with SMTP id o185mr7071079wmd.86.1466356776371; Sun, 19 Jun 2016 10:19:36 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id v200sm9364734wmv.4.2016.06.19.10.19.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2016 10:19:35 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 19 Jun 2016 19:19:34 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools Message-ID: <20160619171934.5hxchhcvrbhhxvti@ivaldir.etoilebsd.net> References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <20160619170538.qt2kmzr5fo34ekvj@ivaldir.etoilebsd.net> <73ce250f-71f6-7bde-9340-e6b6bf7ce749@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fkepdmjy6vfsgsuy" Content-Disposition: inline In-Reply-To: <73ce250f-71f6-7bde-9340-e6b6bf7ce749@freebsd.org> User-Agent: Mutt/1.6.1-neo (2016-06-11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:19:38 -0000 --fkepdmjy6vfsgsuy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 19, 2016 at 08:16:54PM +0300, Andrey Chernov wrote: > On 19.06.2016 20:05, Baptiste Daroussin wrote: > > On Sun, Jun 19, 2016 at 07:47:27PM +0300, Andrey Chernov wrote: > >> On 19.06.2016 18:49, Baptiste Daroussin wrote: > >>> On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote: > >>>> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: > >>>>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: > >>>>>> Log: > >>>>>> - Prefer to use %d over %e where the day of the month should be = zero > >>>>>> filled. > >>>>>> - Since %e means the day of the month as well, regard %e as same= as %d > >>>>>> in md_order. > >>>>> > >>>>> Nonsense doubled formats in sr_*_RS locales and nonsense md_order t= here too. > >>>> > >>>> Crap I'll dig into it, thanks for spotting it. > >>>> > >>>> Best regards, > >>>> Bapt > >>> > >>> Should be fixed by: > >>> https://people.freebsd.org/~bapt/locale-triple-components.diff > >>> > >>> The perl script generating the locales was badly handling locales wit= h 3 > >>> components, fixed now. > >>> > >>> Sorry about that > >>> > >>> Best regards, > >>> Bapt > >>> > >> > >> sr locales are badly named before anything else, proper format is > >> language[_COUNTRY][.encoding][@variant] > >> I.e. > >> sr_RS.UTF-8@Latn > >> sr_RS.ISO8859-2@Latn > >> sr_RS.ISO8859-t@Cyrl > >=20 > > According to what? > >> > >> I don't know, if out utilities (f.e. locale(1)) can handle @variant su= ffix. > >> > > Our syntax is the syntax for the variants that has been the widly adopt= ed: > > Microsoft, ICU, java, python's babel internationalisation thing, > > cldr (of course), CPAN components (Datime::Locales for example) > >=20 > > This is respecting RFC 3066 with the little difference that we use '_' = instead > > of '-' > >=20 > > Best regards, > > Bapt > >=20 >=20 > According to POSIX, but I can't find the reference right now, it is > related to XPG3 or XPG4. It was already many years. > First reference from Google > http://www.boost.org/doc/libs/1_60_0/libs/locale/doc/html/locale_gen.html > Next from Gentoo: > https://wiki.gentoo.org/wiki/Localization/Guide > Microsoft, Linux and GNU iconv understand @-syntax >=20 >=20 As soon as our libc and locale tool support it we can make aliases to suppo= rt both syntax Best regards, Bapt --fkepdmjy6vfsgsuy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXZtQlAAoJEGOJi9zxtz5axGwQAM6N/UorjrdVO1iPAAsvNiNR RsCxmMGj+38WO7m4THozi0ryUaF4bDbS4yDNo5kkwuir8YMsPxjjrFg8M0fA5WZF 0JN4ljLDlh59ZOZuEvOssBB1gNVxoG5ElW+YArxv7M9BoKck0Omdx1liRjCbc2B6 1Y2qmh6T0IMOl5TOtpezpT6hIs9uCn2GzS66XpnQ0yXSsvnqtd+xb3QzAbM0f+aY 491dxmcczdy3vqicJmfVFH2P27UmyD67DWw6KyIfgwKCKMGrm2PtsRIiMJ/XdpVD pZ689njw5jLwCwFz71OOBfceLUHyT+e4nURLKZ/0zTlS5wjK3jrb/gcm9Hm/8rJd AAaveN9VY3SXvn7hkEicpb5QefRd/MfcoWS7Qw1gs7QuL0AFcrKHjiWisqV3R973 3DoCpCvse1qPCouH5ISq0ONRITTC6SDBhb7lvBt9ZiwaVTzDPkrrRIje3hxM45/7 2dz0L6rgw4SoQ2DQaA79FEAT5g6j+/CjM8NzAfrjcfoLsSO6PiMOoLOvajpSAvG7 xzredNs4Lua3KpsTyFDz0YCXNNgT+yO7xTSbJby5dauZWDOx8UB3O97fTiNRSRGV uR/98rodkiN8ObLKg+IxG/gG7lK2VGhKg2X6zvwY0bsPiw2He6Ma+hXj6rGNb6dI c1FrKgpMbGKYPehiJYoC =VA8Q -----END PGP SIGNATURE----- --fkepdmjy6vfsgsuy-- From owner-svn-src-all@freebsd.org Sun Jun 19 17:21:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29B49A7A7DB for ; Sun, 19 Jun 2016 17:21:40 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 97CE82D2E for ; Sun, 19 Jun 2016 17:21:39 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f46.google.com with SMTP id q132so24868039lfe.3 for ; Sun, 19 Jun 2016 10:21:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=B6glWHyYP+n71RtPFxB53Zk1Q5RSBDu7IsUKLQiB76s=; b=HhL/m6ciG1qHccah1YhxrNcYV/AxH/5AlxYJT9tXa2WW09GEDWX/FaGM+C4oK95DG2 mU06Bb4o4tS4UzVGzVaQfuLgLvQ10cae/5q812jw/2VT5ZqZrVRh8Xz3nJei5oS1iSlm pI6Y6SPj8gF3U7MsaHvy+eRqFhh7vKZbcgmC0Yii4rqZu09+3jb4pkLR1qZWz+r3xQVT D5iuiNqeGOioOq0jgSp0nmgOsf5e+5bqoebZrjnSH7bjYY7X1zgr5Q3oakBD9lcfmxOx rE5qfmGHg13jNPX6+KT2SRsouoaK+yiCkeeSfeZzK94sNM02AsyJFXPW4In9qelrlGaI 1wnA== X-Gm-Message-State: ALyK8tI3QLG+SQf4hPqBet8jqqW32S+tPDPn34Ac8IMYQ2TwJ9OVb+WeklTurfpGe28LPQ== X-Received: by 10.25.26.194 with SMTP id a185mr2526427lfa.156.1466356897382; Sun, 19 Jun 2016 10:21:37 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id l138sm783043lfb.22.2016.06.19.10.21.36 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2016 10:21:36 -0700 (PDT) Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools To: Baptiste Daroussin References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO From: Andrey Chernov Message-ID: Date: Sun, 19 Jun 2016 20:21:35 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6m75Ost4vG0OV8lve34fUTm0HoOHsRVin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:21:40 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6m75Ost4vG0OV8lve34fUTm0HoOHsRVin Content-Type: multipart/mixed; boundary="ljhoxWrLxihoE186QEtis6QLrjBEkHmPC" From: Andrey Chernov To: Baptiste Daroussin Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Message-ID: Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> In-Reply-To: <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> --ljhoxWrLxihoE186QEtis6QLrjBEkHmPC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19.06.2016 20:10, Baptiste Daroussin wrote: > On Sun, Jun 19, 2016 at 08:05:30PM +0300, Andrey Chernov wrote: >> On 19.06.2016 19:52, Andrey Chernov wrote: >>> On 19.06.2016 19:47, Andrey Chernov wrote: >>>> On 19.06.2016 18:49, Baptiste Daroussin wrote: >>>>> On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote:= >>>>>> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: >>>>>>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: >>>>>>>> Log: >>>>>>>> - Prefer to use %d over %e where the day of the month should b= e zero >>>>>>>> filled. >>>>>>>> - Since %e means the day of the month as well, regard %e as sa= me as %d >>>>>>>> in md_order. >>>>>>> >>>>>>> Nonsense doubled formats in sr_*_RS locales and nonsense md_order= there too. >>>>>> >>>>>> Crap I'll dig into it, thanks for spotting it. >>>>>> >>>>>> Best regards, >>>>>> Bapt >>>>> >>>>> Should be fixed by: >>>>> https://people.freebsd.org/~bapt/locale-triple-components.diff >>>>> >>>>> The perl script generating the locales was badly handling locales w= ith 3 >>>>> components, fixed now. >>>>> >>>>> Sorry about that >>>>> >>>>> Best regards, >>>>> Bapt >>>>> >>>> >>>> sr locales are badly named before anything else, proper format is >>>> language[_COUNTRY][.encoding][@variant] >>>> I.e. >>>> sr_RS.UTF-8@Latn >>>> sr_RS.ISO8859-2@Latn >>>> sr_RS.ISO8859-t@Cyrl >>>> >>>> I don't know, if out utilities (f.e. locale(1)) can handle @variant = suffix. >>>> >>>> >>> =3Dsr_RS.ISO8859-5@Cyrl >>> =3Dour, and not utilities only but libc too >> >> Since right now we have only single @variant per each encoding, and no= >> @variant for other locales, we can just drop it and use right names li= ke: >> sr_RS.UTF-8 >=20 > We have 2 for the above the Cyrl version and the Latn version >=20 >> sr_RS.ISO8859-2 >> sr_RS.ISO8859-5 >=20 > We can make aliases easily for that is that is what people want, not th= e we have > the same for other locales: >=20 > zh_Hans_CN.GB18030 > zh_Hans_CN.GB2312 > zh_Hans_CN.GBK > zh_Hans_CN.UTF-8 > zh_Hans_CN.eucCN > zh_Hant_HK.UTF-8 > zh_Hant_TW.Big5 > zh_Hant_TW.UTF-8 >=20 > With some aliases for some of the previously existing ones: > zh_TW.Big5 > zh_TW.UTF-8 > zh_CN.GB18030 > zh_CN.GB2312 > zh_CN.GBK > zh_CN.UTF-8 > zh_CN.eucCN > zh_HK.UTF-8 >=20 > Some of the new locales (that didn't exist before) I have only imported= the new > name format: > kk_Cyrl_KZ.UTF-8 > mn_Cyrl_MN.UTF-8 > sr_Cyrl_RS.ISO8859-5 > sr_Cyrl_RS.UTF-8 > sr_Latn_RS.ISO8859-2 > sr_Latn_RS.UTF-8 >=20 > I would prefer staying on the new syntax given it is allowed by some RF= C and it > is slowly being adopted everywhere else. >=20 > Btw another RFC: https://www.ietf.org/rfc/rfc5646.txt >=20 > Best regards, > Bapt >=20 Old POSIX don't use RFC 5646, there are ISO-639 two-letter codes. When encodings are different, there is no needs to specify variants, they have meaning only for the same encoding. --ljhoxWrLxihoE186QEtis6QLrjBEkHmPC-- --6m75Ost4vG0OV8lve34fUTm0HoOHsRVin Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJXZtSfAAoJEKUckv0MjfbKgIQIAMrDxXUpLz5SNUNkI3uSZg76 3oy0rRpDuvL3ZW2tR7iB90MEF9J2YJD+vBayC2wP4aYRlqk+XoGbkMHyjMZOzbFW vp09lD6K+kPOzkDy5xxnipvuGFQVMjOUaHhdJo8oX0KeCYq5UdcjqF4bvsDa+cQS EmPkGcTfCxh6CP51AwzulxLMzuThdgm7J1ymAurkn4Y14++H2tMca3EMnWC/WLUK Z5x9FHUq/ZYVu1jKvT/2JlH9zTEJ7AXPqVlDW67PyG1UfwYZ2Qy5r5B8Rx3iCpJn SaRm6236N/yGIr/3UaYXXiS+T2NR8AELUfsHmUy609WwVtofRvB/dvcG7lSI+AA= =TYfX -----END PGP SIGNATURE----- --6m75Ost4vG0OV8lve34fUTm0HoOHsRVin-- From owner-svn-src-all@freebsd.org Sun Jun 19 17:34:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F05EA7AAEB; Sun, 19 Jun 2016 17:34:13 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 191D8163C; Sun, 19 Jun 2016 17:34:12 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id EgbobYWPuwsAcEgbpbCn44; Sun, 19 Jun 2016 11:34:11 -0600 X-Authority-Analysis: v=2.2 cv=U7HQNqju c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=pD_ry4oyNxEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=qSgVzNnN3oH25cI-RzoA:9 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 4D70A13753; Sun, 19 Jun 2016 10:34:08 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u5JHY79U055006; Sun, 19 Jun 2016 10:34:07 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201606191734.u5JHY79U055006@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= cc: Niclas Zeising , Cy Schubert , Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r288291 - head/etc In-Reply-To: Message from =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= of "Sun, 19 Jun 2016 18:25:30 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 19 Jun 2016 10:34:07 -0700 X-CMAE-Envelope: MS4wfPbETxoQH9LTmmxa8OupNy2QR6ub80g8mI5pzCtS9g4IFvSQpiA/yl0cixCtwfkYl1SPOLG6W+E3b7nWF1XWErg1Ec4NwEM9Ge1mH8HqS4LVTmRw/0Xv 1qDNqR5SKuuhT97WBs7q1xwUTDIU4VbKqNbr5Y+2uB63nl2d7Cs6VcITMonneQK2gVlmNe+Iwp9q4X8K8NUPvCroXej17ZtU5ZjQ5BwUreTOmJHlYLYen2kX Ia68NTkSPqpNtHuXm41AE7OjtnYGmlGPnCAAGkWx/BrANWND9Q8ByypJIIc4xZcp0aZl4tBYzloIAcL4c2pk6HNoca/yaUl/01penrHcgHb1cyVB2yKm3/8k JAa603zmieS/HtMI76X+ueCVz9TesA== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:34:13 -0000 In message , =?UTF-8?Q?Jean-S > On 19/06/2016 16:59, Niclas Zeising wrote: > > I wanted to bring this to attention, since it seems noone else has > > noticed it, or cared enough about it. It is nothing that stops me from= > > > using FreeBSD, I will just have to remember to start ddb manually, or > > run the commands in case of a panic. > > There is a bug filed to track this issue: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206291 > > I have the same problem because the system was installed a long time ago.= I have some older systems that have been upgraded over the years. If nobody minds, I'd like to assign this to myself, unless of course someone else wants it... -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sun Jun 19 18:29:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5A3DA7A9D9; Sun, 19 Jun 2016 18:29:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A30012FED; Sun, 19 Jun 2016 18:29:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5JITh9S007425; Sun, 19 Jun 2016 18:29:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5JIThWV007424; Sun, 19 Jun 2016 18:29:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606191829.u5JIThWV007424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 19 Jun 2016 18:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302019 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 18:29:44 -0000 Author: kib Date: Sun Jun 19 18:29:43 2016 New Revision: 302019 URL: https://svnweb.freebsd.org/changeset/base/302019 Log: Do not access NFS data for reclaimed vnode. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (delphij) Modified: head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Sun Jun 19 07:31:02 2016 (r302018) +++ head/sys/fs/nfsclient/nfs_clvnops.c Sun Jun 19 18:29:43 2016 (r302019) @@ -3097,10 +3097,14 @@ nfs_advlock(struct vop_advlock_args *ap) } } if (error == 0 && ap->a_op == F_SETLK) { - /* Mark that a file lock has been acquired. */ - mtx_lock(&np->n_mtx); - np->n_flag |= NHASBEENLOCKED; - mtx_unlock(&np->n_mtx); + error = NFSVOPLOCK(vp, LK_SHARED); + if (error == 0) { + /* Mark that a file lock has been acquired. */ + mtx_lock(&np->n_mtx); + np->n_flag |= NHASBEENLOCKED; + mtx_unlock(&np->n_mtx); + NFSVOPUNLOCK(vp, 0); + } } } return (error); From owner-svn-src-all@freebsd.org Sun Jun 19 18:32:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28C6CA7AC21; Sun, 19 Jun 2016 18:32:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D44591633; Sun, 19 Jun 2016 18:32:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5JIWaSI011044; Sun, 19 Jun 2016 18:32:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5JIWaNa011043; Sun, 19 Jun 2016 18:32:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606191832.u5JIWaNa011043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 19 Jun 2016 18:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302020 - head/sys/nlm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 18:32:37 -0000 Author: kib Date: Sun Jun 19 18:32:35 2016 New Revision: 302020 URL: https://svnweb.freebsd.org/changeset/base/302020 Log: Remote and local adv lock servers might de-synchronize (the added comment explains the plausible scenario), resulting in EDEADLK returned on the local registration attempt. Handle this by re-trying the local op [1]. On unmount, local registration abort is indicated as EINTR, abort the nlm call as well. Reported and tested by: pho Suggested and reviewed by: dfr (previous version, [1]) Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (delphij) Modified: head/sys/nlm/nlm_advlock.c Modified: head/sys/nlm/nlm_advlock.c ============================================================================== --- head/sys/nlm/nlm_advlock.c Sun Jun 19 18:29:43 2016 (r302019) +++ head/sys/nlm/nlm_advlock.c Sun Jun 19 18:32:35 2016 (r302020) @@ -713,7 +713,37 @@ nlm_record_lock(struct vnode *vp, int op newfl.l_pid = svid; newfl.l_sysid = NLM_SYSID_CLIENT | sysid; - error = lf_advlockasync(&a, &vp->v_lockf, size); + for (;;) { + error = lf_advlockasync(&a, &vp->v_lockf, size); + if (error == EDEADLK) { + /* + * Locks are associated with the processes and + * not with threads. Suppose we have two + * threads A1 A2 in one process, A1 locked + * file f1, A2 is locking file f2, and A1 is + * unlocking f1. Then remote server may + * already unlocked f1, while local still not + * yet scheduled A1 to make the call to local + * advlock manager. The process B owns lock on + * f2 and issued the lock on f1. Remote would + * grant B the request on f1, but local would + * return EDEADLK. + */ + pause("nlmdlk", 1); + /* XXXKIB allow suspend */ + } else if (error == EINTR) { + /* + * lf_purgelocks() might wake up the lock + * waiter and removed our lock graph edges. + * There is no sense in re-trying recording + * the lock to the local manager after + * reclaim. + */ + error = 0; + break; + } else + break; + } KASSERT(error == 0 || error == ENOENT, ("Failed to register NFS lock locally - error=%d", error)); } From owner-svn-src-all@freebsd.org Sun Jun 19 19:02:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D3D4A7A1E7 for ; Sun, 19 Jun 2016 19:02:33 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B79D713D1 for ; Sun, 19 Jun 2016 19:02:32 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f50.google.com with SMTP id l188so25649012lfe.2 for ; Sun, 19 Jun 2016 12:02:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=q9sFnyRXmn8bT45xEDKzMeBH5XWcvcyHDwHRrdF5aek=; b=N8nTSCtt0JXxRVI09w6sQW6OpceN8RQGMJ8PZBl+HP8RBzpzKdXAdIzo1urSUytqHF bcRQ2rL7mbH+d/k+39SxmayQy2/tfymN7F2bqc77Ss7aOnwZ5tG7A4+KwxCah9wwN/0w ZW4rFlvmnaLLc3nCrc5dbcslgl6xtyFLGczYOlPVR/XzHgGFE5qeyPYCd3F706KN0K2B /XTEyGo8rYZQSxrAI4HlThoMmxzqmSSBpkOhR4fW37p+U/1558G4jhYGafFsZ9QZ6vXh PGyDLnFALasQQksmxrvAWrZsYXIusROSUm5QR3LRW8ZztCgy2/NTGd2cuwg4mrm6jfii p9YQ== X-Gm-Message-State: ALyK8tJExH4Dv3q5vYOjxlTlg3XDy++sFsiq9tRmaTEwPC++kZxnbqYkqedOVBs1QrL/Lw== X-Received: by 10.25.19.204 with SMTP id 73mr2471353lft.24.1466362948822; Sun, 19 Jun 2016 12:02:28 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id a7sm1066229lbg.31.2016.06.19.12.02.27 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2016 12:02:28 -0700 (PDT) Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools To: Baptiste Daroussin References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO From: Andrey Chernov Message-ID: <1f579a9a-3aa4-e99b-f991-b42a1672a9b4@freebsd.org> Date: Sun, 19 Jun 2016 22:02:26 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WoTE0oBWc3SakH7xS1VPsx0ukpJBp64nC" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 19:02:33 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WoTE0oBWc3SakH7xS1VPsx0ukpJBp64nC Content-Type: multipart/mixed; boundary="1LAqo2a7sSKGut8OSAFBxCCJj96jGObXe" From: Andrey Chernov To: Baptiste Daroussin Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Message-ID: <1f579a9a-3aa4-e99b-f991-b42a1672a9b4@freebsd.org> Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> In-Reply-To: --1LAqo2a7sSKGut8OSAFBxCCJj96jGObXe Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19.06.2016 20:21, Andrey Chernov wrote: > On 19.06.2016 20:10, Baptiste Daroussin wrote: >> On Sun, Jun 19, 2016 at 08:05:30PM +0300, Andrey Chernov wrote: >>> On 19.06.2016 19:52, Andrey Chernov wrote: >>>> On 19.06.2016 19:47, Andrey Chernov wrote: >>>>> On 19.06.2016 18:49, Baptiste Daroussin wrote: >>>>>> On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote= : >>>>>>> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: >>>>>>>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: >>>>>>>>> Log: >>>>>>>>> - Prefer to use %d over %e where the day of the month should = be zero >>>>>>>>> filled. >>>>>>>>> - Since %e means the day of the month as well, regard %e as s= ame as %d >>>>>>>>> in md_order. >>>>>>>> >>>>>>>> Nonsense doubled formats in sr_*_RS locales and nonsense md_orde= r there too. >>>>>>> >>>>>>> Crap I'll dig into it, thanks for spotting it. >>>>>>> >>>>>>> Best regards, >>>>>>> Bapt >>>>>> >>>>>> Should be fixed by: >>>>>> https://people.freebsd.org/~bapt/locale-triple-components.diff >>>>>> >>>>>> The perl script generating the locales was badly handling locales = with 3 >>>>>> components, fixed now. >>>>>> >>>>>> Sorry about that >>>>>> >>>>>> Best regards, >>>>>> Bapt >>>>>> >>>>> >>>>> sr locales are badly named before anything else, proper format is >>>>> language[_COUNTRY][.encoding][@variant] >>>>> I.e. >>>>> sr_RS.UTF-8@Latn >>>>> sr_RS.ISO8859-2@Latn >>>>> sr_RS.ISO8859-t@Cyrl >>>>> >>>>> I don't know, if out utilities (f.e. locale(1)) can handle @variant= suffix. >>>>> >>>>> >>>> =3Dsr_RS.ISO8859-5@Cyrl >>>> =3Dour, and not utilities only but libc too >>> >>> Since right now we have only single @variant per each encoding, and n= o >>> @variant for other locales, we can just drop it and use right names l= ike: >>> sr_RS.UTF-8 >> >> We have 2 for the above the Cyrl version and the Latn version >> >>> sr_RS.ISO8859-2 >>> sr_RS.ISO8859-5 >> >> We can make aliases easily for that is that is what people want, not t= he we have >> the same for other locales: >> >> zh_Hans_CN.GB18030 >> zh_Hans_CN.GB2312 >> zh_Hans_CN.GBK >> zh_Hans_CN.UTF-8 >> zh_Hans_CN.eucCN >> zh_Hant_HK.UTF-8 >> zh_Hant_TW.Big5 >> zh_Hant_TW.UTF-8 >> >> With some aliases for some of the previously existing ones: >> zh_TW.Big5 >> zh_TW.UTF-8 >> zh_CN.GB18030 >> zh_CN.GB2312 >> zh_CN.GBK >> zh_CN.UTF-8 >> zh_CN.eucCN >> zh_HK.UTF-8 >> >> Some of the new locales (that didn't exist before) I have only importe= d the new >> name format: >> kk_Cyrl_KZ.UTF-8 >> mn_Cyrl_MN.UTF-8 >> sr_Cyrl_RS.ISO8859-5 >> sr_Cyrl_RS.UTF-8 >> sr_Latn_RS.ISO8859-2 >> sr_Latn_RS.UTF-8 >> >> I would prefer staying on the new syntax given it is allowed by some R= FC and it >> is slowly being adopted everywhere else. >> >> Btw another RFC: https://www.ietf.org/rfc/rfc5646.txt >> >> Best regards, >> Bapt >> >=20 > Old POSIX don't use RFC 5646, there are ISO-639 two-letter codes. When > encodings are different, there is no needs to specify variants, they > have meaning only for the same encoding. >=20 >=20 I found POSIX reference about @-syntax: [language[_territory][.codeset][@modifier]] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html It says nothing about language, territory or codeset standards. They comes from another standard, ISO 15897: "8. Natural language, as specified in ISO 639 9. Territory, as two-letter form of ISO 3166" I can't find there something about codeset/charmap standartization, but perhaps I just overlook some reference. --1LAqo2a7sSKGut8OSAFBxCCJj96jGObXe-- --WoTE0oBWc3SakH7xS1VPsx0ukpJBp64nC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJXZuxDAAoJEKUckv0MjfbKWXEH/iBBMGi43MlgKWOMwN7ufY8J e1uEjw4CnZ4qkRPqGZIJZy7tUhbVm1AOeU8A50BDDrDR/VPA+/Wdnc9VCC0u++LE Jmgd4InFxjP7QjrpOGRSkuyq3iDdPeEkFCrEiQ+p8l+2Zbs13Yp9lCOdDBlL8Kuf WYQVnWtGCcM9KWhZkWIRP0DAovC3crrRkbXUb9tq07BpVCfFnk6RxccykoXMKZwp ISa5LE45AlDEksej5CF/UYX7WByM7AEq7BAcyaI2Ai4k0NKmn+aNsE1e1vTU0m37 d3wfyG1+kOYXbYgeblZO/NNmlkbBv9uxtCNSuGEKJXkmoFs+LFNeDWKvXC6w64Q= =W+Ss -----END PGP SIGNATURE----- --WoTE0oBWc3SakH7xS1VPsx0ukpJBp64nC-- From owner-svn-src-all@freebsd.org Sun Jun 19 19:40:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24965A7AECF; Sun, 19 Jun 2016 19:40:55 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA2B927FA; Sun, 19 Jun 2016 19:40:54 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x22c.google.com with SMTP id r201so35155261wme.1; Sun, 19 Jun 2016 12:40:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WISp0Cmp79qSyT7asbuYkgcbQEbL7u3DxyWhUcF/iFk=; b=MKgdXV/EgBt8svSFjHL/W1/2AyjW4QwS5EtKVql5QadJXNGAwz2XSqZovyCoJKqWRO 7AWwWZziAvNgIM0yNWsr/WSw7pJLOFAQkDfPKD1U5Ah3FRL6ePmZvrJ30KDMKLvHbOPe +Fse2xAoOotjsfWWYAcHnSS1YvVCgNOMJ+pAp/YQ5vJ2jPNCDaZYv9MS46vHMA5DmT9R zm9g0MAe7xT2atpuok+M0Q3WJztritHFzcKtb/uePjBvHNkL/TUFJj61zO0eKjoZ96eH lcTkU11dDjG08DqBDCWb6iJLa15ZfSkJ8pf6al6sLwDoBvCQ7UKR71heLHLgYNoj4voJ xtdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=WISp0Cmp79qSyT7asbuYkgcbQEbL7u3DxyWhUcF/iFk=; b=ISjiPHBHtyPlJltBq8wiR+wvYEkMzP7+2vTy40LLFWjOqzkXeKvzle386ylsa3iEO6 MyEHoBAfj/Xb14o+626vN/h5bH0eI6mNIQVvZPgnOpJ22bxf7R5fETUs3lxj7XqHmB7i 05GLyPgPCEsCXREkNdVuOznXCHvML2EtBOPcNUYji+crIFBRCiTipDwfkU6vTOy5j0I5 iUp9NGIGLtqqbISzZ3v3jI5g3PbZNp0Mdk1igaEkQNHDy1118aR5XniOBaEGpH24Z6p1 RegTYvuL/jfSQ4/KpVjdy4cztktH8VlM3eREek+uea37mrwyieAcrveKGKvxdW3yi80S nTuw== X-Gm-Message-State: ALyK8tK8AtbjAr8IfGm6OvvCG+x+vbUgCpI06T8VcjiAfG0OEBA2jiXv9gapPzIRTWR9QQ== X-Received: by 10.28.25.134 with SMTP id 128mr3098254wmz.16.1466365253230; Sun, 19 Jun 2016 12:40:53 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id w76sm9847792wmd.11.2016.06.19.12.40.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2016 12:40:52 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 19 Jun 2016 21:40:51 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools Message-ID: <20160619194051.w4dueeutrgtjcfuf@ivaldir.etoilebsd.net> References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> <1f579a9a-3aa4-e99b-f991-b42a1672a9b4@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="q2c376tbb6u7dqvn" Content-Disposition: inline In-Reply-To: <1f579a9a-3aa4-e99b-f991-b42a1672a9b4@freebsd.org> User-Agent: Mutt/1.6.1-neo (2016-06-11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 19:40:55 -0000 --q2c376tbb6u7dqvn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 19, 2016 at 10:02:26PM +0300, Andrey Chernov wrote: > On 19.06.2016 20:21, Andrey Chernov wrote: > > On 19.06.2016 20:10, Baptiste Daroussin wrote: > >> On Sun, Jun 19, 2016 at 08:05:30PM +0300, Andrey Chernov wrote: > >>> On 19.06.2016 19:52, Andrey Chernov wrote: > >>>> On 19.06.2016 19:47, Andrey Chernov wrote: > >>>>> On 19.06.2016 18:49, Baptiste Daroussin wrote: > >>>>>> On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wrote: > >>>>>>> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote: > >>>>>>>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: > >>>>>>>>> Log: > >>>>>>>>> - Prefer to use %d over %e where the day of the month should = be zero > >>>>>>>>> filled. > >>>>>>>>> - Since %e means the day of the month as well, regard %e as s= ame as %d > >>>>>>>>> in md_order. > >>>>>>>> > >>>>>>>> Nonsense doubled formats in sr_*_RS locales and nonsense md_orde= r there too. > >>>>>>> > >>>>>>> Crap I'll dig into it, thanks for spotting it. > >>>>>>> > >>>>>>> Best regards, > >>>>>>> Bapt > >>>>>> > >>>>>> Should be fixed by: > >>>>>> https://people.freebsd.org/~bapt/locale-triple-components.diff > >>>>>> > >>>>>> The perl script generating the locales was badly handling locales = with 3 > >>>>>> components, fixed now. > >>>>>> > >>>>>> Sorry about that > >>>>>> > >>>>>> Best regards, > >>>>>> Bapt > >>>>>> > >>>>> > >>>>> sr locales are badly named before anything else, proper format is > >>>>> language[_COUNTRY][.encoding][@variant] > >>>>> I.e. > >>>>> sr_RS.UTF-8@Latn > >>>>> sr_RS.ISO8859-2@Latn > >>>>> sr_RS.ISO8859-t@Cyrl > >>>>> > >>>>> I don't know, if out utilities (f.e. locale(1)) can handle @variant= suffix. > >>>>> > >>>>> > >>>> =3Dsr_RS.ISO8859-5@Cyrl > >>>> =3Dour, and not utilities only but libc too > >>> > >>> Since right now we have only single @variant per each encoding, and no > >>> @variant for other locales, we can just drop it and use right names l= ike: > >>> sr_RS.UTF-8 > >> > >> We have 2 for the above the Cyrl version and the Latn version > >> > >>> sr_RS.ISO8859-2 > >>> sr_RS.ISO8859-5 > >> > >> We can make aliases easily for that is that is what people want, not t= he we have > >> the same for other locales: > >> > >> zh_Hans_CN.GB18030 > >> zh_Hans_CN.GB2312 > >> zh_Hans_CN.GBK > >> zh_Hans_CN.UTF-8 > >> zh_Hans_CN.eucCN > >> zh_Hant_HK.UTF-8 > >> zh_Hant_TW.Big5 > >> zh_Hant_TW.UTF-8 > >> > >> With some aliases for some of the previously existing ones: > >> zh_TW.Big5 > >> zh_TW.UTF-8 > >> zh_CN.GB18030 > >> zh_CN.GB2312 > >> zh_CN.GBK > >> zh_CN.UTF-8 > >> zh_CN.eucCN > >> zh_HK.UTF-8 > >> > >> Some of the new locales (that didn't exist before) I have only importe= d the new > >> name format: > >> kk_Cyrl_KZ.UTF-8 > >> mn_Cyrl_MN.UTF-8 > >> sr_Cyrl_RS.ISO8859-5 > >> sr_Cyrl_RS.UTF-8 > >> sr_Latn_RS.ISO8859-2 > >> sr_Latn_RS.UTF-8 > >> > >> I would prefer staying on the new syntax given it is allowed by some R= FC and it > >> is slowly being adopted everywhere else. > >> > >> Btw another RFC: https://www.ietf.org/rfc/rfc5646.txt > >> > >> Best regards, > >> Bapt > >> > >=20 > > Old POSIX don't use RFC 5646, there are ISO-639 two-letter codes. When > > encodings are different, there is no needs to specify variants, they > > have meaning only for the same encoding. > >=20 > >=20 >=20 > I found POSIX reference about @-syntax: > [language[_territory][.codeset][@modifier]] > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html > It says nothing about language, territory or codeset standards. >=20 > They comes from another standard, ISO 15897: > "8. Natural language, as specified in ISO 639 > 9. Territory, as two-letter form of ISO 3166" > I can't find there something about codeset/charmap standartization, but > perhaps I just overlook some reference. >=20 Thanks a lot for that reference I wonder how I failed at finding it, I read twice the locale definition in opengroup documents. I have found yet proof in the code, but from my testings (using nl_langinfo= ()) I can see that the @modifier is properly supported. I have 2 proposal then: 1/ Keep the current version and add aliases with "@" for the one in variants 2/ Rename all the variants we have now into the POSIX version with "@" What do you think? Best regards, Bapt --q2c376tbb6u7dqvn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXZvUnAAoJEGOJi9zxtz5a2dcP/2+VFqGafUG6o7XnZ9rNSx+f DynRmTSbSgo0Uv/EEPOSkbTqvGg/lWgiL1+YxfX2aO++3rBQqLsS7McjBcUwYwPg cg1rkfZRhOPne3YT6YOlWs4nL3DWq5EUXiKX5R15mnQHxQQgkfF7aa5lhW746sgR K7ieDx6e1Jvt8KlZhvbgBpLiLYeaMbyxWqlyFNT5tEE2CYgwT9bhkRY7N6XkQ+le 74dU+UXW0gF1rAn5tDG9JwJvQ+cLH5x3cmf5gVaDiLPgOIOj3pZ/MtGrasWZDkua llqgVpGnQDBtgH7XLPhpIF/lH0227Di8e7OvYYFSRy5jQ3BCb6d9wOJEZJoPLi/K Stm5ejgLZfZu4l9u/pgAaCerjVv/iImHlHVXRL6IJwo4R+rMNxlkV1AmYPNrezZx f1EkRtDjRc7xLk7STg31GSMNoOgPgTl2lsZ85N/o3ttjSFjh2vFfMjwz8HEjqRL0 tf9weDPukIonqNBuQ5pCcLBp78I62kIxPg3+V+2oCdHr9zcbRKCieFocVLS7j1kt gqvDWxJWSbOKSfqJhXU/qJ1Aarp7CT82fIh7C1JBiCFd9FZA4qeQ5vKuytDkHNJw WGyikuET06nVcfcL2aopiW8Ykk0yu8jPxUkvpyUbfJSwmssO4JUSEmJrRmOGSXIe i8jb2c1QHy9RlWGsGt77 =X0qN -----END PGP SIGNATURE----- --q2c376tbb6u7dqvn-- From owner-svn-src-all@freebsd.org Sun Jun 19 19:52:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6899FA7915D; Sun, 19 Jun 2016 19:52:04 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mail.vx.sk (mail.vx.sk [5.9.78.60]) by mx1.freebsd.org (Postfix) with ESMTP id 9F7552E5E; Sun, 19 Jun 2016 19:52:03 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from [IPv6:2a02:2450:1023:80df:ec62:d80e:1be2:9454] (unknown [IPv6:2a02:2450:1023:80df:ec62:d80e:1be2:9454]) by mail.vx.sk (Postfix) with ESMTPSA id BA06E9DED1; Sun, 19 Jun 2016 21:52:01 +0200 (CEST) Subject: Re: svn commit: r299448 - in head/sys/cddl/contrib/opensolaris: common/acl uts/common/fs/zfs uts/common/sys To: Alexander Motin , Cy Schubert , Jan Beich , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201606191428.u5JESbbs053857@slippy.cwsent.com> <49d3d34d-ba91-ebdf-497f-cbe1614bec53@FreeBSD.org> From: Martin Matuska Message-ID: Date: Sun, 19 Jun 2016 21:52:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <49d3d34d-ba91-ebdf-497f-cbe1614bec53@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 19:52:04 -0000 I highly suggest dealing with this at OpenZFS: - opening an issue at Ilumos - discussing this on the developer@open-zfs.org mailing list On 19.06.2016 16:33, Alexander Motin wrote: > On 19.06.16 17:28, Cy Schubert wrote: >> In message <20160619080803.GA1638@brick>, Edward Tomasz=20 >> =3D?utf-8?Q?Napiera=3DC5=3D82 >> a?=3D writes: >>> On 0614T0232, Jan Beich wrote: >>>> Alexander Motin writes: >>>> >>>>> Author: mav >>>>> Date: Wed May 11 13:43:20 2016 >>>>> New Revision: 299448 >>>>> URL: https://svnweb.freebsd.org/changeset/base/299448 >>>>> >>>>> Log: >>>>> MFV r299442: 6762 POSIX write should imply DELETE_CHILD on direct= ories=20 >>> - and >>>>> some additional considerations >>>>> =20 >>>>> Reviewed by: Gordon Ross >>>>> Reviewed by: Yuri Pankov >>>>> Author: Kevin Crowe >>>>> =20 >>>>> openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916 >>>> This commit confuses acl_is_trivial_np(3). Notice '+' in ls(1) and '= D' >>>> in getfacl(1) outputs. >>> It's not just that. >>> >>> Those changes: >>> >>> 1. Confuse acl_is_trivial_np(3), as you say. It's hard to fix in lib= c, >>> because they make trivial ACLs different for files and directories= , >>> and acl_is_trivial_np(3) has no way of telling which is which. >>> >>> 2. They make delete deny permission take precedence over the containi= ng >>> directory write allow permission, which is rather different from w= hat >>> people expect in unix systems, and is against the NFSv4 specificat= ion, >>> even though it might be a better fit for Windows. >> This is Windows behavior and inconsistent with the rest of FreeBSD and= any=20 >> UNIX or Linux system. >> >>> 3. They make umask apply to inherit_only permissions, and >>> >>> 4. I don't fully understand this one yet, but from the ACL regression= >>> test suite (which lives in tests/sys/acl/, and I'd appreciate peop= le >>> actually ran this before committing ACL-related changes) it looks >>> like it makes umask not apply to the stuff it should. >>> >>> The #1 could be fixed by making ZFS not setting delete_child on write= , >>> basically reverting to the previous behaviour in that aspect. As for= >>> the others... I'm not saying each one of those is wrong, but they >>> certainly warrant further discussion, especially #2 and #4. >> I think #2 is wrong behavior on any UNIX-like or POSIX system. >> >>> Basically, what I'm trying to say is that we should consider backing >>> this out for 11.0-RELEASE, reverting to the previous semantics, verif= ied >>> by passing the regression tests. >> Agreed. >> >> What in FreeBSD was this patch supposed to solve in the first place? > Growing divergence from OpenZFS upstream. I am not advocating this > patch, but it would be good, if possible, to not revert it completely, > but block wrong behavior with some minimal ifdefs to make further ZFS > merges easier. Help would be appreciated. ;) > From owner-svn-src-all@freebsd.org Sun Jun 19 23:36:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78D57A7A2B5; Sun, 19 Jun 2016 23:36:41 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B21D139D; Sun, 19 Jun 2016 23:36:41 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5JNaeBU022503; Sun, 19 Jun 2016 23:36:40 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5JNaeYt022502; Sun, 19 Jun 2016 23:36:40 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201606192336.u5JNaeYt022502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Sun, 19 Jun 2016 23:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302023 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 23:36:41 -0000 Author: karels Date: Sun Jun 19 23:36:40 2016 New Revision: 302023 URL: https://svnweb.freebsd.org/changeset/base/302023 Log: Add Mike Karels as committer, with gnn as mentor. Approved by: gnn (mentor) Approved by: re Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Sun Jun 19 21:29:17 2016 (r302022) +++ head/share/misc/committers-src.dot Sun Jun 19 23:36:40 2016 (r302023) @@ -212,6 +212,7 @@ julian [label="Julian Elischer\njulian@F jwd [label="John De Boskey\njwd@FreeBSD.org\n2000/05/19"] kaiw [label="Kai Wang\nkaiw@FreeBSD.org\n2007/09/26"] kan [label="Alexander Kabaev\nkan@FreeBSD.org\n2002/07/21"] +karels [label="Mike Karels\nkarels@FreeBSD.org\n2016/06/09"] ken [label="Ken Merry\nken@FreeBSD.org\n1998/09/08"] kensmith [label="Ken Smith\nkensmith@FreeBSD.org\n2004/01/23"] kevlo [label="Kevin Lo\nkevlo@FreeBSD.org\n2006/07/23"] @@ -481,6 +482,7 @@ gnn -> arybchik gnn -> erj gnn -> kp gnn -> jtl +gnn -> karels gonzo -> jmcneill From owner-svn-src-all@freebsd.org Mon Jun 20 02:04:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9327EA79FAE; Mon, 20 Jun 2016 02:04:41 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F39B2833; Mon, 20 Jun 2016 02:04:41 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K24eUE077101; Mon, 20 Jun 2016 02:04:40 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5K24eph077100; Mon, 20 Jun 2016 02:04:40 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606200204.u5K24eph077100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 20 Jun 2016 02:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302024 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 02:04:41 -0000 Author: adrian Date: Mon Jun 20 02:04:40 2016 New Revision: 302024 URL: https://svnweb.freebsd.org/changeset/base/302024 Log: [ath] fix EDMA TX buffer flags for use when retransmitting frames. This started showing up when doing lots of aggregate traffic. For TDMA it's always no-ACK traffic and I didn't notice this, and I didn't notice it when doing 11abg traffic as it didn't fail enough in a bad way to trigger this. This showed up as the fifo depth being < 0. Eg: Jun 19 09:23:07 gertrude kernel: ath0: ath_tx_edma_push_staging_list: queued 2 packets; depth=2, fifo depth=1 Jun 19 09:23:07 gertrude kernel: ath0: ath_edma_tx_processq: Q1, bf=0xfffffe000385f068, start=1, end=1 Jun 19 09:23:07 gertrude kernel: ath0: ath_edma_tx_processq: Q1: FIFO depth is now 0 (1) Jun 19 09:23:07 gertrude kernel: ath0: ath_edma_tx_processq: Q1, bf=0xfffffe0003866fe8, start=0, end=1 Jun 19 09:23:07 gertrude kernel: ath0: ath_edma_tx_processq: Q1: FIFO depth is now -1 (0) So, clear the flags before adding them to a TX queue, so if they're re-added for the retransmit path it'll clear whatever they were and not double-account the FIFOEND flag. Oops. Tested: * AR9380, STA mode, 11n iperf testing (~130mbit) Approved by: re (delphij) Modified: head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Sun Jun 19 23:36:40 2016 (r302023) +++ head/sys/dev/ath/if_ath_tx_edma.c Mon Jun 20 02:04:40 2016 (r302024) @@ -192,6 +192,9 @@ ath_tx_edma_push_staging_list(struct ath /* Queue it into our staging list */ TAILQ_INSERT_TAIL(&sq, bf, bf_list); + + /* Ensure the flags are cleared */ + bf->bf_flags &= ~(ATH_BUF_FIFOPTR | ATH_BUF_FIFOEND); sqdepth++; } From owner-svn-src-all@freebsd.org Mon Jun 20 02:57:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4E1DA7B8AF for ; Mon, 20 Jun 2016 02:57:17 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A8BD1CED for ; Mon, 20 Jun 2016 02:57:17 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f42.google.com with SMTP id l188so29082072lfe.2 for ; Sun, 19 Jun 2016 19:57:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=tk5HI0dkrq3Y39Z+zcRtseY3wLt1rKNaFGzZKEyd/Vw=; b=lDsnferP+dL2mNpaKinBRhHLX2L4bQ4dk5EIwkBiAtPoGyYHQrlmbxLO3I/iLobeEe Ll+XFL6QvHCmx7gXvTx2EDKtF9+YEAm8Yp8XM3/gUIHwpKba5T0k8A+RkMyWLNRFlQmt G9FAjMAJ1pA29FPa+Ig7/1YgpnDaXHbxv25lC97wUXyxXPZISJBiBZPWnpcJC+F0Bl8P 4TlKyVjex4biIcn5rcR9/LpFhI7LMha5hPobYMSF2nVAipx5qNaX0MaDSLaFFrWlhm59 AhKQ6yPo5lnjBywVsr3iE/5CKcGBAhvJkKibmr9CZd7JeLLwyyg5olq+GEOUeDTZ/P5p QlqA== X-Gm-Message-State: ALyK8tJYPoUZGtlbHSGXVafC1Iv4pODI97zYvKty4V9HAnan6Y5c5lVx7GA4hJsHicb3cw== X-Received: by 10.25.32.6 with SMTP id g6mr234052lfg.188.1466391430028; Sun, 19 Jun 2016 19:57:10 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id h73sm3219838lfe.8.2016.06.19.19.57.08 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2016 19:57:09 -0700 (PDT) Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools To: Baptiste Daroussin References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> <1f579a9a-3aa4-e99b-f991-b42a1672a9b4@freebsd.org> <20160619194051.w4dueeutrgtjcfuf@ivaldir.etoilebsd.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO From: Andrey Chernov Message-ID: <45daf91a-6e15-eded-03bd-9d126938b1f0@freebsd.org> Date: Mon, 20 Jun 2016 05:57:08 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160619194051.w4dueeutrgtjcfuf@ivaldir.etoilebsd.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kopswqJwNuk46FLvDUiWXhImPHw3NTB6M" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 02:57:17 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --kopswqJwNuk46FLvDUiWXhImPHw3NTB6M Content-Type: multipart/mixed; boundary="scj0p6wei9JQP1OV1fqbTtiv4IGfGFkTU" From: Andrey Chernov To: Baptiste Daroussin Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO Message-ID: <45daf91a-6e15-eded-03bd-9d126938b1f0@freebsd.org> Subject: Re: svn commit: r302016 - in head: share/timedef tools/tools/locale/tools References: <201606190344.u5J3iWO6079652@repo.freebsd.org> <3387744f-7abd-417c-599f-163e78b4170e@freebsd.org> <20160619145233.kjnfyxjb75fdcucz@ivaldir.etoilebsd.net> <20160619154918.etycha7kvj4v7nrp@ivaldir.etoilebsd.net> <77076d87-41ad-0cce-c703-ed9cef1bdb8b@freebsd.org> <20160619171021.7ps2te7wgoxfqznv@ivaldir.etoilebsd.net> <1f579a9a-3aa4-e99b-f991-b42a1672a9b4@freebsd.org> <20160619194051.w4dueeutrgtjcfuf@ivaldir.etoilebsd.net> In-Reply-To: <20160619194051.w4dueeutrgtjcfuf@ivaldir.etoilebsd.net> --scj0p6wei9JQP1OV1fqbTtiv4IGfGFkTU Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19.06.2016 22:40, Baptiste Daroussin wrote: > On Sun, Jun 19, 2016 at 10:02:26PM +0300, Andrey Chernov wrote: >> On 19.06.2016 20:21, Andrey Chernov wrote: >>> On 19.06.2016 20:10, Baptiste Daroussin wrote: >>>> On Sun, Jun 19, 2016 at 08:05:30PM +0300, Andrey Chernov wrote: >>>>> On 19.06.2016 19:52, Andrey Chernov wrote: >>>>>> On 19.06.2016 19:47, Andrey Chernov wrote: >>>>>>> On 19.06.2016 18:49, Baptiste Daroussin wrote: >>>>>>>> On Sun, Jun 19, 2016 at 04:52:34PM +0200, Baptiste Daroussin wro= te: >>>>>>>>> On Sun, Jun 19, 2016 at 07:57:49AM +0300, Andrey Chernov wrote:= >>>>>>>>>> On 19.06.2016 6:44, Hajimu UMEMOTO wrote: >>>>>>>>>>> Log: >>>>>>>>>>> - Prefer to use %d over %e where the day of the month shoul= d be zero >>>>>>>>>>> filled. >>>>>>>>>>> - Since %e means the day of the month as well, regard %e as= same as %d >>>>>>>>>>> in md_order. >>>>>>>>>> >>>>>>>>>> Nonsense doubled formats in sr_*_RS locales and nonsense md_or= der there too. >>>>>>>>> >>>>>>>>> Crap I'll dig into it, thanks for spotting it. >>>>>>>>> >>>>>>>>> Best regards, >>>>>>>>> Bapt >>>>>>>> >>>>>>>> Should be fixed by: >>>>>>>> https://people.freebsd.org/~bapt/locale-triple-components.diff >>>>>>>> >>>>>>>> The perl script generating the locales was badly handling locale= s with 3 >>>>>>>> components, fixed now. >>>>>>>> >>>>>>>> Sorry about that >>>>>>>> >>>>>>>> Best regards, >>>>>>>> Bapt >>>>>>>> >>>>>>> >>>>>>> sr locales are badly named before anything else, proper format is= >>>>>>> language[_COUNTRY][.encoding][@variant] >>>>>>> I.e. >>>>>>> sr_RS.UTF-8@Latn >>>>>>> sr_RS.ISO8859-2@Latn >>>>>>> sr_RS.ISO8859-t@Cyrl >>>>>>> >>>>>>> I don't know, if out utilities (f.e. locale(1)) can handle @varia= nt suffix. >>>>>>> >>>>>>> >>>>>> =3Dsr_RS.ISO8859-5@Cyrl >>>>>> =3Dour, and not utilities only but libc too >>>>> >>>>> Since right now we have only single @variant per each encoding, and= no >>>>> @variant for other locales, we can just drop it and use right names= like: >>>>> sr_RS.UTF-8 >>>> >>>> We have 2 for the above the Cyrl version and the Latn version >>>> >>>>> sr_RS.ISO8859-2 >>>>> sr_RS.ISO8859-5 >>>> >>>> We can make aliases easily for that is that is what people want, not= the we have >>>> the same for other locales: >>>> >>>> zh_Hans_CN.GB18030 >>>> zh_Hans_CN.GB2312 >>>> zh_Hans_CN.GBK >>>> zh_Hans_CN.UTF-8 >>>> zh_Hans_CN.eucCN >>>> zh_Hant_HK.UTF-8 >>>> zh_Hant_TW.Big5 >>>> zh_Hant_TW.UTF-8 >>>> >>>> With some aliases for some of the previously existing ones: >>>> zh_TW.Big5 >>>> zh_TW.UTF-8 >>>> zh_CN.GB18030 >>>> zh_CN.GB2312 >>>> zh_CN.GBK >>>> zh_CN.UTF-8 >>>> zh_CN.eucCN >>>> zh_HK.UTF-8 >>>> >>>> Some of the new locales (that didn't exist before) I have only impor= ted the new >>>> name format: >>>> kk_Cyrl_KZ.UTF-8 >>>> mn_Cyrl_MN.UTF-8 >>>> sr_Cyrl_RS.ISO8859-5 >>>> sr_Cyrl_RS.UTF-8 >>>> sr_Latn_RS.ISO8859-2 >>>> sr_Latn_RS.UTF-8 >>>> >>>> I would prefer staying on the new syntax given it is allowed by some= RFC and it >>>> is slowly being adopted everywhere else. >>>> >>>> Btw another RFC: https://www.ietf.org/rfc/rfc5646.txt >>>> >>>> Best regards, >>>> Bapt >>>> >>> >>> Old POSIX don't use RFC 5646, there are ISO-639 two-letter codes. Whe= n >>> encodings are different, there is no needs to specify variants, they >>> have meaning only for the same encoding. >>> >>> >> >> I found POSIX reference about @-syntax: >> [language[_territory][.codeset][@modifier]] >> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.htm= l >> It says nothing about language, territory or codeset standards. >> >> They comes from another standard, ISO 15897: >> "8. Natural language, as specified in ISO 639 >> 9. Territory, as two-letter form of ISO 3166" >> I can't find there something about codeset/charmap standartization, bu= t >> perhaps I just overlook some reference. >> >=20 > Thanks a lot for that reference I wonder how I failed at finding it, I = read > twice the locale definition in opengroup documents. >=20 > I have found yet proof in the code, but from my testings (using nl_lang= info()) >=20 > I can see that the @modifier is properly supported. >=20 > I have 2 proposal then: > 1/ Keep the current version and add aliases with "@" for the one in var= iants > 2/ Rename all the variants we have now into the POSIX version with "@" To minimize confusion among people and better cross-platform compatibility IMHO we need to see what Linux have here (in parts it not violates POSIX and ISO standards, of course). We have different charmap names (ISO-* vs. ISO*), and we have it already too long to change as many people thinks, but new sr and other locales can be easily set in line while they are still new. --scj0p6wei9JQP1OV1fqbTtiv4IGfGFkTU-- --kopswqJwNuk46FLvDUiWXhImPHw3NTB6M Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJXZ1uEAAoJEKUckv0MjfbKyPcH/A3MaB7QuK5HlJlhX2Ta49jK 0meAEjCkMm+f0ax8yqaoXStjwZMPJKB5eLMEEWEwIMmQjnirc0ftgyomeO+eXLcQ pOItxy4nw31YtGNUs68xBMe1dELXVUHy1P/CaGd5gr1+0AlYGFpKbDgDZbDS8XU5 bipHGj6QIUUOyZIVc69puhCOrNvA6fEJ4skeT3FmYhs2+Slx9ll9qCUb3gnmEOuh TcpAzSwDD2ms3VAJ93YeXfx4GDfQCcBNvg+xJHiYXySt8mD6xTdOnwzOipAB7vpC 9lVkBKsW9WF/OBh9Jiq0Yc9SbgtHtoTpDy0jgrA0ntJ10Ni5VZQU0IlQpwPVTJ0= =uCLD -----END PGP SIGNATURE----- --kopswqJwNuk46FLvDUiWXhImPHw3NTB6M-- From owner-svn-src-all@freebsd.org Mon Jun 20 06:40:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7011DA7B38C; Mon, 20 Jun 2016 06:40:59 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B9F913B2; Mon, 20 Jun 2016 06:40:59 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K6ewfU078178; Mon, 20 Jun 2016 06:40:58 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5K6ewF0078176; Mon, 20 Jun 2016 06:40:58 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201606200640.u5K6ewF0078176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 20 Jun 2016 06:40:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302025 - head/usr.sbin/bsdinstall/partedit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 06:40:59 -0000 Author: wma Date: Mon Jun 20 06:40:58 2016 New Revision: 302025 URL: https://svnweb.freebsd.org/changeset/base/302025 Log: ARM64: bsdinstall support for creating EFI partitions This patch enables bsdinstall to create EFI partition during installation and uploading it's contents, making the ARM64 FreeBSD installation bootable. Obtained from: Semihalf Sponsored by: Cavium Approved by: re Reviewed by: allanjude, emaste, nwhitehorn, wma Differential Revision: https://reviews.freebsd.org/D6853 Added: head/usr.sbin/bsdinstall/partedit/partedit_arm64.c (contents, props changed) Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/gpart_ops.c Mon Jun 20 02:04:40 2016 (r302024) +++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c Mon Jun 20 06:40:58 2016 (r302025) @@ -218,7 +218,7 @@ choose_part_type(const char *def_scheme) {"BSD", "BSD Labels", "Bootable on most x86 systems", 0 }, {"GPT", "GUID Partition Table", - "Bootable on most x86 systems", 0 }, + "Bootable on most x86 systems and EFI aware ARM64", 0 }, {"MBR", "DOS Partitions", "Bootable on most x86 systems", 0 }, {"PC98", "NEC PC9801 Partition Table", Added: head/usr.sbin/bsdinstall/partedit/partedit_arm64.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdinstall/partedit/partedit_arm64.c Mon Jun 20 06:40:58 2016 (r302025) @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2016 Cavium Inc. + * All rights reserved. + * + * Developed by Semihalf. + * Based on work by Nathan Whitehorn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include "partedit.h" + +/* EFI partition size in KB */ +#define EFI_BOOTPART_SIZE (50 * 1024) +#define EFI_BOOTPART_PATH "/boot/boot1.efifat" + +const char * +default_scheme(void) +{ + + return ("GPT"); +} + +int +is_scheme_bootable(const char *part_type) +{ + + if (strcmp(part_type, "GPT") == 0) + return (1); + + return (0); +} + +int +is_fs_bootable(const char *part_type, const char *fs) +{ + + if (strcmp(fs, "freebsd-ufs") == 0) + return (1); + + return (0); +} + +size_t +bootpart_size(const char *scheme) +{ + + /* We only support GPT with EFI */ + if (strcmp(scheme, "GPT") != 0) + return (0); + + return ((EFI_BOOTPART_SIZE) * 1024); +} + +const char * +bootpart_type(const char *scheme) +{ + + /* Only EFI is supported as boot partition */ + return ("efi"); +} + +const char * +bootcode_path(const char *part_type) +{ + + return (NULL); +} + +const char * +partcode_path(const char *part_type, const char *fs_type) +{ + + if (strcmp(part_type, "GPT") == 0) + return (EFI_BOOTPART_PATH); + + /* No boot partition data for non-GPT */ + return (NULL); +} + From owner-svn-src-all@freebsd.org Mon Jun 20 06:45:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05D4DA7B544; Mon, 20 Jun 2016 06:45:45 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2ECD19F0; Mon, 20 Jun 2016 06:45:44 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K6ji9O081762; Mon, 20 Jun 2016 06:45:44 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5K6jhBr081752; Mon, 20 Jun 2016 06:45:43 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201606200645.u5K6jhBr081752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 20 Jun 2016 06:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302026 - in head: share/monetdef share/msgdef share/numericdef share/timedef tools/tools/locale/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 06:45:45 -0000 Author: bapt Date: Mon Jun 20 06:45:42 2016 New Revision: 302026 URL: https://svnweb.freebsd.org/changeset/base/302026 Log: Fix generation of locales with multiple variants Serbian locales have triple components to represent the 2 variations of the locale: Latin and Cyrillic. Previously the tools generatic the locale were appending both definitions instead of differentiating them. Reported by: ache Approved by: re (gjb) Added: head/share/msgdef/sr_Cyrl_RS.UTF-8.src (contents, props changed) head/share/timedef/sr_Cyrl_RS.UTF-8.src (contents, props changed) Deleted: head/share/msgdef/bg_BG.UTF-8.src head/share/msgdef/sl_SI.UTF-8.src head/share/msgdef/sr_Latn_RS.ISO8859-2.src head/share/numericdef/sr_Latn_RS.UTF-8.src head/share/timedef/en_HK.UTF-8.src Modified: head/share/monetdef/sr_Latn_RS.UTF-8.src head/share/msgdef/Makefile head/share/msgdef/sr_Cyrl_RS.ISO8859-5.src head/share/msgdef/sr_Latn_RS.UTF-8.src head/share/numericdef/Makefile head/share/timedef/Makefile head/share/timedef/sr_Cyrl_RS.ISO8859-5.src head/share/timedef/sr_Latn_RS.ISO8859-2.src (contents, props changed) head/share/timedef/sr_Latn_RS.UTF-8.src (contents, props changed) head/tools/tools/locale/tools/cldr2def.pl Modified: head/share/monetdef/sr_Latn_RS.UTF-8.src ============================================================================== --- head/share/monetdef/sr_Latn_RS.UTF-8.src Mon Jun 20 06:40:58 2016 (r302025) +++ head/share/monetdef/sr_Latn_RS.UTF-8.src Mon Jun 20 06:45:42 2016 (r302026) @@ -4,47 +4,47 @@ # ----------------------------------------------------------------------------- # # int_curr_symbol (last character always SPACE) -RSD ""RSD +RSD # # currency_symbol -RSD""RSD +RSD # # mon_decimal_point -,"", +, # # mon_thousands_sep -."". +. # # mon_grouping -33 +3 # # positive_sign -"" + # # negative_sign --""- +- # # int_frac_digits -00 +0 # # frac_digits -00 +0 # # p_cs_precedes -00 +0 # # p_sep_by_space -11 +1 # # n_cs_precedes -00 +0 # # n_sep_by_space -11 +1 # # p_sign_posn -11 +1 # # n_sign_posn -11 +1 # EOF Modified: head/share/msgdef/Makefile ============================================================================== --- head/share/msgdef/Makefile Mon Jun 20 06:40:58 2016 (r302025) +++ head/share/msgdef/Makefile Mon Jun 20 06:45:42 2016 (r302026) @@ -16,7 +16,6 @@ LOCALES+= be_BY.CP1251 LOCALES+= be_BY.ISO8859-5 LOCALES+= be_BY.UTF-8 LOCALES+= bg_BG.CP1251 -LOCALES+= bg_BG.UTF-8 LOCALES+= cs_CZ.UTF-8 LOCALES+= de_DE.UTF-8 LOCALES+= el_GR.ISO8859-7 @@ -64,9 +63,8 @@ LOCALES+= ru_RU.UTF-8 LOCALES+= se_NO.UTF-8 LOCALES+= sk_SK.ISO8859-2 LOCALES+= sk_SK.UTF-8 -LOCALES+= sl_SI.UTF-8 LOCALES+= sr_Cyrl_RS.ISO8859-5 -LOCALES+= sr_Latn_RS.ISO8859-2 +LOCALES+= sr_Cyrl_RS.UTF-8 LOCALES+= sr_Latn_RS.UTF-8 LOCALES+= sv_SE.UTF-8 LOCALES+= tr_TR.ISO8859-9 @@ -97,6 +95,7 @@ SAME+= ar_SA.UTF-8 ar_MA.UTF-8 SAME+= ar_SA.UTF-8 ar_JO.UTF-8 SAME+= ar_SA.UTF-8 ar_EG.UTF-8 SAME+= ar_SA.UTF-8 ar_AE.UTF-8 +SAME+= sr_Cyrl_RS.UTF-8 bg_BG.UTF-8 SAME+= es_MX.ISO8859-1 es_ES.ISO8859-15 SAME+= es_MX.ISO8859-1 es_ES.ISO8859-1 SAME+= es_MX.ISO8859-1 es_AR.ISO8859-1 @@ -179,9 +178,11 @@ SAME+= fr_FR.UTF-8 fr_CA.ISO8859-1 SAME+= fr_FR.UTF-8 fr_BE.UTF-8 SAME+= fr_FR.UTF-8 fr_BE.ISO8859-15 SAME+= fr_FR.UTF-8 fr_BE.ISO8859-1 -SAME+= sl_SI.UTF-8 sl_SI.ISO8859-2 -SAME+= sl_SI.UTF-8 hr_HR.UTF-8 -SAME+= sl_SI.UTF-8 hr_HR.ISO8859-2 +SAME+= sr_Latn_RS.UTF-8 sr_Latn_RS.ISO8859-2 +SAME+= sr_Latn_RS.UTF-8 sl_SI.UTF-8 +SAME+= sr_Latn_RS.UTF-8 sl_SI.ISO8859-2 +SAME+= sr_Latn_RS.UTF-8 hr_HR.UTF-8 +SAME+= sr_Latn_RS.UTF-8 hr_HR.ISO8859-2 SAME+= hu_HU.UTF-8 hu_HU.ISO8859-2 SAME+= is_IS.ISO8859-15 is_IS.ISO8859-1 SAME+= it_IT.ISO8859-15 it_IT.ISO8859-1 @@ -199,7 +200,6 @@ SAME+= pt_PT.ISO8859-15 pt_BR.ISO8859-1 SAME+= pt_PT.UTF-8 pt_BR.UTF-8 SAME+= ro_RO.UTF-8 ro_RO.ISO8859-2 SAME+= se_NO.UTF-8 se_FI.UTF-8 -SAME+= sr_Latn_RS.UTF-8 sr_Cyrl_RS.UTF-8 SAME+= zh_Hans_CN.GBK zh_Hans_CN.GB18030 SAME+= zh_Hans_CN.GBK zh_Hans_CN.eucCN SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) Modified: head/share/msgdef/sr_Cyrl_RS.ISO8859-5.src ============================================================================== --- head/share/msgdef/sr_Cyrl_RS.ISO8859-5.src Mon Jun 20 06:40:58 2016 (r302025) +++ head/share/msgdef/sr_Cyrl_RS.ISO8859-5.src Mon Jun 20 06:45:42 2016 (r302026) @@ -4,14 +4,14 @@ # ----------------------------------------------------------------------------- # # yesexpr -^(([Դ]([а])?)|([Դ])|([yY]([eE][sS])?)|([yY]))""^(([dD]([aA])?)|([dD])|([yY]([eE][sS])?)|([yY])) +^(([Դ]([а])?)|([Դ])|([yY]([eE][sS])?)|([yY])) # # noexpr -^(([ݽ]([յ])?)|([ݽ])|([nN]([oO])?)|([nN]))""^(([nN]([eE])?)|([nN])|([nN]([oO])?)|([nN])) +^(([ݽ]([յ])?)|([ݽ])|([nN]([oO])?)|([nN])) # # yesstr -::::yes:y:YES:Y""da:d:DA:D:yes:y:YES:Y +::::yes:y:YES:Y # # nostr -::::no:n:NO:N""ne:n:NE:N:no:n:NO:N +::::no:n:NO:N # EOF Added: head/share/msgdef/sr_Cyrl_RS.UTF-8.src ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/msgdef/sr_Cyrl_RS.UTF-8.src Mon Jun 20 06:45:42 2016 (r302026) @@ -0,0 +1,17 @@ +# Warning: Do not edit. This file is automatically generated from the +# tools in /usr/src/tools/tools/locale. The data is obtained from the +# CLDR project, obtained from http://cldr.unicode.org/ +# ----------------------------------------------------------------------------- +# +# yesexpr +^(([дД]([аА])?)|([дД])|([yY]([eE][sS])?)|([yY])) +# +# noexpr +^(([нН]([еЕ])?)|([нН])|([nN]([oO])?)|([nN])) +# +# yesstr +да:д:ДА:Д:yes:y:YES:Y +# +# nostr +не:н:НЕ:Н:no:n:NO:N +# EOF Modified: head/share/msgdef/sr_Latn_RS.UTF-8.src ============================================================================== --- head/share/msgdef/sr_Latn_RS.UTF-8.src Mon Jun 20 06:40:58 2016 (r302025) +++ head/share/msgdef/sr_Latn_RS.UTF-8.src Mon Jun 20 06:45:42 2016 (r302026) @@ -4,14 +4,14 @@ # ----------------------------------------------------------------------------- # # yesexpr -^(([дД]([аА])?)|([дД])|([yY]([eE][sS])?)|([yY]))""^(([dD]([aA])?)|([dD])|([yY]([eE][sS])?)|([yY])) +^(([dD]([aA])?)|([dD])|([yY]([eE][sS])?)|([yY])) # # noexpr -^(([нН]([еЕ])?)|([нН])|([nN]([oO])?)|([nN]))""^(([nN]([eE])?)|([nN])|([nN]([oO])?)|([nN])) +^(([nN]([eE])?)|([nN])|([nN]([oO])?)|([nN])) # # yesstr -да:д:ДА:Д:yes:y:YES:Y""da:d:DA:D:yes:y:YES:Y +da:d:DA:D:yes:y:YES:Y # # nostr -не:н:НЕ:Н:no:n:NO:N""ne:n:NE:N:no:n:NO:N +ne:n:NE:N:no:n:NO:N # EOF Modified: head/share/numericdef/Makefile ============================================================================== --- head/share/numericdef/Makefile Mon Jun 20 06:40:58 2016 (r302025) +++ head/share/numericdef/Makefile Mon Jun 20 06:45:42 2016 (r302026) @@ -18,7 +18,6 @@ LOCALES+= hi_IN.UTF-8 LOCALES+= hy_AM.UTF-8 LOCALES+= it_CH.UTF-8 LOCALES+= ru_RU.CP866 -LOCALES+= sr_Latn_RS.UTF-8 LOCALES+= tr_TR.UTF-8 LOCALES+= uk_UA.ISO8859-5 LOCALES+= uk_UA.KOI8-U @@ -133,6 +132,10 @@ SAME+= ar_SA.UTF-8 ar_JO.UTF-8 SAME+= ar_SA.UTF-8 ar_EG.UTF-8 SAME+= ar_SA.UTF-8 ar_AE.UTF-8 SAME+= tr_TR.UTF-8 tr_TR.ISO8859-9 +SAME+= tr_TR.UTF-8 sr_Latn_RS.UTF-8 +SAME+= tr_TR.UTF-8 sr_Latn_RS.ISO8859-2 +SAME+= tr_TR.UTF-8 sr_Cyrl_RS.UTF-8 +SAME+= tr_TR.UTF-8 sr_Cyrl_RS.ISO8859-5 SAME+= tr_TR.UTF-8 sl_SI.UTF-8 SAME+= tr_TR.UTF-8 sl_SI.ISO8859-2 SAME+= tr_TR.UTF-8 ro_RO.UTF-8 @@ -199,9 +202,6 @@ SAME+= fr_CH.ISO8859-15 fr_CH.ISO8859-1 SAME+= hi_IN.UTF-8 hi_IN.ISCII-DEV SAME+= hy_AM.UTF-8 hy_AM.ARMSCII-8 SAME+= uk_UA.KOI8-U ru_RU.KOI8-R -SAME+= sr_Latn_RS.UTF-8 sr_Latn_RS.ISO8859-2 -SAME+= sr_Latn_RS.UTF-8 sr_Cyrl_RS.UTF-8 -SAME+= sr_Latn_RS.UTF-8 sr_Cyrl_RS.ISO8859-5 SAME+= ko_KR.eucKR ko_KR.CP949 # legacy (same charset) FILES= ${LOCALES:S/$/.out/} Modified: head/share/timedef/Makefile ============================================================================== --- head/share/timedef/Makefile Mon Jun 20 06:40:58 2016 (r302025) +++ head/share/timedef/Makefile Mon Jun 20 06:45:42 2016 (r302026) @@ -34,7 +34,6 @@ LOCALES+= el_GR.ISO8859-7 LOCALES+= el_GR.UTF-8 LOCALES+= en_CA.UTF-8 LOCALES+= en_GB.UTF-8 -LOCALES+= en_HK.UTF-8 LOCALES+= en_IE.UTF-8 LOCALES+= en_PH.UTF-8 LOCALES+= en_SG.UTF-8 @@ -111,6 +110,7 @@ LOCALES+= sk_SK.UTF-8 LOCALES+= sl_SI.ISO8859-2 LOCALES+= sl_SI.UTF-8 LOCALES+= sr_Cyrl_RS.ISO8859-5 +LOCALES+= sr_Cyrl_RS.UTF-8 LOCALES+= sr_Latn_RS.ISO8859-2 LOCALES+= sr_Latn_RS.UTF-8 LOCALES+= sv_FI.ISO8859-15 @@ -154,11 +154,12 @@ SAME+= de_DE.ISO8859-15 de_DE.ISO8859-1 SAME+= de_DE.ISO8859-15 de_CH.ISO8859-15 SAME+= de_DE.ISO8859-15 de_CH.ISO8859-1 SAME+= de_DE.UTF-8 de_CH.UTF-8 -SAME+= en_HK.UTF-8 en_HK.ISO8859-1 -SAME+= en_HK.UTF-8 en_AU.UTF-8 -SAME+= en_HK.UTF-8 en_AU.US-ASCII -SAME+= en_HK.UTF-8 en_AU.ISO8859-15 -SAME+= en_HK.UTF-8 en_AU.ISO8859-1 +SAME+= en_PH.UTF-8 en_HK.UTF-8 +SAME+= en_PH.UTF-8 en_HK.ISO8859-1 +SAME+= en_PH.UTF-8 en_AU.UTF-8 +SAME+= en_PH.UTF-8 en_AU.US-ASCII +SAME+= en_PH.UTF-8 en_AU.ISO8859-15 +SAME+= en_PH.UTF-8 en_AU.ISO8859-1 SAME+= en_CA.UTF-8 en_CA.US-ASCII SAME+= en_CA.UTF-8 en_CA.ISO8859-15 SAME+= en_CA.UTF-8 en_CA.ISO8859-1 @@ -198,7 +199,6 @@ SAME+= nl_NL.UTF-8 nl_NL.ISO8859-15 SAME+= nl_NL.UTF-8 nl_NL.ISO8859-1 SAME+= nn_NO.ISO8859-15 nn_NO.ISO8859-1 SAME+= pt_PT.ISO8859-15 pt_PT.ISO8859-1 -SAME+= sr_Latn_RS.UTF-8 sr_Cyrl_RS.UTF-8 SAME+= sv_FI.ISO8859-15 sv_FI.ISO8859-1 SAME+= sv_SE.ISO8859-15 sv_SE.ISO8859-1 SAME+= zh_Hans_CN.GBK zh_Hans_CN.GB18030 Modified: head/share/timedef/sr_Cyrl_RS.ISO8859-5.src ============================================================================== --- head/share/timedef/sr_Cyrl_RS.ISO8859-5.src Mon Jun 20 06:40:58 2016 (r302025) +++ head/share/timedef/sr_Cyrl_RS.ISO8859-5.src Mon Jun 20 06:45:42 2016 (r302026) @@ -15,18 +15,7 @@ -""jan -feb -mar -apr -maj -jun -jul -avg -sep -okt -nov -dec + # # Long month names (as in a date) @@ -40,18 +29,7 @@ dec -""januar -februar -mart -april -maj -jun -jul -avgust -septembar -oktobar -novembar -decembar + # # Short weekday names @@ -60,13 +38,7 @@ decembar -""ned -pon -uto -sre -cet -pet -sub + # # Long weekday names @@ -75,30 +47,23 @@ sub -""nedelja -ponedeljak -utorak -sreda -cetvrtak -petak -subota + # # X_fmt -%H.%M.%S""%H.%M.%S +%H.%M.%S # # x_fmt -%d.%m.%y.""%e.%m.%y. +%d.%m.%y. # # c_fmt -%d. %B %Y. %H.%M.%S""%d. %B %Y. %H.%M.%S %Z +%d. %B %Y. %H.%M.%S # # AM/PM - ""pre podne -po podne + # # date_fmt -%d. %B %Y. %H.%M.%S %Z""%d. %B %Y. %H.%M.%S %Z +%d. %B %Y. %H.%M.%S %Z # # Long month names (without case ending) @@ -112,22 +77,11 @@ po podne -""januar -februar -mart -april -maj -jun -jul -avgust -septembar -oktobar -novembar -decembar + # # md_order -dmdm +dm # # ampm_fmt -%I.%M.%S %p""%I.%M.%S %p +%I.%M.%S %p # EOF Added: head/share/timedef/sr_Cyrl_RS.UTF-8.src ============================================================================== Binary file. No diff available. Modified: head/share/timedef/sr_Latn_RS.ISO8859-2.src ============================================================================== --- head/share/timedef/sr_Latn_RS.ISO8859-2.src Mon Jun 20 06:40:58 2016 (r302025) +++ head/share/timedef/sr_Latn_RS.ISO8859-2.src Mon Jun 20 06:45:42 2016 (r302026) @@ -4,18 +4,7 @@ # ----------------------------------------------------------------------------- # # Short month names -jah -feb -mar -apr -maj -juh -jul -abg -cep -okt -hob -dec""jan +jan feb mar apr @@ -29,18 +18,7 @@ nov dec # # Long month names (as in a date) -jahuar -februar -mart -aprjl -maj -juh -jul -abguct -ceptembar -oktobar -hobembar -decembar""januar +januar februar mart april @@ -54,13 +32,7 @@ novembar decembar # # Short weekday names -hed -poh -uto -cre -et -pet -cub""ned +ned pon uto sre @@ -69,13 +41,7 @@ pet sub # # Long weekday names -hedelja -pohedeljak -utorak -creda -etbrtak -petak -cubota""nedelja +nedelja ponedeljak utorak sreda @@ -84,35 +50,23 @@ petak subota # # X_fmt -%H.%M.%S""%H.%M.%S +%H.%M.%S # # x_fmt -%d.%m.%y.""%d.%m.%y. +%d.%m.%y. # # c_fmt -%d. %B %Y. %H.%M.%S""%d. %B %Y. %H.%M.%S %Z +%d. %B %Y. %H.%M.%S # # AM/PM -pre podhe -po podhe""pre podne +pre podne po podne # # date_fmt -%d. %B %Y. %H.%M.%S %Z""%d. %B %Y. %H.%M.%S %Z +%d. %B %Y. %H.%M.%S %Z # # Long month names (without case ending) -jahuar -februar -mart -aprjl -maj -juh -jul -abguct -ceptembar -oktobar -hobembar -decembar""januar +januar februar mart april @@ -126,8 +80,8 @@ novembar decembar # # md_order -dmdm +dm # # ampm_fmt -%I.%M.%S %p""%I.%M.%S %p +%I.%M.%S %p # EOF Modified: head/share/timedef/sr_Latn_RS.UTF-8.src ============================================================================== Binary file (source and/or target). No diff available. Modified: head/tools/tools/locale/tools/cldr2def.pl ============================================================================== --- head/tools/tools/locale/tools/cldr2def.pl Mon Jun 20 06:40:58 2016 (r302025) +++ head/tools/tools/locale/tools/cldr2def.pl Mon Jun 20 06:45:42 2016 (r302026) @@ -595,8 +595,8 @@ sub get_fields { $line =~ s/^$k\s+//; } - $values{$l}{$c}{$k} = "" - if (!defined $values{$l}{$c}{$k}); + $values{$l}{$f}{$c}{$k} = "" + if (!defined $values{$l}{$f}{$c}{$k}); $continue = ($line =~ /\/$/); $line =~ s/\/$// if ($continue); @@ -606,7 +606,7 @@ sub get_fields { s/\<([^>_]+)_([^>]+)\>/<$1 $2>/; } die "_ in data - $line" if ($line =~ /_/); - $values{$l}{$c}{$k} .= $line; + $values{$l}{$f}{$c}{$k} .= $line; last if (!$continue); } @@ -723,7 +723,7 @@ sub print_fields { # ----------------------------------------------------------------------------- EOF foreach my $k (keys(%keys)) { - my $f = $keys{$k}; + my $g = $keys{$k}; die("Unknown $k in \%DESC") if (!defined $DESC{$k}); @@ -731,37 +731,38 @@ EOF $output .= "#\n# $DESC{$k}\n"; # Replace one row with another - if ($f =~ /^>/) { - $k = substr($f, 1); - $f = $keys{$k}; + if ($g =~ /^>/) { + $k = substr($g, 1); + $g = $keys{$k}; } # Callback function - if ($f =~ /^\ Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D072A7A838; Mon, 20 Jun 2016 09:06:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D84927A9; Mon, 20 Jun 2016 09:06:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K96o9t033476; Mon, 20 Jun 2016 09:06:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5K96om0033475; Mon, 20 Jun 2016 09:06:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606200906.u5K96om0033475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 20 Jun 2016 09:06: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: r302027 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 09:06:51 -0000 Author: kib Date: Mon Jun 20 09:06:50 2016 New Revision: 302027 URL: https://svnweb.freebsd.org/changeset/base/302027 Log: MFC r301851: Explicitely initialize sw_alloc_sx. Modified: stable/10/sys/vm/swap_pager.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/swap_pager.c ============================================================================== --- stable/10/sys/vm/swap_pager.c Mon Jun 20 06:45:42 2016 (r302026) +++ stable/10/sys/vm/swap_pager.c Mon Jun 20 09:06:50 2016 (r302027) @@ -498,6 +498,7 @@ swap_pager_init(void) TAILQ_INIT(&swap_pager_object_list[i]); mtx_init(&sw_alloc_mtx, "swap_pager list", NULL, MTX_DEF); mtx_init(&sw_dev_mtx, "swapdev", NULL, MTX_DEF); + sx_init(&sw_alloc_sx, "swspsx"); /* * Device Stripe, in PAGE_SIZE'd blocks From owner-svn-src-all@freebsd.org Mon Jun 20 09:15:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B502A7AA68; Mon, 20 Jun 2016 09:15:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A3772D60; Mon, 20 Jun 2016 09:15:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K9F3gv037189; Mon, 20 Jun 2016 09:15:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5K9F3Yf037188; Mon, 20 Jun 2016 09:15:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606200915.u5K9F3Yf037188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 20 Jun 2016 09:15: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: r302028 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 09:15:04 -0000 Author: kib Date: Mon Jun 20 09:15:03 2016 New Revision: 302028 URL: https://svnweb.freebsd.org/changeset/base/302028 Log: MFC r301853: Do not access pv_table array for fictitious pages. Modified: stable/10/sys/amd64/amd64/pmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c ============================================================================== --- stable/10/sys/amd64/amd64/pmap.c Mon Jun 20 09:06:50 2016 (r302027) +++ stable/10/sys/amd64/amd64/pmap.c Mon Jun 20 09:15:03 2016 (r302028) @@ -381,6 +381,7 @@ static TAILQ_HEAD(pch, pv_chunk) pv_chun static struct mtx pv_chunks_mutex; static struct rwlock pv_list_locks[NPV_LIST_LOCKS]; static struct md_page *pv_table; +static struct md_page pv_dummy; /* * All those kernel PT submaps that BSD is so fond of @@ -1100,6 +1101,7 @@ pmap_init(void) M_WAITOK | M_ZERO); for (i = 0; i < pv_npg; i++) TAILQ_INIT(&pv_table[i].pv_list); + TAILQ_INIT(&pv_dummy.pv_list); mtx_init(&cpage_lock, "cpage", NULL, MTX_DEF); cpage_a = kva_alloc(PAGE_SIZE); @@ -3808,9 +3810,8 @@ pmap_remove_all(vm_page_t m) ("pmap_remove_all: page %p is not managed", m)); SLIST_INIT(&free); rw_wlock(&pvh_global_lock); - if ((m->flags & PG_FICTITIOUS) != 0) - goto small_mappings; - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : + pa_to_pvh(VM_PAGE_TO_PHYS(m)); while ((pv = TAILQ_FIRST(&pvh->pv_list)) != NULL) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); @@ -3819,7 +3820,6 @@ pmap_remove_all(vm_page_t m) (void)pmap_demote_pde(pmap, pde, va); PMAP_UNLOCK(pmap); } -small_mappings: while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); @@ -5677,11 +5677,10 @@ pmap_remove_write(vm_page_t m) return; rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : + pa_to_pvh(VM_PAGE_TO_PHYS(m)); retry_pv_loop: rw_wlock(lock); - if ((m->flags & PG_FICTITIOUS) != 0) - goto small_mappings; TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -5705,7 +5704,6 @@ retry_pv_loop: lock, VM_PAGE_TO_PV_LIST_LOCK(m), m)); PMAP_UNLOCK(pmap); } -small_mappings: TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -5807,13 +5805,12 @@ pmap_ts_referenced(vm_page_t m) cleared = 0; pa = VM_PAGE_TO_PHYS(m); lock = PHYS_TO_PV_LIST_LOCK(pa); - pvh = pa_to_pvh(pa); + pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : pa_to_pvh(pa); rw_rlock(&pvh_global_lock); rw_wlock(lock); retry: not_cleared = 0; - if ((m->flags & PG_FICTITIOUS) != 0 || - (pvf = TAILQ_FIRST(&pvh->pv_list)) == NULL) + if ((pvf = TAILQ_FIRST(&pvh->pv_list)) == NULL) goto small_mappings; pv = pvf; do { @@ -6139,13 +6136,12 @@ pmap_clear_modify(vm_page_t m) */ if ((m->aflags & PGA_WRITEABLE) == 0) return; - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : + pa_to_pvh(VM_PAGE_TO_PHYS(m)); rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); rw_wlock(lock); restart: - if ((m->flags & PG_FICTITIOUS) != 0) - goto small_mappings; TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -6189,7 +6185,6 @@ restart: } PMAP_UNLOCK(pmap); } -small_mappings: TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { From owner-svn-src-all@freebsd.org Mon Jun 20 14:59:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50BCDAC436B; Mon, 20 Jun 2016 14:59:31 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F20C228A0; Mon, 20 Jun 2016 14:59:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [150.158.232.236] (114.40-78-194.adsl-static.isp.belgacom.be [194.78.40.114]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 599E61EF5F; Mon, 20 Jun 2016 16:59:28 +0200 (CEST) From: "Kristof Provost" To: "Alan Somers" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300881 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs geom Date: Mon, 20 Jun 2016 16:59:27 +0200 Message-ID: In-Reply-To: <201605272232.u4RMWjku087648@repo.freebsd.org> References: <201605272232.u4RMWjku087648@repo.freebsd.org> MIME-Version: 1.0 X-Mailer: MailMate (1.9.4r5234) Content-Type: text/plain; charset=utf-8; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 14:59:31 -0000 Hi, It looks like this change breaks boot on my machine. I’m running a root-on-ZFS system and reliably see this panic during boot. It’s a 4 disk raidz-1. It’s now running r302028 with r300881 backed out, and booting fine. The panic: panic: solaris assert: refcount(count(&spa->spa_refcount) >= spa->spa_minref || MUTEX_HELD(&spa_namespace_lock), file: /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c, line: 863 Unfortunately I can’t get a dump, but here’s a picture of the backtrace: https://people.freebsd.org/~kp/zfs_panic.jpg Regards, Kristof On 28 May 2016, at 0:32, Alan Somers wrote: > Author: asomers > Date: Fri May 27 22:32:44 2016 > New Revision: 300881 > URL: https://svnweb.freebsd.org/changeset/base/300881 > > Log: > Avoid issuing spa config updates for physical path when not > necessary > > ZFS's configuration needs to be updated whenever the physical path > for a > device changes, but not when a new device is introduced. This is > because new > devices necessarily cause config updates, but only if they are > actually > accepted into the pool. > > sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > Split vdev_geom_set_physpath out of vdev_geom_attrchanged. When > setting the vdev's physical path, only request a config update if > the physical path has changed. Don't request it when opening a > device for the first time, because the config sync will happen > anyway upstack. > > sys/geom/geom_dev.c > Split g_dev_set_physpath and g_dev_set_media out of > g_dev_attrchanged > > Submitted by: will, asomers > MFC after: 4 weeks > Sponsored by: Spectra Logic Corp > Differential Revision: https://reviews.freebsd.org/D6428 > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > head/sys/geom/geom_dev.c From owner-svn-src-all@freebsd.org Mon Jun 20 15:27:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A039DAC48D7; Mon, 20 Jun 2016 15:27:19 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ob0-x22d.google.com (mail-ob0-x22d.google.com [IPv6:2607:f8b0:4003:c01::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64846198C; Mon, 20 Jun 2016 15:27:19 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ob0-x22d.google.com with SMTP id ot10so515685obb.2; Mon, 20 Jun 2016 08:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=Ee7A08SnpK/qwPMZTJ0PX7Uk9Wrsmf4tozGE+Wa1crs=; b=Rp2YjmIceElMXfXyp3l7zbd+FG2D9n4b8D2x1KIHiD9DQQDvyAfOQFI4rFuTHcAmzl CH+Q3cbtOjktZqGWSdHWxkN2rGn9aLhvi9LGKDk3o9XNLGIJ9PNtQ6mTvQgboNSJH4Ep YGh7vyIx5yl+SQsMhjrEo32bFvMaZE+txT+H2vOJxcDVQqZNC+4vuKVRqx0J2mEhC4pB zW32oSb6zSWt0kk/ZhC0LEITvpgrxSfTnM4M7YMNynou8t3ExOi7hXgNisNO1ld0/5Kx exmzeyk2+Tsf0DNP/+HRj3mfWEh+vOdUpI3D2gD5r+ZW/4bVj0JdbJKcBjH8cylgUlOX eAzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=Ee7A08SnpK/qwPMZTJ0PX7Uk9Wrsmf4tozGE+Wa1crs=; b=M0buPYKdAJfRTeoB0WtXYXU5uFjN5vIeLOTpe9pWWYRGxlgcdDI8Hp9+0jJtIAQyjb ucDsnNXiZYiixWRo061pAmkAwhtiyu2z2JPmRogHlvj/xIgd5isa7uB74X3CCN1MX1Ii EGHWlQy6zzdVFmB6QtZI1kP6nJCrPmqLc7t0Sn008G8Wh+LItiSLItDKgwEsba+CaOlG wjBmJO3siTbKuwn8NKY3ebZQFrXNuwCreHv9vSWYBn3MBxgWYBkY5XSZ4x9hthyjFf5D adoW8HCGT6Mnxor4QmfBqG+MDjlq1TA4E+a+vfLmHUdpyNyokuHoW2xuEbJgtAilR0Rg isQA== X-Gm-Message-State: ALyK8tI9OJu99UaLTau5H8l7He2S8r/Z6R6kg1USfDqhfgy0t4cCKJOFczeMy5UN/R4gi2O8BmfmDI4LLC9bwA== X-Received: by 10.157.0.74 with SMTP id 68mr11008420ota.55.1466436438449; Mon, 20 Jun 2016 08:27:18 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.202.102.206 with HTTP; Mon, 20 Jun 2016 08:27:17 -0700 (PDT) In-Reply-To: References: <201605272232.u4RMWjku087648@repo.freebsd.org> From: Alan Somers Date: Mon, 20 Jun 2016 09:27:17 -0600 X-Google-Sender-Auth: gvyGmPphMt_dHbGBCHsGMh5XdFM Message-ID: Subject: Re: svn commit: r300881 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs geom To: Kristof Provost Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 15:27:19 -0000 You say it's a 4-disk RAIDZ1. Anything topologically weird, like a log, cache or spare device? SAS or SATA? Any SAS expanders? Please open a bug for this and assign to me so we can be sure to get this fixed in time for 11.0. -Alan On Mon, Jun 20, 2016 at 8:59 AM, Kristof Provost wrote: > Hi, > > It looks like this change breaks boot on my machine. > I=E2=80=99m running a root-on-ZFS system and reliably see this panic duri= ng boot. > It=E2=80=99s a 4 disk raidz-1. > > It=E2=80=99s now running r302028 with r300881 backed out, and booting fin= e. > > The panic: > panic: solaris assert: refcount(count(&spa->spa_refcount) >=3D spa->spa_m= inref > || > MUTEX_HELD(&spa_namespace_lock), file: > /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c, line: > 863 > > Unfortunately I can=E2=80=99t get a dump, but here=E2=80=99s a picture of= the backtrace: > https://people.freebsd.org/~kp/zfs_panic.jpg > > Regards, > Kristof > > On 28 May 2016, at 0:32, Alan Somers wrote: > > Author: asomers > Date: Fri May 27 22:32:44 2016 > New Revision: 300881 > URL: https://svnweb.freebsd.org/changeset/base/300881 > > Log: > Avoid issuing spa config updates for physical path when not necessary > > ZFS's configuration needs to be updated whenever the physical path for a > device changes, but not when a new device is introduced. This is because = new > devices necessarily cause config updates, but only if they are actually > accepted into the pool. > > sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > Split vdev_geom_set_physpath out of vdev_geom_attrchanged. When > setting the vdev's physical path, only request a config update if > the physical path has changed. Don't request it when opening a > device for the first time, because the config sync will happen > anyway upstack. > > sys/geom/geom_dev.c > Split g_dev_set_physpath and g_dev_set_media out of > g_dev_attrchanged > > Submitted by: will, asomers > MFC after: 4 weeks > Sponsored by: Spectra Logic Corp > Differential Revision: https://reviews.freebsd.org/D6428 > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > head/sys/geom/geom_dev.c From owner-svn-src-all@freebsd.org Mon Jun 20 15:31:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91889AC4AD2; Mon, 20 Jun 2016 15:31:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27B471EB6; Mon, 20 Jun 2016 15:31:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [150.158.232.236] (114.40-78-194.adsl-static.isp.belgacom.be [194.78.40.114]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 1CABA1E03E; Mon, 20 Jun 2016 17:31:56 +0200 (CEST) From: "Kristof Provost" To: "Alan Somers" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r300881 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs geom Date: Mon, 20 Jun 2016 17:31:54 +0200 Message-ID: In-Reply-To: References: <201605272232.u4RMWjku087648@repo.freebsd.org> MIME-Version: 1.0 X-Mailer: MailMate (1.9.4r5234) Content-Type: text/plain; charset=utf-8; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 15:31:58 -0000 No, it’s an HP Microserver. 4 data disks and that’s it. Bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210409 Regards, Kristof On 20 Jun 2016, at 17:27, Alan Somers wrote: > You say it's a 4-disk RAIDZ1. Anything topologically weird, like a > log, cache or spare device? SAS or SATA? Any SAS expanders? Please > open a bug for this and assign to me so we can be sure to get this > fixed in time for 11.0. > > -Alan > > On Mon, Jun 20, 2016 at 8:59 AM, Kristof Provost > wrote: >> Hi, >> >> It looks like this change breaks boot on my machine. >> I’m running a root-on-ZFS system and reliably see this panic during >> boot. >> It’s a 4 disk raidz-1. >> >> It’s now running r302028 with r300881 backed out, and booting fine. >> >> The panic: >> panic: solaris assert: refcount(count(&spa->spa_refcount) >= >> spa->spa_minref >> || >> MUTEX_HELD(&spa_namespace_lock), file: >> /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c, >> line: >> 863 >> >> Unfortunately I can’t get a dump, but here’s a picture of the >> backtrace: >> https://people.freebsd.org/~kp/zfs_panic.jpg >> >> Regards, >> Kristof >> >> On 28 May 2016, at 0:32, Alan Somers wrote: >> >> Author: asomers >> Date: Fri May 27 22:32:44 2016 >> New Revision: 300881 >> URL: https://svnweb.freebsd.org/changeset/base/300881 >> >> Log: >> Avoid issuing spa config updates for physical path when not necessary >> >> ZFS's configuration needs to be updated whenever the physical path >> for a >> device changes, but not when a new device is introduced. This is >> because new >> devices necessarily cause config updates, but only if they are >> actually >> accepted into the pool. >> >> sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c >> Split vdev_geom_set_physpath out of vdev_geom_attrchanged. When >> setting the vdev's physical path, only request a config update if >> the physical path has changed. Don't request it when opening a >> device for the first time, because the config sync will happen >> anyway upstack. >> >> sys/geom/geom_dev.c >> Split g_dev_set_physpath and g_dev_set_media out of >> g_dev_attrchanged >> >> Submitted by: will, asomers >> MFC after: 4 weeks >> Sponsored by: Spectra Logic Corp >> Differential Revision: https://reviews.freebsd.org/D6428 >> >> Modified: >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c >> head/sys/geom/geom_dev.c From owner-svn-src-all@freebsd.org Mon Jun 20 15:34:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3115AC4D0F; Mon, 20 Jun 2016 15:34:33 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) by mx1.freebsd.org (Postfix) with ESMTP id B4BB520FF; Mon, 20 Jun 2016 15:34:33 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [10.1.1.2]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id C6F31DB5D; Mon, 20 Jun 2016 15:34:27 +0000 (UTC) Subject: Re: svn commit: r300881 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs geom To: Kristof Provost , Alan Somers References: <201605272232.u4RMWjku087648@repo.freebsd.org> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Allan Jude Message-ID: Date: Mon, 20 Jun 2016 11:34:27 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 15:34:33 -0000 On 2016-06-20 11:31, Kristof Provost wrote: > No, it’s an HP Microserver. 4 data disks and that’s it. > > Bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210409 > > Regards, > Kristof > > On 20 Jun 2016, at 17:27, Alan Somers wrote: > > You say it's a 4-disk RAIDZ1. Anything topologically weird, like a > log, cache or spare device? SAS or SATA? Any SAS expanders? Please > open a bug for this and assign to me so we can be sure to get this > fixed in time for 11.0. > > -Alan > > On Mon, Jun 20, 2016 at 8:59 AM, Kristof Provost kp@freebsd.org > wrote: > > Hi, > > It looks like this change breaks boot on my machine. > I’m running a root-on-ZFS system and reliably see this panic > during boot. > It’s a 4 disk raidz-1. > > It’s now running r302028 with r300881 backed out, and booting fine. > > The panic: > panic: solaris assert: refcount(count(&spa->spa_refcount) >= > spa->spa_minref > || > MUTEX_HELD(&spa_namespace_lock), file: > /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c, > line: > 863 > > Unfortunately I can’t get a dump, but here’s a picture of the > backtrace: > https://people.freebsd.org/~kp/zfs_panic.jpg > > > Regards, > Kristof > > Looking at the backtrace, do you have one or more ZVOLs? -- Allan Jude From owner-svn-src-all@freebsd.org Mon Jun 20 15:37:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57438AC4E9E; Mon, 20 Jun 2016 15:37:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F52A24CF; Mon, 20 Jun 2016 15:37:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [150.158.232.236] (114.40-78-194.adsl-static.isp.belgacom.be [194.78.40.114]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id C675B1E0BF; Mon, 20 Jun 2016 17:37:47 +0200 (CEST) From: "Kristof Provost" To: "Allan Jude" Cc: "Alan Somers" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r300881 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs geom Date: Mon, 20 Jun 2016 17:37:46 +0200 Message-ID: <7EEFB79D-649B-4115-9E46-F077FA686EA6@FreeBSD.org> In-Reply-To: References: <201605272232.u4RMWjku087648@repo.freebsd.org> MIME-Version: 1.0 X-Mailer: MailMate (1.9.4r5234) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 15:37:50 -0000 On 20 Jun 2016, at 17:34, Allan Jude wrote: > Looking at the backtrace, do you have one or more ZVOLs? > No, there are no zvols: % zfs list -t volume no datasets available Regards, Kristof From owner-svn-src-all@freebsd.org Mon Jun 20 15:45:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C00EA7B0FC; Mon, 20 Jun 2016 15:45:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68D4E2A4A; Mon, 20 Jun 2016 15:45:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5KFjo4n082200; Mon, 20 Jun 2016 15:45:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5KFjo9S082199; Mon, 20 Jun 2016 15:45:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606201545.u5KFjo9S082199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 20 Jun 2016 15:45:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302029 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 15:45:51 -0000 Author: kib Date: Mon Jun 20 15:45:50 2016 New Revision: 302029 URL: https://svnweb.freebsd.org/changeset/base/302029 Log: Fix typo. Note that atomic is still required even for interlocked case. Sponsored by: The FreeBSD Foundation Approved by: re (marius) Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Jun 20 09:15:03 2016 (r302028) +++ head/sys/kern/vfs_subr.c Mon Jun 20 15:45:50 2016 (r302029) @@ -2494,9 +2494,10 @@ v_decr_devcount(struct vnode *vp) * * Notes on lockless counter manipulation: * _vhold, vputx and other routines make various decisions based - * on either holdcnt or usecount being 0. As long as either contuner + * on either holdcnt or usecount being 0. As long as either counter * is not transitioning 0->1 nor 1->0, the manipulation can be done - * with atomic operations. Otherwise the interlock is taken. + * with atomic operations. Otherwise the interlock is taken covering + * both the atomic and additional actions. */ int vget(struct vnode *vp, int flags, struct thread *td) From owner-svn-src-all@freebsd.org Mon Jun 20 16:12:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42C66A7B93A; Mon, 20 Jun 2016 16:12:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1AF271EF1; Mon, 20 Jun 2016 16:12:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5KGCRQT093473; Mon, 20 Jun 2016 16:12:27 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5KGCR1c093472; Mon, 20 Jun 2016 16:12:27 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606201612.u5KGCR1c093472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 20 Jun 2016 16:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302030 - head/sys/contrib/dev/ath/ath_hal/ar9300 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 16:12:28 -0000 Author: adrian Date: Mon Jun 20 16:12:27 2016 New Revision: 302030 URL: https://svnweb.freebsd.org/changeset/base/302030 Log: [ath] implement TX queue configuration extensions for the AR9380 HAL. Among other things, this introduces the idea of DBA-gated queues that aren't the CABQ. The TDMA support requires this. Tested: * AR9580 (hostap mode) * AR9380 (sta mode) Approved by: re (gjb) Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c Mon Jun 20 15:45:50 2016 (r302029) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c Mon Jun 20 16:12:27 2016 (r302030) @@ -368,19 +368,40 @@ ar9300_reset_tx_queue(struct ath_hal *ah OS_REG_WRITE(ah, AR_DCHNTIME(q), SM(qi->tqi_burstTime, AR_D_CHNTIME_DUR) | (qi->tqi_burstTime ? AR_D_CHNTIME_EN : 0)); - if (qi->tqi_burstTime && - (qi->tqi_qflags & HAL_TXQ_RDYTIME_EXP_POLICY_ENABLE)) - { + if (qi->tqi_readyTime && + (qi->tqi_qflags & HAL_TXQ_RDYTIME_EXP_POLICY_ENABLE)) qmisc |= AR_Q_MISC_RDYTIME_EXP_POLICY; + if (qi->tqi_qflags & HAL_TXQ_DBA_GATED) + qmisc = (qmisc &~ AR_Q_MISC_FSP) | AR_Q_MISC_FSP_DBA_GATED; + if (MS(qmisc, AR_Q_MISC_FSP) != AR_Q_MISC_FSP_ASAP) { + /* + * These are meangingful only when not scheduled asap. + */ + if (qi->tqi_qflags & HAL_TXQ_CBR_DIS_BEMPTY) + qmisc |= AR_Q_MISC_CBR_INCR_DIS0; + else + qmisc &= ~AR_Q_MISC_CBR_INCR_DIS0; + if (qi->tqi_qflags & HAL_TXQ_CBR_DIS_QEMPTY) + qmisc |= AR_Q_MISC_CBR_INCR_DIS1; + else + qmisc &= ~AR_Q_MISC_CBR_INCR_DIS1; } - if (qi->tqi_qflags & HAL_TXQ_BACKOFF_DISABLE) { + if (qi->tqi_qflags & HAL_TXQ_BACKOFF_DISABLE) dmisc |= AR_D_MISC_POST_FR_BKOFF_DIS; - } - - if (qi->tqi_qflags & HAL_TXQ_FRAG_BURST_BACKOFF_ENABLE) { + if (qi->tqi_qflags & HAL_TXQ_FRAG_BURST_BACKOFF_ENABLE) dmisc |= AR_D_MISC_FRAG_BKOFF_EN; - } + if (qi->tqi_qflags & HAL_TXQ_ARB_LOCKOUT_GLOBAL) + dmisc |= SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL, + AR_D_MISC_ARB_LOCKOUT_CNTRL); + else if (qi->tqi_qflags & HAL_TXQ_ARB_LOCKOUT_INTRA) + dmisc |= SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_INTRA_FR, + AR_D_MISC_ARB_LOCKOUT_CNTRL); + if (qi->tqi_qflags & HAL_TXQ_IGNORE_VIRTCOL) + dmisc |= SM(AR_D_MISC_VIR_COL_HANDLING_IGNORE, + AR_D_MISC_VIR_COL_HANDLING); + if (qi->tqi_qflags & HAL_TXQ_SEQNUM_INC_DIS) + dmisc |= AR_D_MISC_SEQ_NUM_INCR_DIS; switch (qi->tqi_type) { case HAL_TX_QUEUE_BEACON: /* beacon frames */ @@ -433,9 +454,8 @@ ar9300_reset_tx_queue(struct ath_hal *ah SM(TU_TO_USEC(value), AR_Q_RDYTIMECFG_DURATION) | AR_Q_RDYTIMECFG_EN); } - - dmisc |= (AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL << - AR_D_MISC_ARB_LOCKOUT_CNTRL_S); + dmisc |= SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL, + AR_D_MISC_ARB_LOCKOUT_CNTRL); break; case HAL_TX_QUEUE_PSPOLL: /* From owner-svn-src-all@freebsd.org Mon Jun 20 18:14:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0418FA7AA8A; Mon, 20 Jun 2016 18:14:53 +0000 (UTC) (envelope-from slm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9AC7286B; Mon, 20 Jun 2016 18:14:52 +0000 (UTC) (envelope-from slm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5KIEpKu044797; Mon, 20 Jun 2016 18:14:51 GMT (envelope-from slm@FreeBSD.org) Received: (from slm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5KIEpIh044790; Mon, 20 Jun 2016 18:14:51 GMT (envelope-from slm@FreeBSD.org) Message-Id: <201606201814.u5KIEpIh044790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slm set sender to slm@FreeBSD.org using -f From: Stephen McConnell Date: Mon, 20 Jun 2016 18:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302031 - head/sys/dev/mps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 18:14:53 -0000 Author: slm Date: Mon Jun 20 18:14:51 2016 New Revision: 302031 URL: https://svnweb.freebsd.org/changeset/base/302031 Log: - No log bit in IOCStatus and endian-safe changes. Use MPI2_IOCSTATUS_MASK when checking IOCStatus to mask off the log bit, and make a few more things endian-safe. - Fix possible use of invalid pointer. It was possible to use an invalid pointer to get the target ID value. To fix this, initialize a local Target ID variable to an invalid value and change that variable to a valid value only if the pointer to the Target ID is not NULL. - No need to set the MPSSAS_SHUTDOWN flag because it's never used. - done_ccb pointer can be used if it is NULL. To prevent this, move check for done_ccb == NULL to before done_ccb is used in mpssas_stop_unit_done(). - Disks can go missing until a reboot is done in some cases. This is due to the DevHandle not being released, which causes the Firmware to not allow that disk to be re-added. Reviewed by: ken Approved by: re (gjb), ken, scottl, ambrisko (mentors) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6872 Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mps_config.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_sas_lsi.c head/sys/dev/mps/mps_user.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Mon Jun 20 16:12:27 2016 (r302030) +++ head/sys/dev/mps/mps.c Mon Jun 20 18:14:51 2016 (r302031) @@ -1922,9 +1922,10 @@ mps_intr_locked(void *data) */ rel_rep = (MPI2_DIAG_RELEASE_REPLY *)reply; - if (le16toh(rel_rep->IOCStatus) == + if ((le16toh(rel_rep->IOCStatus) & + MPI2_IOCSTATUS_MASK) == MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED) - { + { pBuffer = &sc->fw_diag_buffer_list[ rel_rep->BufferType]; Modified: head/sys/dev/mps/mps_config.c ============================================================================== --- head/sys/dev/mps/mps_config.c Mon Jun 20 16:12:27 2016 (r302030) +++ head/sys/dev/mps/mps_config.c Mon Jun 20 18:14:51 2016 (r302031) @@ -499,7 +499,8 @@ mps_wd_config_pages(struct mps_softc *sc */ if (mps_config_get_raid_volume_pg0(sc, &mpi_reply, raid_vol_pg0, (u32)raid_vol_pg0->DevHandle)) { - if (mpi_reply.IOCStatus != + if ((le16toh(mpi_reply.IOCStatus) & + MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) { mps_dprint(sc, MPS_FAULT, "Multiple RAID Volume Page0! Direct Drive " Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Mon Jun 20 16:12:27 2016 (r302030) +++ head/sys/dev/mps/mps_sas.c Mon Jun 20 18:14:51 2016 (r302031) @@ -241,6 +241,8 @@ mpssas_alloc_tm(struct mps_softc *sc) void mpssas_free_tm(struct mps_softc *sc, struct mps_command *tm) { + int target_id = 0xFFFFFFFF; + if (tm == NULL) return; @@ -251,10 +253,11 @@ mpssas_free_tm(struct mps_softc *sc, str */ if (tm->cm_targ != NULL) { tm->cm_targ->flags &= ~MPSSAS_TARGET_INRESET; + target_id = tm->cm_targ->tid; } if (tm->cm_ccb) { mps_dprint(sc, MPS_INFO, "Unfreezing devq for target ID %d\n", - tm->cm_targ->tid); + target_id); xpt_release_devq(tm->cm_ccb->ccb_h.path, 1, TRUE); xpt_free_path(tm->cm_ccb->ccb_h.path); xpt_free_ccb(tm->cm_ccb); @@ -372,12 +375,11 @@ mpssas_remove_volume(struct mps_softc *s return; } - if (reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) { - mps_dprint(sc, MPS_FAULT, + if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) != + MPI2_IOCSTATUS_SUCCESS) { + mps_dprint(sc, MPS_ERROR, "IOCStatus = 0x%x while resetting device 0x%x\n", - reply->IOCStatus, handle); - mpssas_free_tm(sc, tm); - return; + le16toh(reply->IOCStatus), handle); } mps_dprint(sc, MPS_XINFO, @@ -394,7 +396,8 @@ mpssas_remove_volume(struct mps_softc *s * this target id if possible, and so we can assign the same target id * to this device if it comes back in the future. */ - if (reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) { + if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) == + MPI2_IOCSTATUS_SUCCESS) { targ = tm->cm_targ; targ->handle = 0x0; targ->encl_handle = 0x0; @@ -567,24 +570,22 @@ mpssas_remove_device(struct mps_softc *s "%s: cm_flags = %#x for remove of handle %#04x! " "This should not happen!\n", __func__, tm->cm_flags, handle); - mpssas_free_tm(sc, tm); - return; } if (reply == NULL) { /* XXX retry the remove after the diag reset completes? */ mps_dprint(sc, MPS_FAULT, - "%s NULL reply reseting device 0x%04x\n", __func__, handle); + "%s NULL reply resetting device 0x%04x\n", __func__, + handle); mpssas_free_tm(sc, tm); return; } - if (le16toh(reply->IOCStatus) != MPI2_IOCSTATUS_SUCCESS) { - mps_dprint(sc, MPS_FAULT, + if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) != + MPI2_IOCSTATUS_SUCCESS) { + mps_dprint(sc, MPS_ERROR, "IOCStatus = 0x%x while resetting device 0x%x\n", le16toh(reply->IOCStatus), handle); - mpssas_free_tm(sc, tm); - return; } mps_dprint(sc, MPS_XINFO, "Reset aborted %u commands\n", @@ -662,7 +663,8 @@ mpssas_remove_complete(struct mps_softc * this target id if possible, and so we can assign the same target id * to this device if it comes back in the future. */ - if (le16toh(reply->IOCStatus) == MPI2_IOCSTATUS_SUCCESS) { + if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) == + MPI2_IOCSTATUS_SUCCESS) { targ = tm->cm_targ; targ->handle = 0x0; targ->encl_handle = 0x0; @@ -880,7 +882,6 @@ mps_detach_sas(struct mps_softc *sc) cam_sim_free(sassc->sim, FALSE); } - sassc->flags |= MPSSAS_SHUTDOWN; mps_unlock(sc); if (sassc->devq != NULL) Modified: head/sys/dev/mps/mps_sas_lsi.c ============================================================================== --- head/sys/dev/mps/mps_sas_lsi.c Mon Jun 20 16:12:27 2016 (r302030) +++ head/sys/dev/mps/mps_sas_lsi.c Mon Jun 20 18:14:51 2016 (r302031) @@ -1161,15 +1161,15 @@ mpssas_stop_unit_done(struct cam_periph struct mpssas_softc *sassc; char path_str[64]; + if (done_ccb == NULL) + return; + sassc = (struct mpssas_softc *)done_ccb->ccb_h.ppriv_ptr1; xpt_path_string(done_ccb->ccb_h.path, path_str, sizeof(path_str)); mps_dprint(sassc->sc, MPS_INFO, "Completing stop unit for %s\n", path_str); - if (done_ccb == NULL) - return; - /* * Nothing more to do except free the CCB and path. If the command * timed out, an abort reset, then target reset will be issued during Modified: head/sys/dev/mps/mps_user.c ============================================================================== --- head/sys/dev/mps/mps_user.c Mon Jun 20 16:12:27 2016 (r302030) +++ head/sys/dev/mps/mps_user.c Mon Jun 20 18:14:51 2016 (r302031) @@ -1220,12 +1220,14 @@ mps_post_fw_diag_buffer(struct mps_softc * Process POST reply. */ reply = (MPI2_DIAG_BUFFER_POST_REPLY *)cm->cm_reply; - if (reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) { + if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) != + MPI2_IOCSTATUS_SUCCESS) { status = MPS_DIAG_FAILURE; mps_dprint(sc, MPS_FAULT, "%s: post of FW Diag Buffer failed " "with IOCStatus = 0x%x, IOCLogInfo = 0x%x and " - "TransferLength = 0x%x\n", __func__, reply->IOCStatus, - reply->IOCLogInfo, reply->TransferLength); + "TransferLength = 0x%x\n", __func__, + le16toh(reply->IOCStatus), le32toh(reply->IOCLogInfo), + le32toh(reply->TransferLength)); goto done; } @@ -1304,12 +1306,13 @@ mps_release_fw_diag_buffer(struct mps_so * Process RELEASE reply. */ reply = (MPI2_DIAG_RELEASE_REPLY *)cm->cm_reply; - if ((reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) || - pBuffer->owned_by_firmware) { + if (((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) != + MPI2_IOCSTATUS_SUCCESS) || pBuffer->owned_by_firmware) { status = MPS_DIAG_FAILURE; mps_dprint(sc, MPS_FAULT, "%s: release of FW Diag Buffer " "failed with IOCStatus = 0x%x and IOCLogInfo = 0x%x\n", - __func__, reply->IOCStatus, reply->IOCLogInfo); + __func__, le16toh(reply->IOCStatus), + le32toh(reply->IOCLogInfo)); goto done; } Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Mon Jun 20 16:12:27 2016 (r302030) +++ head/sys/dev/mps/mpsvar.h Mon Jun 20 18:14:51 2016 (r302031) @@ -33,7 +33,7 @@ #ifndef _MPSVAR_H #define _MPSVAR_H -#define MPS_DRIVER_VERSION "20.00.00.00-fbsd" +#define MPS_DRIVER_VERSION "21.00.00.00-fbsd" #define MPS_DB_MAX_WAIT 2500 From owner-svn-src-all@freebsd.org Mon Jun 20 19:00:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50608AC47C3; Mon, 20 Jun 2016 19:00:49 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 090E02443; Mon, 20 Jun 2016 19:00:48 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5KJ0mMN059946; Mon, 20 Jun 2016 19:00:48 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5KJ0mL3059944; Mon, 20 Jun 2016 19:00:48 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201606201900.u5KJ0mL3059944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Mon, 20 Jun 2016 19:00:48 +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: r302032 - stable/10/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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 19:00:49 -0000 Author: truckman Date: Mon Jun 20 19:00:47 2016 New Revision: 302032 URL: https://svnweb.freebsd.org/changeset/base/302032 Log: MFC r300240 Change net.inet.tcp.ecn.enable sysctl mib from a binary off/on control to a three way setting. 0 - Totally disable ECN. (no change) 1 - Enable ECN if incoming connections request it. Outgoing connections will request ECN. (no change from present != 0 setting) 2 - Enable ECN if incoming connections request it. Outgoing conections will not request ECN. Change the default value of net.inet.tcp.ecn.enable from 0 to 2. Linux version 2.4.20 and newer, Solaris, and Mac OS X 10.5 and newer have similar capabilities. The actual values above match Linux, and the default matches the current Linux default. Reviewed by: eadler Relnotes: yes Differential Revision: https://reviews.freebsd.org/D6386 Modified: stable/10/sys/netinet/tcp_input.c stable/10/sys/netinet/tcp_output.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Mon Jun 20 18:14:51 2016 (r302031) +++ stable/10/sys/netinet/tcp_input.c Mon Jun 20 19:00:47 2016 (r302032) @@ -184,7 +184,7 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, ecn, CTLFLAG_RW, 0, "TCP ECN"); -VNET_DEFINE(int, tcp_do_ecn) = 0; +VNET_DEFINE(int, tcp_do_ecn) = 2; SYSCTL_VNET_INT(_net_inet_tcp_ecn, OID_AUTO, enable, CTLFLAG_RW, &VNET_NAME(tcp_do_ecn), 0, "TCP ECN support"); Modified: stable/10/sys/netinet/tcp_output.c ============================================================================== --- stable/10/sys/netinet/tcp_output.c Mon Jun 20 18:14:51 2016 (r302031) +++ stable/10/sys/netinet/tcp_output.c Mon Jun 20 19:00:47 2016 (r302032) @@ -1109,7 +1109,7 @@ send: * resend those bits a number of times as per * RFC 3168. */ - if (tp->t_state == TCPS_SYN_SENT && V_tcp_do_ecn) { + if (tp->t_state == TCPS_SYN_SENT && V_tcp_do_ecn == 1) { if (tp->t_rxtshift >= 1) { if (tp->t_rxtshift <= V_tcp_ecn_maxretries) flags |= TH_ECE|TH_CWR; From owner-svn-src-all@freebsd.org Mon Jun 20 19:14:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4392FAC4D17 for ; Mon, 20 Jun 2016 19:14:14 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F11CE2FAE for ; Mon, 20 Jun 2016 19:14:13 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f53.google.com with SMTP id l188so43906443lfe.2 for ; Mon, 20 Jun 2016 12:14:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=iyxKpX4UwXDyl6+RtcmYonJ2/ppbeeZNmspQT4kygEc=; b=B5VjfvMfoyyFBSWjZt8IxqFtj+zBlhxOqveMDaksNZ8WeV5emvq2rIdlPKcvUQXUsh qkijLd2olgkQcCb0qHOjxaYXqj8QeiKzfHUm13CGxd42xMwouiwhUE6A/BKgijFQXjQm ul23KLHLZevZ2sLyH1wCbH0guU8Nj2wLMoRyuNR3UZxClQoyO6ZyeOu1XIZ/aZuSTcNI niSqZEneOUf2RMT366Nh3xu2WUbBaHsQyKRm5o34LYO6oxdh7PxL4b9LddPleENMFwf1 VmRC2FJZSErnGqi8s4g7NW3bV6dSOV0Nkb1EAgyqGceVGNoEL7Lje5IbwK2MHjMCXqqw mnNw== X-Gm-Message-State: ALyK8tIOOrF6c5oKR/00DYKKyYv/9Z/khyjSUwPBTuLx4m92P0j9UO6ULTYDyfWp1few4g== X-Received: by 10.25.152.1 with SMTP id a1mr3756950lfe.33.1466450046320; Mon, 20 Jun 2016 12:14:06 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id dw5sm1241626lbc.26.2016.06.20.12.14.05 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Jun 2016 12:14:05 -0700 (PDT) Subject: Re: svn commit: r302026 - in head: share/monetdef share/msgdef share/numericdef share/timedef tools/tools/locale/tools To: Baptiste Daroussin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201606200645.u5K6jhBr081752@repo.freebsd.org> From: Andrey Chernov Message-ID: <0de854da-5914-901a-3d15-41429808ace1@freebsd.org> Date: Mon, 20 Jun 2016 22:14:04 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <201606200645.u5K6jhBr081752@repo.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 19:14:14 -0000 On 20.06.2016 9:45, Baptiste Daroussin wrote: > Author: bapt > Date: Mon Jun 20 06:45:42 2016 > New Revision: 302026 > URL: https://svnweb.freebsd.org/changeset/base/302026 > > Log: > Fix generation of locales with multiple variants Thanx. Just want to note, even if we stay with RFC 5646 language tags instead of ISO 639 ones with @modifier (per ISO 15897), current tags are incorrect because have "_" instead of "-" which makes parsing harder, because "_" is territory separator and someone may not expect several "_" exists. Per RFC 5646 we need names like sr-Cyrl_RS.UTF-8.src and not sr_Cyrl_RS.UTF-8.src From owner-svn-src-all@freebsd.org Mon Jun 20 21:27:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39C0FAC4AB6; Mon, 20 Jun 2016 21:27:13 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-lf0-x235.google.com (mail-lf0-x235.google.com [IPv6:2a00:1450:4010:c07::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C912A1344; Mon, 20 Jun 2016 21:27:12 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-lf0-x235.google.com with SMTP id f6so47729810lfg.0; Mon, 20 Jun 2016 14:27:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=x5G3vTJ737rQT176wTe9zZaWH2Wb5+GQ98PoSWsaLMo=; b=QFCXAIY8SEjt2J+Q8aVjvCW0OsIE7Sl2dJb2D5bidB+wiGrBt6iVCT3z4lfyIC+LSx 0vHrV3wVT7v3J33SQ2HT0tIj/a7iUy5LmyC3TdJX0thIitR4GjG1wAuD6syNxZK6dK1Z gNhdt7cSRerUJj6ZjzMRCbOZO9mYesb+eQpinQlRp0dDlbmSPlKqV/h9j8fPEsq93vSH sCIY/L/28bvcfOpwL0SvxHM+hDhJsKZctSYA85+J8ri6rOH4CeHICbIkMBfOSsqz+Cdt rwxPBzw/45DzaM1qq0qa5NpmZLWt5gJFDFn4Eh5qgruXvsy4FoJ1QWSYEubDDaf/+53F cvuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=x5G3vTJ737rQT176wTe9zZaWH2Wb5+GQ98PoSWsaLMo=; b=nJfBcBeGkZHebE9QstDp6HM8wPlpG0+8IEIkGpkR1m9QCu2D4ucMLtn4PV3UWVldg7 fe965L1mNNij92hdJD1InBDuRLR68CYW1a0DhXv2ovY+kx7Rj+R4bvn7kJvOl15IHxzR x6M+cELr9QgXlLc/Bu5hXUV5UjAZSM0RnuSkPCz46WrrbfPCmjE7NeIH8gXfyTRpzFE0 cA5vfpwFPnhKRo1njhbj2Umrv+reZoadVAXYS41N6qJfmmdC9gymxIrIjv2crm0HGs8B aG0Cd7bU/5DjH0cJM5UV1Z+1alwUq5a6bpnZzJcXjnO52OfcNniU6hVkeZOs9oe0Nvo0 quXQ== X-Gm-Message-State: ALyK8tIzDNBptYUrVMS8VlrnCiURHi0xwuTsPRmVSIKWpy5lmMgCmmLR4PnpbIKOEfAklg== X-Received: by 10.28.48.15 with SMTP id w15mr69831wmw.28.1466458030181; Mon, 20 Jun 2016 14:27:10 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id zg10sm41028165wjb.1.2016.06.20.14.27.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 14:27:09 -0700 (PDT) Sender: Baptiste Daroussin Date: Mon, 20 Jun 2016 23:27:08 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302026 - in head: share/monetdef share/msgdef share/numericdef share/timedef tools/tools/locale/tools Message-ID: <20160620212708.6hckbjzqntihtiba@ivaldir.etoilebsd.net> References: <201606200645.u5K6jhBr081752@repo.freebsd.org> <0de854da-5914-901a-3d15-41429808ace1@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jf2slo6kygmfunon" Content-Disposition: inline In-Reply-To: <0de854da-5914-901a-3d15-41429808ace1@freebsd.org> User-Agent: Mutt/1.6.1-neo (2016-06-11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 21:27:13 -0000 --jf2slo6kygmfunon Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 20, 2016 at 10:14:04PM +0300, Andrey Chernov wrote: > On 20.06.2016 9:45, Baptiste Daroussin wrote: > > Author: bapt > > Date: Mon Jun 20 06:45:42 2016 > > New Revision: 302026 > > URL: https://svnweb.freebsd.org/changeset/base/302026 > >=20 > > Log: > > Fix generation of locales with multiple variants >=20 > Thanx. > Just want to note, even if we stay with RFC 5646 language tags instead > of ISO 639 ones with @modifier (per ISO 15897), current tags are > incorrect because have "_" instead of "-" which makes parsing harder, > because "_" is territory separator and someone may not expect several > "_" exists. Per RFC 5646 we need names like > sr-Cyrl_RS.UTF-8.src > and not > sr_Cyrl_RS.UTF-8.src >=20 I'm going to move to the @modifier, just it needs a first step which was fi= xing the locales with multiple variants. Just give me a bit of time Best regards, Bapt --jf2slo6kygmfunon Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXaF+mAAoJEGOJi9zxtz5aB00P/2To7SHuBEsAN4SVriEbg5i5 xIbWaI+tX69ei1FZWgT5HkdxBCgp627HSD4zb4A+iAWr7DXfG3OKmWtCNU+o8Y3Q 0suJavazP5hOejJojmObx4s7ZJA0i7TvQbYEzfWHn70UzMhbdk5PLmGiKIfhX6GU TfVu0YZgw6LpRtOpzpz5cVnXJSTnrye/xQEnxXkhgICCgF8IPBQJmNjB2QSBolvI +3i8a+Kc200SKQkijXOgYiPmPSnZSmL+1HDY8Sko9FLRed6tVLS+tH9KBe0WB+ml XpAUjpHAhVB8Cuu1o+xk/jxLCXkGF8X4k8fvCOVHcAjLpGYTlVPvmrj/WERDbL60 zMgwVj1nIW986PHwc+eQRCVFhrTmKyEjxvEmIza4Txhncus8Dey0edKGM+USYV1q R65YgG11CryF+v1tVrJUzblLpOW3gM/QfsYNBF0+zCRNs2Vuky5+HH40eAx6EroJ FxRN+8bQd0XBj4JJQc3zLDmDoPBXkR2IzW1Uk4orHMduEx2lhbnxOribBzg+4J09 YvZIoaJecJGnx1vqjTniBJUWnqxwPDmPBGidBAX/6J84KPEdoO46x7EVjVAP73pW 4IJK3hHWyMMv/XffenIZqxucLNQ5K4LE4UT8P7J01AwnTM2YqJViSKAgfFR9m04W /fenBavz6ZgoS719lGf4 =HZWO -----END PGP SIGNATURE----- --jf2slo6kygmfunon-- From owner-svn-src-all@freebsd.org Mon Jun 20 22:39:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06454AC4054; Mon, 20 Jun 2016 22:39:34 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC6D71CB8; Mon, 20 Jun 2016 22:39:33 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5KMdWvF042732; Mon, 20 Jun 2016 22:39:32 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5KMdWaa042731; Mon, 20 Jun 2016 22:39:32 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201606202239.u5KMdWaa042731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 20 Jun 2016 22:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302034 - head/sys/dev/urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 22:39:34 -0000 Author: avos Date: Mon Jun 20 22:39:32 2016 New Revision: 302034 URL: https://svnweb.freebsd.org/changeset/base/302034 Log: urtwn: fix panic on device detach. Remove frames from active/pending Tx queues and free related node references when vap is destroyed to prevent various use-after-free scenarios. Reported and tested by: Aleksander Alekseev PR: 208632 Approved by: re (gjb) Modified: head/sys/dev/urtwn/if_urtwn.c Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Mon Jun 20 22:05:59 2016 (r302033) +++ head/sys/dev/urtwn/if_urtwn.c Mon Jun 20 22:39:32 2016 (r302034) @@ -208,6 +208,10 @@ static struct ieee80211vap *urtwn_vap_cr const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN]); static void urtwn_vap_delete(struct ieee80211vap *); +static void urtwn_vap_clear_tx(struct urtwn_softc *, + struct ieee80211vap *); +static void urtwn_vap_clear_tx_queue(struct urtwn_softc *, + urtwn_datahead *, struct ieee80211vap *); static struct mbuf * urtwn_rx_copy_to_mbuf(struct urtwn_softc *, struct r92c_rx_stat *, int); static struct mbuf * urtwn_report_intr(struct usb_xfer *, @@ -824,8 +828,16 @@ urtwn_vap_delete(struct ieee80211vap *va struct urtwn_softc *sc = ic->ic_softc; struct urtwn_vap *uvp = URTWN_VAP(vap); + /* Guarantee that nothing will go through this vap. */ + ieee80211_new_state(vap, IEEE80211_S_INIT, -1); + ieee80211_draintask(ic, &vap->iv_nstate_task); + + URTWN_LOCK(sc); if (uvp->bcn_mbuf != NULL) m_freem(uvp->bcn_mbuf); + /* Cancel any unfinished Tx. */ + urtwn_vap_clear_tx(sc, vap); + URTWN_UNLOCK(sc); if (vap->iv_opmode == IEEE80211_M_IBSS) ieee80211_draintask(ic, &uvp->tsf_task_adhoc); if (URTWN_CHIP_HAS_RATECTL(sc)) @@ -834,6 +846,41 @@ urtwn_vap_delete(struct ieee80211vap *va free(uvp, M_80211_VAP); } +static void +urtwn_vap_clear_tx(struct urtwn_softc *sc, struct ieee80211vap *vap) +{ + + URTWN_ASSERT_LOCKED(sc); + + urtwn_vap_clear_tx_queue(sc, &sc->sc_tx_active, vap); + urtwn_vap_clear_tx_queue(sc, &sc->sc_tx_pending, vap); +} + +static void +urtwn_vap_clear_tx_queue(struct urtwn_softc *sc, urtwn_datahead *head, + struct ieee80211vap *vap) +{ + struct urtwn_data *dp, *tmp; + + STAILQ_FOREACH_SAFE(dp, head, next, tmp) { + if (dp->ni != NULL) { + if (dp->ni->ni_vap == vap) { + ieee80211_free_node(dp->ni); + dp->ni = NULL; + + if (dp->m != NULL) { + m_freem(dp->m); + dp->m = NULL; + } + + STAILQ_REMOVE(head, dp, urtwn_data, next); + STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, dp, + next); + } + } + } +} + static struct mbuf * urtwn_rx_copy_to_mbuf(struct urtwn_softc *sc, struct r92c_rx_stat *stat, int totlen) From owner-svn-src-all@freebsd.org Mon Jun 20 22:45:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D43EAAC4275; Mon, 20 Jun 2016 22:45:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB24920CD; Mon, 20 Jun 2016 22:45:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5KMjJxd046232; Mon, 20 Jun 2016 22:45:19 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5KMjJLv046231; Mon, 20 Jun 2016 22:45:19 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201606202245.u5KMjJLv046231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 20 Jun 2016 22:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302035 - head/sys/dev/rtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 22:45:20 -0000 Author: avos Date: Mon Jun 20 22:45:19 2016 New Revision: 302035 URL: https://svnweb.freebsd.org/changeset/base/302035 Log: rtwn: fix Tx processing, add some busdma synchronization. 1) Unload mbuf instead of descriptor in rtwn_tx_done(). 2) Add more synchronization for device visible mappings before touching the memory. 3) Improve watchdog timer logic. Reported and tested by: mva Approved by: re (gjb) Modified: head/sys/dev/rtwn/if_rtwn.c Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Mon Jun 20 22:39:32 2016 (r302034) +++ head/sys/dev/rtwn/if_rtwn.c Mon Jun 20 22:45:19 2016 (r302035) @@ -586,6 +586,9 @@ rtwn_free_rx_list(struct rtwn_softc *sc) if (rx_ring->desc_dmat != NULL) { if (rx_ring->desc != NULL) { + bus_dmamap_sync(rx_ring->desc_dmat, + rx_ring->desc_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(rx_ring->desc_dmat, rx_ring->desc_map); bus_dmamem_free(rx_ring->desc_dmat, rx_ring->desc, @@ -600,6 +603,8 @@ rtwn_free_rx_list(struct rtwn_softc *sc) rx_data = &rx_ring->rx_data[i]; if (rx_data->m != NULL) { + bus_dmamap_sync(rx_ring->data_dmat, + rx_data->map, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(rx_ring->data_dmat, rx_data->map); m_freem(rx_data->m); rx_data->m = NULL; @@ -643,6 +648,8 @@ rtwn_alloc_tx_list(struct rtwn_softc *sc device_printf(sc->sc_dev, "could not load desc DMA map\n"); goto fail; } + bus_dmamap_sync(tx_ring->desc_dmat, tx_ring->desc_map, + BUS_DMASYNC_PREWRITE); error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, @@ -691,6 +698,8 @@ rtwn_reset_tx_list(struct rtwn_softc *sc sizeof(desc->nextdescaddr))); if (tx_data->m != NULL) { + bus_dmamap_sync(tx_ring->data_dmat, tx_data->map, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(tx_ring->data_dmat, tx_data->map); m_freem(tx_data->m); tx_data->m = NULL; @@ -718,6 +727,8 @@ rtwn_free_tx_list(struct rtwn_softc *sc, if (tx_ring->desc_dmat != NULL) { if (tx_ring->desc != NULL) { + bus_dmamap_sync(tx_ring->desc_dmat, + tx_ring->desc_map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(tx_ring->desc_dmat, tx_ring->desc_map); bus_dmamem_free(tx_ring->desc_dmat, tx_ring->desc, @@ -730,6 +741,8 @@ rtwn_free_tx_list(struct rtwn_softc *sc, tx_data = &tx_ring->tx_data[i]; if (tx_data->m != NULL) { + bus_dmamap_sync(tx_ring->data_dmat, tx_data->map, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(tx_ring->data_dmat, tx_data->map); m_freem(tx_data->m); tx_data->m = NULL; @@ -1761,7 +1774,10 @@ rtwn_tx_done(struct rtwn_softc *sc, int if (le32toh(tx_desc->txdw0) & R92C_TXDW0_OWN) continue; - bus_dmamap_unload(tx_ring->desc_dmat, tx_ring->desc_map); + /* Unmap and free mbuf. */ + bus_dmamap_sync(tx_ring->data_dmat, tx_data->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(tx_ring->data_dmat, tx_data->map); /* * XXX TODO: figure out whether the transmit succeeded or not. @@ -1771,8 +1787,10 @@ rtwn_tx_done(struct rtwn_softc *sc, int tx_data->ni = NULL; tx_data->m = NULL; - sc->sc_tx_timer = 0; - tx_ring->queued--; + if (--tx_ring->queued) + sc->sc_tx_timer = 5; + else + sc->sc_tx_timer = 0; } if (tx_ring->queued < (RTWN_TX_LIST_COUNT - 1)) From owner-svn-src-all@freebsd.org Mon Jun 20 23:17:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 995C4AC4D72; Mon, 20 Jun 2016 23:17:01 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AC32123C; Mon, 20 Jun 2016 23:17:01 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5KNH09T057421; Mon, 20 Jun 2016 23:17:00 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5KNH0TH057420; Mon, 20 Jun 2016 23:17:00 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201606202317.u5KNH0TH057420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 20 Jun 2016 23:17:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302036 - head/tests/sys/acl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 23:17:01 -0000 Author: asomers Date: Mon Jun 20 23:17:00 2016 New Revision: 302036 URL: https://svnweb.freebsd.org/changeset/base/302036 Log: Skip sys/acl tests on systems lacking perl tests/sys/acl/Makefile add perl to the required_programs for all tests in this directory Reviewed by: ngie Approved by: re (gjb) MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6870 Modified: head/tests/sys/acl/Makefile Modified: head/tests/sys/acl/Makefile ============================================================================== --- head/tests/sys/acl/Makefile Mon Jun 20 22:45:19 2016 (r302035) +++ head/tests/sys/acl/Makefile Mon Jun 20 23:17:00 2016 (r302036) @@ -27,11 +27,11 @@ TEST_METADATA.$t+= required_user="root" _ACL_PROGS= getfacl setfacl .for t in 01 03 04 -TEST_METADATA.$t+= required_programs="zpool ${_ACL_PROGS}" +TEST_METADATA.$t+= required_programs="perl zpool ${_ACL_PROGS}" .endfor .for t in 00 02 -TEST_METADATA.$t+= required_programs="${_ACL_PROGS}" +TEST_METADATA.$t+= required_programs="perl ${_ACL_PROGS}" .endfor .include From owner-svn-src-all@freebsd.org Mon Jun 20 23:55:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BB49AC4405; Mon, 20 Jun 2016 23:55:36 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE5952276; Mon, 20 Jun 2016 23:55:35 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5KNtZvb071720; Mon, 20 Jun 2016 23:55:35 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5KNtXAj071708; Mon, 20 Jun 2016 23:55:33 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201606202355.u5KNtXAj071708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Mon, 20 Jun 2016 23:55:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r302037 - in vendor/libarchive/dist: . build libarchive libarchive/test X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 23:55:36 -0000 Author: mm Date: Mon Jun 20 23:55:33 2016 New Revision: 302037 URL: https://svnweb.freebsd.org/changeset/base/302037 Log: Update vendor/libarchive to git 139d0576b51a253732a5ab1f66805dffbf8b00af tag v3.2.1 Fixed vendor issues: Issue 521: Properly check reading from lzss decompression buffer Issue 717: Fix integer overflow when computing location of volume descriptor Issue 718: Security fix TALOS-CAN-152 Issue 719: Security fix TALOS-CAN-154 Security: TALOS-CAN-152, TALOS-CAN-154 Modified: vendor/libarchive/dist/Makefile.am vendor/libarchive/dist/NEWS vendor/libarchive/dist/build/version vendor/libarchive/dist/configure.ac vendor/libarchive/dist/libarchive/archive.h vendor/libarchive/dist/libarchive/archive_entry.h vendor/libarchive/dist/libarchive/archive_ppmd7.c vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c vendor/libarchive/dist/libarchive/archive_read_support_format_iso9660.c vendor/libarchive/dist/libarchive/archive_read_support_format_rar.c vendor/libarchive/dist/libarchive/test/CMakeLists.txt vendor/libarchive/dist/libarchive/test/test_write_format_gnutar_filenames.c Modified: vendor/libarchive/dist/Makefile.am ============================================================================== --- vendor/libarchive/dist/Makefile.am Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/Makefile.am Mon Jun 20 23:55:33 2016 (r302037) @@ -454,6 +454,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_rar_encryption_data.c \ libarchive/test/test_read_format_rar_encryption_partially.c \ libarchive/test/test_read_format_rar_encryption_header.c \ + libarchive/test/test_read_format_rar_invalid1.c \ libarchive/test/test_read_format_raw.c \ libarchive/test/test_read_format_tar.c \ libarchive/test/test_read_format_tar_concatenated.c \ @@ -747,6 +748,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_rar_encryption_data.rar.uu \ libarchive/test/test_read_format_rar_encryption_header.rar.uu \ libarchive/test/test_read_format_rar_encryption_partially.rar.uu \ + libarchive/test/test_read_format_rar_invalid1.rar.uu \ libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu \ libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu \ libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu \ Modified: vendor/libarchive/dist/NEWS ============================================================================== --- vendor/libarchive/dist/NEWS Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/NEWS Mon Jun 20 23:55:33 2016 (r302037) @@ -1,3 +1,8 @@ +Jun 20, 2016: libarchive 3.2.1 released + This fixes a handful of security and other critical issues with 3.2.0 + +May 01, 2016: libarchive 3.2.0 released + Apr 09, 2016: libarchive 3.1.901a released Another test release in preparation for 3.2.0 Modified: vendor/libarchive/dist/build/version ============================================================================== --- vendor/libarchive/dist/build/version Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/build/version Mon Jun 20 23:55:33 2016 (r302037) @@ -1 +1 @@ -3002000 +3002001 Modified: vendor/libarchive/dist/configure.ac ============================================================================== --- vendor/libarchive/dist/configure.ac Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/configure.ac Mon Jun 20 23:55:33 2016 (r302037) @@ -4,8 +4,8 @@ dnl First, define all of the version num dnl In particular, this allows the version macro to be used in AC_INIT dnl These first two version numbers are updated automatically on each release. -m4_define([LIBARCHIVE_VERSION_S],[3.2.0]) -m4_define([LIBARCHIVE_VERSION_N],[3002000]) +m4_define([LIBARCHIVE_VERSION_S],[3.2.1]) +m4_define([LIBARCHIVE_VERSION_N],[3002001]) dnl bsdtar and bsdcpio versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) Modified: vendor/libarchive/dist/libarchive/archive.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive.h Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/libarchive/archive.h Mon Jun 20 23:55:33 2016 (r302037) @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3002000 +#define ARCHIVE_VERSION_NUMBER 3002001 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(vo /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.2.0" +#define ARCHIVE_VERSION_ONLY_STRING "3.2.1" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); Modified: vendor/libarchive/dist/libarchive/archive_entry.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_entry.h Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/libarchive/archive_entry.h Mon Jun 20 23:55:33 2016 (r302037) @@ -29,7 +29,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3002000 +#define ARCHIVE_VERSION_NUMBER 3002001 /* * Note: archive_entry.h is for use outside of libarchive; the Modified: vendor/libarchive/dist/libarchive/archive_ppmd7.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_ppmd7.c Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/libarchive/archive_ppmd7.c Mon Jun 20 23:55:33 2016 (r302037) @@ -126,6 +126,11 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt3 { if (p->Base == 0 || p->Size != size) { + /* RestartModel() below assumes that p->Size >= UNIT_SIZE + (see the calculation of m->MinContext). */ + if (size < UNIT_SIZE) { + return False; + } Ppmd7_Free(p, alloc); p->AlignOffset = #ifdef PPMD_32BIT Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c Mon Jun 20 23:55:33 2016 (r302037) @@ -2153,6 +2153,9 @@ read_SubStreamsInfo(struct archive_read return (-1); if (UMAX_ENTRY < f[i].numUnpackStreams) return (-1); + if (unpack_streams > SIZE_MAX - UMAX_ENTRY) { + return (-1); + } unpack_streams += (size_t)f[i].numUnpackStreams; } if ((p = header_bytes(a, 1)) == NULL) Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_iso9660.c Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_iso9660.c Mon Jun 20 23:55:33 2016 (r302037) @@ -1091,7 +1091,7 @@ choose_volume(struct archive_read *a, st /* This condition is unlikely; by way of caution. */ vd = &(iso9660->joliet); - skipsize = LOGICAL_BLOCK_SIZE * vd->location; + skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location; skipsize = __archive_read_consume(a, skipsize); if (skipsize < 0) return ((int)skipsize); @@ -1129,7 +1129,7 @@ choose_volume(struct archive_read *a, st && iso9660->seenJoliet) { /* Switch reading data from primary to joliet. */ vd = &(iso9660->joliet); - skipsize = LOGICAL_BLOCK_SIZE * vd->location; + skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location; skipsize -= iso9660->current_position; skipsize = __archive_read_consume(a, skipsize); if (skipsize < 0) Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_rar.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_rar.c Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_rar.c Mon Jun 20 23:55:33 2016 (r302037) @@ -2127,6 +2127,12 @@ parse_codes(struct archive_read *a) rar->range_dec.Stream = &rar->bytein; __archive_ppmd7_functions.Ppmd7_Construct(&rar->ppmd7_context); + if (rar->dictionary_size == 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Invalid zero dictionary size"); + return (ARCHIVE_FATAL); + } + if (!__archive_ppmd7_functions.Ppmd7_Alloc(&rar->ppmd7_context, rar->dictionary_size, &g_szalloc)) { @@ -2884,11 +2890,10 @@ copy_from_lzss_window(struct archive_rea } windowoffs = lzss_offset_for_position(&rar->lzss, startpos); - if(windowoffs + length <= lzss_size(&rar->lzss)) + if(windowoffs + length <= lzss_size(&rar->lzss)) { memcpy(&rar->unp_buffer[rar->unp_offset], &rar->lzss.window[windowoffs], length); - else - { + } else if (length <= lzss_size(&rar->lzss)) { firstpart = lzss_size(&rar->lzss) - windowoffs; if (firstpart < 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, @@ -2900,9 +2905,14 @@ copy_from_lzss_window(struct archive_rea &rar->lzss.window[windowoffs], firstpart); memcpy(&rar->unp_buffer[rar->unp_offset + firstpart], &rar->lzss.window[0], length - firstpart); - } else + } else { memcpy(&rar->unp_buffer[rar->unp_offset], &rar->lzss.window[windowoffs], length); + } + } else { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Bad RAR file data"); + return (ARCHIVE_FATAL); } rar->unp_offset += length; if (rar->unp_offset >= rar->unp_buffer_size) Modified: vendor/libarchive/dist/libarchive/test/CMakeLists.txt ============================================================================== --- vendor/libarchive/dist/libarchive/test/CMakeLists.txt Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/libarchive/test/CMakeLists.txt Mon Jun 20 23:55:33 2016 (r302037) @@ -143,6 +143,7 @@ IF(ENABLE_TEST) test_read_format_rar_encryption_data.c test_read_format_rar_encryption_header.c test_read_format_rar_encryption_partially.c + test_read_format_rar_invalid1.c test_read_format_raw.c test_read_format_tar.c test_read_format_tar_concatenated.c Modified: vendor/libarchive/dist/libarchive/test/test_write_format_gnutar_filenames.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/test_write_format_gnutar_filenames.c Mon Jun 20 23:17:00 2016 (r302036) +++ vendor/libarchive/dist/libarchive/test/test_write_format_gnutar_filenames.c Mon Jun 20 23:55:33 2016 (r302037) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); * reads back to verify it. */ -static char filename[1024]; +static char filename[2048]; DEFINE_TEST(test_write_format_gnutar_filenames) { From owner-svn-src-all@freebsd.org Tue Jun 21 00:00:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42C11AC46FE; Tue, 21 Jun 2016 00:00:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02EB42541; Tue, 21 Jun 2016 00:00:06 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L006WN071968; Tue, 21 Jun 2016 00:00:06 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L006n4071966; Tue, 21 Jun 2016 00:00:06 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201606210000.u5L006n4071966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Tue, 21 Jun 2016 00:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r302038 - vendor/libarchive/dist/libarchive/test X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 00:00:07 -0000 Author: mm Date: Tue Jun 21 00:00:05 2016 New Revision: 302038 URL: https://svnweb.freebsd.org/changeset/base/302038 Log: Add two missing test files in r302037 Added: vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.c (contents, props changed) vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.rar.uu Added: vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.c Tue Jun 21 00:00:05 2016 (r302038) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2003-2016 Tim Kientzle + * 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(S) ``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(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_rar_invalid1) +{ + const char *refname = "test_read_format_rar_invalid1.rar"; + struct archive *a; + struct archive_entry *ae; + char *buff[100]; + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, refname, 10240)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_data(a, buff, 99)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} Added: vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.rar.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.rar.uu Tue Jun 21 00:00:05 2016 (r302038) @@ -0,0 +1,5 @@ +begin 644 test_read_format_rar_invalid1.rar +M4F%R(1H'`,^0B$4= +2,P0`I($``'1E Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DD40AC4795; Tue, 21 Jun 2016 00:01:03 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16F3027A9; Tue, 21 Jun 2016 00:01:03 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L0125M072355; Tue, 21 Jun 2016 00:01:02 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L012Wu072338; Tue, 21 Jun 2016 00:01:02 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201606210001.u5L012Wu072338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Tue, 21 Jun 2016 00:01:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r302039 - vendor/libarchive/3.2.1 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 00:01:03 -0000 Author: mm Date: Tue Jun 21 00:01:02 2016 New Revision: 302039 URL: https://svnweb.freebsd.org/changeset/base/302039 Log: Tag libarchive 3.2.1 Added: vendor/libarchive/3.2.1/ - copied from r302038, vendor/libarchive/dist/ From owner-svn-src-all@freebsd.org Tue Jun 21 02:36:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2AFDAC503B; Tue, 21 Jun 2016 02:36:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E77113D6; Tue, 21 Jun 2016 02:36:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L2a3Ex030523; Tue, 21 Jun 2016 02:36:03 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L2a39L030518; Tue, 21 Jun 2016 02:36:03 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210236.u5L2a39L030518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 02:36: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: r302040 - in stable/10/sys/dev/hyperv: netvsc storvsc vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 02:36:04 -0000 Author: sephe Date: Tue Jun 21 02:36:03 2016 New Revision: 302040 URL: https://svnweb.freebsd.org/changeset/base/302040 Log: MFC 297815,297841,297908,297913 297815 hyperv: Typo Noticed by: kib MFC after: 1 week Sponsored by: Microsoft OSTC 297841 hyperv: Replace 0 w/ NULL Submitted by: pfg MFC after: 1 week Sponsored by: Microsoft OSTC 297908 hyperv/vmbus: Merge duplicated version check for events Submitted by: Jun Su Reviewed by: sephe MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5911 297913 hyperv: device_get_softc does not return NULL MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 00:01:02 2016 (r302039) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 02:36:03 2016 (r302040) @@ -433,9 +433,6 @@ netvsc_attach(device_t dev) int tso_maxlen; sc = device_get_softc(dev); - if (sc == NULL) { - return (ENOMEM); - } bzero(sc, sizeof(hn_softc_t)); sc->hn_unit = unit; @@ -1186,10 +1183,6 @@ netvsc_linkstatus_callback(struct hv_dev { hn_softc_t *sc = device_get_softc(device_obj->device); - if (sc == NULL) { - return; - } - if (status == 1) { sc->hn_carrier = 1; } else { Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 00:01:02 2016 (r302039) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 02:36:03 2016 (r302040) @@ -324,9 +324,6 @@ get_stor_device(struct hv_device *device struct storvsc_softc *sc; sc = device_get_softc(device->device); - if (sc == NULL) { - return NULL; - } if (outbound) { /* @@ -1009,10 +1006,6 @@ storvsc_attach(device_t dev) root_mount_token = root_mount_hold("storvsc"); sc = device_get_softc(dev); - if (sc == NULL) { - ret = ENOMEM; - goto cleanup; - } stor_type = storvsc_get_storage_type(dev); Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Tue Jun 21 00:01:02 2016 (r302039) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Tue Jun 21 02:36:03 2016 (r302040) @@ -308,14 +308,18 @@ hv_vmbus_on_events(int cpu) KASSERT(cpu <= mp_maxid, ("VMBUS: hv_vmbus_on_events: " "cpu out of range!")); + page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu]; + event = (hv_vmbus_synic_event_flags *) + page_addr + HV_VMBUS_MESSAGE_SINT; if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) || (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7)) { maxdword = HV_MAX_NUM_CHANNELS_SUPPORTED >> 5; /* * receive size is 1/2 page and divide that by 4 bytes */ - recv_interrupt_page = - hv_vmbus_g_connection.recv_interrupt_page; + if (synch_test_and_clear_bit(0, &event->flags32[0])) + recv_interrupt_page = + hv_vmbus_g_connection.recv_interrupt_page; } else { /* * On Host with Win8 or above, the event page can be @@ -323,9 +327,6 @@ hv_vmbus_on_events(int cpu) * that has the pending interrupt. */ maxdword = HV_EVENT_FLAGS_DWORD_COUNT; - page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu]; - event = (hv_vmbus_synic_event_flags *) - page_addr + HV_VMBUS_MESSAGE_SINT; recv_interrupt_page = event->flags32; } Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Tue Jun 21 00:01:02 2016 (r302039) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Tue Jun 21 02:36:03 2016 (r302040) @@ -127,7 +127,7 @@ int hv_vmbus_init(void) { hv_vmbus_x64_msr_hypercall_contents hypercall_msr; - void* virt_addr = 0; + void* virt_addr = NULL; memset( hv_vmbus_g_context.syn_ic_event_page, @@ -445,7 +445,7 @@ hyperv_identify(void) "\003SYNIC" /* MSRs for SynIC */ "\004SYNTM" /* MSRs for SynTimer */ "\005APIC" /* MSR_{EOI,ICR,TPR} */ - "\006HYERCALL" /* MSR_{GUEST_OS_ID,HYPERCALL} */ + "\006HYPERCALL" /* MSR_{GUEST_OS_ID,HYPERCALL} */ "\007VPINDEX" /* MSR_VP_INDEX */ "\010RESET" /* MSR_RESET */ "\011STATS" /* MSR_STATS_ */ Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 00:01:02 2016 (r302039) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 02:36:03 2016 (r302040) @@ -145,7 +145,6 @@ hv_vmbus_isr(struct trapframe *frame) { int cpu; hv_vmbus_message* msg; - hv_vmbus_synic_event_flags* event; void* page_addr; cpu = PCPU_GET(cpuid); @@ -156,26 +155,7 @@ hv_vmbus_isr(struct trapframe *frame) * in Windows when running as a guest in Hyper-V */ - page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu]; - event = (hv_vmbus_synic_event_flags*) - page_addr + HV_VMBUS_MESSAGE_SINT; - - if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) || - (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7)) { - /* Since we are a child, we only need to check bit 0 */ - if (synch_test_and_clear_bit(0, &event->flags32[0])) { - hv_vmbus_on_events(cpu); - } - } else { - /* - * On host with Win8 or above, we can directly look at - * the event page. If bit n is set, we have an interrupt - * on the channel with id n. - * Directly schedule the event software interrupt on - * current cpu. - */ - hv_vmbus_on_events(cpu); - } + hv_vmbus_on_events(cpu); /* Check if there are actual msgs to be process */ page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu]; @@ -672,7 +652,7 @@ vmbus_bus_exit(void) smp_rendezvous(NULL, hv_vmbus_synic_cleanup, NULL, NULL); for(i = 0; i < 2 * MAXCPU; i++) { - if (setup_args.page_buffers[i] != 0) + if (setup_args.page_buffers[i] != NULL) free(setup_args.page_buffers[i], M_DEVBUF); } From owner-svn-src-all@freebsd.org Tue Jun 21 04:51:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC692A7AEF9; Tue, 21 Jun 2016 04:51:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E7E22D75; Tue, 21 Jun 2016 04:51:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L4pueU082084; Tue, 21 Jun 2016 04:51:56 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L4ptYP082074; Tue, 21 Jun 2016 04:51:55 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210451.u5L4ptYP082074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 04:51: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: r302041 - in stable/10/sys: amd64/amd64 amd64/conf conf dev/hyperv/vmbus dev/hyperv/vmbus/amd64 dev/hyperv/vmbus/i386 i386/conf i386/i386 modules/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 04:51:58 -0000 Author: sephe Date: Tue Jun 21 04:51:55 2016 New Revision: 302041 URL: https://svnweb.freebsd.org/changeset/base/302041 Log: MFC 297931,298022 297931 Expose doreti as a global symbol on amd64 and i386. doreti provides the common code path for returning from interrupt andlers on x86. Exposing doreti as a global symbol allows kernel modules to include low-level interrupt handlers instead of requiring all low-level handlers to be statically compiled into the kernel. Submitted by: Howard Su Reviewed by: kib 298022 hyperv: Deprecate HYPERV option by moving Hyper-V IDT vector into vmbus Submitted by: Jun Su Reviewed by: jhb, kib, sephe Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5910 Added: stable/10/sys/dev/hyperv/vmbus/amd64/ - copied from r298022, head/sys/dev/hyperv/vmbus/amd64/ stable/10/sys/dev/hyperv/vmbus/i386/ - copied from r298022, head/sys/dev/hyperv/vmbus/i386/ Modified: stable/10/sys/amd64/amd64/apic_vector.S stable/10/sys/amd64/amd64/exception.S stable/10/sys/amd64/conf/GENERIC stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/i386/conf/GENERIC stable/10/sys/i386/i386/apic_vector.s stable/10/sys/i386/i386/exception.s stable/10/sys/modules/hyperv/vmbus/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/apic_vector.S ============================================================================== --- stable/10/sys/amd64/amd64/apic_vector.S Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/amd64/amd64/apic_vector.S Tue Jun 21 04:51:55 2016 (r302041) @@ -150,22 +150,6 @@ IDTVEC(xen_intr_upcall) jmp doreti #endif -#ifdef HYPERV -/* - * This is the Hyper-V vmbus channel direct callback interrupt. - * Only used when it is running on Hyper-V. - */ - .text - SUPERALIGN_TEXT -IDTVEC(hv_vmbus_callback) - PUSH_FRAME - FAKE_MCOUNT(TF_RIP(%rsp)) - movq %rsp, %rdi - call hv_vector_handler - MEXITCOUNT - jmp doreti -#endif - #ifdef SMP /* * Global address space TLB shootdown. Modified: stable/10/sys/amd64/amd64/exception.S ============================================================================== --- stable/10/sys/amd64/amd64/exception.S Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/amd64/amd64/exception.S Tue Jun 21 04:51:55 2016 (r302041) @@ -661,6 +661,7 @@ MCOUNT_LABEL(eintr) .text SUPERALIGN_TEXT .type doreti,@function + .globl doreti doreti: FAKE_MCOUNT($bintr) /* init "from" bintr -> doreti */ /* Modified: stable/10/sys/amd64/conf/GENERIC ============================================================================== --- stable/10/sys/amd64/conf/GENERIC Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/amd64/conf/GENERIC Tue Jun 21 04:51:55 2016 (r302041) @@ -353,7 +353,6 @@ device virtio_scsi # VirtIO SCSI devic device virtio_balloon # VirtIO Memory Balloon device # HyperV drivers and enchancement support -# NOTE: HYPERV depends on hyperv. They must be added or removed together. options HYPERV # Hyper-V kernel infrastructure device hyperv # HyperV drivers Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/conf/files.amd64 Tue Jun 21 04:51:55 2016 (r302041) @@ -278,6 +278,7 @@ dev/hyperv/vmbus/hv_hv.c optional hyp dev/hyperv/vmbus/hv_et.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv +dev/hyperv/vmbus/amd64/hv_vector.S optional hyperv dev/kbd/kbd.c optional atkbd | sc | ukbd | vt dev/lindev/full.c optional lindev dev/lindev/lindev.c optional lindev Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/conf/files.i386 Tue Jun 21 04:51:55 2016 (r302041) @@ -254,6 +254,7 @@ dev/hyperv/vmbus/hv_hv.c optional hyp dev/hyperv/vmbus/hv_et.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv +dev/hyperv/vmbus/i386/hv_vector.S optional hyperv dev/ichwd/ichwd.c optional ichwd dev/if_ndis/if_ndis.c optional ndis dev/if_ndis/if_ndis_pccard.c optional ndis pccard Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 04:51:55 2016 (r302041) @@ -370,7 +370,6 @@ vmbus_probe(device_t dev) { return (BUS_PROBE_DEFAULT); } -#ifdef HYPERV extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback); /** @@ -430,21 +429,6 @@ vmbus_vector_free(int vector) setidt(vector, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0); } -#else /* HYPERV */ - -static int -vmbus_vector_alloc(void) -{ - return(0); -} - -static void -vmbus_vector_free(int vector) -{ -} - -#endif /* HYPERV */ - static void vmbus_cpuset_setthread_task(void *xmask, int pending __unused) { Modified: stable/10/sys/i386/conf/GENERIC ============================================================================== --- stable/10/sys/i386/conf/GENERIC Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/i386/conf/GENERIC Tue Jun 21 04:51:55 2016 (r302041) @@ -362,7 +362,6 @@ device virtio_scsi # VirtIO SCSI devic device virtio_balloon # VirtIO Memory Balloon device # HyperV drivers and enchancement support -# NOTE: HYPERV depends on hyperv. They must be added or removed together. options HYPERV # Hyper-V kernel infrastructure device hyperv # HyperV drivers Modified: stable/10/sys/i386/i386/apic_vector.s ============================================================================== --- stable/10/sys/i386/i386/apic_vector.s Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/i386/i386/apic_vector.s Tue Jun 21 04:51:55 2016 (r302041) @@ -157,25 +157,6 @@ IDTVEC(xen_intr_upcall) jmp doreti #endif -#ifdef HYPERV -/* - * This is the Hyper-V vmbus channel direct callback interrupt. - * Only used when it is running on Hyper-V. - */ - .text - SUPERALIGN_TEXT -IDTVEC(hv_vmbus_callback) - PUSH_FRAME - SET_KERNEL_SREGS - cld - FAKE_MCOUNT(TF_EIP(%esp)) - pushl %esp - call hv_vector_handler - add $4, %esp - MEXITCOUNT - jmp doreti -#endif - #ifdef SMP /* * Global address space TLB shootdown. Modified: stable/10/sys/i386/i386/exception.s ============================================================================== --- stable/10/sys/i386/i386/exception.s Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/i386/i386/exception.s Tue Jun 21 04:51:55 2016 (r302041) @@ -344,6 +344,7 @@ MCOUNT_LABEL(eintr) .text SUPERALIGN_TEXT .type doreti,@function + .globl doreti doreti: FAKE_MCOUNT($bintr) /* init "from" bintr -> doreti */ doreti_next: Modified: stable/10/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- stable/10/sys/modules/hyperv/vmbus/Makefile Tue Jun 21 02:36:03 2016 (r302040) +++ stable/10/sys/modules/hyperv/vmbus/Makefile Tue Jun 21 04:51:55 2016 (r302041) @@ -1,7 +1,7 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../../dev/hyperv/vmbus \ - ${.CURDIR}/../../../dev/hyperv/utilities + ${.CURDIR}/../../../dev/hyperv/vmbus/${MACHINE_CPUARCH} KMOD= hv_vmbus SRCS= hv_channel.c \ @@ -14,8 +14,17 @@ SRCS= hv_channel.c \ hv_vmbus_priv.h SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h +# XXX: for assym.s +SRCS+= opt_kstack_pages.h opt_nfs.h opt_apic.h opt_hwpmc_hooks.h opt_compat.h + +SRCS+= assym.s \ + hv_vector.S + +hv_vector.o: + ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ + ${.IMPSRC} -o ${.TARGET} + CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/include \ - -I${.CURDIR}/../../../dev/hyperv/vmbus \ - -I${.CURDIR}/../../../dev/hyperv/utilities + -I${.CURDIR}/../../../dev/hyperv/vmbus .include From owner-svn-src-all@freebsd.org Tue Jun 21 05:02:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 902ECAC41E3; Tue, 21 Jun 2016 05:02:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CF48132D; Tue, 21 Jun 2016 05:02:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L523hD085150; Tue, 21 Jun 2016 05:02:03 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L5239i085149; Tue, 21 Jun 2016 05:02:03 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210502.u5L5239i085149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 05:02: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: r302042 - stable/10/sys/dev/hyperv/storvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 05:02:04 -0000 Author: sephe Date: Tue Jun 21 05:02:03 2016 New Revision: 302042 URL: https://svnweb.freebsd.org/changeset/base/302042 Log: MFC 298040 hyperv/stor: Use xpt_done_direct() upon I/O completion Reviewed by: mav MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5955 Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 04:51:55 2016 (r302041) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 05:02:03 2016 (r302042) @@ -2133,8 +2133,9 @@ storvsc_io_done(struct hv_storvsc_reques reqp->softc->hs_frozen = 0; } storvsc_free_request(sc, reqp); - xpt_done(ccb); mtx_unlock(&sc->hs_lock); + + xpt_done_direct(ccb); } /** From owner-svn-src-all@freebsd.org Tue Jun 21 05:11:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E99FDAC42D1; Tue, 21 Jun 2016 05:11:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C1C21750; Tue, 21 Jun 2016 05:11:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L5BJAt086907; Tue, 21 Jun 2016 05:11:19 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L5BJLa086904; Tue, 21 Jun 2016 05:11:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210511.u5L5BJLa086904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 05:11: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: r302043 - in stable/10/sys/dev/hyperv: netvsc storvsc vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 05:11:21 -0000 Author: sephe Date: Tue Jun 21 05:11:19 2016 New Revision: 302043 URL: https://svnweb.freebsd.org/changeset/base/302043 Log: MFC 298041,298259 298041 hyperv: No need to zero out softc MFC after: 1 week Sponsored by: Microsoft OSTC 298259 hyperv: Remove two assign-only local variables Submitted by: Jun Su MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 05:02:03 2016 (r302042) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 05:11:19 2016 (r302043) @@ -434,7 +434,6 @@ netvsc_attach(device_t dev) sc = device_get_softc(dev); - bzero(sc, sizeof(hn_softc_t)); sc->hn_unit = unit; sc->hn_dev = dev; Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 05:02:03 2016 (r302042) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 05:11:19 2016 (r302043) @@ -1014,8 +1014,6 @@ storvsc_attach(device_t dev) goto cleanup; } - bzero(sc, sizeof(struct storvsc_softc)); - /* fill in driver specific properties */ sc->hs_drv_props = &g_drv_props_table[stor_type]; Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jun 21 05:02:03 2016 (r302042) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jun 21 05:11:19 2016 (r302043) @@ -375,12 +375,6 @@ vmbus_channel_on_offer(hv_vmbus_channel_ offer = (hv_vmbus_channel_offer_channel*) hdr; - hv_guid *guidType; - hv_guid *guidInstance; - - guidType = &offer->offer.interface_type; - guidInstance = &offer->offer.interface_instance; - // copy offer data copied = malloc(sizeof(*copied), M_DEVBUF, M_NOWAIT); if (copied == NULL) { From owner-svn-src-all@freebsd.org Tue Jun 21 05:16:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F58CAC449B; Tue, 21 Jun 2016 05:16:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33E931C1E; Tue, 21 Jun 2016 05:16:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L5GMul089756; Tue, 21 Jun 2016 05:16:22 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L5GMxa089753; Tue, 21 Jun 2016 05:16:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210516.u5L5GMxa089753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 05:16:22 +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: r302044 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 05:16:23 -0000 Author: sephe Date: Tue Jun 21 05:16:21 2016 New Revision: 302044 URL: https://svnweb.freebsd.org/changeset/base/302044 Log: MFC 298260 hyperv/vmbus: Make device probe/attach synchronous w/ vmbus attach/SYSINIT Discussed with: Jun Su , Dexuan Cui MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jun 21 05:11:19 2016 (r302043) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jun 21 05:16:21 2016 (r302044) @@ -30,7 +30,10 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include +#include #include "hv_vmbus_priv.h" @@ -95,6 +98,14 @@ typedef struct hv_work_item { void* context; } hv_work_item; +static struct mtx vmbus_chwait_lock; +MTX_SYSINIT(vmbus_chwait_lk, &vmbus_chwait_lock, "vmbus primarych wait lock", + MTX_DEF); +static uint32_t vmbus_chancnt; +static uint32_t vmbus_devcnt; + +#define VMBUS_CHANCNT_DONE 0x80000000 + /** * Implementation of the work abstraction. */ @@ -279,6 +290,11 @@ vmbus_channel_process_offer(hv_vmbus_cha mtx_unlock(&hv_vmbus_g_connection.channel_lock); hv_vmbus_free_vmbus_channel(new_channel); } + + mtx_lock(&vmbus_chwait_lock); + vmbus_devcnt++; + mtx_unlock(&vmbus_chwait_lock); + wakeup(&vmbus_devcnt); } void @@ -384,6 +400,11 @@ vmbus_channel_on_offer(hv_vmbus_channel_ memcpy(copied, hdr, sizeof(*copied)); hv_queue_work_item(vmbus_channel_on_offer_internal, copied); + + mtx_lock(&vmbus_chwait_lock); + if ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0) + vmbus_chancnt++; + mtx_unlock(&vmbus_chwait_lock); } static void @@ -475,6 +496,11 @@ vmbus_channel_on_offer_rescind_internal( static void vmbus_channel_on_offers_delivered(hv_vmbus_channel_msg_header* hdr) { + + mtx_lock(&vmbus_chwait_lock); + vmbus_chancnt |= VMBUS_CHANCNT_DONE; + mtx_unlock(&vmbus_chwait_lock); + wakeup(&vmbus_chancnt); } /** @@ -752,3 +778,18 @@ vmbus_select_outgoing_channel(struct hv_ return(outgoing_channel); } + +void +vmbus_scan(void) +{ + uint32_t chancnt; + + mtx_lock(&vmbus_chwait_lock); + while ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0) + mtx_sleep(&vmbus_chancnt, &vmbus_chwait_lock, 0, "waitch", 0); + chancnt = vmbus_chancnt & ~VMBUS_CHANCNT_DONE; + + while (vmbus_devcnt != chancnt) + mtx_sleep(&vmbus_devcnt, &vmbus_chwait_lock, 0, "waitdev", 0); + mtx_unlock(&vmbus_chwait_lock); +} Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 05:11:19 2016 (r302043) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 05:16:21 2016 (r302044) @@ -326,7 +326,6 @@ int hv_vmbus_child_device_register(struct hv_device *child_dev) { device_t child; - int ret = 0; if (bootverbose) { char name[40]; @@ -338,10 +337,6 @@ hv_vmbus_child_device_register(struct hv child_dev->device = child; device_set_ivars(child, child_dev); - mtx_lock(&Giant); - ret = device_probe_and_attach(child); - mtx_unlock(&Giant); - return (0); } @@ -562,6 +557,11 @@ vmbus_bus_init(void) goto cleanup1; hv_vmbus_request_channel_offers(); + + vmbus_scan(); + bus_generic_attach(vmbus_devp); + device_printf(vmbus_devp, "device scan, probe and attach done\n"); + return (ret); cleanup1: Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jun 21 05:11:19 2016 (r302043) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jun 21 05:16:21 2016 (r302044) @@ -751,6 +751,9 @@ void hv_vmbus_on_events(int cpu); void hv_et_init(void); void hv_et_intr(struct trapframe*); +/* Wait for device creation */ +void vmbus_scan(void); + /* * The guest OS needs to register the guest ID with the hypervisor. * The guest ID is a 64 bit entity and the structure of this ID is From owner-svn-src-all@freebsd.org Tue Jun 21 05:20:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF9A6AC46B1; Tue, 21 Jun 2016 05:20:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CD1B1F1F; Tue, 21 Jun 2016 05:20:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L5Khm0089990; Tue, 21 Jun 2016 05:20:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L5Kf5v089965; Tue, 21 Jun 2016 05:20:41 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210520.u5L5Kf5v089965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 05:20: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: r302045 - in stable/10/sys/dev/hyperv: include netvsc storvsc utilities vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 05:20:44 -0000 Author: sephe Date: Tue Jun 21 05:20:41 2016 New Revision: 302045 URL: https://svnweb.freebsd.org/changeset/base/302045 Log: MFC 298446 hyperv: Update copyright to 2016 for the files Microsoft changed in 2016 Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6039 Modified: stable/10/sys/dev/hyperv/include/hyperv.h stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis.h stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c stable/10/sys/dev/hyperv/utilities/hv_kvp.c stable/10/sys/dev/hyperv/utilities/hv_kvp.h stable/10/sys/dev/hyperv/utilities/hv_shutdown.c stable/10/sys/dev/hyperv/utilities/hv_timesync.c stable/10/sys/dev/hyperv/utilities/hv_util.c stable/10/sys/dev/hyperv/utilities/hv_util.h stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_et.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/10/sys/dev/hyperv/include/hyperv.h Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/include/hyperv.h Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2010-2012 Citrix Inc. - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * All rights reserved. * Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis.h Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis.h Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Microsoft Corp. + * Copyright (c) 2014,2016 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_kvp.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/utilities/hv_kvp.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Microsoft Corp. + * Copyright (c) 2014,2016 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.h ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_kvp.h Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/utilities/hv_kvp.h Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Microsoft Corp. + * Copyright (c) 2014,2016 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/10/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_shutdown.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/utilities/hv_shutdown.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Microsoft Corp. + * Copyright (c) 2014,2016 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/10/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_timesync.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/utilities/hv_timesync.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Microsoft Corp. + * Copyright (c) 2014,2016 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/10/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_util.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/utilities/hv_util.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Microsoft Corp. + * Copyright (c) 2014,2016 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/10/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_util.h Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/utilities/hv_util.h Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/vmbus/hv_et.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_et.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/vmbus/hv_et.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Microsoft Corp. + * Copyright (c) 2015,2016 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jun 21 05:16:21 2016 (r302044) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jun 21 05:20:41 2016 (r302045) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2016 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. From owner-svn-src-all@freebsd.org Tue Jun 21 05:33:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBA4BAC4CF5; Tue, 21 Jun 2016 05:33:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C5AC297A; Tue, 21 Jun 2016 05:33:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L5XQ8n097248; Tue, 21 Jun 2016 05:33:26 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L5XQV4097245; Tue, 21 Jun 2016 05:33:26 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210533.u5L5XQV4097245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 05:33: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: r302046 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 05:33:27 -0000 Author: sephe Date: Tue Jun 21 05:33:26 2016 New Revision: 302046 URL: https://svnweb.freebsd.org/changeset/base/302046 Log: MFC 298449,298568 298449 hyperv/et: Make Hyper-V event timer a device. Submitted by: Jun Su Reviewed by: sephe, Dexuan Cui MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5957 298568 hyperv/et: Strip extra white space in function name Reported by: Sascha Wildner MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/vmbus/hv_et.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_et.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_et.c Tue Jun 21 05:20:41 2016 (r302045) +++ stable/10/sys/dev/hyperv/vmbus/hv_et.c Tue Jun 21 05:33:26 2016 (r302046) @@ -28,6 +28,9 @@ __FBSDID("$FreeBSD$"); #include +#include +#include +#include #include #include #include @@ -40,8 +43,7 @@ __FBSDID("$FreeBSD$"); #define HV_MAX_DELTA_TICKS 0xffffffffLL #define HV_MIN_DELTA_TICKS 1LL -static struct eventtimer et; -static uint64_t periodticks[MAXCPU]; +static struct eventtimer *et; static inline uint64_t sbintime2tick(sbintime_t time) @@ -62,10 +64,6 @@ hv_et_start(struct eventtimer *et, sbint timer_cfg.auto_enable = 1; timer_cfg.sintx = HV_VMBUS_TIMER_SINT; - periodticks[curcpu] = sbintime2tick(periodtime); - if (firsttime == 0) - firsttime = periodtime; - current = rdmsr(HV_X64_MSR_TIME_REF_COUNT); current += sbintime2tick(firsttime); @@ -87,45 +85,77 @@ hv_et_stop(struct eventtimer *et) void hv_et_intr(struct trapframe *frame) { - union hv_timer_config timer_cfg; struct trapframe *oldframe; struct thread *td; - if (periodticks[curcpu] != 0) { - uint64_t tick = sbintime2tick(periodticks[curcpu]); - timer_cfg.as_uint64 = rdmsr(HV_X64_MSR_STIMER0_CONFIG); - timer_cfg.enable = 0; - timer_cfg.auto_enable = 1; - timer_cfg.periodic = 1; - periodticks[curcpu] = 0; - - wrmsr(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64); - wrmsr(HV_X64_MSR_STIMER0_COUNT, tick); - } - - if (et.et_active) { + if (et->et_active) { td = curthread; td->td_intr_nesting_level++; oldframe = td->td_intr_frame; td->td_intr_frame = frame; - et.et_event_cb(&et, et.et_arg); + et->et_event_cb(et, et->et_arg); td->td_intr_frame = oldframe; td->td_intr_nesting_level--; } } -void -hv_et_init(void) +static void +hv_et_identify(driver_t *driver, device_t parent) +{ + if (device_find_child(parent, "hv_et", -1) != NULL) + return; + + device_add_child(parent, "hv_et", -1); +} + +static int +hv_et_probe(device_t dev) +{ + device_set_desc(dev, "Hyper-V event timer"); + + return (BUS_PROBE_NOWILDCARD); +} + +static int +hv_et_attach(device_t dev) +{ + /* XXX: need allocate SINT and remove global et */ + et = device_get_softc(dev); + + et->et_name = "Hyper-V"; + et->et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; + et->et_quality = 1000; + et->et_frequency = HV_TIMER_FREQUENCY; + et->et_min_period = HV_MIN_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY); + et->et_max_period = HV_MAX_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY); + et->et_start = hv_et_start; + et->et_stop = hv_et_stop; + et->et_priv = dev; + + return (et_register(et)); +} + +static int +hv_et_detach(device_t dev) { - et.et_name = "HyperV"; - et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU | ET_FLAGS_PERIODIC; - et.et_quality = 1000; - et.et_frequency = HV_TIMER_FREQUENCY; - et.et_min_period = (1LL << 32) / HV_TIMER_FREQUENCY; - et.et_max_period = HV_MAX_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY); - et.et_start = hv_et_start; - et.et_stop = hv_et_stop; - et.et_priv = &et; - et_register(&et); + return (et_deregister(et)); } +static device_method_t hv_et_methods[] = { + DEVMETHOD(device_identify, hv_et_identify), + DEVMETHOD(device_probe, hv_et_probe), + DEVMETHOD(device_attach, hv_et_attach), + DEVMETHOD(device_detach, hv_et_detach), + + DEVMETHOD_END +}; + +static driver_t hv_et_driver = { + "hv_et", + hv_et_methods, + sizeof(struct eventtimer) +}; + +static devclass_t hv_et_devclass; +DRIVER_MODULE(hv_et, vmbus, hv_et_driver, hv_et_devclass, NULL, 0); +MODULE_VERSION(hv_et, 1); Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Tue Jun 21 05:20:41 2016 (r302045) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Tue Jun 21 05:33:26 2016 (r302046) @@ -171,8 +171,6 @@ hv_vmbus_init(void) hv_vmbus_g_context.hypercall_page = virt_addr; - hv_et_init(); - return (0); cleanup: Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 05:20:41 2016 (r302045) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Tue Jun 21 05:33:26 2016 (r302046) @@ -277,6 +277,9 @@ vmbus_child_pnpinfo_str(device_t dev, de char guidbuf[40]; struct hv_device *dev_ctx = device_get_ivars(child); + if (dev_ctx == NULL) + return (0); + strlcat(buf, "classid=", buflen); snprintf_hv_guid(guidbuf, sizeof(guidbuf), &dev_ctx->class_id); strlcat(buf, guidbuf, buflen); @@ -606,6 +609,7 @@ vmbus_attach(device_t dev) if (!cold) vmbus_bus_init(); + bus_generic_probe(dev); return (0); } From owner-svn-src-all@freebsd.org Tue Jun 21 05:49:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6C31AC4EDE; Tue, 21 Jun 2016 05:49:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 980A52DDF; Tue, 21 Jun 2016 05:49:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L5n7ut001163; Tue, 21 Jun 2016 05:49:07 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L5n7L1001162; Tue, 21 Jun 2016 05:49:07 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210549.u5L5n7L1001162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 05:49:07 +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: r302047 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 05:49:08 -0000 Author: sephe Date: Tue Jun 21 05:49:07 2016 New Revision: 302047 URL: https://svnweb.freebsd.org/changeset/base/302047 Log: MFC 298561,298563 298561 hn: Increase odrops for if_transmit method if drbr_enqueue fails. MFC after: 1 week Sponsored by: Microsoft OSTC 298563 hyperv/hn: Allow users to configure ifq or bufring depth. MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 05:33:26 2016 (r302046) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 05:49:07 2016 (r302047) @@ -291,6 +291,10 @@ static int hn_tx_ring_cnt = 0; SYSCTL_INT(_hw_hn, OID_AUTO, tx_ring_cnt, CTLFLAG_RDTUN, &hn_tx_ring_cnt, 0, "# of TX rings to use"); +static int hn_tx_swq_depth = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_depth, CTLFLAG_RDTUN, + &hn_tx_swq_depth, 0, "Depth of IFQ or BUFRING"); + static u_int hn_cpu_index; /* @@ -352,6 +356,16 @@ hn_set_lro_lenlim(struct hn_softc *sc, i #endif static int +hn_get_txswq_depth(const struct hn_tx_ring *txr) +{ + + KASSERT(txr->hn_txdesc_cnt > 0, ("tx ring is not setup yet")); + if (hn_tx_swq_depth < txr->hn_txdesc_cnt) + return txr->hn_txdesc_cnt; + return hn_tx_swq_depth; +} + +static int hn_ifmedia_upd(struct ifnet *ifp __unused) { @@ -517,9 +531,11 @@ netvsc_attach(device_t dev) /* needed by hv_rf_on_device_add() code */ ifp->if_mtu = ETHERMTU; if (hn_use_if_start) { + int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); + ifp->if_start = hn_start; - IFQ_SET_MAXLEN(&ifp->if_snd, 512); - ifp->if_snd.ifq_drv_maxlen = 511; + IFQ_SET_MAXLEN(&ifp->if_snd, qdepth); + ifp->if_snd.ifq_drv_maxlen = qdepth - 1; IFQ_SET_READY(&ifp->if_snd); } else { ifp->if_transmit = hn_transmit; @@ -2341,10 +2357,14 @@ hn_create_tx_ring(struct hn_softc *sc, i TASK_INIT(&txr->hn_tx_task, 0, hn_start_taskfunc, txr); TASK_INIT(&txr->hn_txeof_task, 0, hn_start_txeof_taskfunc, txr); } else { + int br_depth; + txr->hn_txeof = hn_xmit_txeof; TASK_INIT(&txr->hn_tx_task, 0, hn_xmit_taskfunc, txr); TASK_INIT(&txr->hn_txeof_task, 0, hn_xmit_txeof_taskfunc, txr); - txr->hn_mbuf_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_NETVSC, + + br_depth = hn_get_txswq_depth(txr); + txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_NETVSC, M_WAITOK, &txr->hn_tx_lock); } @@ -2756,8 +2776,10 @@ hn_transmit(struct ifnet *ifp, struct mb txr = &sc->hn_tx_ring[idx]; error = drbr_enqueue(ifp, txr->hn_mbuf_br, m); - if (error) + if (error) { + if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1); return error; + } if (txr->hn_oactive) return 0; From owner-svn-src-all@freebsd.org Tue Jun 21 06:18:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FB48A7B3CB; Tue, 21 Jun 2016 06:18:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B27E1DB3; Tue, 21 Jun 2016 06:18:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L6IgqH013047; Tue, 21 Jun 2016 06:18:42 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L6IfA0013039; Tue, 21 Jun 2016 06:18:41 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210618.u5L6IfA0013039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 06:18: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: r302048 - in stable/10/sys/dev/hyperv: include netvsc storvsc vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 06:18:43 -0000 Author: sephe Date: Tue Jun 21 06:18:41 2016 New Revision: 302048 URL: https://svnweb.freebsd.org/changeset/base/302048 Log: MFC 298569,298570,298571,298572,298574,298575,298613,298614,298615,298616,298617 298569 hyperv/channel: Remove the unnecessary 'new' flag MFC after: 1 week Sponsored by: Microsoft OSTC 298570 hyperv/channel: Minor style changes; no functional changes. MFC after: 1 week Sponsored by: Microsoft OSTC 298571 hyperv/channel: Remove unapplied comment MFC after: 1 week Sponsored by: Microsoft OSTC 298572 hyperv/channel: Log a warning about duplicated primary channel offer MFC after: 1 week Sponsored by: Microsoft OSTC 298574 hyperv/channel: Add functions to synchronize sub-channel offers MFC after: 1 week Sponsored by: Microsoft OSTC 298575 hyperv/hn: Synchronize sub-channel offers MFC after: 1 week Sponsored by: Microsoft OSTC 298613 hyperv/stor: Remove the useless hs_open_multi_channel This fixes the sub-channel offer race after Hyper-V device probe/attach is moved to vmbus SYSINIT/attach. MFC after: 1 week Sponsored by: Microsoft OSTC 298614 hyperv/stor: Synchronize sub-channel offers MFC after: 1 week Sponsored by: Microsoft OSTC 298615 hyperv/hn: Avoid sub-channel creation callback. Since the sub-channel offers are synchronized, we can do our own channel setup without using the sub-channel creation callback. This paves the way to whack the sub-channel creation callback. MFC after: 1 week Sponsored by: Microsoft OSTC 298616 hyperv/stor: Avoid sub-channel creation callback. Since the sub-channel offers are synchronized, we can do our own channel setup without using the sub-channel creation callback. This paves the way to whack the sub-channel creation callback. MFC after: 1 week Sponsored by: Microsoft OSTC 298617 hyperv/channel: Git rid of the sub-channel creation callback It is no longer used. MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/include/hyperv.h stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis.h stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/10/sys/dev/hyperv/include/hyperv.h Tue Jun 21 05:49:07 2016 (r302047) +++ stable/10/sys/dev/hyperv/include/hyperv.h Tue Jun 21 06:18:41 2016 (r302048) @@ -691,7 +691,6 @@ typedef struct { } hv_vmbus_ring_buffer_info; typedef void (*hv_vmbus_pfn_channel_callback)(void *context); -typedef void (*hv_vmbus_sc_creation_callback)(void *context); typedef enum { HV_CHANNEL_OFFER_STATE, @@ -804,13 +803,6 @@ typedef struct hv_vmbus_channel { * response on the same channel. */ - /* - * Multi-channel creation callback. This callback will be called in - * process context when a Multi-channel offer is received from the host. - * The guest can open the Multi-channel in the context of this callback. - */ - hv_vmbus_sc_creation_callback sc_creation_callback; - struct mtx sc_lock; /* @@ -818,6 +810,7 @@ typedef struct hv_vmbus_channel { */ TAILQ_HEAD(, hv_vmbus_channel) sc_list_anchor; TAILQ_ENTRY(hv_vmbus_channel) sc_list_entry; + int subchan_cnt; /* * The primary channel this sub-channle belongs to. @@ -914,6 +907,9 @@ int hv_vmbus_channel_teardown_gpdal( struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); +struct hv_vmbus_channel ** + vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt); +void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt); /** * @brief Get physical address from virtual Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Jun 21 05:49:07 2016 (r302047) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Jun 21 06:18:41 2016 (r302048) @@ -660,30 +660,12 @@ hv_nv_disconnect_from_vsp(netvsc_dev *ne hv_nv_destroy_send_buffer(net_dev); } -/* - * Callback handler for subchannel offer - * @@param context new subchannel - */ -static void -hv_nv_subchan_callback(void *xchan) +void +hv_nv_subchan_attach(struct hv_vmbus_channel *chan) { - struct hv_vmbus_channel *chan = xchan; - netvsc_dev *net_dev; - uint16_t chn_index = chan->offer_msg.offer.sub_channel_index; - struct hv_device *device = chan->device; - hn_softc_t *sc = device_get_softc(device->device); - int ret; - - net_dev = sc->net_dev; - - if (chn_index >= net_dev->num_channel) { - /* Would this ever happen? */ - return; - } - netvsc_subchan_callback(sc, chan); chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); - ret = hv_vmbus_channel_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, + hv_vmbus_channel_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, chan); } @@ -720,7 +702,6 @@ hv_nv_on_device_add(struct hv_device *de free(chan->hv_chan_rdbuf, M_NETVSC); goto cleanup; } - chan->sc_creation_callback = hv_nv_subchan_callback; /* * Connect with the NetVsp Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 05:49:07 2016 (r302047) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 06:18:41 2016 (r302048) @@ -1267,6 +1267,7 @@ int hv_nv_on_device_remove(struct hv_dev boolean_t destroy_channel); int hv_nv_on_send(struct hv_vmbus_channel *chan, netvsc_packet *pkt); int hv_nv_get_next_send_section(netvsc_dev *net_dev); +void hv_nv_subchan_attach(struct hv_vmbus_channel *chan); #endif /* __HV_NET_VSC_H__ */ Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 05:49:07 2016 (r302047) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 06:18:41 2016 (r302048) @@ -336,6 +336,7 @@ static void hn_create_rx_data(struct hn_ static void hn_destroy_rx_data(struct hn_softc *sc); static void hn_set_tx_chimney_size(struct hn_softc *, int); static void hn_channel_attach(struct hn_softc *, struct hv_vmbus_channel *); +static void hn_subchan_attach(struct hn_softc *, struct hv_vmbus_channel *); static int hn_transmit(struct ifnet *, struct mbuf *); static void hn_xmit_qflush(struct ifnet *); @@ -438,7 +439,7 @@ static int netvsc_attach(device_t dev) { struct hv_device *device_ctx = vmbus_get_devctx(dev); - struct hv_vmbus_channel *chan; + struct hv_vmbus_channel *pri_chan; netvsc_device_info device_info; hn_softc_t *sc; int unit = device_get_unit(dev); @@ -518,12 +519,12 @@ netvsc_attach(device_t dev) /* * Associate the first TX/RX ring w/ the primary channel. */ - chan = device_ctx->channel; - KASSERT(HV_VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); - KASSERT(chan->offer_msg.offer.sub_channel_index == 0, + pri_chan = device_ctx->channel; + KASSERT(HV_VMBUS_CHAN_ISPRIMARY(pri_chan), ("not primary channel")); + KASSERT(pri_chan->offer_msg.offer.sub_channel_index == 0, ("primary channel subidx %u", - chan->offer_msg.offer.sub_channel_index)); - hn_channel_attach(sc, chan); + pri_chan->offer_msg.offer.sub_channel_index)); + hn_channel_attach(sc, pri_chan); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; @@ -578,6 +579,26 @@ netvsc_attach(device_t dev) device_printf(dev, "%d TX ring, %d RX ring\n", sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse); + if (sc->net_dev->num_channel > 1) { + struct hv_vmbus_channel **subchan; + int subchan_cnt = sc->net_dev->num_channel - 1; + int i; + + /* Wait for sub-channels setup to complete. */ + subchan = vmbus_get_subchan(pri_chan, subchan_cnt); + + /* Attach the sub-channels. */ + for (i = 0; i < subchan_cnt; ++i) { + /* NOTE: Calling order is critical. */ + hn_subchan_attach(sc, subchan[i]); + hv_nv_subchan_attach(subchan[i]); + } + + /* Release the sub-channels */ + vmbus_rel_subchan(subchan, subchan_cnt); + device_printf(dev, "%d sub-channels setup done\n", subchan_cnt); + } + #if __FreeBSD_version >= 1100099 if (sc->hn_rx_ring_inuse > 1) { /* @@ -2910,8 +2931,8 @@ hn_channel_attach(struct hn_softc *sc, s vmbus_channel_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); } -void -netvsc_subchan_callback(struct hn_softc *sc, struct hv_vmbus_channel *chan) +static void +hn_subchan_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan) { KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan), Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis.h Tue Jun 21 05:49:07 2016 (r302047) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis.h Tue Jun 21 06:18:41 2016 (r302048) @@ -1068,8 +1068,6 @@ struct hv_vmbus_channel; int netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet, rndis_tcp_ip_csum_info *csum_info); void netvsc_channel_rollup(struct hv_vmbus_channel *chan); -void netvsc_subchan_callback(struct hn_softc *sc, - struct hv_vmbus_channel *chan); void* hv_set_rppi_data(rndis_msg *rndis_mesg, uint32_t rppi_size, Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 05:49:07 2016 (r302047) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 06:18:41 2016 (r302048) @@ -134,7 +134,6 @@ struct storvsc_softc { uint32_t hs_num_out_reqs; boolean_t hs_destroy; boolean_t hs_drain_notify; - boolean_t hs_open_multi_channel; struct sema hs_drain_sema; struct hv_storvsc_request hs_init_req; struct hv_storvsc_request hs_reset_req; @@ -347,29 +346,19 @@ get_stor_device(struct hv_device *device return sc; } -/** - * @brief Callback handler, will be invoked when receive mutil-channel offer - * - * @param context new multi-channel - */ static void -storvsc_handle_sc_creation(void *context) +storvsc_subchan_attach(struct hv_vmbus_channel *new_channel) { - hv_vmbus_channel *new_channel; struct hv_device *device; struct storvsc_softc *sc; struct vmstor_chan_props props; int ret = 0; - new_channel = (hv_vmbus_channel *)context; device = new_channel->device; sc = get_stor_device(device, TRUE); if (sc == NULL) return; - if (FALSE == sc->hs_open_multi_channel) - return; - memset(&props, 0, sizeof(props)); ret = hv_vmbus_channel_open(new_channel, @@ -392,11 +381,12 @@ storvsc_handle_sc_creation(void *context static void storvsc_send_multichannel_request(struct hv_device *dev, int max_chans) { + struct hv_vmbus_channel **subchan; struct storvsc_softc *sc; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; int request_channels_cnt = 0; - int ret; + int ret, i; /* get multichannels count that need to create */ request_channels_cnt = MIN(max_chans, mp_ncpus); @@ -410,9 +400,6 @@ storvsc_send_multichannel_request(struct request = &sc->hs_init_req; - /* Establish a handler for multi-channel */ - dev->channel->sc_creation_callback = storvsc_handle_sc_creation; - /* request the host to create multi-channel */ memset(request, 0, sizeof(struct hv_storvsc_request)); @@ -448,7 +435,15 @@ storvsc_send_multichannel_request(struct return; } - sc->hs_open_multi_channel = TRUE; + /* Wait for sub-channels setup to complete. */ + subchan = vmbus_get_subchan(dev->channel, request_channels_cnt); + + /* Attach the sub-channels. */ + for (i = 0; i < request_channels_cnt; ++i) + storvsc_subchan_attach(subchan[i]); + + /* Release the sub-channels. */ + vmbus_rel_subchan(subchan, request_channels_cnt); if (bootverbose) printf("Storvsc create multi-channel success!\n"); @@ -1067,7 +1062,6 @@ storvsc_attach(device_t dev) sc->hs_destroy = FALSE; sc->hs_drain_notify = FALSE; - sc->hs_open_multi_channel = FALSE; sema_init(&sc->hs_drain_sema, 0, "Store Drain Sema"); ret = hv_storvsc_connect_vsp(hv_dev); Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Jun 21 05:49:07 2016 (r302047) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Jun 21 06:18:41 2016 (r302048) @@ -618,7 +618,6 @@ hv_vmbus_channel_close_internal(hv_vmbus hv_vmbus_channel_msg_info* info; channel->state = HV_CHANNEL_OPEN_STATE; - channel->sc_creation_callback = NULL; /* * set rxq to NULL to avoid more requests be scheduled Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jun 21 05:49:07 2016 (r302047) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jun 21 06:18:41 2016 (r302048) @@ -177,13 +177,10 @@ hv_vmbus_free_vmbus_channel(hv_vmbus_cha static void vmbus_channel_process_offer(hv_vmbus_channel *new_channel) { - boolean_t f_new; hv_vmbus_channel* channel; int ret; uint32_t relid; - f_new = TRUE; - channel = NULL; relid = new_channel->offer_msg.child_rel_id; /* * Make sure this is a new offer @@ -192,31 +189,24 @@ vmbus_channel_process_offer(hv_vmbus_cha hv_vmbus_g_connection.channels[relid] = new_channel; TAILQ_FOREACH(channel, &hv_vmbus_g_connection.channel_anchor, - list_entry) - { + list_entry) { if (memcmp(&channel->offer_msg.offer.interface_type, &new_channel->offer_msg.offer.interface_type, sizeof(hv_guid)) == 0 && memcmp(&channel->offer_msg.offer.interface_instance, &new_channel->offer_msg.offer.interface_instance, - sizeof(hv_guid)) == 0) { - f_new = FALSE; + sizeof(hv_guid)) == 0) break; - } } - if (f_new) { - /* Insert at tail */ - TAILQ_INSERT_TAIL( - &hv_vmbus_g_connection.channel_anchor, - new_channel, - list_entry); + if (channel == NULL) { + /* Install the new primary channel */ + TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_anchor, + new_channel, list_entry); } mtx_unlock(&hv_vmbus_g_connection.channel_lock); - /*XXX add new channel to percpu_list */ - - if (!f_new) { + if (channel != NULL) { /* * Check if this is a sub channel. */ @@ -227,10 +217,8 @@ vmbus_channel_process_offer(hv_vmbus_cha new_channel->primary_channel = channel; new_channel->device = channel->device; mtx_lock(&channel->sc_lock); - TAILQ_INSERT_TAIL( - &channel->sc_list_anchor, - new_channel, - sc_list_entry); + TAILQ_INSERT_TAIL(&channel->sc_list_anchor, + new_channel, sc_list_entry); mtx_unlock(&channel->sc_lock); if (bootverbose) { @@ -251,17 +239,25 @@ vmbus_channel_process_offer(hv_vmbus_cha "its primary channel is <%p>.\n", new_channel, new_channel->primary_channel); - /*XXX add it to percpu_list */ - new_channel->state = HV_CHANNEL_OPEN_STATE; - if (channel->sc_creation_callback != NULL) { - channel->sc_creation_callback(new_channel); - } + + /* + * Bump up sub-channel count and notify anyone that is + * interested in this sub-channel, after this sub-channel + * is setup. + */ + mtx_lock(&channel->sc_lock); + channel->subchan_cnt++; + mtx_unlock(&channel->sc_lock); + wakeup(channel); + return; } - hv_vmbus_free_vmbus_channel(new_channel); - return; + printf("VMBUS: duplicated primary channel%u\n", + new_channel->offer_msg.child_rel_id); + hv_vmbus_free_vmbus_channel(new_channel); + return; } new_channel->state = HV_CHANNEL_OPEN_STATE; @@ -283,10 +279,8 @@ vmbus_channel_process_offer(hv_vmbus_cha ret = hv_vmbus_child_device_register(new_channel->device); if (ret != 0) { mtx_lock(&hv_vmbus_g_connection.channel_lock); - TAILQ_REMOVE( - &hv_vmbus_g_connection.channel_anchor, - new_channel, - list_entry); + TAILQ_REMOVE(&hv_vmbus_g_connection.channel_anchor, + new_channel, list_entry); mtx_unlock(&hv_vmbus_g_connection.channel_lock); hv_vmbus_free_vmbus_channel(new_channel); } @@ -793,3 +787,41 @@ vmbus_scan(void) mtx_sleep(&vmbus_devcnt, &vmbus_chwait_lock, 0, "waitdev", 0); mtx_unlock(&vmbus_chwait_lock); } + +struct hv_vmbus_channel ** +vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt) +{ + struct hv_vmbus_channel **ret, *chan; + int i; + + ret = malloc(subchan_cnt * sizeof(struct hv_vmbus_channel *), M_TEMP, + M_WAITOK); + + mtx_lock(&pri_chan->sc_lock); + + while (pri_chan->subchan_cnt < subchan_cnt) + mtx_sleep(pri_chan, &pri_chan->sc_lock, 0, "subch", 0); + + i = 0; + TAILQ_FOREACH(chan, &pri_chan->sc_list_anchor, sc_list_entry) { + /* TODO: refcnt chan */ + ret[i] = chan; + + ++i; + if (i == subchan_cnt) + break; + } + KASSERT(i == subchan_cnt, ("invalid subchan count %d, should be %d", + pri_chan->subchan_cnt, subchan_cnt)); + + mtx_unlock(&pri_chan->sc_lock); + + return ret; +} + +void +vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) +{ + + free(subchan, M_TEMP); +} From owner-svn-src-all@freebsd.org Tue Jun 21 06:37:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 308E9A7B89E; Tue, 21 Jun 2016 06:37:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA5E52843; Tue, 21 Jun 2016 06:37:39 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L6bdsr020604; Tue, 21 Jun 2016 06:37:39 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L6bcnT020601; Tue, 21 Jun 2016 06:37:38 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210637.u5L6bcnT020601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 06: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: r302049 - in stable/10/sys/dev/hyperv: netvsc storvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 06:37:40 -0000 Author: sephe Date: Tue Jun 21 06:37:38 2016 New Revision: 302049 URL: https://svnweb.freebsd.org/changeset/base/302049 Log: MFC 298618,298620,298688,298689 298618 hyperv/stor: Set description properly in probe devmethod MFC after: 1 week Sponsored by: Microsoft OSTC 298620 hyperv/hn: Change description to "Hyper-V Network Interface" This is consistent w/ other Hyper-V devices. MFC after: 1 week Sponsored by: Microsoft OSTC 298688 hyperv/hn: Restart sending earlier once we gathered some free TX descs This greatly reduces the oqdrops under heavy workload. For TCP send/recv test (10K concurrent connections): oqdrops is reduced by 17% on sending side, and 57% on receiving side. For nginx-1.8/wrk-4 1KB object test (10K concurrent connections, 4 requests/connection): oqdrops is reduced by 44% on nginx side, and 10% on wrk side. MFC after: 1 week Sponsored by: Microsoft OSTC 298689 hyperv/hn: Remove unapplied comment. Chimney sending buffers are shared across channels. MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 06:18:41 2016 (r302048) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 06:37:38 2016 (r302049) @@ -1185,7 +1185,8 @@ struct hn_tx_ring { #endif int hn_txdesc_cnt; int hn_txdesc_avail; - int hn_has_txeof; + u_short hn_has_txeof; + u_short hn_txdone_cnt; int hn_sched_tx; void (*hn_txeof)(struct hn_tx_ring *); Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 06:18:41 2016 (r302048) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 06:37:38 2016 (r302049) @@ -157,6 +157,8 @@ __FBSDID("$FreeBSD$"); #define HN_DIRECT_TX_SIZE_DEF 128 +#define HN_EARLY_TXEOF_THRESH 8 + struct hn_txdesc { #ifndef HN_USE_TXDESC_BUFRING SLIST_ENTRY(hn_txdesc) link; @@ -406,7 +408,7 @@ netvsc_probe(device_t dev) p = vmbus_get_type(dev); if (!memcmp(p, &g_net_vsc_device_type.data, sizeof(hv_guid))) { - device_set_desc(dev, "Synthetic Network Interface"); + device_set_desc(dev, "Hyper-V Network Interface"); if (bootverbose) printf("Netvsc probe... DONE \n"); @@ -805,6 +807,13 @@ hn_txdesc_hold(struct hn_txdesc *txd) atomic_add_int(&txd->refs, 1); } +static __inline void +hn_txeof(struct hn_tx_ring *txr) +{ + txr->hn_has_txeof = 0; + txr->hn_txeof(txr); +} + static void hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt) { @@ -823,6 +832,13 @@ hn_tx_done(struct hv_vmbus_channel *chan txr->hn_has_txeof = 1; hn_txdesc_put(txr, txd); + + ++txr->hn_txdone_cnt; + if (txr->hn_txdone_cnt >= HN_EARLY_TXEOF_THRESH) { + txr->hn_txdone_cnt = 0; + if (txr->hn_oactive) + hn_txeof(txr); + } } void @@ -848,8 +864,8 @@ netvsc_channel_rollup(struct hv_vmbus_ch if (txr == NULL || !txr->hn_has_txeof) return; - txr->hn_has_txeof = 0; - txr->hn_txeof(txr); + txr->hn_txdone_cnt = 0; + hn_txeof(txr); } /* @@ -999,8 +1015,6 @@ hn_encap(struct hn_tx_ring *txr, struct /* * Chimney send, if the packet could fit into one chimney buffer. - * - * TODO: vRSS, chimney buffer should be per-channel. */ if (packet->tot_data_buf_len < txr->hn_tx_chimney_size) { netvsc_dev *net_dev = txr->hn_sc->net_dev; Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 06:18:41 2016 (r302048) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jun 21 06:37:38 2016 (r302049) @@ -957,6 +957,7 @@ storvsc_probe(device_t dev) if(bootverbose) device_printf(dev, "Enlightened ATA/IDE detected\n"); + device_set_desc(dev, g_drv_props_table[DRIVER_BLKVSC].drv_desc); ret = BUS_PROBE_DEFAULT; } else if(bootverbose) device_printf(dev, "Emulated ATA/IDE set (hw.ata.disk_enable set)\n"); @@ -964,6 +965,7 @@ storvsc_probe(device_t dev) case DRIVER_STORVSC: if(bootverbose) device_printf(dev, "Enlightened SCSI device detected\n"); + device_set_desc(dev, g_drv_props_table[DRIVER_STORVSC].drv_desc); ret = BUS_PROBE_DEFAULT; break; default: @@ -1015,7 +1017,6 @@ storvsc_attach(device_t dev) /* fill in device specific properties */ sc->hs_unit = device_get_unit(dev); sc->hs_dev = hv_dev; - device_set_desc(dev, g_drv_props_table[stor_type].drv_desc); LIST_INIT(&sc->hs_free_list); mtx_init(&sc->hs_lock, "hvslck", NULL, MTX_DEF); From owner-svn-src-all@freebsd.org Tue Jun 21 06:45:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17FF7A7BB29; Tue, 21 Jun 2016 06:45:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D76022C30; Tue, 21 Jun 2016 06:45:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L6jU9F024366; Tue, 21 Jun 2016 06:45:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L6jTLQ024362; Tue, 21 Jun 2016 06:45:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210645.u5L6jTLQ024362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 06:45: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: r302050 - in stable/10/sys/dev/hyperv: netvsc vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 06:45:31 -0000 Author: sephe Date: Tue Jun 21 06:45:29 2016 New Revision: 302050 URL: https://svnweb.freebsd.org/changeset/base/302050 Log: MFC 298690,298693,298694 298690 hyperv/hn: Mark sysctls MPSAFE MFC after: 1 week Sponsored by: Microsoft OSTC 298693 hyperv/vmbus: Mark sysctls MPSAFE MFC after: 1 week Sponsored by: Microsoft OSTC 298694 hyperv/hn: Add stat for # of chimney sending tries MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 06:37:38 2016 (r302049) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 06:45:29 2016 (r302050) @@ -1211,6 +1211,7 @@ struct hn_tx_ring { u_long hn_send_failed; u_long hn_txdma_failed; u_long hn_tx_collapsed; + u_long hn_tx_chimney_tried; u_long hn_tx_chimney; u_long hn_pkts; Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 06:37:38 2016 (r302049) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 06:45:29 2016 (r302050) @@ -216,7 +216,8 @@ struct hn_txdesc { int hv_promisc_mode = 0; /* normal mode by default */ -SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD, NULL, "Hyper-V network interface"); +SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, + "Hyper-V network interface"); /* Trust tcp segements verification on host side. */ static int hn_trust_hosttcp = 1; @@ -1020,6 +1021,7 @@ hn_encap(struct hn_tx_ring *txr, struct netvsc_dev *net_dev = txr->hn_sc->net_dev; uint32_t send_buf_section_idx; + txr->hn_tx_chimney_tried++; send_buf_section_idx = hv_nv_get_next_send_section(net_dev); if (send_buf_section_idx != @@ -2216,7 +2218,7 @@ hn_create_rx_data(struct hn_softc *sc, i /* Create dev.hn.UNIT.rx sysctl tree */ sc->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "rx", - CTLFLAG_RD, 0, ""); + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; @@ -2256,7 +2258,7 @@ hn_create_rx_data(struct hn_softc *sc, i snprintf(name, sizeof(name), "%d", i); rxr->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(sc->hn_rx_sysctl_tree), - OID_AUTO, name, CTLFLAG_RD, 0, ""); + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); if (rxr->hn_rx_sysctl_tree != NULL) { SYSCTL_ADD_ULONG(ctx, @@ -2268,7 +2270,7 @@ hn_create_rx_data(struct hn_softc *sc, i } SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_queued", - CTLTYPE_U64 | CTLFLAG_RW, sc, + CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_lro.lro_queued), #if __FreeBSD_version < 1100095 hn_rx_stat_int_sysctl, @@ -2277,7 +2279,7 @@ hn_create_rx_data(struct hn_softc *sc, i #endif "LU", "LRO queued"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_flushed", - CTLTYPE_U64 | CTLFLAG_RW, sc, + CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_lro.lro_flushed), #if __FreeBSD_version < 1100095 hn_rx_stat_int_sysctl, @@ -2286,51 +2288,53 @@ hn_create_rx_data(struct hn_softc *sc, i #endif "LU", "LRO flushed"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_tried", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_lro_tried), hn_rx_stat_ulong_sysctl, "LU", "# of LRO tries"); #if __FreeBSD_version >= 1100099 SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_length_lim", - CTLTYPE_UINT | CTLFLAG_RW, sc, 0, hn_lro_lenlim_sysctl, "IU", + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_lro_lenlim_sysctl, "IU", "Max # of data bytes to be aggregated by LRO"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_ackcnt_lim", - CTLTYPE_INT | CTLFLAG_RW, sc, 0, hn_lro_ackcnt_sysctl, "I", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_lro_ackcnt_sysctl, "I", "Max # of ACKs to be aggregated by LRO"); #endif SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "trust_hosttcp", - CTLTYPE_INT | CTLFLAG_RW, sc, HN_TRUST_HCSUM_TCP, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, HN_TRUST_HCSUM_TCP, hn_trust_hcsum_sysctl, "I", "Trust tcp segement verification on host side, " "when csum info is missing"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "trust_hostudp", - CTLTYPE_INT | CTLFLAG_RW, sc, HN_TRUST_HCSUM_UDP, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, HN_TRUST_HCSUM_UDP, hn_trust_hcsum_sysctl, "I", "Trust udp datagram verification on host side, " "when csum info is missing"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "trust_hostip", - CTLTYPE_INT | CTLFLAG_RW, sc, HN_TRUST_HCSUM_IP, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, HN_TRUST_HCSUM_IP, hn_trust_hcsum_sysctl, "I", "Trust ip packet verification on host side, " "when csum info is missing"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "csum_ip", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_csum_ip), hn_rx_stat_ulong_sysctl, "LU", "RXCSUM IP"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "csum_tcp", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_csum_tcp), hn_rx_stat_ulong_sysctl, "LU", "RXCSUM TCP"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "csum_udp", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_csum_udp), hn_rx_stat_ulong_sysctl, "LU", "RXCSUM UDP"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "csum_trusted", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_csum_trusted), hn_rx_stat_ulong_sysctl, "LU", "# of packets that we trust host's csum verification"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "small_pkts", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_small_pkts), hn_rx_stat_ulong_sysctl, "LU", "# of small packets received"); SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rx_ring_cnt", @@ -2523,7 +2527,7 @@ hn_create_tx_ring(struct hn_softc *sc, i snprintf(name, sizeof(name), "%d", id); txr->hn_tx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, - name, CTLFLAG_RD, 0, ""); + name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); if (txr->hn_tx_sysctl_tree != NULL) { child = SYSCTL_CHILDREN(txr->hn_tx_sysctl_tree); @@ -2618,7 +2622,7 @@ hn_create_tx_data(struct hn_softc *sc, i /* Create dev.hn.UNIT.tx sysctl tree */ sc->hn_tx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "tx", - CTLFLAG_RD, 0, ""); + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { int error; @@ -2629,25 +2633,29 @@ hn_create_tx_data(struct hn_softc *sc, i } SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "no_txdescs", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_tx_ring, hn_no_txdescs), hn_tx_stat_ulong_sysctl, "LU", "# of times short of TX descs"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "send_failed", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_tx_ring, hn_send_failed), hn_tx_stat_ulong_sysctl, "LU", "# of hyper-v sending failure"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "txdma_failed", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_tx_ring, hn_txdma_failed), hn_tx_stat_ulong_sysctl, "LU", "# of TX DMA failure"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "tx_collapsed", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_tx_ring, hn_tx_collapsed), hn_tx_stat_ulong_sysctl, "LU", "# of TX mbuf collapsed"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "tx_chimney", - CTLTYPE_ULONG | CTLFLAG_RW, sc, + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_tx_ring, hn_tx_chimney), hn_tx_stat_ulong_sysctl, "LU", "# of chimney send"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "tx_chimney_tried", + CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, + __offsetof(struct hn_tx_ring, hn_tx_chimney_tried), + hn_tx_stat_ulong_sysctl, "LU", "# of chimney send tries"); SYSCTL_ADD_INT(ctx, child, OID_AUTO, "txdesc_cnt", CTLFLAG_RD, &sc->hn_tx_ring[0].hn_txdesc_cnt, 0, "# of total TX descs"); @@ -2655,15 +2663,16 @@ hn_create_tx_data(struct hn_softc *sc, i CTLFLAG_RD, &sc->hn_tx_chimney_max, 0, "Chimney send packet size upper boundary"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "tx_chimney_size", - CTLTYPE_INT | CTLFLAG_RW, sc, 0, hn_tx_chimney_size_sysctl, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_tx_chimney_size_sysctl, "I", "Chimney send packet size limit"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "direct_tx_size", - CTLTYPE_INT | CTLFLAG_RW, sc, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_tx_ring, hn_direct_tx_size), hn_tx_conf_int_sysctl, "I", "Size of the packet for direct transmission"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "sched_tx", - CTLTYPE_INT | CTLFLAG_RW, sc, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_tx_ring, hn_sched_tx), hn_tx_conf_int_sysctl, "I", "Always schedule transmission " Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Jun 21 06:37:38 2016 (r302049) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Jun 21 06:45:29 2016 (r302050) @@ -118,21 +118,21 @@ vmbus_channel_sysctl_create(hv_vmbus_cha /* This creates dev.DEVNAME.DEVUNIT.channel tree */ devch_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "channel", CTLFLAG_RD, 0, ""); + OID_AUTO, "channel", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); /* This creates dev.DEVNAME.DEVUNIT.channel.CHANID tree */ snprintf(name, sizeof(name), "%d", ch_id); devch_id_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(devch_sysctl), - OID_AUTO, name, CTLFLAG_RD, 0, ""); + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); if (primary_ch != NULL) { devch_sub_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(devch_id_sysctl), - OID_AUTO, "sub", CTLFLAG_RD, 0, ""); + OID_AUTO, "sub", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); snprintf(name, sizeof(name), "%d", sub_ch_id); devch_id_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(devch_sub_sysctl), - OID_AUTO, name, CTLFLAG_RD, 0, ""); + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "chanid", CTLFLAG_RD, @@ -141,20 +141,20 @@ vmbus_channel_sysctl_create(hv_vmbus_cha SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "cpu", CTLFLAG_RD, &channel->target_cpu, 0, "owner CPU id"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, - "monitor_allocated", CTLTYPE_INT | CTLFLAG_RD, channel, 0, - vmbus_channel_sysctl_monalloc, "I", + "monitor_allocated", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + channel, 0, vmbus_channel_sysctl_monalloc, "I", "is monitor allocated to this channel"); devch_id_in_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "in", - CTLFLAG_RD, 0, ""); + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); devch_id_out_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "out", - CTLFLAG_RD, 0, ""); + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(devch_id_in_sysctl), &(channel->inbound), Modified: stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Tue Jun 21 06:37:38 2016 (r302049) +++ stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Tue Jun 21 06:45:29 2016 (r302050) @@ -78,7 +78,7 @@ hv_ring_buffer_stat( { SYSCTL_ADD_PROC(ctx, tree_node, OID_AUTO, "ring_buffer_stats", - CTLTYPE_STRING|CTLFLAG_RD, rbi, 0, + CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, rbi, 0, hv_rbi_sysctl_stats, "A", desc); } /** From owner-svn-src-all@freebsd.org Tue Jun 21 06:52:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56336A7BDEF; Tue, 21 Jun 2016 06:52:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25BD0121A; Tue, 21 Jun 2016 06:52:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L6qLOM027886; Tue, 21 Jun 2016 06:52:21 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L6qL7M027885; Tue, 21 Jun 2016 06:52:21 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210652.u5L6qL7M027885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 06:52: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: r302051 - stable/10/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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 06:52:22 -0000 Author: sephe Date: Tue Jun 21 06:52:21 2016 New Revision: 302051 URL: https://svnweb.freebsd.org/changeset/base/302051 Log: MFC 298696,298730 298696 tcp/lro: Fix typo. MFC after: 1 week Sponsored by: Microsoft OSTC 298730 tcp/lro: Fix more typo Noticed by: hiren MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/netinet/tcp_lro.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_lro.c ============================================================================== --- stable/10/sys/netinet/tcp_lro.c Tue Jun 21 06:45:29 2016 (r302050) +++ stable/10/sys/netinet/tcp_lro.c Tue Jun 21 06:52:21 2016 (r302051) @@ -451,7 +451,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) return (TCP_LRO_CANNOT); - /* XXX-BZ We lose a AKC|PUSH flag concatinating multiple segments. */ + /* XXX-BZ We lose a ACK|PUSH flag concatenating multiple segments. */ /* XXX-BZ Ideally we'd flush on PUSH? */ /* From owner-svn-src-all@freebsd.org Tue Jun 21 06:56:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE0CFA7BE74; Tue, 21 Jun 2016 06:56:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5AB613C0; Tue, 21 Jun 2016 06:56:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L6u9Zb028080; Tue, 21 Jun 2016 06:56:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L6u9JJ028079; Tue, 21 Jun 2016 06:56:09 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210656.u5L6u9JJ028079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 06:56:09 +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: r302052 - stable/10/sys/dev/mxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 06:56:11 -0000 Author: sephe Date: Tue Jun 21 06:56:09 2016 New Revision: 302052 URL: https://svnweb.freebsd.org/changeset/base/302052 Log: MFC 299506 mxge: Setup mbuf flowid before calling tcp_lro_rx(). Reviewed by: gallatin MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6320 Modified: stable/10/sys/dev/mxge/if_mxge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/10/sys/dev/mxge/if_mxge.c Tue Jun 21 06:52:21 2016 (r302051) +++ stable/10/sys/dev/mxge/if_mxge.c Tue Jun 21 06:56:09 2016 (r302052) @@ -2701,8 +2701,12 @@ mxge_rx_done_big(struct mxge_slice_state if (eh->ether_type == htons(ETHERTYPE_VLAN)) { mxge_vlan_tag_remove(m, &csum); } + /* flowid only valid if RSS hashing is enabled */ + if (sc->num_slices > 1) { + m->m_pkthdr.flowid = (ss - sc->ss); + M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); + } /* if the checksum is valid, mark it in the mbuf header */ - if ((ifp->if_capenable & (IFCAP_RXCSUM_IPV6 | IFCAP_RXCSUM)) && (0 == mxge_rx_csum(m, csum))) { /* Tell the stack that the checksum is good */ @@ -2715,11 +2719,6 @@ mxge_rx_done_big(struct mxge_slice_state return; #endif } - /* flowid only valid if RSS hashing is enabled */ - if (sc->num_slices > 1) { - m->m_pkthdr.flowid = (ss - sc->ss); - M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); - } /* pass the frame up the stack */ (*ifp->if_input)(ifp, m); } @@ -2770,6 +2769,11 @@ mxge_rx_done_small(struct mxge_slice_sta if (eh->ether_type == htons(ETHERTYPE_VLAN)) { mxge_vlan_tag_remove(m, &csum); } + /* flowid only valid if RSS hashing is enabled */ + if (sc->num_slices > 1) { + m->m_pkthdr.flowid = (ss - sc->ss); + M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); + } /* if the checksum is valid, mark it in the mbuf header */ if ((ifp->if_capenable & (IFCAP_RXCSUM_IPV6 | IFCAP_RXCSUM)) && (0 == mxge_rx_csum(m, csum))) { @@ -2783,11 +2787,6 @@ mxge_rx_done_small(struct mxge_slice_sta return; #endif } - /* flowid only valid if RSS hashing is enabled */ - if (sc->num_slices > 1) { - m->m_pkthdr.flowid = (ss - sc->ss); - M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); - } /* pass the frame up the stack */ (*ifp->if_input)(ifp, m); } From owner-svn-src-all@freebsd.org Tue Jun 21 07:05:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36D94AC501A; Tue, 21 Jun 2016 07:05:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 134BC1969; Tue, 21 Jun 2016 07:05:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5L75orR031694; Tue, 21 Jun 2016 07:05:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5L75nrl031690; Tue, 21 Jun 2016 07:05:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606210705.u5L75nrl031690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Jun 2016 07:05: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: r302053 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 07:05:51 -0000 Author: sephe Date: Tue Jun 21 07:05:49 2016 New Revision: 302053 URL: https://svnweb.freebsd.org/changeset/base/302053 Log: MFC 299401,299888 299401 hyperv/hn: Extract RSS hash value and type. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6287 299888 hyperv/hn: Combine per-packet-information parsing. MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis.h stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 06:56:09 2016 (r302052) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Jun 21 07:05:49 2016 (r302053) @@ -1164,6 +1164,7 @@ struct hn_rx_ring { u_long hn_lro_tried; u_long hn_small_pkts; u_long hn_pkts; + u_long hn_rss_pkts; /* Rarely used stuffs */ struct sysctl_oid *hn_rx_sysctl_tree; Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 06:56:09 2016 (r302052) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jun 21 07:05:49 2016 (r302053) @@ -142,7 +142,7 @@ __FBSDID("$FreeBSD$"); #define HN_RNDIS_MSG_LEN \ (sizeof(rndis_msg) + \ - RNDIS_HASH_PPI_SIZE + \ + RNDIS_HASHVAL_PPI_SIZE + \ RNDIS_VLAN_PPI_SIZE + \ RNDIS_TSO_PPI_SIZE + \ RNDIS_CSUM_PPI_SIZE) @@ -883,7 +883,7 @@ hn_encap(struct hn_tx_ring *txr, struct rndis_msg *rndis_mesg; rndis_packet *rndis_pkt; rndis_per_packet_info *rppi; - struct ndis_hash_info *hash_info; + struct rndis_hash_value *hash_value; uint32_t rndis_msg_size; packet = &txd->netvsc_pkt; @@ -909,16 +909,16 @@ hn_encap(struct hn_tx_ring *txr, struct rndis_msg_size = RNDIS_MESSAGE_SIZE(rndis_packet); /* - * Set the hash info for this packet, so that the host could + * Set the hash value for this packet, so that the host could * dispatch the TX done event for this packet back to this TX * ring's channel. */ - rndis_msg_size += RNDIS_HASH_PPI_SIZE; - rppi = hv_set_rppi_data(rndis_mesg, RNDIS_HASH_PPI_SIZE, + rndis_msg_size += RNDIS_HASHVAL_PPI_SIZE; + rppi = hv_set_rppi_data(rndis_mesg, RNDIS_HASHVAL_PPI_SIZE, nbl_hash_value); - hash_info = (struct ndis_hash_info *)((uint8_t *)rppi + + hash_value = (struct rndis_hash_value *)((uint8_t *)rppi + rppi->per_packet_info_offset); - hash_info->hash = txr->hn_tx_idx; + hash_value->hash_value = txr->hn_tx_idx; if (m_head->m_flags & M_VLANTAG) { ndis_8021q_info *rppi_vlan_info; @@ -1308,7 +1308,9 @@ hv_m_append(struct mbuf *m0, int len, c_ */ int netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet, - rndis_tcp_ip_csum_info *csum_info) + const rndis_tcp_ip_csum_info *csum_info, + const struct rndis_hash_info *hash_info, + const struct rndis_hash_value *hash_value) { struct hn_rx_ring *rxr = chan->hv_chan_rxr; struct ifnet *ifp = rxr->hn_ifp; @@ -1417,7 +1419,6 @@ netvsc_recv(struct hv_vmbus_channel *cha CSUM_DATA_VALID | CSUM_PSEUDO_HDR); m_new->m_pkthdr.csum_data = 0xffff; } - /* Rely on SW csum verification though... */ do_lro = 1; } else if (pr == IPPROTO_UDP) { if (do_csum && @@ -1444,8 +1445,50 @@ skip: m_new->m_flags |= M_VLANTAG; } - m_new->m_pkthdr.flowid = rxr->hn_rx_idx; - M_HASHTYPE_SET(m_new, M_HASHTYPE_OPAQUE); + if (hash_info != NULL && hash_value != NULL) { + int hash_type = M_HASHTYPE_OPAQUE; + + rxr->hn_rss_pkts++; + m_new->m_pkthdr.flowid = hash_value->hash_value; + if ((hash_info->hash_info & NDIS_HASH_FUNCTION_MASK) == + NDIS_HASH_FUNCTION_TOEPLITZ) { + uint32_t type = + (hash_info->hash_info & NDIS_HASH_TYPE_MASK); + + switch (type) { + case NDIS_HASH_IPV4: + hash_type = M_HASHTYPE_RSS_IPV4; + break; + + case NDIS_HASH_TCP_IPV4: + hash_type = M_HASHTYPE_RSS_TCP_IPV4; + break; + + case NDIS_HASH_IPV6: + hash_type = M_HASHTYPE_RSS_IPV6; + break; + + case NDIS_HASH_IPV6_EX: + hash_type = M_HASHTYPE_RSS_IPV6_EX; + break; + + case NDIS_HASH_TCP_IPV6: + hash_type = M_HASHTYPE_RSS_TCP_IPV6; + break; + + case NDIS_HASH_TCP_IPV6_EX: + hash_type = M_HASHTYPE_RSS_TCP_IPV6_EX; + break; + } + } + M_HASHTYPE_SET(m_new, hash_type); + } else { + if (hash_value != NULL) + m_new->m_pkthdr.flowid = hash_value->hash_value; + else + m_new->m_pkthdr.flowid = rxr->hn_rx_idx; + M_HASHTYPE_SET(m_new, M_HASHTYPE_OPAQUE); + } /* * Note: Moved RX completion back to hv_nv_on_receive() so all @@ -2265,6 +2308,11 @@ hn_create_rx_data(struct hn_softc *sc, i SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), OID_AUTO, "packets", CTLFLAG_RW, &rxr->hn_pkts, "# of packets received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rss_pkts", CTLFLAG_RW, + &rxr->hn_rss_pkts, + "# of packets w/ RSS info received"); } } } Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis.h Tue Jun 21 06:56:09 2016 (r302052) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis.h Tue Jun 21 07:05:49 2016 (r302053) @@ -617,6 +617,7 @@ typedef enum ndis_per_pkt_infotype_ { } ndis_per_pkt_infotype; #define nbl_hash_value pkt_cancel_id +#define nbl_hash_info original_netbuf_list typedef struct ndis_8021q_info_ { union { @@ -630,10 +631,6 @@ typedef struct ndis_8021q_info_ { } u1; } ndis_8021q_info; -struct ndis_hash_info { - uint32_t hash; -} __packed; - struct rndis_object_header { uint8_t type; uint8_t revision; @@ -694,6 +691,28 @@ typedef struct rndis_tcp_ip_csum_info_ { }; } rndis_tcp_ip_csum_info; +struct rndis_hash_value { + uint32_t hash_value; +} __packed; + +struct rndis_hash_info { + uint32_t hash_info; +} __packed; + +#define NDIS_HASH_FUNCTION_MASK 0x000000FF /* see hash function */ +#define NDIS_HASH_TYPE_MASK 0x00FFFF00 /* see hash type */ + +/* hash function */ +#define NDIS_HASH_FUNCTION_TOEPLITZ 0x00000001 + +/* hash type */ +#define NDIS_HASH_IPV4 0x00000100 +#define NDIS_HASH_TCP_IPV4 0x00000200 +#define NDIS_HASH_IPV6 0x00000400 +#define NDIS_HASH_IPV6_EX 0x00000800 +#define NDIS_HASH_TCP_IPV6 0x00001000 +#define NDIS_HASH_TCP_IPV6_EX 0x00002000 + typedef struct rndis_tcp_tso_info_ { union { struct { @@ -727,8 +746,8 @@ typedef struct rndis_tcp_tso_info_ { }; } rndis_tcp_tso_info; -#define RNDIS_HASH_PPI_SIZE (sizeof(rndis_per_packet_info) + \ - sizeof(struct ndis_hash_info)) +#define RNDIS_HASHVAL_PPI_SIZE (sizeof(rndis_per_packet_info) + \ + sizeof(struct rndis_hash_value)) #define RNDIS_VLAN_PPI_SIZE (sizeof(rndis_per_packet_info) + \ sizeof(ndis_8021q_info)) @@ -1066,7 +1085,9 @@ typedef struct rndismp_rx_bufs_info_ { struct hv_vmbus_channel; int netvsc_recv(struct hv_vmbus_channel *chan, - netvsc_packet *packet, rndis_tcp_ip_csum_info *csum_info); + netvsc_packet *packet, const rndis_tcp_ip_csum_info *csum_info, + const struct rndis_hash_info *hash_info, + const struct rndis_hash_value *hash_value); void netvsc_channel_rollup(struct hv_vmbus_channel *chan); void* hv_set_rppi_data(rndis_msg *rndis_mesg, Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Tue Jun 21 06:56:09 2016 (r302052) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Tue Jun 21 07:05:49 2016 (r302053) @@ -50,6 +50,22 @@ __FBSDID("$FreeBSD$"); #include "hv_rndis.h" #include "hv_rndis_filter.h" +struct hv_rf_recvinfo { + const ndis_8021q_info *vlan_info; + const rndis_tcp_ip_csum_info *csum_info; + const struct rndis_hash_info *hash_info; + const struct rndis_hash_value *hash_value; +}; + +#define HV_RF_RECVINFO_VLAN 0x1 +#define HV_RF_RECVINFO_CSUM 0x2 +#define HV_RF_RECVINFO_HASHINF 0x4 +#define HV_RF_RECVINFO_HASHVAL 0x8 +#define HV_RF_RECVINFO_ALL \ + (HV_RF_RECVINFO_VLAN | \ + HV_RF_RECVINFO_CSUM | \ + HV_RF_RECVINFO_HASHINF | \ + HV_RF_RECVINFO_HASHVAL) /* * Forward declarations @@ -434,6 +450,84 @@ hv_rf_receive_indicate_status(rndis_devi } } +static int +hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hv_rf_recvinfo *info) +{ + const rndis_per_packet_info *ppi; + uint32_t mask, len; + + info->vlan_info = NULL; + info->csum_info = NULL; + info->hash_info = NULL; + info->hash_value = NULL; + + if (rpkt->per_pkt_info_offset == 0) + return 0; + + ppi = (const rndis_per_packet_info *) + ((const uint8_t *)rpkt + rpkt->per_pkt_info_offset); + len = rpkt->per_pkt_info_length; + mask = 0; + + while (len != 0) { + const void *ppi_dptr; + uint32_t ppi_dlen; + + if (__predict_false(ppi->size < ppi->per_packet_info_offset)) + return EINVAL; + ppi_dlen = ppi->size - ppi->per_packet_info_offset; + ppi_dptr = (const uint8_t *)ppi + ppi->per_packet_info_offset; + + switch (ppi->type) { + case ieee_8021q_info: + if (__predict_false(ppi_dlen < sizeof(ndis_8021q_info))) + return EINVAL; + info->vlan_info = ppi_dptr; + mask |= HV_RF_RECVINFO_VLAN; + break; + + case tcpip_chksum_info: + if (__predict_false(ppi_dlen < + sizeof(rndis_tcp_ip_csum_info))) + return EINVAL; + info->csum_info = ppi_dptr; + mask |= HV_RF_RECVINFO_CSUM; + break; + + case nbl_hash_value: + if (__predict_false(ppi_dlen < + sizeof(struct rndis_hash_value))) + return EINVAL; + info->hash_value = ppi_dptr; + mask |= HV_RF_RECVINFO_HASHVAL; + break; + + case nbl_hash_info: + if (__predict_false(ppi_dlen < + sizeof(struct rndis_hash_info))) + return EINVAL; + info->hash_info = ppi_dptr; + mask |= HV_RF_RECVINFO_HASHINF; + break; + + default: + goto skip; + } + + if (mask == HV_RF_RECVINFO_ALL) { + /* All found; done */ + break; + } +skip: + if (__predict_false(len < ppi->size)) + return EINVAL; + len -= ppi->size; + ppi = (const rndis_per_packet_info *) + ((const uint8_t *)ppi + ppi->size); + } + return 0; +} + /* * RNDIS filter receive data */ @@ -442,10 +536,9 @@ hv_rf_receive_data(rndis_device *device, struct hv_vmbus_channel *chan, netvsc_packet *pkt) { rndis_packet *rndis_pkt; - ndis_8021q_info *rppi_vlan_info; uint32_t data_offset; - rndis_tcp_ip_csum_info *csum_info = NULL; device_t dev = device->net_dev->dev->device; + struct hv_rf_recvinfo info; rndis_pkt = &message->msg.packet; @@ -469,15 +562,18 @@ hv_rf_receive_data(rndis_device *device, pkt->tot_data_buf_len = rndis_pkt->data_length; pkt->data = (void *)((unsigned long)pkt->data + data_offset); - rppi_vlan_info = hv_get_ppi_data(rndis_pkt, ieee_8021q_info); - if (rppi_vlan_info) { - pkt->vlan_tci = rppi_vlan_info->u1.s1.vlan_id; - } else { - pkt->vlan_tci = 0; + if (hv_rf_find_recvinfo(rndis_pkt, &info)) { + pkt->status = nvsp_status_failure; + device_printf(dev, "recvinfo parsing failed\n"); + return; } - csum_info = hv_get_ppi_data(rndis_pkt, tcpip_chksum_info); - netvsc_recv(chan, pkt, csum_info); + if (info.vlan_info != NULL) + pkt->vlan_tci = info.vlan_info->u1.s1.vlan_id; + else + pkt->vlan_tci = 0; + + netvsc_recv(chan, pkt, info.csum_info, info.hash_info, info.hash_value); } /* From owner-svn-src-all@freebsd.org Tue Jun 21 07:12:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A41F7AC5174; Tue, 21 Jun 2016 07:12:54 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com [IPv6:2a00:1450:4010:c07::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1962D1D54; Tue, 21 Jun 2016 07:12:54 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-lf0-x22d.google.com with SMTP id q132so9230245lfe.3; Tue, 21 Jun 2016 00:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7dQih5MafRpb5XkR2BBSUc2uV4n2jT9z28WQhJhsJlo=; b=MJeXKy7Ry9W16yAilrCqSdfYYQw6A4h5ZovK4TGlR4zQV3s7rzgeE0NfJKedF5/QIH uP4A+ef/rImkOkAqcKockMc+t1yjcyg6cK+KVFJimvMzPkB7wacAAfqMO/x0gzv3ohyu 2dgEMmXJzhoBESWOW4+JQG1PWFNYFKor2Eyu92+XeSId5E9bhWZ6XsfRkvEyiU2alUJh adrqetk96S37I9n1l6bNpSZXKbC51dxc7D7ChhXcjzWluC/SZdip+Bn2/RP9r2Gxh+qe 8Zorc78MbmCuuMDK4M31ad9uuAOqZxFwkFCgabcFsDjOvRg9zo1D4maRn0lL32iT+bIU Yt3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=7dQih5MafRpb5XkR2BBSUc2uV4n2jT9z28WQhJhsJlo=; b=bSzIongaHDbpm1uAYOdifjXaqqYHiPSWftgKT2Bh4zFi3FooK3KypL0PmmwfuXVv10 67laEVQIYSYE1D5KDAjRGUxrhWWiBnIPZVGLMYqRyymqHHGH9p1Y2DsXuKAJfRNwRMGr cjvLLD1sGc3FGbMCA4zQF6pewpeh7Ru/UmdXzRbtHSbXqldqrXCgr/sPBERB+i60QMHg 5NKCk9ORifnKcS4x32QA3u9/6+Cd6gENB+xMTYC87nV12WP/C697JX79DRugEH++wNc/ dQoH015X3Hw0n5aPPB406OCbHuq+ZUNQpQTga/gsQsWTpnxqZdM10MqCFczO46oYPtMv ywHg== X-Gm-Message-State: ALyK8tJT6Zlqd6qr1HkT7rH9Axj+UlBTwZmwuGS8LvjdDIrGKTtMzYBa2mWfXf+1c1SuoQ== X-Received: by 10.28.166.23 with SMTP id p23mr1648220wme.58.1466493171597; Tue, 21 Jun 2016 00:12:51 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id t188sm1466204wma.8.2016.06.21.00.12.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jun 2016 00:12:50 -0700 (PDT) Sender: Baptiste Daroussin Date: Tue, 21 Jun 2016 09:12:49 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302026 - in head: share/monetdef share/msgdef share/numericdef share/timedef tools/tools/locale/tools Message-ID: <20160621071249.coi44qjecd67hz32@ivaldir.etoilebsd.net> References: <201606200645.u5K6jhBr081752@repo.freebsd.org> <0de854da-5914-901a-3d15-41429808ace1@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="24bdtrqibjdslz6r" Content-Disposition: inline In-Reply-To: <0de854da-5914-901a-3d15-41429808ace1@freebsd.org> User-Agent: Mutt/1.6.1-neo (2016-06-11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 07:12:54 -0000 --24bdtrqibjdslz6r Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 20, 2016 at 10:14:04PM +0300, Andrey Chernov wrote: > On 20.06.2016 9:45, Baptiste Daroussin wrote: > > Author: bapt > > Date: Mon Jun 20 06:45:42 2016 > > New Revision: 302026 > > URL: https://svnweb.freebsd.org/changeset/base/302026 > >=20 > > Log: > > Fix generation of locales with multiple variants >=20 > Thanx. > Just want to note, even if we stay with RFC 5646 language tags instead > of ISO 639 ones with @modifier (per ISO 15897), current tags are > incorrect because have "_" instead of "-" which makes parsing harder, > because "_" is territory separator and someone may not expect several > "_" exists. Per RFC 5646 we need names like > sr-Cyrl_RS.UTF-8.src > and not > sr_Cyrl_RS.UTF-8.src >=20 I have a patch that create the @modifier version meaning for instance: sr_RS.UTF-8@[modifier] it also adds an alias sr_RS.UTF-8 which is the cyrillic version (following = the what has been done on linux for this locale) I am seeking for your opinion on a policy to handle the locales with varian= ts. I am hesitating between 2 options: 1/ Provide all locales that may have modifier: - for sr_RS: sr_RS.UTF-8@cyrillic sr_RS.UTF-8@latin and sr_RS.UTF-8 (which is actually the same as sr_RS.UTF-8@cyrillic) - for zh_TW zh_TW.UTF-8@hant and zh_TW.UTF-8 (which is an alias on zh_TW.UTF-8@hant) - for mn_MN mn_MN.UTF-8@cyrillic mn_MN.UTF-8 (which is an alias on mn_MN.UTF-8@cyrillic) 2/ Only provide the @version for the ones for which we have an ambiguity - for sr_RS: sr_RS.UTF-8@latin sr_RS.UTF-8 (would be the cyrillic one) - for zh_TW zh_TW.UTF-8 (no @modifier version) - for mn_MN mn_MN.UTF-8 (no @modifier version) I do like the first (more explicit and simpler to do with our code while st= ill compatible with the second). Linux only does the second. But I understand the first can be confusing for languages with (for now) on= ly one variant supported like users asking themselves: which one should I choose: mn_MN.UTF-8 or mn_MN.UTF-8@cyrillic? They might not now they are actually the same Any opinion? Best regards Bapt --24bdtrqibjdslz6r Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXaOhZAAoJEGOJi9zxtz5ahX8QALqUh+/49ShThYKudtNNhvxT C3ROihA1eGSweACBAjJ5iprhZtgg0RmM4Jzdzwv+gsTkt92FrShRgdjcErxKUxRo qDwByMlA1b5+ZIETDYcURXkzYHDuMBXjWH58a+antv/6QChY+xPPdKiBuxafMJfy L+/SBKr8eb/WekHF1ZHhZmD6QuGbXtvWIiUPRmAjNlwSCMskn53EfOHOUB+FhD9y 0JSg4/mEVSeurh4aylP/+gEROHybH7X5UNzJMVKf2lYOFBs/b59jluLZhCsQn+Z4 HiI00svmPSisrAQI4ylQsFfxpgkJYvrmwCuxgsdmgiPdYoPJlGsEy9DJBw3bNrcE o16/4iSso4686X/gHqXtAdSFz/nfEJqRFVMalBoB8F/HNk22PWvXTHk9gnepfZvw Ht6OWxt+l51BKAntlYeYoOoH6XUjLOOUF8tEo4QxxtAjsTSlMHp2SXQxQb512S6C Ay+l8J2UhK1Efi10hEJHEmnkHDr4DF2CcAu7g57/Q8meNUuLFcsbjnpxwYph7Fcu 4nYYzQoOQhz2k0fRT3X+YvzR4PqXZVfZArBK+I4BqrREIS8Casbbsr2wCP7z4dxx lemfRAb454pgA22QEVJ1dEWRcbw/Yvwgjfd+0Y12kGoGDbJ+2gFEnitpCt6VkPOa rG8xlmii1lSMxZB1Deoc =VDVy -----END PGP SIGNATURE----- --24bdtrqibjdslz6r-- From owner-svn-src-all@freebsd.org Tue Jun 21 09:36:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F302AC5F63; Tue, 21 Jun 2016 09:36:31 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-lb0-x22b.google.com (mail-lb0-x22b.google.com [IPv6:2a00:1450:4010:c04::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D4442872; Tue, 21 Jun 2016 09:36:31 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-lb0-x22b.google.com with SMTP id xp5so6898057lbb.0; Tue, 21 Jun 2016 02:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=jTKuvjRLStrRA/fOm9S/pzxjvaqa42lBkMxr+xPgxnc=; b=m5sucP3GAJezdEemHXLzYS3N0miLliynnjNokKYLiGwOZs7vcG24GzD/husg5doMzE EMz5OYgSXrWlxQhrbGSJg4OzV3e2YGdtR4Y6GgZNQpTflRDexRi9ggxJBYqYUeC3i3h2 jPfCiD6HbCg5KZVfG386k+pEZX49a/7vjq2MftN7njPpp3+c52xWBvV5h6Lf6B6ELOm8 0v1gS41CISNKOv+x0dbbTtleWxZiMWhWOgkfKFhzNKpctu5pJCqviXbxX7AM7DKHtdtD 70n2+vLHuMaDHGu7HOLQxp5PvvsTqvbb/QK8x7pOzOvrdIcwDZUfG3xfyfLX4cRZTnvo MxlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=jTKuvjRLStrRA/fOm9S/pzxjvaqa42lBkMxr+xPgxnc=; b=jrB7PsWIZAWTuHRBTQwiYPmbBryXL4bN/ZaLET9q4tPltgM7wOe7rQ72wC4y1Ry0t0 dqQofNRV/1hcs5UKmnlRjxPjQ6mCIdMIxE7bs0BDcAhGGnyYF21zzDOJQsojGxHec2Ub isRVpC2MN1MaEtaq+wUuvxHI8JXSIZ8MLYFlJgm031bMLtro1UKdefGF1DIjPWgV82V+ y6Xof6qTwyy0oDkLZjgdukp/0vZtFN/j39ky2roqL84K4in8cpOYuerpPsSeyvtA6C24 fis0hUtfuluyKtMd+1aST7I0qghkS7XxJNEFLWay+tJ4YS3/vHWXKm7T5Loyec9P0h4z xrQA== X-Gm-Message-State: ALyK8tLIJGmywPOAsbWTQuI4bGH/GuGle7jpCSj2CeM6Gnh/9/pUrfMFMM8ay89b2XJEZw== X-Received: by 10.194.235.4 with SMTP id ui4mr20092268wjc.23.1466501789081; Tue, 21 Jun 2016 02:36:29 -0700 (PDT) Received: from brick (acyt159.neoplus.adsl.tpnet.pl. [83.11.203.159]) by smtp.gmail.com with ESMTPSA id t67sm2093644wma.1.2016.06.21.02.36.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jun 2016 02:36:28 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Tue, 21 Jun 2016 11:36:24 +0200 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Alexander Motin Cc: Cy Schubert , Jan Beich , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r299448 - in head/sys/cddl/contrib/opensolaris: common/acl uts/common/fs/zfs uts/common/sys Message-ID: <20160621093624.GD80346@brick> Mail-Followup-To: Alexander Motin , Cy Schubert , Jan Beich , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201606191428.u5JESbbs053857@slippy.cwsent.com> <49d3d34d-ba91-ebdf-497f-cbe1614bec53@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49d3d34d-ba91-ebdf-497f-cbe1614bec53@FreeBSD.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 09:36:31 -0000 On 0619T1733, Alexander Motin wrote: > On 19.06.16 17:28, Cy Schubert wrote: > > In message <20160619080803.GA1638@brick>, Edward Tomasz > > =?utf-8?Q?Napiera=C5=82 > > a?= writes: > >> On 0614T0232, Jan Beich wrote: > >>> Alexander Motin writes: > >>> > >>>> Author: mav > >>>> Date: Wed May 11 13:43:20 2016 > >>>> New Revision: 299448 > >>>> URL: https://svnweb.freebsd.org/changeset/base/299448 > >>>> > >>>> Log: > >>>> MFV r299442: 6762 POSIX write should imply DELETE_CHILD on directories > >> - and > >>>> some additional considerations > >>>> > >>>> Reviewed by: Gordon Ross > >>>> Reviewed by: Yuri Pankov > >>>> Author: Kevin Crowe > >>>> > >>>> openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916 > >>> > >>> This commit confuses acl_is_trivial_np(3). Notice '+' in ls(1) and 'D' > >>> in getfacl(1) outputs. > >> > >> It's not just that. > >> > >> Those changes: > >> > >> 1. Confuse acl_is_trivial_np(3), as you say. It's hard to fix in libc, > >> because they make trivial ACLs different for files and directories, > >> and acl_is_trivial_np(3) has no way of telling which is which. > >> > >> 2. They make delete deny permission take precedence over the containing > >> directory write allow permission, which is rather different from what > >> people expect in unix systems, and is against the NFSv4 specification, > >> even though it might be a better fit for Windows. > > > > This is Windows behavior and inconsistent with the rest of FreeBSD and any > > UNIX or Linux system. > > > >> > >> 3. They make umask apply to inherit_only permissions, and > >> > >> 4. I don't fully understand this one yet, but from the ACL regression > >> test suite (which lives in tests/sys/acl/, and I'd appreciate people > >> actually ran this before committing ACL-related changes) it looks > >> like it makes umask not apply to the stuff it should. > >> > >> The #1 could be fixed by making ZFS not setting delete_child on write, > >> basically reverting to the previous behaviour in that aspect. As for > >> the others... I'm not saying each one of those is wrong, but they > >> certainly warrant further discussion, especially #2 and #4. > > > > I think #2 is wrong behavior on any UNIX-like or POSIX system. > > > >> > >> Basically, what I'm trying to say is that we should consider backing > >> this out for 11.0-RELEASE, reverting to the previous semantics, verified > >> by passing the regression tests. > > > > Agreed. > > > > What in FreeBSD was this patch supposed to solve in the first place? > > Growing divergence from OpenZFS upstream. I am not advocating this > patch, but it would be good, if possible, to not revert it completely, > but block wrong behavior with some minimal ifdefs to make further ZFS > merges easier. Help would be appreciated. ;) Our family just expanded, and thus I'm afraid I won't be able to help for the next few weeks. That's one of the reasons why I've suggested the backout for 11.0 - not a permanent "let's ignore this piece of code forever" backout, but a temporary one, for 11.0; we would then go back to the topic after the release. From owner-svn-src-all@freebsd.org Tue Jun 21 13:48:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45F03AC5898; Tue, 21 Jun 2016 13:48:54 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F53314E6; Tue, 21 Jun 2016 13:48:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LDmraV081638; Tue, 21 Jun 2016 13:48:53 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LDmom9081605; Tue, 21 Jun 2016 13:48:50 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606211348.u5LDmom9081605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 21 Jun 2016 13:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302054 - in head/sys: contrib/ipfilter/netinet dev/usb/net kern net netgraph netinet netinet6 netipsec netpfil/ipfw netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 13:48:54 -0000 Author: bz Date: Tue Jun 21 13:48:49 2016 New Revision: 302054 URL: https://svnweb.freebsd.org/changeset/base/302054 Log: Get closer to a VIMAGE network stack teardown from top to bottom rather than removing the network interfaces first. This change is rather larger and convoluted as the ordering requirements cannot be separated. Move the pfil(9) framework to SI_SUB_PROTO_PFIL, move Firewalls and related modules to their own SI_SUB_PROTO_FIREWALL. Move initialization of "physical" interfaces to SI_SUB_DRIVERS, move virtual (cloned) interfaces to SI_SUB_PSEUDO. Move Multicast to SI_SUB_PROTO_MC. Re-work parts of multicast initialisation and teardown, not taking the huge amount of memory into account if used as a module yet. For interface teardown we try to do as many of them as we can on SI_SUB_INIT_IF, but for some this makes no sense, e.g., when tunnelling over a higher layer protocol such as IP. In that case the interface has to go along (or before) the higher layer protocol is shutdown. Kernel hhooks need to go last on teardown as they may be used at various higher layers and we cannot remove them before we cleaned up the higher layers. For interface teardown there are multiple paths: (a) a cloned interface is destroyed (inside a VIMAGE or in the base system), (b) any interface is moved from a virtual network stack to a different network stack ("vmove"), or (c) a virtual network stack is being shut down. All code paths go through if_detach_internal() where we, depending on the vmove flag or the vnet state, make a decision on how much to shut down; in case we are destroying a VNET the individual protocol layers will cleanup their own parts thus we cannot do so again for each interface as we end up with, e.g., double-frees, destroying locks twice or acquiring already destroyed locks. When calling into protocol cleanups we equally have to tell them whether they need to detach upper layer protocols ("ulp") or not (e.g., in6_ifdetach()). Provide or enahnce helper functions to do proper cleanup at a protocol rather than at an interface level. Approved by: re (hrs) Obtained from: projects/vnet Reviewed by: gnn, jhb Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D6747 Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c head/sys/dev/usb/net/usb_ethernet.c head/sys/kern/kern_hhook.c head/sys/net/if.c head/sys/net/if_bridge.c head/sys/net/if_disc.c head/sys/net/if_edsc.c head/sys/net/if_enc.c head/sys/net/if_epair.c head/sys/net/if_lagg.c head/sys/net/if_loop.c head/sys/net/if_vlan.c head/sys/net/pfil.c head/sys/net/route.c head/sys/net/vnet.c head/sys/net/vnet.h head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_iface.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_var.h head/sys/netinet/ip_id.c head/sys/netinet/ip_input.c head/sys/netinet/ip_mroute.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_ifattach.h head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h head/sys/netipsec/ipsec.c head/sys/netipsec/xform_tcp.c head/sys/netpfil/ipfw/dn_sched.h head/sys/netpfil/ipfw/ip_dummynet.c head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_nat.c head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Tue Jun 21 13:48:49 2016 (r302054) @@ -287,7 +287,7 @@ static moduledata_t ipfiltermod = { }; -DECLARE_MODULE(ipfilter, ipfiltermod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); +DECLARE_MODULE(ipfilter, ipfiltermod, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY); #ifdef MODULE_VERSION MODULE_VERSION(ipfilter, 1); #endif Modified: head/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/dev/usb/net/usb_ethernet.c Tue Jun 21 13:48:49 2016 (r302054) @@ -641,5 +641,9 @@ uether_rxflush(struct usb_ether *ue) } } -DECLARE_MODULE(uether, uether_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +/* + * USB net drivers are run by DRIVER_MODULE() thus SI_SUB_DRIVERS, + * SI_ORDER_MIDDLE. Run uether after that. + */ +DECLARE_MODULE(uether, uether_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(uether, 1); Modified: head/sys/kern/kern_hhook.c ============================================================================== --- head/sys/kern/kern_hhook.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/kern/kern_hhook.c Tue Jun 21 13:48:49 2016 (r302054) @@ -510,7 +510,7 @@ hhook_vnet_uninit(const void *unused __u /* * When a vnet is created and being initialised, init the V_hhook_vhead_list. */ -VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBUF, SI_ORDER_FIRST, +VNET_SYSINIT(hhook_vnet_init, SI_SUB_INIT_IF, SI_ORDER_FIRST, hhook_vnet_init, NULL); /* @@ -518,5 +518,5 @@ VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBU * points to clean up on vnet tear down, but in case the KPI is misused, * provide a function to clean up and free memory for a vnet being destroyed. */ -VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_MBUF, SI_ORDER_ANY, +VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_INIT_IF, SI_ORDER_FIRST, hhook_vnet_uninit, NULL); Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/if.c Tue Jun 21 13:48:49 2016 (r302054) @@ -914,6 +914,16 @@ if_detach(struct ifnet *ifp) CURVNET_RESTORE(); } +/* + * The vmove flag, if set, indicates that we are called from a callpath + * that is moving an interface to a different vnet instance. + * + * The shutdown flag, if set, indicates that we are called in the + * process of shutting down a vnet instance. Currently only the + * vnet_if_return SYSUNINIT function sets it. Note: we can be called + * on a vnet instance shutdown without this flag being set, e.g., when + * the cloned interfaces are destoyed as first thing of teardown. + */ static int if_detach_internal(struct ifnet *ifp, int vmove, struct if_clone **ifcp) { @@ -921,8 +931,10 @@ if_detach_internal(struct ifnet *ifp, in int i; struct domain *dp; struct ifnet *iter; - int found = 0; + int found = 0, shutdown; + shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && + ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; IFNET_WLOCK(); TAILQ_FOREACH(iter, &V_ifnet, if_link) if (iter == ifp) { @@ -930,10 +942,6 @@ if_detach_internal(struct ifnet *ifp, in found = 1; break; } -#ifdef VIMAGE - if (found) - curvnet->vnet_ifcnt--; -#endif IFNET_WUNLOCK(); if (!found) { /* @@ -951,19 +959,58 @@ if_detach_internal(struct ifnet *ifp, in #endif } - /* Check if this is a cloned interface or not. */ + /* + * At this point we know the interface still was on the ifnet list + * and we removed it so we are in a stable state. + */ +#ifdef VIMAGE + curvnet->vnet_ifcnt--; +#endif + + /* + * In any case (destroy or vmove) detach us from the groups + * and remove/wait for pending events on the taskq. + * XXX-BZ in theory an interface could still enqueue a taskq change? + */ + if_delgroups(ifp); + + taskqueue_drain(taskqueue_swi, &ifp->if_linktask); + + /* + * Check if this is a cloned interface or not. Must do even if + * shutting down as a if_vmove_reclaim() would move the ifp and + * the if_clone_addgroup() will have a corrupted string overwise + * from a gibberish pointer. + */ if (vmove && ifcp != NULL) *ifcp = if_clone_findifc(ifp); + if_down(ifp); + /* - * Remove/wait for pending events. + * On VNET shutdown abort here as the stack teardown will do all + * the work top-down for us. + */ + if (shutdown) { + /* + * In case of a vmove we are done here without error. + * If we would signal an error it would lead to the same + * abort as if we did not find the ifnet anymore. + * if_detach() calls us in void context and does not care + * about an early abort notification, so life is splendid :) + */ + goto finish_vnet_shutdown; + } + + /* + * At this point we are not tearing down a VNET and are either + * going to destroy or vmove the interface and have to cleanup + * accordingly. */ - taskqueue_drain(taskqueue_swi, &ifp->if_linktask); /* * Remove routes and flush queues. */ - if_down(ifp); #ifdef ALTQ if (ALTQ_IS_ENABLED(&ifp->if_snd)) altq_disable(&ifp->if_snd); @@ -1018,8 +1065,8 @@ if_detach_internal(struct ifnet *ifp, in } rt_flushifroutes(ifp); - if_delgroups(ifp); +finish_vnet_shutdown: /* * We cannot hold the lock over dom_ifdetach calls as they might * sleep, for example trying to drain a callout, thus open up the @@ -1048,7 +1095,7 @@ if_detach_internal(struct ifnet *ifp, in * unused if_index in target vnet and calls if_grow() if necessary, * and finally find an unused if_xname for the target vnet. */ -void +static void if_vmove(struct ifnet *ifp, struct vnet *new_vnet) { struct if_clone *ifc; @@ -1115,6 +1162,7 @@ if_vmove_loan(struct thread *td, struct { struct prison *pr; struct ifnet *difp; + int shutdown; /* Try to find the prison within our visibility. */ sx_slock(&allprison_lock); @@ -1135,12 +1183,22 @@ if_vmove_loan(struct thread *td, struct /* XXX Lock interfaces to avoid races. */ CURVNET_SET_QUIET(pr->pr_vnet); difp = ifunit(ifname); - CURVNET_RESTORE(); if (difp != NULL) { + CURVNET_RESTORE(); prison_free(pr); return (EEXIST); } + /* Make sure the VNET is stable. */ + shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && + ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; + if (shutdown) { + CURVNET_RESTORE(); + prison_free(pr); + return (EBUSY); + } + CURVNET_RESTORE(); + /* Move the interface into the child jail/vnet. */ if_vmove(ifp, pr->pr_vnet); @@ -1157,6 +1215,7 @@ if_vmove_reclaim(struct thread *td, char struct prison *pr; struct vnet *vnet_dst; struct ifnet *ifp; + int shutdown; /* Try to find the prison within our visibility. */ sx_slock(&allprison_lock); @@ -1184,6 +1243,15 @@ if_vmove_reclaim(struct thread *td, char return (EEXIST); } + /* Make sure the VNET is stable. */ + shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && + ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; + if (shutdown) { + CURVNET_RESTORE(); + prison_free(pr); + return (EBUSY); + } + /* Get interface back from child jail/vnet. */ if_vmove(ifp, vnet_dst); CURVNET_RESTORE(); @@ -2642,8 +2710,22 @@ ifioctl(struct socket *so, u_long cmd, c struct ifreq *ifr; int error; int oif_flags; +#ifdef VIMAGE + int shutdown; +#endif CURVNET_SET(so->so_vnet); +#ifdef VIMAGE + /* Make sure the VNET is stable. */ + shutdown = (so->so_vnet->vnet_state > SI_SUB_VNET && + so->so_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; + if (shutdown) { + CURVNET_RESTORE(); + return (EBUSY); + } +#endif + + switch (cmd) { case SIOCGIFCONF: error = ifconf(cmd, data); Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/if_bridge.c Tue Jun 21 13:48:49 2016 (r302054) @@ -541,7 +541,7 @@ vnet_bridge_uninit(const void *unused __ V_bridge_cloner = NULL; BRIDGE_LIST_LOCK_DESTROY(); } -VNET_SYSUNINIT(vnet_bridge_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_bridge_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_bridge_uninit, NULL); static int Modified: head/sys/net/if_disc.c ============================================================================== --- head/sys/net/if_disc.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/if_disc.c Tue Jun 21 13:48:49 2016 (r302054) @@ -137,7 +137,7 @@ vnet_disc_init(const void *unused __unus V_disc_cloner = if_clone_simple(discname, disc_clone_create, disc_clone_destroy, 0); } -VNET_SYSINIT(vnet_disc_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSINIT(vnet_disc_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_disc_init, NULL); static void @@ -146,7 +146,7 @@ vnet_disc_uninit(const void *unused __un if_clone_detach(V_disc_cloner); } -VNET_SYSUNINIT(vnet_disc_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_disc_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_disc_uninit, NULL); static int Modified: head/sys/net/if_edsc.c ============================================================================== --- head/sys/net/if_edsc.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/if_edsc.c Tue Jun 21 13:48:49 2016 (r302054) @@ -336,7 +336,7 @@ vnet_edsc_uninit(const void *unused __un */ if_clone_detach(V_edsc_cloner); } -VNET_SYSUNINIT(vnet_edsc_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_edsc_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_edsc_uninit, NULL); /* Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/if_enc.c Tue Jun 21 13:48:49 2016 (r302054) @@ -136,7 +136,6 @@ enc_clone_destroy(struct ifnet *ifp) sc = ifp->if_softc; KASSERT(sc == V_enc_sc, ("sc != ifp->if_softc")); - enc_remove_hhooks(sc); bpfdetach(ifp); if_detach(ifp); if_free(ifp); @@ -170,10 +169,6 @@ enc_clone_create(struct if_clone *ifc, i ifp->if_softc = sc; if_attach(ifp); bpfattach(ifp, DLT_ENC, sizeof(struct enchdr)); - if (enc_add_hhooks(sc) != 0) { - enc_clone_destroy(ifp); - return (ENXIO); - } return (0); } @@ -369,18 +364,44 @@ vnet_enc_init(const void *unused __unuse V_enc_cloner = if_clone_simple(encname, enc_clone_create, enc_clone_destroy, 1); } -VNET_SYSINIT(vnet_enc_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSINIT(vnet_enc_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_enc_init, NULL); static void +vnet_enc_init_proto(void *unused __unused) +{ + KASSERT(V_enc_sc != NULL, ("%s: V_enc_sc is %p\n", __func__, V_enc_sc)); + + if (enc_add_hhooks(V_enc_sc) != 0) + enc_clone_destroy(V_enc_sc->sc_ifp); +} +VNET_SYSINIT(vnet_enc_init_proto, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_enc_init_proto, NULL); + +static void vnet_enc_uninit(const void *unused __unused) { + KASSERT(V_enc_sc != NULL, ("%s: V_enc_sc is %p\n", __func__, V_enc_sc)); if_clone_detach(V_enc_cloner); } -VNET_SYSUNINIT(vnet_enc_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_enc_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_enc_uninit, NULL); +/* + * The hhook consumer needs to go before ip[6]_destroy are called on + * SI_ORDER_THIRD. + */ +static void +vnet_enc_uninit_hhook(const void *unused __unused) +{ + KASSERT(V_enc_sc != NULL, ("%s: V_enc_sc is %p\n", __func__, V_enc_sc)); + + enc_remove_hhooks(V_enc_sc); +} +VNET_SYSUNINIT(vnet_enc_uninit_hhook, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH, + vnet_enc_uninit_hhook, NULL); + static int enc_modevent(module_t mod, int type, void *data) { @@ -401,4 +422,4 @@ static moduledata_t enc_mod = { 0 }; -DECLARE_MODULE(if_enc, enc_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); +DECLARE_MODULE(if_enc, enc_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/if_epair.c Tue Jun 21 13:48:49 2016 (r302054) @@ -963,7 +963,7 @@ vnet_epair_init(const void *unused __unu netisr_register_vnet(&epair_nh); #endif } -VNET_SYSINIT(vnet_epair_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSINIT(vnet_epair_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_epair_init, NULL); static void @@ -975,7 +975,7 @@ vnet_epair_uninit(const void *unused __u #endif if_clone_detach(V_epair_cloner); } -VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_epair_uninit, NULL); static int @@ -1012,5 +1012,5 @@ static moduledata_t epair_mod = { 0 }; -DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); MODULE_VERSION(if_epair, 1); Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/if_lagg.c Tue Jun 21 13:48:49 2016 (r302054) @@ -271,7 +271,7 @@ vnet_lagg_uninit(const void *unused __un if_clone_detach(V_lagg_cloner); LAGG_LIST_LOCK_DESTROY(); } -VNET_SYSUNINIT(vnet_lagg_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_lagg_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_lagg_uninit, NULL); static int Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/if_loop.c Tue Jun 21 13:48:49 2016 (r302054) @@ -156,7 +156,7 @@ vnet_loif_init(const void *unused __unus 1); #endif } -VNET_SYSINIT(vnet_loif_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSINIT(vnet_loif_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_loif_init, NULL); #ifdef VIMAGE @@ -167,7 +167,7 @@ vnet_loif_uninit(const void *unused __un if_clone_detach(V_lo_cloner); V_loif = NULL; } -VNET_SYSUNINIT(vnet_loif_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_loif_uninit, SI_SUB_INIT_IF, SI_ORDER_SECOND, vnet_loif_uninit, NULL); #endif Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/if_vlan.c Tue Jun 21 13:48:49 2016 (r302054) @@ -823,7 +823,7 @@ vnet_vlan_uninit(const void *unused __un if_clone_detach(V_vlan_cloner); } -VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, +VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_INIT_IF, SI_ORDER_FIRST, vnet_vlan_uninit, NULL); #endif Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/pfil.c Tue Jun 21 13:48:49 2016 (r302054) @@ -383,17 +383,14 @@ vnet_pfil_uninit(const void *unused __un PFIL_LOCK_DESTROY_REAL(&V_pfil_lock); } -/* Define startup order. */ -#define PFIL_SYSINIT_ORDER SI_SUB_PROTO_BEGIN -#define PFIL_MODEVENT_ORDER (SI_ORDER_FIRST) /* On boot slot in here. */ -#define PFIL_VNET_ORDER (PFIL_MODEVENT_ORDER + 2) /* Later still. */ - /* * Starting up. * * VNET_SYSINIT is called for each existing vnet and each new vnet. + * Make sure the pfil bits are first before any possible subsystem which + * might piggyback on the SI_SUB_PROTO_PFIL. */ -VNET_SYSINIT(vnet_pfil_init, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, +VNET_SYSINIT(vnet_pfil_init, SI_SUB_PROTO_PFIL, SI_ORDER_FIRST, vnet_pfil_init, NULL); /* @@ -401,5 +398,5 @@ VNET_SYSINIT(vnet_pfil_init, PFIL_SYSINI * * VNET_SYSUNINIT is called for each exiting vnet as it exits. */ -VNET_SYSUNINIT(vnet_pfil_uninit, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, +VNET_SYSUNINIT(vnet_pfil_uninit, SI_SUB_PROTO_PFIL, SI_ORDER_FIRST, vnet_pfil_uninit, NULL); Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/route.c Tue Jun 21 13:48:49 2016 (r302054) @@ -334,7 +334,7 @@ vnet_route_uninit(const void *unused __u free(V_rt_tables, M_RTABLE); uma_zdestroy(V_rtzone); } -VNET_SYSUNINIT(vnet_route_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, +VNET_SYSUNINIT(vnet_route_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, vnet_route_uninit, 0); #endif Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/vnet.c Tue Jun 21 13:48:49 2016 (r302054) @@ -331,8 +331,7 @@ vnet_init_done(void *unused __unused) curvnet = NULL; } - -SYSINIT(vnet_init_done, SI_SUB_VNET_DONE, SI_ORDER_FIRST, vnet_init_done, +SYSINIT(vnet_init_done, SI_SUB_VNET_DONE, SI_ORDER_ANY, vnet_init_done, NULL); /* Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/net/vnet.h Tue Jun 21 13:48:49 2016 (r302054) @@ -111,8 +111,8 @@ vnet_##name##_init(const void *unused) \ { \ VNET_PCPUSTAT_ALLOC(name, M_WAITOK); \ } \ -VNET_SYSINIT(vnet_ ## name ## _init, SI_SUB_PROTO_IFATTACHDOMAIN, \ - SI_ORDER_ANY, vnet_ ## name ## _init, NULL) +VNET_SYSINIT(vnet_ ## name ## _init, SI_SUB_INIT_IF, \ + SI_ORDER_FIRST, vnet_ ## name ## _init, NULL) #define VNET_PCPUSTAT_SYSUNINIT(name) \ static void \ @@ -120,8 +120,8 @@ vnet_##name##_uninit(const void *unused) { \ VNET_PCPUSTAT_FREE(name); \ } \ -VNET_SYSUNINIT(vnet_ ## name ## _uninit, SI_SUB_PROTO_IFATTACHDOMAIN, \ - SI_ORDER_ANY, vnet_ ## name ## _uninit, NULL) +VNET_SYSUNINIT(vnet_ ## name ## _uninit, SI_SUB_INIT_IF, \ + SI_ORDER_FIRST, vnet_ ## name ## _uninit, NULL) #ifdef SYSCTL_OID #define SYSCTL_VNET_PCPUSTAT(parent, nbr, name, type, array, desc) \ Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netgraph/ng_eiface.c Tue Jun 21 13:48:49 2016 (r302054) @@ -679,5 +679,5 @@ vnet_ng_eiface_uninit(const void *unused delete_unrhdr(V_ng_eiface_unit); } -VNET_SYSUNINIT(vnet_ng_eiface_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_ng_eiface_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_ng_eiface_uninit, NULL); Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netgraph/ng_iface.c Tue Jun 21 13:48:49 2016 (r302054) @@ -786,5 +786,5 @@ vnet_ng_iface_uninit(const void *unused) delete_unrhdr(V_ng_iface_unit); } -VNET_SYSUNINIT(vnet_ng_iface_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_ng_iface_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_ng_iface_uninit, NULL); Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet/igmp.c Tue Jun 21 13:48:49 2016 (r302054) @@ -227,7 +227,8 @@ static VNET_DEFINE(int, current_state_ti #define V_state_change_timers_running VNET(state_change_timers_running) #define V_current_state_timers_running VNET(current_state_timers_running) -static VNET_DEFINE(LIST_HEAD(, igmp_ifsoftc), igi_head); +static VNET_DEFINE(LIST_HEAD(, igmp_ifsoftc), igi_head) = + LIST_HEAD_INITIALIZER(igi_head); static VNET_DEFINE(struct igmpstat, igmpstat) = { .igps_version = IGPS_VERSION_3, .igps_len = sizeof(struct igmpstat), @@ -701,10 +702,6 @@ igi_delete_locked(const struct ifnet *if return; } } - -#ifdef INVARIANTS - panic("%s: igmp_ifsoftc not found for ifp %p\n", __func__, ifp); -#endif } /* @@ -3595,57 +3592,28 @@ igmp_rec_type_to_str(const int type) } #endif -static void -igmp_init(void *unused __unused) -{ - - CTR1(KTR_IGMPV3, "%s: initializing", __func__); - - IGMP_LOCK_INIT(); - - m_raopt = igmp_ra_alloc(); - - netisr_register(&igmp_nh); -} -SYSINIT(igmp_init, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, igmp_init, NULL); - -static void -igmp_uninit(void *unused __unused) -{ - - CTR1(KTR_IGMPV3, "%s: tearing down", __func__); - - netisr_unregister(&igmp_nh); - - m_free(m_raopt); - m_raopt = NULL; - - IGMP_LOCK_DESTROY(); -} -SYSUNINIT(igmp_uninit, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, igmp_uninit, NULL); - +#ifdef VIMAGE static void vnet_igmp_init(const void *unused __unused) { - CTR1(KTR_IGMPV3, "%s: initializing", __func__); - - LIST_INIT(&V_igi_head); + netisr_register_vnet(&igmp_nh); } -VNET_SYSINIT(vnet_igmp_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_igmp_init, - NULL); +VNET_SYSINIT(vnet_igmp_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, + vnet_igmp_init, NULL); static void vnet_igmp_uninit(const void *unused __unused) { + /* This can happen when we shutdown the entire network stack. */ CTR1(KTR_IGMPV3, "%s: tearing down", __func__); - KASSERT(LIST_EMPTY(&V_igi_head), - ("%s: igi list not empty; ifnets not detached?", __func__)); + netisr_unregister_vnet(&igmp_nh); } -VNET_SYSUNINIT(vnet_igmp_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_igmp_uninit, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_igmp_uninit, NULL); +#endif #ifdef DDB DB_SHOW_COMMAND(igi_list, db_show_igi_list) @@ -3682,14 +3650,24 @@ static int igmp_modevent(module_t mod, int type, void *unused __unused) { - switch (type) { - case MOD_LOAD: - case MOD_UNLOAD: - break; - default: - return (EOPNOTSUPP); - } - return (0); + switch (type) { + case MOD_LOAD: + CTR1(KTR_IGMPV3, "%s: initializing", __func__); + IGMP_LOCK_INIT(); + m_raopt = igmp_ra_alloc(); + netisr_register(&igmp_nh); + break; + case MOD_UNLOAD: + CTR1(KTR_IGMPV3, "%s: tearing down", __func__); + netisr_unregister(&igmp_nh); + m_free(m_raopt); + m_raopt = NULL; + IGMP_LOCK_DESTROY(); + break; + default: + return (EOPNOTSUPP); + } + return (0); } static moduledata_t igmp_mod = { @@ -3697,4 +3675,4 @@ static moduledata_t igmp_mod = { igmp_modevent, 0 }; -DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE); Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet/in.c Tue Jun 21 13:48:49 2016 (r302054) @@ -895,6 +895,39 @@ in_scrubprefix(struct in_ifaddr *target, #undef rtinitflags +void +in_ifscrub_all(void) +{ + struct ifnet *ifp; + struct ifaddr *ifa, *nifa; + struct ifaliasreq ifr; + + IFNET_RLOCK(); + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + /* Cannot lock here - lock recursion. */ + /* IF_ADDR_RLOCK(ifp); */ + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { + if (ifa->ifa_addr->sa_family != AF_INET) + continue; + + /* + * This is ugly but the only way for legacy IP to + * cleanly remove addresses and everything attached. + */ + bzero(&ifr, sizeof(ifr)); + ifr.ifra_addr = *ifa->ifa_addr; + if (ifa->ifa_dstaddr) + ifr.ifra_broadaddr = *ifa->ifa_dstaddr; + (void)in_control(NULL, SIOCDIFADDR, (caddr_t)&ifr, + ifp, NULL); + } + /* IF_ADDR_RUNLOCK(ifp); */ + in_purgemaddrs(ifp); + igmp_domifdetach(ifp); + } + IFNET_RUNLOCK(); +} + /* * Return 1 if the address might be a local broadcast address. */ Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet/in_var.h Tue Jun 21 13:48:49 2016 (r302054) @@ -376,6 +376,7 @@ int in_control(struct socket *, u_long, struct thread *); int in_addprefix(struct in_ifaddr *, int); int in_scrubprefix(struct in_ifaddr *, u_int); +void in_ifscrub_all(void); void ip_input(struct mbuf *); void ip_direct_input(struct mbuf *); void in_ifadown(struct ifaddr *ifa, int); Modified: head/sys/netinet/ip_id.c ============================================================================== --- head/sys/netinet/ip_id.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet/ip_id.c Tue Jun 21 13:48:49 2016 (r302054) @@ -294,4 +294,4 @@ ipid_sysuninit(void) counter_u64_free(V_ip_id); mtx_destroy(&V_ip_id_mtx); } -VNET_SYSUNINIT(ip_id, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY, ipid_sysuninit, NULL); +VNET_SYSUNINIT(ip_id, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ipid_sysuninit, NULL); Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet/ip_input.c Tue Jun 21 13:48:49 2016 (r302054) @@ -370,6 +370,7 @@ ip_init(void) static void ip_destroy(void *unused __unused) { + struct ifnet *ifp; int error; #ifdef RSS @@ -393,11 +394,21 @@ ip_destroy(void *unused __unused) "type HHOOK_TYPE_IPSEC_OUT, id HHOOK_IPSEC_INET: " "error %d returned\n", __func__, error); } - /* Cleanup in_ifaddr hash table; should be empty. */ - hashdestroy(V_in_ifaddrhashtbl, M_IFADDR, V_in_ifaddrhmask); + + /* Remove the IPv4 addresses from all interfaces. */ + in_ifscrub_all(); + + /* Make sure the IPv4 routes are gone as well. */ + IFNET_RLOCK(); + TAILQ_FOREACH(ifp, &V_ifnet, if_link) + rt_flushifroutes_af(ifp, AF_INET); + IFNET_RUNLOCK(); /* Destroy IP reassembly queue. */ ipreass_destroy(); + + /* Cleanup in_ifaddr hash table; should be empty. */ + hashdestroy(V_in_ifaddrhashtbl, M_IFADDR, V_in_ifaddrhmask); } VNET_SYSUNINIT(ip, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip_destroy, NULL); Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet/ip_mroute.c Tue Jun 21 13:48:49 2016 (r302054) @@ -2822,7 +2822,7 @@ vnet_mroute_init(const void *unused __un callout_init(&V_bw_meter_ch, 1); } -VNET_SYSINIT(vnet_mroute_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_mroute_init, +VNET_SYSINIT(vnet_mroute_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mroute_init, NULL); static void @@ -2833,7 +2833,7 @@ vnet_mroute_uninit(const void *unused __ V_nexpire = NULL; } -VNET_SYSUNINIT(vnet_mroute_uninit, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, +VNET_SYSUNINIT(vnet_mroute_uninit, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, vnet_mroute_uninit, NULL); static int @@ -2946,4 +2946,4 @@ static moduledata_t ip_mroutemod = { 0 }; -DECLARE_MODULE(ip_mroute, ip_mroutemod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); +DECLARE_MODULE(ip_mroute, ip_mroutemod, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE); Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet6/in6.c Tue Jun 21 13:48:49 2016 (r302054) @@ -2419,7 +2419,7 @@ in6_domifdetach(struct ifnet *ifp, void mld_domifdetach(ifp); scope6_ifdetach(ext->scope6_id); - nd6_ifdetach(ext->nd_ifinfo); + nd6_ifdetach(ifp, ext->nd_ifinfo); lltable_free(ext->lltable); COUNTER_ARRAY_FREE(ext->in6_ifstat, sizeof(struct in6_ifstat) / sizeof(uint64_t)); Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet6/in6_ifattach.c Tue Jun 21 13:48:49 2016 (r302054) @@ -761,19 +761,30 @@ in6_ifattach(struct ifnet *ifp, struct i /* * NOTE: in6_ifdetach() does not support loopback if at this moment. - * We don't need this function in bsdi, because interfaces are never removed - * from the ifnet list in bsdi. + * + * When shutting down a VNET we clean up layers top-down. In that case + * upper layer protocols (ulp) are cleaned up already and locks are destroyed + * and we must not call into these cleanup functions anymore, thus purgeulp + * is set to 0 in that case by in6_ifdetach_destroy(). + * The normal case of destroying a (cloned) interface still needs to cleanup + * everything related to the interface and will have purgeulp set to 1. */ -void -in6_ifdetach(struct ifnet *ifp) +static void +_in6_ifdetach(struct ifnet *ifp, int purgeulp) { struct ifaddr *ifa, *next; if (ifp->if_afdata[AF_INET6] == NULL) return; - /* remove neighbor management table */ - nd6_purge(ifp); + /* + * Remove neighbor management table. + * Enabling the nd6_purge will panic on vmove for interfaces on VNET + * teardown as the IPv6 layer is cleaned up already and the locks + * are destroyed. + */ + if (purgeulp) + nd6_purge(ifp); /* * nuke any of IPv6 addresses we have @@ -784,9 +795,11 @@ in6_ifdetach(struct ifnet *ifp) continue; in6_purgeaddr(ifa); } - in6_pcbpurgeif0(&V_udbinfo, ifp); - in6_pcbpurgeif0(&V_ulitecbinfo, ifp); - in6_pcbpurgeif0(&V_ripcbinfo, ifp); + if (purgeulp) { + in6_pcbpurgeif0(&V_udbinfo, ifp); + in6_pcbpurgeif0(&V_ulitecbinfo, ifp); + in6_pcbpurgeif0(&V_ripcbinfo, ifp); + } /* leave from all multicast groups joined */ in6_purgemaddrs(ifp); @@ -798,7 +811,22 @@ in6_ifdetach(struct ifnet *ifp) * prefixes after removing all addresses above. * (Or can we just delay calling nd6_purge until at this point?) */ - nd6_purge(ifp); + if (purgeulp) + nd6_purge(ifp); +} + +void +in6_ifdetach(struct ifnet *ifp) +{ + + _in6_ifdetach(ifp, 1); +} + +void +in6_ifdetach_destroy(struct ifnet *ifp) +{ + + _in6_ifdetach(ifp, 0); } int Modified: head/sys/netinet6/in6_ifattach.h ============================================================================== --- head/sys/netinet6/in6_ifattach.h Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet6/in6_ifattach.h Tue Jun 21 13:48:49 2016 (r302054) @@ -37,6 +37,7 @@ void in6_ifattach(struct ifnet *, struct ifnet *); void in6_ifattach_destroy(void); void in6_ifdetach(struct ifnet *); +void in6_ifdetach_destroy(struct ifnet *); int in6_get_tmpifid(struct ifnet *, u_int8_t *, const u_int8_t *, int); void in6_tmpaddrtimer(void *); int in6_get_hw_ifid(struct ifnet *, struct in6_addr *); Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet6/ip6_input.c Tue Jun 21 13:48:49 2016 (r302054) @@ -113,6 +113,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -314,6 +315,8 @@ ip6proto_unregister(short ip6proto) static void ip6_destroy(void *unused __unused) { + struct ifaddr *ifa, *nifa; + struct ifnet *ifp; int error; #ifdef RSS @@ -336,9 +339,30 @@ ip6_destroy(void *unused __unused) "type HHOOK_TYPE_IPSEC_OUT, id HHOOK_IPSEC_INET6: " "error %d returned\n", __func__, error); } - hashdestroy(V_in6_ifaddrhashtbl, M_IFADDR, V_in6_ifaddrhmask); + + /* Cleanup addresses. */ + IFNET_RLOCK(); + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + /* Cannot lock here - lock recursion. */ + /* IF_ADDR_LOCK(ifp); */ + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { + + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + in6_purgeaddr(ifa); + } + /* IF_ADDR_UNLOCK(ifp); */ + in6_ifdetach_destroy(ifp); + mld_domifdetach(ifp); + /* Make sure any routes are gone as well. */ + rt_flushifroutes_af(ifp, AF_INET6); + } + IFNET_RUNLOCK(); + nd6_destroy(); in6_ifattach_destroy(); + + hashdestroy(V_in6_ifaddrhashtbl, M_IFADDR, V_in6_ifaddrhmask); } VNET_SYSUNINIT(inet6, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip6_destroy, NULL); Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet6/ip6_mroute.c Tue Jun 21 13:48:49 2016 (r302054) @@ -1966,4 +1966,4 @@ static moduledata_t ip6_mroutemod = { 0 }; -DECLARE_MODULE(ip6_mroute, ip6_mroutemod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(ip6_mroute, ip6_mroutemod, SI_SUB_PROTO_MC, SI_ORDER_ANY); Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet6/mld6.c Tue Jun 21 13:48:49 2016 (r302054) @@ -612,9 +612,6 @@ mli_delete_locked(const struct ifnet *if return; } } -#ifdef INVARIANTS - panic("%s: mld_ifsoftc not found for ifp %p\n", __func__, ifp); -#endif } /* @@ -3265,7 +3262,7 @@ mld_init(void *unused __unused) mld_po.ip6po_prefer_tempaddr = IP6PO_TEMPADDR_NOTPREFER; mld_po.ip6po_flags = IP6PO_DONTFRAG; } -SYSINIT(mld_init, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, mld_init, NULL); +SYSINIT(mld_init, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, mld_init, NULL); static void mld_uninit(void *unused __unused) @@ -3274,7 +3271,7 @@ mld_uninit(void *unused __unused) CTR1(KTR_MLD, "%s: tearing down", __func__); MLD_LOCK_DESTROY(); } -SYSUNINIT(mld_uninit, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, mld_uninit, NULL); +SYSUNINIT(mld_uninit, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, mld_uninit, NULL); static void vnet_mld_init(const void *unused __unused) @@ -3284,19 +3281,17 @@ vnet_mld_init(const void *unused __unuse LIST_INIT(&V_mli_head); } -VNET_SYSINIT(vnet_mld_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_mld_init, +VNET_SYSINIT(vnet_mld_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mld_init, NULL); static void vnet_mld_uninit(const void *unused __unused) { + /* This can happen if we shutdown the network stack. */ CTR1(KTR_MLD, "%s: tearing down", __func__); - - KASSERT(LIST_EMPTY(&V_mli_head), - ("%s: mli list not empty; ifnets not detached?", __func__)); } -VNET_SYSUNINIT(vnet_mld_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_mld_uninit, +VNET_SYSUNINIT(vnet_mld_uninit, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mld_uninit, NULL); static int @@ -3318,4 +3313,4 @@ static moduledata_t mld_mod = { mld_modevent, 0 }; -DECLARE_MODULE(mld, mld_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(mld, mld_mod, SI_SUB_PROTO_MC, SI_ORDER_ANY); Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Tue Jun 21 07:05:49 2016 (r302053) +++ head/sys/netinet6/nd6.c Tue Jun 21 13:48:49 2016 (r302054) @@ -292,8 +292,19 @@ nd6_ifattach(struct ifnet *ifp) } void -nd6_ifdetach(struct nd_ifinfo *nd) +nd6_ifdetach(struct ifnet *ifp, struct nd_ifinfo *nd) { + struct ifaddr *ifa, *next; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Jun 21 14:16:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BDA5AC5EA7; Tue, 21 Jun 2016 14:16:34 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1365E267D; Tue, 21 Jun 2016 14:16:34 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LEGXhN092562; Tue, 21 Jun 2016 14:16:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LEGXde092560; Tue, 21 Jun 2016 14:16:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201606211416.u5LEGXde092560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 21 Jun 2016 14:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302055 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 14:16:34 -0000 Author: emaste Date: Tue Jun 21 14:16:32 2016 New Revision: 302055 URL: https://svnweb.freebsd.org/changeset/base/302055 Log: syscons.4,vt.4: update kern.vty description reflecting vt as default rS274085 made vt(4) the default system console. Catch up to this in the man page description for the kern.vty tunable. Reviewed by: bz Approved by: re (hrs) Differential Revision: https://reviews.freebsd.org/D6901 Modified: head/share/man/man4/syscons.4 head/share/man/man4/vt.4 Modified: head/share/man/man4/syscons.4 ============================================================================== --- head/share/man/man4/syscons.4 Tue Jun 21 13:48:49 2016 (r302054) +++ head/share/man/man4/syscons.4 Tue Jun 21 14:16:32 2016 (r302055) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 3, 2014 +.Dd June 21, 2016 .Dt SYSCONS 4 .Os .Sh NAME @@ -468,9 +468,10 @@ be selected by setting this variable to .Ql sc or .Ql vt . -If not set, -.Nm -provides the default system console. +If not set, the default console in the +.Pa GENERIC +kernel is +.Xr vt 4 . .El .Sh FILES .Bl -tag -width /usr/share/syscons/xxxxyyyyzzz -compact Modified: head/share/man/man4/vt.4 ============================================================================== --- head/share/man/man4/vt.4 Tue Jun 21 13:48:49 2016 (r302054) +++ head/share/man/man4/vt.4 Tue Jun 21 14:16:32 2016 (r302055) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 17, 2016 +.Dd June 21, 2016 .Dt "VIRTUAL TERMINALS" 4 .Os .Sh NAME @@ -200,12 +200,11 @@ Set this value to .Ql vt or .Ql sc -to override the default driver used for the system console. -By default, -.Xr sc 4 -is used on computers that boot from BIOS, and -.Nm -is used on computers that boot from UEFI. +to choose a specific system console, overriding the default. +If not set, the default in the +.Pa GENERIC +kernel is +.Nm . .It Va kern.vt.fb.default_mode Set this value to a graphic mode to override the default mode picked by the .Nm From owner-svn-src-all@freebsd.org Tue Jun 21 15:18:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D449AC5C76; Tue, 21 Jun 2016 15:18:24 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D408D1788; Tue, 21 Jun 2016 15:18:23 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LFIN2S022055; Tue, 21 Jun 2016 15:18:23 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LFIMSg022047; Tue, 21 Jun 2016 15:18:22 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201606211518.u5LFIMSg022047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Tue, 21 Jun 2016 15:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r302056 - in vendor/libarchive/dist: . cpio cpio/test libarchive libarchive_fe X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 15:18:24 -0000 Author: mm Date: Tue Jun 21 15:18:22 2016 New Revision: 302056 URL: https://svnweb.freebsd.org/changeset/base/302056 Log: Update vendor/libarchive to git f502a81fcd7c331204bf53cc40cbf966ebb28a42 Modified: vendor/libarchive/dist/configure.ac vendor/libarchive/dist/cpio/cpio.c vendor/libarchive/dist/cpio/test/test_option_version.c vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c vendor/libarchive/dist/libarchive/archive_read_support_format_warc.c vendor/libarchive/dist/libarchive_fe/passphrase.c Modified: vendor/libarchive/dist/configure.ac ============================================================================== --- vendor/libarchive/dist/configure.ac Tue Jun 21 14:16:32 2016 (r302055) +++ vendor/libarchive/dist/configure.ac Tue Jun 21 15:18:22 2016 (r302056) @@ -27,6 +27,7 @@ AC_CONFIG_AUX_DIR([build/autoconf]) AC_CONFIG_MACRO_DIR([build/autoconf]) # Must follow AC_CONFIG macros above... AM_INIT_AUTOMAKE() +AM_MAINTAINER_MODE([enable]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # Libtool's "interface version" can be computed from the libarchive version. @@ -845,6 +846,7 @@ if test "x$with_openssl" != "xno"; then else AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1]) fi + AC_CHECK_LIB(crypto,EVP_CIPHER_CTX_init) fi # Probe libmd AFTER OpenSSL/libcrypto. Modified: vendor/libarchive/dist/cpio/cpio.c ============================================================================== --- vendor/libarchive/dist/cpio/cpio.c Tue Jun 21 14:16:32 2016 (r302055) +++ vendor/libarchive/dist/cpio/cpio.c Tue Jun 21 15:18:22 2016 (r302056) @@ -498,7 +498,7 @@ long_help(void) static void version(void) { - fprintf(stdout,"bsdcpio %s -- %s\n", + fprintf(stdout,"bsdcpio %s - %s\n", BSDCPIO_VERSION_STRING, archive_version_details()); exit(0); Modified: vendor/libarchive/dist/cpio/test/test_option_version.c ============================================================================== --- vendor/libarchive/dist/cpio/test/test_option_version.c Tue Jun 21 14:16:32 2016 (r302055) +++ vendor/libarchive/dist/cpio/test/test_option_version.c Tue Jun 21 15:18:22 2016 (r302056) @@ -59,8 +59,8 @@ verify(const char *p, size_t s) ++q; --s; /* Separator. */ failure("Version: %s", p); - assertEqualMem(q, "-- ", 3); - q += 3; s -= 3; + assertEqualMem(q, "- ", 2); + q += 2; s -= 2; /* libarchive name and version number */ assert(s > 11); failure("Version: %s", p); Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c Tue Jun 21 14:16:32 2016 (r302055) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c Tue Jun 21 15:18:22 2016 (r302056) @@ -1712,6 +1712,7 @@ lha_crc16(uint16_t crc, const void *pp, for (;len >= 8; len -= 8) { /* This if statement expects compiler optimization will * remove the stament which will not be executed. */ +#undef bswap16 #if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */ # define bswap16(x) _byteswap_ushort(x) #elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8) \ Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_warc.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_warc.c Tue Jun 21 14:16:32 2016 (r302055) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_warc.c Tue Jun 21 15:18:22 2016 (r302056) @@ -535,7 +535,8 @@ xstrpisotime(const char *s, char **endpt /* as a courtesy to our callers, and since this is a non-standard * routine, we skip leading whitespace */ - for (; isspace(*s); s++); + while (isspace((unsigned char)*s)) + ++s; /* read year */ if ((tm.tm_year = strtoi_lim(s, &s, 1583, 4095)) < 0 || *s++ != '-') { @@ -639,7 +640,9 @@ _warc_rdtyp(const char *buf, size_t bsz) return WT_NONE; } /* overread whitespace */ - for (val += sizeof(_key) - 1U; val < eob && isspace(*val); val++); + val += sizeof(_key) - 1U; + while (val < eob && isspace((unsigned char)*val)) + ++val; if (val + 8U > eob) { ; @@ -676,7 +679,9 @@ _warc_rduri(const char *buf, size_t bsz) return res; } /* overread whitespace */ - for (val += sizeof(_key) - 1U; val < eob && isspace(*val); val++); + val += sizeof(_key) - 1U; + while (val < eob && isspace((unsigned char)*val)) + ++val; /* overread URL designators */ if ((uri = xmemmem(val, eob - val, "://", 3U)) == NULL) { @@ -692,7 +697,8 @@ _warc_rduri(const char *buf, size_t bsz) /* also massage eol to point to the first whitespace * after the last non-whitespace character before * the end of the line */ - for (; eol > uri && isspace(eol[-1]); eol--); + while (eol > uri && isspace((unsigned char)eol[-1])) + --eol; /* now then, inspect the URI */ if (memcmp(val, "file", 4U) == 0) { @@ -727,7 +733,7 @@ _warc_rdlen(const char *buf, size_t bsz) /* strtol kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; len = strtol(val, &on, 10); - if (on == NULL || !isspace(*on)) { + if (on == NULL || !isspace((unsigned char)*on)) { /* hm, can we trust that number? Best not. */ return -1; } @@ -750,7 +756,7 @@ _warc_rdrtm(const char *buf, size_t bsz) /* xstrpisotime() kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; res = xstrpisotime(val, &on); - if (on == NULL || !isspace(*on)) { + if (on == NULL || !isspace((unsigned char)*on)) { /* hm, can we trust that number? Best not. */ return (time_t)-1; } @@ -773,7 +779,7 @@ _warc_rdmtm(const char *buf, size_t bsz) /* xstrpisotime() kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; res = xstrpisotime(val, &on); - if (on == NULL || !isspace(*on)) { + if (on == NULL || !isspace((unsigned char)*on)) { /* hm, can we trust that number? Best not. */ return (time_t)-1; } Modified: vendor/libarchive/dist/libarchive_fe/passphrase.c ============================================================================== --- vendor/libarchive/dist/libarchive_fe/passphrase.c Tue Jun 21 14:16:32 2016 (r302055) +++ vendor/libarchive/dist/libarchive_fe/passphrase.c Tue Jun 21 15:18:22 2016 (r302056) @@ -121,14 +121,15 @@ readpassphrase(const char *prompt, char #else /* _WIN32 && !__CYGWIN__ */ -#include -#include +#include #include #include #ifdef HAVE_PATHS_H #include #endif +#include #include +#include #include #ifdef TCSASOFT @@ -142,11 +143,18 @@ readpassphrase(const char *prompt, char # define _POSIX_VDISABLE VDISABLE #endif -static volatile sig_atomic_t *signo; +#define M(a,b) (a > b ? a : b) +#define MAX_SIGNO M(M(M(SIGALRM, SIGHUP), \ + M(SIGINT, SIGPIPE)), \ + M(M(SIGQUIT, SIGTERM), \ + M(M(SIGTSTP, SIGTTIN), SIGTTOU))) + +static volatile sig_atomic_t signo[MAX_SIGNO + 1]; static void handler(int s) { + assert(s <= MAX_SIGNO); signo[s] = 1; } @@ -166,12 +174,8 @@ readpassphrase(const char *prompt, char return(NULL); } - if (signo == NULL) { - signo = calloc(SIGRTMAX, sizeof(sig_atomic_t)); - } - restart: - for (i = 0; i < SIGRTMAX; i++) + for (i = 0; i <= MAX_SIGNO; i++) signo[i] = 0; nr = -1; save_errno = 0; @@ -198,6 +202,7 @@ restart: sigemptyset(&sa.sa_mask); sa.sa_flags = 0; /* don't restart system calls */ sa.sa_handler = handler; + /* Keep this list in sync with MAX_SIGNO! */ (void)sigaction(SIGALRM, &sa, &savealrm); (void)sigaction(SIGHUP, &sa, &savehup); (void)sigaction(SIGINT, &sa, &saveint); @@ -237,11 +242,11 @@ restart: if (p < end) { if ((flags & RPP_SEVENBIT)) ch &= 0x7f; - if (isalpha(ch)) { + if (isalpha((unsigned char)ch)) { if ((flags & RPP_FORCELOWER)) - ch = (char)tolower(ch); + ch = (char)tolower((unsigned char)ch); if ((flags & RPP_FORCEUPPER)) - ch = (char)toupper(ch); + ch = (char)toupper((unsigned char)ch); } *p++ = ch; } @@ -276,7 +281,7 @@ restart: * If we were interrupted by a signal, resend it to ourselves * now that we have restored the signal handlers. */ - for (i = 0; i < SIGRTMAX; i++) { + for (i = 0; i <= MAX_SIGNO; i++) { if (signo[i]) { kill(getpid(), i); switch (i) { From owner-svn-src-all@freebsd.org Tue Jun 21 15:27:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE6E7AC5E51; Tue, 21 Jun 2016 15:27:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFE801D42; Tue, 21 Jun 2016 15:27:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LFRGdA026148; Tue, 21 Jun 2016 15:27:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LFRG6o026147; Tue, 21 Jun 2016 15:27:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201606211527.u5LFRG6o026147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 21 Jun 2016 15:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302058 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 15:27:18 -0000 Author: asomers Date: Tue Jun 21 15:27:16 2016 New Revision: 302058 URL: https://svnweb.freebsd.org/changeset/base/302058 Log: Fix uninitialized variable from r300881 sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Initialize needs_update in vdev_geom_set_physpath PR: 210409 Reported by: kp Reviewed by: kp Approved by: re (hrs) MFC after: 4 weeks X-MFC-With: 300881 Sponsored by: Spectra Logic Corp Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Jun 21 15:26:59 2016 (r302057) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Jun 21 15:27:16 2016 (r302058) @@ -87,7 +87,7 @@ vdev_geom_set_rotation_rate(vdev_t *vd, static void vdev_geom_set_physpath(struct g_consumer *cp, boolean_t do_null_update) { - boolean_t needs_update; + boolean_t needs_update = B_FALSE; vdev_t *vd; char *physpath; int error, physpath_len; From owner-svn-src-all@freebsd.org Tue Jun 21 15:38:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F7BBAC50AF; Tue, 21 Jun 2016 15:38:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 529E425AE; Tue, 21 Jun 2016 15:38:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LFcKTK030153; Tue, 21 Jun 2016 15:38:20 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LFcKW9030152; Tue, 21 Jun 2016 15:38:20 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606211538.u5LFcKW9030152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 21 Jun 2016 15:38:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302060 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 15:38:21 -0000 Author: adrian Date: Tue Jun 21 15:38:20 2016 New Revision: 302060 URL: https://svnweb.freebsd.org/changeset/base/302060 Log: [ath] fix TX throughput for EDMA chips by pushing more into the TX FIFO. It turns out that getting decent performance requires stacking the TX FIFO a little more aggressively. * Ensure that when we complete a frame, we attempt to push a new frame into the FIFO so TX is kept as active as it needs to be * Be more aggressive about batching non-aggregate frames into a single TX FIFO slot. This "fixes" TDMA performance (since we only get one TX FIFO slot ungated per DMA beacon alert) but it does this by pushing a whole lot of work into the TX FIFO slot. I'm not /entirely/ pleased by this solution, but it does fix a whole bunch of corner case issues in the transmit side and fix TDMA whilst I'm at it. I'll go revisit transmit packet scheduling in ath(4) post 11. Tested: * AR9380, STA mode * AR9580, hostap mode * AR9380, TDMA client mode Approved by: re (hrs) Modified: head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Tue Jun 21 15:29:06 2016 (r302059) +++ head/sys/dev/ath/if_ath_tx_edma.c Tue Jun 21 15:38:20 2016 (r302060) @@ -156,6 +156,17 @@ ath_tx_alq_edma_push(struct ath_softc *s } #endif /* ATH_DEBUG_ALQ */ +/* + * XXX TODO: push an aggregate as a single FIFO slot, even though + * it may not meet the TXOP for say, DBA-gated traffic in TDMA mode. + * + * The TX completion code handles a TX FIFO slot having multiple frames, + * aggregate or otherwise, but it may just make things easier to deal + * with. + * + * XXX TODO: track the number of aggregate subframes and put that in the + * push alq message. + */ static void ath_tx_edma_push_staging_list(struct ath_softc *sc, struct ath_txq *txq, int limit) @@ -274,6 +285,8 @@ ath_tx_edma_push_staging_list(struct ath #endif /* ATH_DEBUG_ALQ */ } +#define TX_BATCH_SIZE 32 + /* * Push some frames into the TX FIFO if we have space. */ @@ -320,7 +333,50 @@ ath_edma_tx_fifo_fill(struct ath_softc * * be time based rather than a hard count, but I also * do need sleep. */ - ath_tx_edma_push_staging_list(sc, txq, 4); + + /* + * Do some basic, basic batching to the hardware + * queue. + * + * If we have TX_BATCH_SIZE entries in the staging + * queue, then let's try to send them all in one hit. + * + * Ensure we don't push more than TX_BATCH_SIZE worth + * in, otherwise we end up draining 8 slots worth of + * 32 frames into the hardware queue and then we don't + * attempt to push more frames in until we empty the + * FIFO. + */ + if (txq->axq_depth >= TX_BATCH_SIZE / 2 && + txq->fifo.axq_depth <= TX_BATCH_SIZE) { + ath_tx_edma_push_staging_list(sc, txq, TX_BATCH_SIZE); + } + + /* + * Aggregate check: if we have less than two FIFO slots + * busy and we have some aggregate frames, queue it. + * + * Now, ideally we'd just check to see if the scheduler + * has given us aggregate frames and push them into the FIFO + * as individual slots, as honestly we should just be pushing + * a single aggregate in as one FIFO slot. + * + * Let's do that next once I know this works. + */ + else if (txq->axq_aggr_depth > 0 && txq->axq_fifo_depth < 2) + ath_tx_edma_push_staging_list(sc, txq, TX_BATCH_SIZE); + + /* + * + * If we have less, and the TXFIFO isn't empty, let's + * wait until we've finished sending the FIFO. + * + * If we have less, and the TXFIFO is empty, then + * send them. + */ + else if (txq->axq_fifo_depth == 0) { + ath_tx_edma_push_staging_list(sc, txq, TX_BATCH_SIZE); + } } /* @@ -478,13 +534,6 @@ ath_edma_xmit_handoff_hw(struct ath_soft /* Push and update frame stats */ ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); - /* For now, set the link pointer in the last descriptor - * to be NULL. - * - * Later on, when it comes time to handling multiple descriptors - * in one FIFO push, we can link descriptors together this way. - */ - /* * Finally, call the FIFO schedule routine to schedule some * frames to the FIFO. @@ -722,6 +771,7 @@ ath_edma_tx_processq(struct ath_softc *s struct ieee80211_node *ni; int nacked = 0; int idx; + int i; #ifdef ATH_DEBUG /* XXX */ @@ -927,28 +977,28 @@ ath_edma_tx_processq(struct ath_softc *s /* Handle frame completion and rate control update */ ath_tx_process_buf_completion(sc, txq, &ts, bf); - /* bf is invalid at this point */ - - /* - * Now that there's space in the FIFO, let's push some - * more frames into it. - */ - ATH_TXQ_LOCK(txq); - if (dosched) - ath_edma_tx_fifo_fill(sc, txq); - ATH_TXQ_UNLOCK(txq); + /* NB: bf is invalid at this point */ } sc->sc_wd_timer = 0; - /* Kick software scheduler */ /* * XXX It's inefficient to do this if the FIFO queue is full, * but there's no easy way right now to only populate * the txq task for _one_ TXQ. This should be fixed. */ - if (dosched) + if (dosched) { + /* Attempt to schedule more hardware frames to the TX FIFO */ + for (i = 0; i < HAL_NUM_TX_QUEUES; i++) { + if (ATH_TXQ_SETUP(sc, i)) { + ATH_TXQ_LOCK(&sc->sc_txq[i]); + ath_edma_tx_fifo_fill(sc, &sc->sc_txq[i]); + ATH_TXQ_UNLOCK(&sc->sc_txq[i]); + } + } + /* Kick software scheduler */ ath_tx_swq_kick(sc); + } } static void From owner-svn-src-all@freebsd.org Tue Jun 21 15:39:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE7B4AC511B; Tue, 21 Jun 2016 15:39:56 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5B1E275B; Tue, 21 Jun 2016 15:39:56 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x22c.google.com with SMTP id g127so21327444ith.0; Tue, 21 Jun 2016 08:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=UtQNlua9UtO3a+yWUvyYdZvxAgu+RcMPkGG57uLtyqA=; b=BjPt5meYcd62QnSut5/wYEZWpGcPrMXHaTpzLX9idtIF+Xxv1Qe6n6fP0OmmOiv8om uHO2MHF0kfzgJQ5v7j3u4nDxxIMjyeeEkeVXNXINWVDY5cOrvI95dZpmf70sKRQk47Np ROJrx9WCtsZ4d9miTVtwnsk2HrKgsmz8KuF7Ueo0XJD4MHKLXmPNhuwKZmAtwuyWqwVX n9lFZ74AgLTN6jcdzP0O/6vpCorsGyARWKJxdO8v/b08mPCICpiJtWgI5v72dcEBgffs 3ysQmoOMWyH8sWEDKHBPoeDqq4pqT7CmndTfhFzCydzfH0/Lf1qwwcCkJVALVP8ze2vn fJqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=UtQNlua9UtO3a+yWUvyYdZvxAgu+RcMPkGG57uLtyqA=; b=mEuL9KAusHyAhdYCsVwvsKX7Qf05KJbEdDJB4SfzqsH9MlhDCT+JgH6dK7OVAm4QTY cemjEwNkuQ3cW8Ryi+NNBUq0KE9LgddM4N/fdJyMA3/Gz9qDeTG+0CbUL8rk9SaU+lPs /I/2FS/SpxEcu5k65F45IrF1QvmqQZGBe9jh+3/RU382QFYDZNk3agx/v3gbJvdN2b7B GWkMeBpD0Zg2lAqG/Pj/9V5uj2qYqS/IOpL7GMr4VYyXpr/n5vvZ9Wv1qx9F3I5CJ56e KXOts2nT/Fp51cWFLr6zEPat89noUslH2qpnD98c9QhCcYnQUo4V5gJYAtmE0Y02p/pT uxzw== X-Gm-Message-State: ALyK8tIWmy1WJK9+lfahvjRUhz699uQkPCs+qLr5ov0skQ928OHRMrEga4uflYPYhF+R3J+muWCwSbwqB6QURg== X-Received: by 10.36.250.10 with SMTP id v10mr6434473ith.25.1466523595883; Tue, 21 Jun 2016 08:39:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.210.212 with HTTP; Tue, 21 Jun 2016 08:39:55 -0700 (PDT) In-Reply-To: <20160621093624.GD80346@brick> References: <201606191428.u5JESbbs053857@slippy.cwsent.com> <49d3d34d-ba91-ebdf-497f-cbe1614bec53@FreeBSD.org> <20160621093624.GD80346@brick> From: Adrian Chadd Date: Tue, 21 Jun 2016 08:39:55 -0700 Message-ID: Subject: Re: svn commit: r299448 - in head/sys/cddl/contrib/opensolaris: common/acl uts/common/fs/zfs uts/common/sys To: Alexander Motin , Cy Schubert , Jan Beich , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 15:39:57 -0000 "Solution dictated on account of personal life" is totally legit! -a On 21 June 2016 at 02:36, Edward Tomasz Napiera=C5=82a = wrote: > On 0619T1733, Alexander Motin wrote: >> On 19.06.16 17:28, Cy Schubert wrote: >> > In message <20160619080803.GA1638@brick>, Edward Tomasz >> > =3D?utf-8?Q?Napiera=3DC5=3D82 >> > a?=3D writes: >> >> On 0614T0232, Jan Beich wrote: >> >>> Alexander Motin writes: >> >>> >> >>>> Author: mav >> >>>> Date: Wed May 11 13:43:20 2016 >> >>>> New Revision: 299448 >> >>>> URL: https://svnweb.freebsd.org/changeset/base/299448 >> >>>> >> >>>> Log: >> >>>> MFV r299442: 6762 POSIX write should imply DELETE_CHILD on direct= ories >> >> - and >> >>>> some additional considerations >> >>>> >> >>>> Reviewed by: Gordon Ross >> >>>> Reviewed by: Yuri Pankov >> >>>> Author: Kevin Crowe >> >>>> >> >>>> openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916 >> >>> >> >>> This commit confuses acl_is_trivial_np(3). Notice '+' in ls(1) and '= D' >> >>> in getfacl(1) outputs. >> >> >> >> It's not just that. >> >> >> >> Those changes: >> >> >> >> 1. Confuse acl_is_trivial_np(3), as you say. It's hard to fix in lib= c, >> >> because they make trivial ACLs different for files and directories= , >> >> and acl_is_trivial_np(3) has no way of telling which is which. >> >> >> >> 2. They make delete deny permission take precedence over the containi= ng >> >> directory write allow permission, which is rather different from w= hat >> >> people expect in unix systems, and is against the NFSv4 specificat= ion, >> >> even though it might be a better fit for Windows. >> > >> > This is Windows behavior and inconsistent with the rest of FreeBSD and= any >> > UNIX or Linux system. >> > >> >> >> >> 3. They make umask apply to inherit_only permissions, and >> >> >> >> 4. I don't fully understand this one yet, but from the ACL regression >> >> test suite (which lives in tests/sys/acl/, and I'd appreciate peop= le >> >> actually ran this before committing ACL-related changes) it looks >> >> like it makes umask not apply to the stuff it should. >> >> >> >> The #1 could be fixed by making ZFS not setting delete_child on write= , >> >> basically reverting to the previous behaviour in that aspect. As for >> >> the others... I'm not saying each one of those is wrong, but they >> >> certainly warrant further discussion, especially #2 and #4. >> > >> > I think #2 is wrong behavior on any UNIX-like or POSIX system. >> > >> >> >> >> Basically, what I'm trying to say is that we should consider backing >> >> this out for 11.0-RELEASE, reverting to the previous semantics, verif= ied >> >> by passing the regression tests. >> > >> > Agreed. >> > >> > What in FreeBSD was this patch supposed to solve in the first place? >> >> Growing divergence from OpenZFS upstream. I am not advocating this >> patch, but it would be good, if possible, to not revert it completely, >> but block wrong behavior with some minimal ifdefs to make further ZFS >> merges easier. Help would be appreciated. ;) > > Our family just expanded, and thus I'm afraid I won't be able to help > for the next few weeks. That's one of the reasons why I've suggested > the backout for 11.0 - not a permanent "let's ignore this piece of code > forever" backout, but a temporary one, for 11.0; we would then go back > to the topic after the release. > > From owner-svn-src-all@freebsd.org Tue Jun 21 15:47:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DBF3AC540A; Tue, 21 Jun 2016 15:47:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CCC02E44; Tue, 21 Jun 2016 15:47:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LFltdp033908; Tue, 21 Jun 2016 15:47:55 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LFlsx7033903; Tue, 21 Jun 2016 15:47:54 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201606211547.u5LFlsx7033903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 21 Jun 2016 15:47:54 +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: r302061 - in stable/10: share/man/man4 sys/modules/netgraph/mppc sys/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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 15:47:56 -0000 Author: pfg Date: Tue Jun 21 15:47:54 2016 New Revision: 302061 URL: https://svnweb.freebsd.org/changeset/base/302061 Log: MFC r301549, r301550: ng_mppc(4): Bring netgraph(3) MPPC compression support. Support for compression has been available from July 2007 but it was never imported due to concerns with patents once held by STAC/HiFn. The issues have clearly been resolved so bring it in now. Special thanks to Brett Glass for preserving the code and pointing documentation for the expiration case. Taken from: mav (through Brett Glass) Added: stable/10/sys/net/mppc.h - copied unchanged from r301549, head/sys/net/mppc.h stable/10/sys/net/mppcc.c - copied unchanged from r301549, head/sys/net/mppcc.c stable/10/sys/net/mppcd.c - copied unchanged from r301549, head/sys/net/mppcd.c Modified: stable/10/share/man/man4/ng_mppc.4 stable/10/sys/modules/netgraph/mppc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ng_mppc.4 ============================================================================== --- stable/10/share/man/man4/ng_mppc.4 Tue Jun 21 15:38:20 2016 (r302060) +++ stable/10/share/man/man4/ng_mppc.4 Tue Jun 21 15:47:54 2016 (r302061) @@ -35,7 +35,7 @@ .\" $Whistle: ng_mppc.8,v 1.1 1999/12/08 20:20:39 archie Exp $ .\" $FreeBSD$ .\" -.Dd December 8, 1999 +.Dd June 7, 2016 .Dt NG_MPPC 4 .Os .Sh NAME @@ -153,12 +153,6 @@ and are supplied to selectively compile in either or both capabilities. At least one of these must be defined, or else this node type is useless. .Pp -The MPPC protocol requires proprietary compression code available -from Hi/Fn (formerly STAC). -These files must be obtained elsewhere and added to the kernel -sources before this node type will compile with the -.Dv NETGRAPH_MPPC_COMPRESSION -option. .Sh SEE ALSO .Xr netgraph 4 , .Xr ng_ppp 4 , Modified: stable/10/sys/modules/netgraph/mppc/Makefile ============================================================================== --- stable/10/sys/modules/netgraph/mppc/Makefile Tue Jun 21 15:38:20 2016 (r302060) +++ stable/10/sys/modules/netgraph/mppc/Makefile Tue Jun 21 15:47:54 2016 (r302061) @@ -4,11 +4,10 @@ KMOD= ng_mppc SRCS= ng_mppc.c opt_netgraph.h -NETGRAPH_MPPC_COMPRESSION?= 0 +NETGRAPH_MPPC_COMPRESSION?= 1 NETGRAPH_MPPC_ENCRYPTION?= 1 .if ${NETGRAPH_MPPC_COMPRESSION} > 0 -# XXX These files don't exist yet, but hopefully someday they will... .PATH: ${.CURDIR}/../../../net SRCS+= mppcc.c mppcd.c .endif Copied: stable/10/sys/net/mppc.h (from r301549, head/sys/net/mppc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/net/mppc.h Tue Jun 21 15:47:54 2016 (r302061, copy of r301549, head/sys/net/mppc.h) @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2007 Alexander Motin + * 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 unmodified, 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$ + */ + +/* + * MPPC decompression library. + * Version 1.0 + * + * Note that Hi/Fn (later acquired by Exar Corporation) held US patents + * on some implementation-critical aspects of MPPC compression. + * These patents lapsed due to non-payment of fees in 2007 and by 2015 + * expired altogether. + */ + +#ifndef _NET_MPPC_H_ +#define _NET_MPPC_H_ + +#define MPPC_MANDATORY_COMPRESS_FLAGS 0 +#define MPPC_MANDATORY_DECOMPRESS_FLAGS 0 + +#define MPPC_SAVE_HISTORY 1 + +#define MPPC_OK 5 +#define MPPC_EXPANDED 8 +#define MPPC_RESTART_HISTORY 16 +#define MPPC_DEST_EXHAUSTED 32 + +extern size_t MPPC_SizeOfCompressionHistory(void); +extern size_t MPPC_SizeOfDecompressionHistory(void); + +extern void MPPC_InitCompressionHistory(char *history); +extern void MPPC_InitDecompressionHistory(char *history); + +extern int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef); +extern int MPPC_Decompress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags); + +#endif Copied: stable/10/sys/net/mppcc.c (from r301549, head/sys/net/mppcc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/net/mppcc.c Tue Jun 21 15:47:54 2016 (r302061, copy of r301549, head/sys/net/mppcc.c) @@ -0,0 +1,299 @@ +/*- + * Copyright (c) 2002-2004 Jan Dubiec + * Copyright (c) 2007 Alexander Motin + * 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 unmodified, 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$ + */ + +/* + * MPPC decompression library. + * Version 1.0 + * + * Note that Hi/Fn (later acquired by Exar Corporation) held US patents + * on some implementation-critical aspects of MPPC compression. + * These patents lapsed due to non-payment of fees in 2007 and by 2015 + * expired altogether. + */ + +#include +#include + +#include + +#define MPPE_HIST_LEN 8192 + +#define HASH(x) (((40543*(((((x)[0]<<4)^(x)[1])<<4)^(x)[2]))>>4) & 0x1fff) + +struct MPPC_comp_state { + uint8_t hist[2*MPPE_HIST_LEN]; + uint16_t histptr; + uint16_t hash[MPPE_HIST_LEN]; +}; + +/* Inserts 1 to 8 bits into the output buffer. */ +static void __inline +putbits8(uint8_t *buf, uint32_t val, const uint32_t n, uint32_t *i, uint32_t *l) +{ + buf += *i; + if (*l >= n) { + *l = (*l) - n; + val <<= *l; + *buf = *buf | (val & 0xff); + if (*l == 0) { + *l = 8; + (*i)++; + *(++buf) = 0; + } + } else { + (*i)++; + *l = 8 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 8) & 0xff); + *(++buf) = val & 0xff; + } +} + +/* Inserts 9 to 16 bits into the output buffer. */ +static void __inline +putbits16(uint8_t *buf, uint32_t val, const uint32_t n, uint32_t *i, uint32_t *l) +{ + buf += *i; + if (*l >= n - 8) { + (*i)++; + *l = 8 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 8) & 0xff); + *(++buf) = val & 0xff; + if (*l == 0) { + *l = 8; + (*i)++; + *(++buf) = 0; + } + } else { + (*i)++; (*i)++; + *l = 16 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 16) & 0xff); + *(++buf) = (val >> 8) & 0xff; + *(++buf) = val & 0xff; + } +} + +/* Inserts 17 to 24 bits into the output buffer. */ +static void __inline +putbits24(uint8_t *buf, uint32_t val, const uint32_t n, uint32_t *i, uint32_t *l) +{ + buf += *i; + if (*l >= n - 16) { + (*i)++; (*i)++; + *l = 16 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 16) & 0xff); + *(++buf) = (val >> 8) & 0xff; + *(++buf) = val & 0xff; + if (*l == 0) { + *l = 8; + (*i)++; + *(++buf) = 0; + } + } else { + (*i)++; (*i)++; (*i)++; + *l = 24 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 24) & 0xff); + *(++buf) = (val >> 16) & 0xff; + *(++buf) = (val >> 8) & 0xff; + *(++buf) = val & 0xff; + } +} + +size_t MPPC_SizeOfCompressionHistory(void) +{ + return (sizeof(struct MPPC_comp_state)); +} + +void MPPC_InitCompressionHistory(char *history) +{ + struct MPPC_comp_state *state = (struct MPPC_comp_state*)history; + + bzero(history, sizeof(struct MPPC_comp_state)); + state->histptr = MPPE_HIST_LEN; +} + +int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef) +{ + struct MPPC_comp_state *state = (struct MPPC_comp_state*)history; + uint32_t olen, off, len, idx, i, l; + uint8_t *hist, *sbuf, *p, *q, *r, *s; + int rtn = MPPC_OK; + + /* + * At this point, to avoid possible buffer overflow caused by packet + * expansion during/after compression, we should make sure we have + * space for the worst case. + + * Maximum MPPC packet expansion is 12.5%. This is the worst case when + * all octets in the input buffer are >= 0x80 and we cannot find any + * repeated tokens. + */ + if (*dstCnt < (*srcCnt * 9 / 8 + 2)) { + rtn &= ~MPPC_OK; + return (rtn); + } + + /* We can't compress more then MPPE_HIST_LEN bytes in a call. */ + if (*srcCnt > MPPE_HIST_LEN) { + rtn &= ~MPPC_OK; + return (rtn); + } + + hist = state->hist + MPPE_HIST_LEN; + /* check if there is enough room at the end of the history */ + if (state->histptr + *srcCnt >= 2*MPPE_HIST_LEN) { + rtn |= MPPC_RESTART_HISTORY; + state->histptr = MPPE_HIST_LEN; + memcpy(state->hist, hist, MPPE_HIST_LEN); + } + /* Add packet to the history. */ + sbuf = state->hist + state->histptr; + memcpy(sbuf, *src, *srcCnt); + state->histptr += *srcCnt; + + /* compress data */ + r = sbuf + *srcCnt; + **dst = olen = i = 0; + l = 8; + while (i < *srcCnt - 2) { + s = q = sbuf + i; + + /* Prognose matching position using hash function. */ + idx = HASH(s); + p = hist + state->hash[idx]; + state->hash[idx] = (uint16_t) (s - hist); + if (p > s) /* It was before MPPC_RESTART_HISTORY. */ + p -= MPPE_HIST_LEN; /* Try previous history buffer. */ + off = s - p; + + /* Check our prognosis. */ + if (off > MPPE_HIST_LEN - 1 || off < 1 || *p++ != *s++ || + *p++ != *s++ || *p++ != *s++) { + /* No match found; encode literal byte. */ + if ((*src)[i] < 0x80) { /* literal byte < 0x80 */ + putbits8(*dst, (uint32_t) (*src)[i], 8, &olen, &l); + } else { /* literal byte >= 0x80 */ + putbits16(*dst, (uint32_t) (0x100|((*src)[i]&0x7f)), 9, + &olen, &l); + } + ++i; + continue; + } + + /* Find length of the matching fragment */ +#if defined(__amd64__) || defined(__i386__) + /* Optimization for CPUs without strict data aligning requirements */ + while ((*((uint32_t*)p) == *((uint32_t*)s)) && (s < (r - 3))) { + p+=4; + s+=4; + } +#endif + while((*p++ == *s++) && (s <= r)); + len = s - q - 1; + i += len; + + /* At least 3 character match found; code data. */ + /* Encode offset. */ + if (off < 64) { /* 10-bit offset; 0 <= offset < 64 */ + putbits16(*dst, 0x3c0|off, 10, &olen, &l); + } else if (off < 320) { /* 12-bit offset; 64 <= offset < 320 */ + putbits16(*dst, 0xe00|(off-64), 12, &olen, &l); + } else if (off < 8192) { /* 16-bit offset; 320 <= offset < 8192 */ + putbits16(*dst, 0xc000|(off-320), 16, &olen, &l); + } else { /* NOTREACHED */ + rtn &= ~MPPC_OK; + return rtn; + } + + /* Encode length of match. */ + if (len < 4) { /* length = 3 */ + putbits8(*dst, 0, 1, &olen, &l); + } else if (len < 8) { /* 4 <= length < 8 */ + putbits8(*dst, 0x08|(len&0x03), 4, &olen, &l); + } else if (len < 16) { /* 8 <= length < 16 */ + putbits8(*dst, 0x30|(len&0x07), 6, &olen, &l); + } else if (len < 32) { /* 16 <= length < 32 */ + putbits8(*dst, 0xe0|(len&0x0f), 8, &olen, &l); + } else if (len < 64) { /* 32 <= length < 64 */ + putbits16(*dst, 0x3c0|(len&0x1f), 10, &olen, &l); + } else if (len < 128) { /* 64 <= length < 128 */ + putbits16(*dst, 0xf80|(len&0x3f), 12, &olen, &l); + } else if (len < 256) { /* 128 <= length < 256 */ + putbits16(*dst, 0x3f00|(len&0x7f), 14, &olen, &l); + } else if (len < 512) { /* 256 <= length < 512 */ + putbits16(*dst, 0xfe00|(len&0xff), 16, &olen, &l); + } else if (len < 1024) { /* 512 <= length < 1024 */ + putbits24(*dst, 0x3fc00|(len&0x1ff), 18, &olen, &l); + } else if (len < 2048) { /* 1024 <= length < 2048 */ + putbits24(*dst, 0xff800|(len&0x3ff), 20, &olen, &l); + } else if (len < 4096) { /* 2048 <= length < 4096 */ + putbits24(*dst, 0x3ff000|(len&0x7ff), 22, &olen, &l); + } else if (len < 8192) { /* 4096 <= length < 8192 */ + putbits24(*dst, 0xffe000|(len&0xfff), 24, &olen, &l); + } else { /* NOTREACHED */ + rtn &= ~MPPC_OK; + return (rtn); + } + } + + /* Add remaining octets to the output. */ + while(*srcCnt - i > 0) { + if ((*src)[i] < 0x80) { /* literal byte < 0x80 */ + putbits8(*dst, (uint32_t) (*src)[i++], 8, &olen, &l); + } else { /* literal byte >= 0x80 */ + putbits16(*dst, (uint32_t) (0x100|((*src)[i++]&0x7f)), 9, &olen, + &l); + } + } + + /* Reset unused bits of the last output octet. */ + if ((l != 0) && (l != 8)) { + putbits8(*dst, 0, l, &olen, &l); + } + + /* If result is bigger then original, set flag and flush history. */ + if ((*srcCnt < olen) || ((flags & MPPC_SAVE_HISTORY) == 0)) { + if (*srcCnt < olen) + rtn |= MPPC_EXPANDED; + bzero(history, sizeof(struct MPPC_comp_state)); + state->histptr = MPPE_HIST_LEN; + } + + *src += *srcCnt; + *srcCnt = 0; + *dst += olen; + *dstCnt -= olen; + + return (rtn); +} Copied: stable/10/sys/net/mppcd.c (from r301549, head/sys/net/mppcd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/net/mppcd.c Tue Jun 21 15:47:54 2016 (r302061, copy of r301549, head/sys/net/mppcd.c) @@ -0,0 +1,284 @@ +/*- + * Copyright (c) 2002-2004 Jan Dubiec + * Copyright (c) 2007 Alexander Motin + * 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 unmodified, 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$ + */ + +/* + * MPPC decompression library. + * Version 1.0 + * + * Note that Hi/Fn (later acquired by Exar Corporation) held US patents + * on some implementation-critical aspects of MPPC compression. + * These patents lapsed due to non-payment of fees in 2007 and by 2015 + * expired altogether. + */ + +#include +#include + +#include + +#define MPPE_HIST_LEN 8192 + +struct MPPC_decomp_state { + uint8_t hist[2*MPPE_HIST_LEN]; + uint16_t histptr; +}; + +static uint32_t __inline +getbits(const uint8_t *buf, const uint32_t n, uint32_t *i, uint32_t *l) +{ + static const uint32_t m[] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; + uint32_t res, ol; + + ol = *l; + if (*l >= n) { + *l = (*l) - n; + res = (buf[*i] & m[ol]) >> (*l); + if (*l == 0) { + *l = 8; + (*i)++; + } + } else { + *l = 8 - n + (*l); + res = (buf[(*i)++] & m[ol]) << 8; + res = (res | buf[*i]) >> (*l); + } + + return (res); +} + +static uint32_t __inline +getbyte(const uint8_t *buf, const uint32_t i, const uint32_t l) +{ + if (l == 8) { + return (buf[i]); + } else { + return ((((buf[i] << 8) | buf[i+1]) >> l) & 0xff); + } +} + +static void __inline +lamecopy(uint8_t *dst, uint8_t *src, uint32_t len) +{ + while (len--) + *dst++ = *src++; +} + +size_t MPPC_SizeOfDecompressionHistory(void) +{ + return (sizeof(struct MPPC_decomp_state)); +} + +void MPPC_InitDecompressionHistory(char *history) +{ + struct MPPC_decomp_state *state = (struct MPPC_decomp_state*)history; + + bzero(history, sizeof(struct MPPC_decomp_state)); + state->histptr = MPPE_HIST_LEN; +} + +int MPPC_Decompress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags) +{ + struct MPPC_decomp_state *state = (struct MPPC_decomp_state*)history; + uint32_t olen, off, len, bits, val, sig, i, l; + uint8_t *hist, *s; + u_char *isrc = *src; + int rtn = MPPC_OK; + + if ((flags & MPPC_RESTART_HISTORY) != 0) { + memcpy(state->hist, state->hist + MPPE_HIST_LEN, MPPE_HIST_LEN); + state->histptr = MPPE_HIST_LEN; + } + + hist = state->hist + state->histptr; + olen = len = i = 0; + l = 8; + bits = *srcCnt * 8; + while (bits >= 8) { + val = getbyte(isrc, i++, l); + if (val < 0x80) { /* literal byte < 0x80 */ + if (state->histptr < 2*MPPE_HIST_LEN) { + /* Copy uncompressed byte to the history. */ + (state->hist)[(state->histptr)++] = (uint8_t) val; + } else { + /* Buffer overflow; drop packet. */ + rtn &= ~MPPC_OK; + return rtn; + } + olen++; + bits -= 8; + continue; + } + + sig = val & 0xc0; + if (sig == 0x80) { /* literal byte >= 0x80 */ + if (state->histptr < 2*MPPE_HIST_LEN) { + /* Copy uncompressed byte to the history. */ + (state->hist)[(state->histptr)++] = + (uint8_t) (0x80|((val&0x3f)<<1)|getbits(isrc, 1 , &i ,&l)); + } else { + /* buffer overflow; drop packet */ + rtn &= ~MPPC_OK; + return (rtn); + } + olen++; + bits -= 9; + continue; + } + + /* Not a literal byte so it must be an (offset,length) pair */ + /* decode offset */ + sig = val & 0xf0; + if (sig == 0xf0) { /* 10-bit offset; 0 <= offset < 64 */ + off = (((val&0x0f)<<2)|getbits(isrc, 2 , &i ,&l)); + bits -= 10; + } else { + if (sig == 0xe0) { /* 12-bit offset; 64 <= offset < 320 */ + off = ((((val&0x0f)<<4)|getbits(isrc, 4 , &i ,&l))+64); + bits -= 12; + } else { + if ((sig&0xe0) == 0xc0) {/* 16-bit offset; 320 <= offset < 8192 */ + off = ((((val&0x1f)<<8)|getbyte(isrc, i++, l))+320); + bits -= 16; + if (off > MPPE_HIST_LEN - 1) { + rtn &= ~MPPC_OK; + return (rtn); + } + } else { /* NOTREACHED */ + rtn &= ~MPPC_OK; + return (rtn); + } + } + } + /* Decode length of match. */ + val = getbyte(isrc, i, l); + if ((val & 0x80) == 0x00) { /* len = 3 */ + len = 3; + bits--; + getbits(isrc, 1 , &i ,&l); + } else if ((val & 0xc0) == 0x80) { /* 4 <= len < 8 */ + len = 0x04 | ((val>>4) & 0x03); + bits -= 4; + getbits(isrc, 4 , &i ,&l); + } else if ((val & 0xe0) == 0xc0) { /* 8 <= len < 16 */ + len = 0x08 | ((val>>2) & 0x07); + bits -= 6; + getbits(isrc, 6 , &i ,&l); + } else if ((val & 0xf0) == 0xe0) { /* 16 <= len < 32 */ + len = 0x10 | (val & 0x0f); + bits -= 8; + i++; + } else { + bits -= 8; + val = (val << 8) | getbyte(isrc, ++i, l); + if ((val & 0xf800) == 0xf000) { /* 32 <= len < 64 */ + len = 0x0020 | ((val >> 6) & 0x001f); + bits -= 2; + getbits(isrc, 2 , &i ,&l); + } else if ((val & 0xfc00) == 0xf800) { /* 64 <= len < 128 */ + len = 0x0040 | ((val >> 4) & 0x003f); + bits -= 4; + getbits(isrc, 4 , &i ,&l); + } else if ((val & 0xfe00) == 0xfc00) { /* 128 <= len < 256 */ + len = 0x0080 | ((val >> 2) & 0x007f); + bits -= 6; + getbits(isrc, 6 , &i ,&l); + } else if ((val & 0xff00) == 0xfe00) { /* 256 <= len < 512 */ + len = 0x0100 | (val & 0x00ff); + bits -= 8; + i++; + } else { + bits -= 8; + val = (val << 8) | getbyte(isrc, ++i, l); + if ((val & 0xff8000) == 0xff0000) { /* 512 <= len < 1024 */ + len = 0x000200 | ((val >> 6) & 0x0001ff); + bits -= 2; + getbits(isrc, 2 , &i ,&l); + } else if ((val & 0xffc000) == 0xff8000) {/* 1024 <= len < 2048 */ + len = 0x000400 | ((val >> 4) & 0x0003ff); + bits -= 4; + getbits(isrc, 4 , &i ,&l); + } else if ((val & 0xffe000) == 0xffc000) {/* 2048 <= len < 4096 */ + len = 0x000800 | ((val >> 2) & 0x0007ff); + bits -= 6; + getbits(isrc, 6 , &i ,&l); + } else if ((val & 0xfff000) == 0xffe000) {/* 4096 <= len < 8192 */ + len = 0x001000 | (val & 0x000fff); + bits -= 8; + i++; + } else { /* NOTREACHED */ + rtn &= ~MPPC_OK; + return (rtn); + } + } + } + + s = state->hist + state->histptr; + state->histptr += len; + olen += len; + if (state->histptr < 2*MPPE_HIST_LEN) { + /* Copy uncompressed bytes to the history. */ + + /* + * In some cases len may be greater than off. It means that memory + * areas pointed by s and s-off overlap. To decode that strange case + * data should be copied exactly by address increasing to make + * some data repeated. + */ + lamecopy(s, s - off, len); + } else { + /* Buffer overflow; drop packet. */ + rtn &= ~MPPC_OK; + return (rtn); + } + } + + /* Do PFC decompression. */ + len = olen; + if ((hist[0] & 0x01) != 0) { + (*dst)[0] = 0; + (*dst)++; + len++; + } + + if (len <= *dstCnt) { + /* Copy uncompressed packet to the output buffer. */ + memcpy(*dst, hist, olen); + } else { + /* Buffer overflow; drop packet. */ + rtn |= MPPC_DEST_EXHAUSTED; + } + + *src += *srcCnt; + *srcCnt = 0; + *dst += len; + *dstCnt -= len; + + return (rtn); +} From owner-svn-src-all@freebsd.org Tue Jun 21 15:49:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BFF7AC54C6; Tue, 21 Jun 2016 15:49:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD8932FC0; Tue, 21 Jun 2016 15:49:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LFnAsX033999; Tue, 21 Jun 2016 15:49:10 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LFn9xM033994; Tue, 21 Jun 2016 15:49:09 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201606211549.u5LFn9xM033994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 21 Jun 2016 15:49:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r302062 - in stable/9: share/man/man4 sys/modules/netgraph/mppc sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 15:49:11 -0000 Author: pfg Date: Tue Jun 21 15:49:09 2016 New Revision: 302062 URL: https://svnweb.freebsd.org/changeset/base/302062 Log: MFC r301549, r301550: ng_mppc(4): Bring netgraph(3) MPPC compression support. Support for compression has been available from July 2007 but it was never imported due to concerns with patents once held by STAC/HiFn. The issues have clearly been resolved so bring it in now. Special thanks to Brett Glass for preserving the code and pointing documentation for the expiration case. Taken from: mav (through Brett Glass) Added: stable/9/sys/net/mppc.h - copied unchanged from r301549, head/sys/net/mppc.h stable/9/sys/net/mppcc.c - copied unchanged from r301549, head/sys/net/mppcc.c stable/9/sys/net/mppcd.c - copied unchanged from r301549, head/sys/net/mppcd.c Modified: stable/9/share/man/man4/ng_mppc.4 stable/9/sys/modules/netgraph/mppc/Makefile Directory Properties: stable/9/share/ (props changed) stable/9/share/man/ (props changed) stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/modules/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/share/man/man4/ng_mppc.4 ============================================================================== --- stable/9/share/man/man4/ng_mppc.4 Tue Jun 21 15:47:54 2016 (r302061) +++ stable/9/share/man/man4/ng_mppc.4 Tue Jun 21 15:49:09 2016 (r302062) @@ -35,7 +35,7 @@ .\" $Whistle: ng_mppc.8,v 1.1 1999/12/08 20:20:39 archie Exp $ .\" $FreeBSD$ .\" -.Dd December 8, 1999 +.Dd June 7, 2016 .Dt NG_MPPC 4 .Os .Sh NAME @@ -154,12 +154,6 @@ and are supplied to selectively compile in either or both capabilities. At least one of these must be defined, or else this node type is useless. .Pp -The MPPC protocol requires proprietary compression code available -from Hi/Fn (formerly STAC). -These files must be obtained elsewhere and added to the kernel -sources before this node type will compile with the -.Dv NETGRAPH_MPPC_COMPRESSION -option. .Sh SEE ALSO .Xr netgraph 4 , .Xr ng_ppp 4 , Modified: stable/9/sys/modules/netgraph/mppc/Makefile ============================================================================== --- stable/9/sys/modules/netgraph/mppc/Makefile Tue Jun 21 15:47:54 2016 (r302061) +++ stable/9/sys/modules/netgraph/mppc/Makefile Tue Jun 21 15:49:09 2016 (r302062) @@ -4,11 +4,10 @@ KMOD= ng_mppc SRCS= ng_mppc.c opt_netgraph.h -NETGRAPH_MPPC_COMPRESSION?= 0 +NETGRAPH_MPPC_COMPRESSION?= 1 NETGRAPH_MPPC_ENCRYPTION?= 1 .if ${NETGRAPH_MPPC_COMPRESSION} > 0 -# XXX These files don't exist yet, but hopefully someday they will... .PATH: ${.CURDIR}/../../../net SRCS+= mppcc.c mppcd.c .endif Copied: stable/9/sys/net/mppc.h (from r301549, head/sys/net/mppc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/net/mppc.h Tue Jun 21 15:49:09 2016 (r302062, copy of r301549, head/sys/net/mppc.h) @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2007 Alexander Motin + * 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 unmodified, 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$ + */ + +/* + * MPPC decompression library. + * Version 1.0 + * + * Note that Hi/Fn (later acquired by Exar Corporation) held US patents + * on some implementation-critical aspects of MPPC compression. + * These patents lapsed due to non-payment of fees in 2007 and by 2015 + * expired altogether. + */ + +#ifndef _NET_MPPC_H_ +#define _NET_MPPC_H_ + +#define MPPC_MANDATORY_COMPRESS_FLAGS 0 +#define MPPC_MANDATORY_DECOMPRESS_FLAGS 0 + +#define MPPC_SAVE_HISTORY 1 + +#define MPPC_OK 5 +#define MPPC_EXPANDED 8 +#define MPPC_RESTART_HISTORY 16 +#define MPPC_DEST_EXHAUSTED 32 + +extern size_t MPPC_SizeOfCompressionHistory(void); +extern size_t MPPC_SizeOfDecompressionHistory(void); + +extern void MPPC_InitCompressionHistory(char *history); +extern void MPPC_InitDecompressionHistory(char *history); + +extern int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef); +extern int MPPC_Decompress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags); + +#endif Copied: stable/9/sys/net/mppcc.c (from r301549, head/sys/net/mppcc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/net/mppcc.c Tue Jun 21 15:49:09 2016 (r302062, copy of r301549, head/sys/net/mppcc.c) @@ -0,0 +1,299 @@ +/*- + * Copyright (c) 2002-2004 Jan Dubiec + * Copyright (c) 2007 Alexander Motin + * 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 unmodified, 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$ + */ + +/* + * MPPC decompression library. + * Version 1.0 + * + * Note that Hi/Fn (later acquired by Exar Corporation) held US patents + * on some implementation-critical aspects of MPPC compression. + * These patents lapsed due to non-payment of fees in 2007 and by 2015 + * expired altogether. + */ + +#include +#include + +#include + +#define MPPE_HIST_LEN 8192 + +#define HASH(x) (((40543*(((((x)[0]<<4)^(x)[1])<<4)^(x)[2]))>>4) & 0x1fff) + +struct MPPC_comp_state { + uint8_t hist[2*MPPE_HIST_LEN]; + uint16_t histptr; + uint16_t hash[MPPE_HIST_LEN]; +}; + +/* Inserts 1 to 8 bits into the output buffer. */ +static void __inline +putbits8(uint8_t *buf, uint32_t val, const uint32_t n, uint32_t *i, uint32_t *l) +{ + buf += *i; + if (*l >= n) { + *l = (*l) - n; + val <<= *l; + *buf = *buf | (val & 0xff); + if (*l == 0) { + *l = 8; + (*i)++; + *(++buf) = 0; + } + } else { + (*i)++; + *l = 8 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 8) & 0xff); + *(++buf) = val & 0xff; + } +} + +/* Inserts 9 to 16 bits into the output buffer. */ +static void __inline +putbits16(uint8_t *buf, uint32_t val, const uint32_t n, uint32_t *i, uint32_t *l) +{ + buf += *i; + if (*l >= n - 8) { + (*i)++; + *l = 8 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 8) & 0xff); + *(++buf) = val & 0xff; + if (*l == 0) { + *l = 8; + (*i)++; + *(++buf) = 0; + } + } else { + (*i)++; (*i)++; + *l = 16 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 16) & 0xff); + *(++buf) = (val >> 8) & 0xff; + *(++buf) = val & 0xff; + } +} + +/* Inserts 17 to 24 bits into the output buffer. */ +static void __inline +putbits24(uint8_t *buf, uint32_t val, const uint32_t n, uint32_t *i, uint32_t *l) +{ + buf += *i; + if (*l >= n - 16) { + (*i)++; (*i)++; + *l = 16 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 16) & 0xff); + *(++buf) = (val >> 8) & 0xff; + *(++buf) = val & 0xff; + if (*l == 0) { + *l = 8; + (*i)++; + *(++buf) = 0; + } + } else { + (*i)++; (*i)++; (*i)++; + *l = 24 - n + (*l); + val <<= *l; + *buf = *buf | ((val >> 24) & 0xff); + *(++buf) = (val >> 16) & 0xff; + *(++buf) = (val >> 8) & 0xff; + *(++buf) = val & 0xff; + } +} + +size_t MPPC_SizeOfCompressionHistory(void) +{ + return (sizeof(struct MPPC_comp_state)); +} + +void MPPC_InitCompressionHistory(char *history) +{ + struct MPPC_comp_state *state = (struct MPPC_comp_state*)history; + + bzero(history, sizeof(struct MPPC_comp_state)); + state->histptr = MPPE_HIST_LEN; +} + +int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef) +{ + struct MPPC_comp_state *state = (struct MPPC_comp_state*)history; + uint32_t olen, off, len, idx, i, l; + uint8_t *hist, *sbuf, *p, *q, *r, *s; + int rtn = MPPC_OK; + + /* + * At this point, to avoid possible buffer overflow caused by packet + * expansion during/after compression, we should make sure we have + * space for the worst case. + + * Maximum MPPC packet expansion is 12.5%. This is the worst case when + * all octets in the input buffer are >= 0x80 and we cannot find any + * repeated tokens. + */ + if (*dstCnt < (*srcCnt * 9 / 8 + 2)) { + rtn &= ~MPPC_OK; + return (rtn); + } + + /* We can't compress more then MPPE_HIST_LEN bytes in a call. */ + if (*srcCnt > MPPE_HIST_LEN) { + rtn &= ~MPPC_OK; + return (rtn); + } + + hist = state->hist + MPPE_HIST_LEN; + /* check if there is enough room at the end of the history */ + if (state->histptr + *srcCnt >= 2*MPPE_HIST_LEN) { + rtn |= MPPC_RESTART_HISTORY; + state->histptr = MPPE_HIST_LEN; + memcpy(state->hist, hist, MPPE_HIST_LEN); + } + /* Add packet to the history. */ + sbuf = state->hist + state->histptr; + memcpy(sbuf, *src, *srcCnt); + state->histptr += *srcCnt; + + /* compress data */ + r = sbuf + *srcCnt; + **dst = olen = i = 0; + l = 8; + while (i < *srcCnt - 2) { + s = q = sbuf + i; + + /* Prognose matching position using hash function. */ + idx = HASH(s); + p = hist + state->hash[idx]; + state->hash[idx] = (uint16_t) (s - hist); + if (p > s) /* It was before MPPC_RESTART_HISTORY. */ + p -= MPPE_HIST_LEN; /* Try previous history buffer. */ + off = s - p; + + /* Check our prognosis. */ + if (off > MPPE_HIST_LEN - 1 || off < 1 || *p++ != *s++ || + *p++ != *s++ || *p++ != *s++) { + /* No match found; encode literal byte. */ + if ((*src)[i] < 0x80) { /* literal byte < 0x80 */ + putbits8(*dst, (uint32_t) (*src)[i], 8, &olen, &l); + } else { /* literal byte >= 0x80 */ + putbits16(*dst, (uint32_t) (0x100|((*src)[i]&0x7f)), 9, + &olen, &l); + } + ++i; + continue; + } + + /* Find length of the matching fragment */ +#if defined(__amd64__) || defined(__i386__) + /* Optimization for CPUs without strict data aligning requirements */ + while ((*((uint32_t*)p) == *((uint32_t*)s)) && (s < (r - 3))) { + p+=4; + s+=4; + } +#endif + while((*p++ == *s++) && (s <= r)); + len = s - q - 1; + i += len; + + /* At least 3 character match found; code data. */ + /* Encode offset. */ + if (off < 64) { /* 10-bit offset; 0 <= offset < 64 */ + putbits16(*dst, 0x3c0|off, 10, &olen, &l); + } else if (off < 320) { /* 12-bit offset; 64 <= offset < 320 */ + putbits16(*dst, 0xe00|(off-64), 12, &olen, &l); + } else if (off < 8192) { /* 16-bit offset; 320 <= offset < 8192 */ + putbits16(*dst, 0xc000|(off-320), 16, &olen, &l); + } else { /* NOTREACHED */ + rtn &= ~MPPC_OK; + return rtn; + } + + /* Encode length of match. */ + if (len < 4) { /* length = 3 */ + putbits8(*dst, 0, 1, &olen, &l); + } else if (len < 8) { /* 4 <= length < 8 */ + putbits8(*dst, 0x08|(len&0x03), 4, &olen, &l); + } else if (len < 16) { /* 8 <= length < 16 */ + putbits8(*dst, 0x30|(len&0x07), 6, &olen, &l); + } else if (len < 32) { /* 16 <= length < 32 */ + putbits8(*dst, 0xe0|(len&0x0f), 8, &olen, &l); + } else if (len < 64) { /* 32 <= length < 64 */ + putbits16(*dst, 0x3c0|(len&0x1f), 10, &olen, &l); + } else if (len < 128) { /* 64 <= length < 128 */ + putbits16(*dst, 0xf80|(len&0x3f), 12, &olen, &l); + } else if (len < 256) { /* 128 <= length < 256 */ + putbits16(*dst, 0x3f00|(len&0x7f), 14, &olen, &l); + } else if (len < 512) { /* 256 <= length < 512 */ + putbits16(*dst, 0xfe00|(len&0xff), 16, &olen, &l); + } else if (len < 1024) { /* 512 <= length < 1024 */ + putbits24(*dst, 0x3fc00|(len&0x1ff), 18, &olen, &l); + } else if (len < 2048) { /* 1024 <= length < 2048 */ + putbits24(*dst, 0xff800|(len&0x3ff), 20, &olen, &l); + } else if (len < 4096) { /* 2048 <= length < 4096 */ + putbits24(*dst, 0x3ff000|(len&0x7ff), 22, &olen, &l); + } else if (len < 8192) { /* 4096 <= length < 8192 */ + putbits24(*dst, 0xffe000|(len&0xfff), 24, &olen, &l); + } else { /* NOTREACHED */ + rtn &= ~MPPC_OK; + return (rtn); + } + } + + /* Add remaining octets to the output. */ + while(*srcCnt - i > 0) { + if ((*src)[i] < 0x80) { /* literal byte < 0x80 */ + putbits8(*dst, (uint32_t) (*src)[i++], 8, &olen, &l); + } else { /* literal byte >= 0x80 */ + putbits16(*dst, (uint32_t) (0x100|((*src)[i++]&0x7f)), 9, &olen, + &l); + } + } + + /* Reset unused bits of the last output octet. */ + if ((l != 0) && (l != 8)) { + putbits8(*dst, 0, l, &olen, &l); + } + + /* If result is bigger then original, set flag and flush history. */ + if ((*srcCnt < olen) || ((flags & MPPC_SAVE_HISTORY) == 0)) { + if (*srcCnt < olen) + rtn |= MPPC_EXPANDED; + bzero(history, sizeof(struct MPPC_comp_state)); + state->histptr = MPPE_HIST_LEN; + } + + *src += *srcCnt; + *srcCnt = 0; + *dst += olen; + *dstCnt -= olen; + + return (rtn); +} Copied: stable/9/sys/net/mppcd.c (from r301549, head/sys/net/mppcd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/net/mppcd.c Tue Jun 21 15:49:09 2016 (r302062, copy of r301549, head/sys/net/mppcd.c) @@ -0,0 +1,284 @@ +/*- + * Copyright (c) 2002-2004 Jan Dubiec + * Copyright (c) 2007 Alexander Motin + * 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 unmodified, 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$ + */ + +/* + * MPPC decompression library. + * Version 1.0 + * + * Note that Hi/Fn (later acquired by Exar Corporation) held US patents + * on some implementation-critical aspects of MPPC compression. + * These patents lapsed due to non-payment of fees in 2007 and by 2015 + * expired altogether. + */ + +#include +#include + +#include + +#define MPPE_HIST_LEN 8192 + +struct MPPC_decomp_state { + uint8_t hist[2*MPPE_HIST_LEN]; + uint16_t histptr; +}; + +static uint32_t __inline +getbits(const uint8_t *buf, const uint32_t n, uint32_t *i, uint32_t *l) +{ + static const uint32_t m[] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; + uint32_t res, ol; + + ol = *l; + if (*l >= n) { + *l = (*l) - n; + res = (buf[*i] & m[ol]) >> (*l); + if (*l == 0) { + *l = 8; + (*i)++; + } + } else { + *l = 8 - n + (*l); + res = (buf[(*i)++] & m[ol]) << 8; + res = (res | buf[*i]) >> (*l); + } + + return (res); +} + +static uint32_t __inline +getbyte(const uint8_t *buf, const uint32_t i, const uint32_t l) +{ + if (l == 8) { + return (buf[i]); + } else { + return ((((buf[i] << 8) | buf[i+1]) >> l) & 0xff); + } +} + +static void __inline +lamecopy(uint8_t *dst, uint8_t *src, uint32_t len) +{ + while (len--) + *dst++ = *src++; +} + +size_t MPPC_SizeOfDecompressionHistory(void) +{ + return (sizeof(struct MPPC_decomp_state)); +} + +void MPPC_InitDecompressionHistory(char *history) +{ + struct MPPC_decomp_state *state = (struct MPPC_decomp_state*)history; + + bzero(history, sizeof(struct MPPC_decomp_state)); + state->histptr = MPPE_HIST_LEN; +} + +int MPPC_Decompress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags) +{ + struct MPPC_decomp_state *state = (struct MPPC_decomp_state*)history; + uint32_t olen, off, len, bits, val, sig, i, l; + uint8_t *hist, *s; + u_char *isrc = *src; + int rtn = MPPC_OK; + + if ((flags & MPPC_RESTART_HISTORY) != 0) { + memcpy(state->hist, state->hist + MPPE_HIST_LEN, MPPE_HIST_LEN); + state->histptr = MPPE_HIST_LEN; + } + + hist = state->hist + state->histptr; + olen = len = i = 0; + l = 8; + bits = *srcCnt * 8; + while (bits >= 8) { + val = getbyte(isrc, i++, l); + if (val < 0x80) { /* literal byte < 0x80 */ + if (state->histptr < 2*MPPE_HIST_LEN) { + /* Copy uncompressed byte to the history. */ + (state->hist)[(state->histptr)++] = (uint8_t) val; + } else { + /* Buffer overflow; drop packet. */ + rtn &= ~MPPC_OK; + return rtn; + } + olen++; + bits -= 8; + continue; + } + + sig = val & 0xc0; + if (sig == 0x80) { /* literal byte >= 0x80 */ + if (state->histptr < 2*MPPE_HIST_LEN) { + /* Copy uncompressed byte to the history. */ + (state->hist)[(state->histptr)++] = + (uint8_t) (0x80|((val&0x3f)<<1)|getbits(isrc, 1 , &i ,&l)); + } else { + /* buffer overflow; drop packet */ + rtn &= ~MPPC_OK; + return (rtn); + } + olen++; + bits -= 9; + continue; + } + + /* Not a literal byte so it must be an (offset,length) pair */ + /* decode offset */ + sig = val & 0xf0; + if (sig == 0xf0) { /* 10-bit offset; 0 <= offset < 64 */ + off = (((val&0x0f)<<2)|getbits(isrc, 2 , &i ,&l)); + bits -= 10; + } else { + if (sig == 0xe0) { /* 12-bit offset; 64 <= offset < 320 */ + off = ((((val&0x0f)<<4)|getbits(isrc, 4 , &i ,&l))+64); + bits -= 12; + } else { + if ((sig&0xe0) == 0xc0) {/* 16-bit offset; 320 <= offset < 8192 */ + off = ((((val&0x1f)<<8)|getbyte(isrc, i++, l))+320); + bits -= 16; + if (off > MPPE_HIST_LEN - 1) { + rtn &= ~MPPC_OK; + return (rtn); + } + } else { /* NOTREACHED */ + rtn &= ~MPPC_OK; + return (rtn); + } + } + } + /* Decode length of match. */ + val = getbyte(isrc, i, l); + if ((val & 0x80) == 0x00) { /* len = 3 */ + len = 3; + bits--; + getbits(isrc, 1 , &i ,&l); + } else if ((val & 0xc0) == 0x80) { /* 4 <= len < 8 */ + len = 0x04 | ((val>>4) & 0x03); + bits -= 4; + getbits(isrc, 4 , &i ,&l); + } else if ((val & 0xe0) == 0xc0) { /* 8 <= len < 16 */ + len = 0x08 | ((val>>2) & 0x07); + bits -= 6; + getbits(isrc, 6 , &i ,&l); + } else if ((val & 0xf0) == 0xe0) { /* 16 <= len < 32 */ + len = 0x10 | (val & 0x0f); + bits -= 8; + i++; + } else { + bits -= 8; + val = (val << 8) | getbyte(isrc, ++i, l); + if ((val & 0xf800) == 0xf000) { /* 32 <= len < 64 */ + len = 0x0020 | ((val >> 6) & 0x001f); + bits -= 2; + getbits(isrc, 2 , &i ,&l); + } else if ((val & 0xfc00) == 0xf800) { /* 64 <= len < 128 */ + len = 0x0040 | ((val >> 4) & 0x003f); + bits -= 4; + getbits(isrc, 4 , &i ,&l); + } else if ((val & 0xfe00) == 0xfc00) { /* 128 <= len < 256 */ + len = 0x0080 | ((val >> 2) & 0x007f); + bits -= 6; + getbits(isrc, 6 , &i ,&l); + } else if ((val & 0xff00) == 0xfe00) { /* 256 <= len < 512 */ + len = 0x0100 | (val & 0x00ff); + bits -= 8; + i++; + } else { + bits -= 8; + val = (val << 8) | getbyte(isrc, ++i, l); + if ((val & 0xff8000) == 0xff0000) { /* 512 <= len < 1024 */ + len = 0x000200 | ((val >> 6) & 0x0001ff); + bits -= 2; + getbits(isrc, 2 , &i ,&l); + } else if ((val & 0xffc000) == 0xff8000) {/* 1024 <= len < 2048 */ + len = 0x000400 | ((val >> 4) & 0x0003ff); + bits -= 4; + getbits(isrc, 4 , &i ,&l); + } else if ((val & 0xffe000) == 0xffc000) {/* 2048 <= len < 4096 */ + len = 0x000800 | ((val >> 2) & 0x0007ff); + bits -= 6; + getbits(isrc, 6 , &i ,&l); + } else if ((val & 0xfff000) == 0xffe000) {/* 4096 <= len < 8192 */ + len = 0x001000 | (val & 0x000fff); + bits -= 8; + i++; + } else { /* NOTREACHED */ + rtn &= ~MPPC_OK; + return (rtn); + } + } + } + + s = state->hist + state->histptr; + state->histptr += len; + olen += len; + if (state->histptr < 2*MPPE_HIST_LEN) { + /* Copy uncompressed bytes to the history. */ + + /* + * In some cases len may be greater than off. It means that memory + * areas pointed by s and s-off overlap. To decode that strange case + * data should be copied exactly by address increasing to make + * some data repeated. + */ + lamecopy(s, s - off, len); + } else { + /* Buffer overflow; drop packet. */ + rtn &= ~MPPC_OK; + return (rtn); + } + } + + /* Do PFC decompression. */ + len = olen; + if ((hist[0] & 0x01) != 0) { + (*dst)[0] = 0; + (*dst)++; + len++; + } + + if (len <= *dstCnt) { + /* Copy uncompressed packet to the output buffer. */ + memcpy(*dst, hist, olen); + } else { + /* Buffer overflow; drop packet. */ + rtn |= MPPC_DEST_EXHAUSTED; + } + + *src += *srcCnt; + *srcCnt = 0; + *dst += len; + *dstCnt -= len; + + return (rtn); +} From owner-svn-src-all@freebsd.org Tue Jun 21 17:05:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4544AC48D6 for ; Tue, 21 Jun 2016 17:05:43 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0191E14 for ; Tue, 21 Jun 2016 17:05:43 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f49.google.com with SMTP id q132so33163739lfe.3 for ; Tue, 21 Jun 2016 10:05:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=VPnP+OAJLJquK6nqc3qNeT0Tf7lcWhj97g5zjDHiL4o=; b=i247DVDSvCqf0KTerAACjkgvQvuVtkFrObEubbsFiOpjkR344lg1G7Dt8ed1cgQY+e Fc9HnbyiwrikMscwG6gVMPr7eZ7quWVYT/AJY0nHBYVB7Drzk2BBr78u6ufWPUqsVdBo Q0X2C4PIMMAhrRn+7w7C+jNkvXkOttfvlT31BhNf81hheP1j0u0UCRXofVDzWkl57q8S GffAX5aIGBrax66IfyyYqz4HKuL/noa0BCA0vBXLwijwD7dEbz5WVQOT8esbhbImwG6A Ymo2wwvbgTJOnNCrj88YThpi+vm766SGgcUBWxyXfDbZ94V0t2wQFtROwNvdnym3eibg EywA== X-Gm-Message-State: ALyK8tK5YlVkpxeZS3O/0Tbsn43zhrp8qPHM/TEjOxwfnCbO30xQ7b/SWKI3zebrtkvZSw== X-Received: by 10.25.4.4 with SMTP id 4mr5640422lfe.208.1466528735374; Tue, 21 Jun 2016 10:05:35 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id q20sm7677000lbn.25.2016.06.21.10.05.34 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2016 10:05:34 -0700 (PDT) Subject: Re: svn commit: r302026 - in head: share/monetdef share/msgdef share/numericdef share/timedef tools/tools/locale/tools To: Baptiste Daroussin References: <201606200645.u5K6jhBr081752@repo.freebsd.org> <0de854da-5914-901a-3d15-41429808ace1@freebsd.org> <20160621071249.coi44qjecd67hz32@ivaldir.etoilebsd.net> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Andrey Chernov Message-ID: <70f03752-4b50-caf6-48ad-68b41bfd00d2@freebsd.org> Date: Tue, 21 Jun 2016 20:05:33 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160621071249.coi44qjecd67hz32@ivaldir.etoilebsd.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fv6ApRKvpDalSXWfDDgDX2ndMFP9FOFod" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 17:05:43 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fv6ApRKvpDalSXWfDDgDX2ndMFP9FOFod Content-Type: multipart/mixed; boundary="QwxPkHatLbWuUn544k9i7Bud9wtJLPbfi" From: Andrey Chernov To: Baptiste Daroussin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <70f03752-4b50-caf6-48ad-68b41bfd00d2@freebsd.org> Subject: Re: svn commit: r302026 - in head: share/monetdef share/msgdef share/numericdef share/timedef tools/tools/locale/tools References: <201606200645.u5K6jhBr081752@repo.freebsd.org> <0de854da-5914-901a-3d15-41429808ace1@freebsd.org> <20160621071249.coi44qjecd67hz32@ivaldir.etoilebsd.net> In-Reply-To: <20160621071249.coi44qjecd67hz32@ivaldir.etoilebsd.net> --QwxPkHatLbWuUn544k9i7Bud9wtJLPbfi Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 21.06.2016 10:12, Baptiste Daroussin wrote: > On Mon, Jun 20, 2016 at 10:14:04PM +0300, Andrey Chernov wrote: >> On 20.06.2016 9:45, Baptiste Daroussin wrote: >>> Author: bapt >>> Date: Mon Jun 20 06:45:42 2016 >>> New Revision: 302026 >>> URL: https://svnweb.freebsd.org/changeset/base/302026 >>> >>> Log: >>> Fix generation of locales with multiple variants >> >> Thanx. >> Just want to note, even if we stay with RFC 5646 language tags instead= >> of ISO 639 ones with @modifier (per ISO 15897), current tags are >> incorrect because have "_" instead of "-" which makes parsing harder, >> because "_" is territory separator and someone may not expect several >> "_" exists. Per RFC 5646 we need names like >> sr-Cyrl_RS.UTF-8.src >> and not >> sr_Cyrl_RS.UTF-8.src >> > I have a patch that create the @modifier version meaning > for instance: > sr_RS.UTF-8@[modifier] >=20 > it also adds an alias sr_RS.UTF-8 which is the cyrillic version (follow= ing the > what has been done on linux for this locale) >=20 > I am seeking for your opinion on a policy to handle the locales with va= riants. > I am hesitating between 2 options: > 1/ Provide all locales that may have modifier: >=20 > - for sr_RS: > sr_RS.UTF-8@cyrillic > sr_RS.UTF-8@latin >=20 > and sr_RS.UTF-8 (which is actually the same as sr_RS.UTF-8@cyrillic) >=20 > - for zh_TW > zh_TW.UTF-8@hant > and zh_TW.UTF-8 (which is an alias on zh_TW.UTF-8@hant) >=20 > - for mn_MN > mn_MN.UTF-8@cyrillic > mn_MN.UTF-8 (which is an alias on mn_MN.UTF-8@cyrillic) >=20 > 2/ Only provide the @version for the ones for which we have an ambiguit= y >=20 > - for sr_RS: > sr_RS.UTF-8@latin > sr_RS.UTF-8 (would be the cyrillic one) >=20 > - for zh_TW > zh_TW.UTF-8 (no @modifier version) >=20 > - for mn_MN > mn_MN.UTF-8 (no @modifier version) >=20 >=20 > I do like the first (more explicit and simpler to do with our code whil= e still > compatible with the second). Linux only does the second. >=20 > But I understand the first can be confusing for languages with (for now= ) only > one variant supported like users asking themselves: > which one should I choose: mn_MN.UTF-8 or mn_MN.UTF-8@cyrillic? > They might not now they are actually the same >=20 > Any opinion? Since @modifier exists just to avoid ambiguity, we definitely don't need to add f.e. @cyrillic to every cyrillic-based locale and @latin to every latin-based one, and so on. Difference between no @modifier and some @modifier is enough to avoid ambiguity too, so I vote for Linux way. GNU libintl drops any @modifier in any case and use its own default encoding it tries to convert to user one later. --QwxPkHatLbWuUn544k9i7Bud9wtJLPbfi-- --fv6ApRKvpDalSXWfDDgDX2ndMFP9FOFod Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJXaXPdAAoJEKUckv0MjfbKqB8H/RrOZA/ObnY5rfP1I58BL7Qt DZFZTuyBwA5VPiBpF+b42p/x2RNpwurmDLHG+gCGg6Va+wAVok3U9sUsQ2SUVIOi rRfallmQ9jCjekyhfpgN1tEgMI+8FGeICXe3UquZ047icl1h0eawnF4zoUuEOwun HuA2JSFQ0mR2th7MNM8v14tKJ1EH1m4rEXqcYO+auK1ag+ftbPG2vMk3HbvjSroi 914cdlehR4dZK9GUkU1Hz/YWjBTq/YBdlJOUHoVoPBmj/1NIsVVY9QMoFKX7sI8j nKzKJgPKDFYtLAw4NyV2v7O0xA+XWY21nsHPeRGwWPgmCVE34wSUjBH51moISDw= =mzVM -----END PGP SIGNATURE----- --fv6ApRKvpDalSXWfDDgDX2ndMFP9FOFod-- From owner-svn-src-all@freebsd.org Tue Jun 21 17:49:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA324AC5646; Tue, 21 Jun 2016 17:49:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D45E1721; Tue, 21 Jun 2016 17:49:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LHnX50078954; Tue, 21 Jun 2016 17:49:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LHnXLk078952; Tue, 21 Jun 2016 17:49:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606211749.u5LHnXLk078952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 21 Jun 2016 17:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302063 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 17:49:34 -0000 Author: kib Date: Tue Jun 21 17:49:33 2016 New Revision: 302063 URL: https://svnweb.freebsd.org/changeset/base/302063 Log: The vmtotal sysctl handler marks active vm objects to calculate statistics. Marking is done by setting the OBJ_ACTIVE flag. The flags change is locked, but the problem is that many parts of system assume that vm object initialization ensures that no other code could change the object, and thus performed lockless. The end result is corrupted flags in vm objects, most visible is spurious OBJ_DEAD flag, causing random hangs. Avoid the active object marking, instead provide equally inexact but immutable is_object_alive() definition for the object mapped state. Avoid iterating over the processes mappings altogether by using arguably improved definition of the paging thread as one which sleeps on the v_free_count. PR: 204764 Diagnosed by: pho Tested by: pho (previous version) Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (gjb) Modified: head/sys/vm/vm_meter.c head/sys/vm/vm_object.h Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Tue Jun 21 15:49:09 2016 (r302062) +++ head/sys/vm/vm_meter.c Tue Jun 21 17:49:33 2016 (r302063) @@ -89,29 +89,31 @@ SYSCTL_PROC(_vm, VM_LOADAVG, loadavg, CT CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_loadavg, "S,loadavg", "Machine loadaverage history"); +/* + * This function aims to determine if the object is mapped, + * specifically, if it is referenced by a vm_map_entry. Because + * objects occasionally acquire transient references that do not + * represent a mapping, the method used here is inexact. However, it + * has very low overhead and is good enough for the advisory + * vm.vmtotal sysctl. + */ +static bool +is_object_active(vm_object_t obj) +{ + + return (obj->ref_count > obj->shadow_count); +} + static int vmtotal(SYSCTL_HANDLER_ARGS) { - struct proc *p; struct vmtotal total; - vm_map_entry_t entry; vm_object_t object; - vm_map_t map; - int paging; + struct proc *p; struct thread *td; - struct vmspace *vm; bzero(&total, sizeof(total)); - /* - * Mark all objects as inactive. - */ - mtx_lock(&vm_object_list_mtx); - TAILQ_FOREACH(object, &vm_object_list, object_list) { - VM_OBJECT_WLOCK(object); - vm_object_clear_flag(object, OBJ_ACTIVE); - VM_OBJECT_WUNLOCK(object); - } - mtx_unlock(&vm_object_list_mtx); + /* * Calculate process statistics. */ @@ -132,11 +134,15 @@ vmtotal(SYSCTL_HANDLER_ARGS) case TDS_INHIBITED: if (TD_IS_SWAPPED(td)) total.t_sw++; - else if (TD_IS_SLEEPING(td) && - td->td_priority <= PZERO) - total.t_dw++; - else - total.t_sl++; + else if (TD_IS_SLEEPING(td)) { + if (td->td_priority <= PZERO) + total.t_dw++; + else + total.t_sl++; + if (td->td_wchan == + &vm_cnt.v_free_count) + total.t_pw++; + } break; case TDS_CAN_RUN: @@ -154,29 +160,6 @@ vmtotal(SYSCTL_HANDLER_ARGS) } } PROC_UNLOCK(p); - /* - * Note active objects. - */ - paging = 0; - vm = vmspace_acquire_ref(p); - if (vm == NULL) - continue; - map = &vm->vm_map; - vm_map_lock_read(map); - for (entry = map->header.next; - entry != &map->header; entry = entry->next) { - if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) || - (object = entry->object.vm_object) == NULL) - continue; - VM_OBJECT_WLOCK(object); - vm_object_set_flag(object, OBJ_ACTIVE); - paging |= object->paging_in_progress; - VM_OBJECT_WUNLOCK(object); - } - vm_map_unlock_read(map); - vmspace_free(vm); - if (paging) - total.t_pw++; } sx_sunlock(&allproc_lock); /* @@ -202,9 +185,18 @@ vmtotal(SYSCTL_HANDLER_ARGS) */ continue; } + if (object->ref_count == 1 && + (object->flags & OBJ_NOSPLIT) != 0) { + /* + * Also skip otherwise unreferenced swap + * objects backing tmpfs vnodes, and POSIX or + * SysV shared memory. + */ + continue; + } total.t_vm += object->size; total.t_rm += object->resident_page_count; - if (object->flags & OBJ_ACTIVE) { + if (is_object_active(object)) { total.t_avm += object->size; total.t_arm += object->resident_page_count; } @@ -212,7 +204,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) /* shared object */ total.t_vmshr += object->size; total.t_rmshr += object->resident_page_count; - if (object->flags & OBJ_ACTIVE) { + if (is_object_active(object)) { total.t_avmshr += object->size; total.t_armshr += object->resident_page_count; } Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Jun 21 15:49:09 2016 (r302062) +++ head/sys/vm/vm_object.h Tue Jun 21 17:49:33 2016 (r302063) @@ -182,7 +182,6 @@ struct vm_object { */ #define OBJ_FICTITIOUS 0x0001 /* (c) contains fictitious pages */ #define OBJ_UNMANAGED 0x0002 /* (c) contains unmanaged pages */ -#define OBJ_ACTIVE 0x0004 /* active objects */ #define OBJ_DEAD 0x0008 /* dead objects (during rundown) */ #define OBJ_NOSPLIT 0x0010 /* dont split this object */ #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ From owner-svn-src-all@freebsd.org Tue Jun 21 17:53:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 722BDAC5800; Tue, 21 Jun 2016 17:53:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CE1C1BFF; Tue, 21 Jun 2016 17:53:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LHrgnL082488; Tue, 21 Jun 2016 17:53:42 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LHrg7t082487; Tue, 21 Jun 2016 17:53:42 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201606211753.u5LHrg7t082487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 21 Jun 2016 17:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302064 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 17:53:43 -0000 Author: ian Date: Tue Jun 21 17:53:42 2016 New Revision: 302064 URL: https://svnweb.freebsd.org/changeset/base/302064 Log: Revert the recent armv6 changes to ALIGNED_POINTER(), restoring the fully-pessimized implementation that requires a type to be aligned to its natural size. On armv6+ the compiler might generate load-/store-multiple instructions which require 4-byte alignment even though the source code is only accessing individual uint32_t values in a way that doesn't require any particular alignment at all. The compiler apparently feels free to combine multiple accesses into a single instruction that requires a more-strict alignment, and no set of compiler flags seems to disable this behavior (at least in clang 3.8). This fixes alignment faults on arm systems using wifi adapters. The wifi code uses ALIGNED_POINTER(p, uint32_t) to decide whether it needs to copy-align tcp headers. Because clang is combining several uint32_t accesses into a single ldm instruction, we need to say that accessing a uint32_t requires 4-byte alignment. Approved by: re(gjb) Modified: head/sys/arm/include/param.h Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Tue Jun 21 17:49:33 2016 (r302063) +++ head/sys/arm/include/param.h Tue Jun 21 17:53:42 2016 (r302064) @@ -91,15 +91,15 @@ * This does not reflect the optimal alignment, just the possibility * (within reasonable limits). * - * armv4 and v5 require alignment to the type's size. armv6 and later require - * that an 8-byte type be aligned to at least a 4-byte boundary; access to - * smaller types can be unaligned. + * armv4 and v5 require alignment to the type's size. armv6 requires 8-byte + * alignment for the ldrd/strd instructions, but otherwise follows armv7 rules. + * armv7 requires that an 8-byte type be aligned to at least a 4-byte boundary; + * access to smaller types can be unaligned, except that the compiler may + * optimize access to adjacent uint32_t values into a single load/store-multiple + * instruction which requires 4-byte alignment, so we must provide the most- + * pessimistic answer possible even on armv7. */ -#if __ARM_ARCH >= 6 -#define ALIGNED_POINTER(p, t) (((sizeof(t) != 8) || ((unsigned)(p) & 3) == 0)) -#else #define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof(t)-1)) == 0) -#endif /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an From owner-svn-src-all@freebsd.org Tue Jun 21 18:50:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B880FAC5382; Tue, 21 Jun 2016 18:50:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 819CA1C7F; Tue, 21 Jun 2016 18:50:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id VAA11991; Tue, 21 Jun 2016 21:50:17 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1bFQkb-000IMc-B3; Tue, 21 Jun 2016 21:50:17 +0300 Subject: Re: svn commit: r301929 - head/sys/kern To: Konstantin Belousov , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201606151556.u5FFu3pt032257@repo.freebsd.org> From: Andriy Gapon Message-ID: <5200834c-c3d4-6331-eecb-155e6453ba96@FreeBSD.org> Date: Tue, 21 Jun 2016 21:49:24 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <201606151556.u5FFu3pt032257@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 18:50:26 -0000 On 15/06/2016 18:56, Konstantin Belousov wrote: > Author: kib > Date: Wed Jun 15 15:56:03 2016 > New Revision: 301929 > URL: https://svnweb.freebsd.org/changeset/base/301929 > > Log: > Do not assume that we own the use reference on the covered vnode until > we set MNTK_UNMOUNT flag on the mp. Otherwise parallel unmount which > wins race with us could dereference the covered vnode, and we are > left with the locked freed memory. > > Reported and tested by: pho > Sponsored by: The FreeBSD Foundation > Approved by: re (gjb) > MFC after: 1 week Kostik, does this change fix (or is likely to fix) the following panic? Thanks! VNASSERT failed 0xfffff8000c926588: tag none, type VBAD usecount 0, writecount 0, refcount 0 mountedhere 0 VNASSERT failed 0xfffff8000e95f000: tag none, type VBAD usecount 0, writecount 0, refcount 0 mountedhere 0 flags () lock type zfs: EXCL by thread 0xfffff80020921a00 (pid 2017, zfs, tid 100794) panic: No vop_unlock(0xfffff8000e95f000, 0xfffffe004df8a980) cpuid = 2 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004df8a820 vpanic() at vpanic+0x182/frame 0xfffffe004df8a8a0 kassert_panic() at kassert_panic+0x126/frame 0xfffffe004df8a910 VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x94/frame 0xfffffe004df8a940 dounmount() at dounmount+0x138/frame 0xfffffe004df8a9c0 sys_unmount() at sys_unmount+0x35d/frame 0xfffffe004df8aae0 amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe004df8abf0 Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe004df8abf0 --- syscall (22, FreeBSD ELF64, sys_unmount), rip = 0x8012f4e4a, rsp = 0x7fffffffc298, rbp = 0x7fffffffc300 --- KDB: enter: panic [ thread pid 2017 tid 100794 ] Stopped at kdb_enter+0x3b: movq $0,kdb_why P.S. Not sure why two VNASSERTs are reported here, but this is copied verbatim from a console. > Modified: > head/sys/kern/vfs_mount.c -- Andriy Gapon From owner-svn-src-all@freebsd.org Tue Jun 21 19:03:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48FB1AC56FB; Tue, 21 Jun 2016 19:03:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E65B325F3; Tue, 21 Jun 2016 19:03:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u5LJ3K8F099569 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 21 Jun 2016 22:03:20 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u5LJ3K8F099569 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u5LJ3KOP099568; Tue, 21 Jun 2016 22:03:20 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 21 Jun 2016 22:03:20 +0300 From: Konstantin Belousov To: Andriy Gapon Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r301929 - head/sys/kern Message-ID: <20160621190320.GF38613@kib.kiev.ua> References: <201606151556.u5FFu3pt032257@repo.freebsd.org> <5200834c-c3d4-6331-eecb-155e6453ba96@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5200834c-c3d4-6331-eecb-155e6453ba96@FreeBSD.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 19:03:26 -0000 On Tue, Jun 21, 2016 at 09:49:24PM +0300, Andriy Gapon wrote: > On 15/06/2016 18:56, Konstantin Belousov wrote: > > Author: kib > > Date: Wed Jun 15 15:56:03 2016 > > New Revision: 301929 > > URL: https://svnweb.freebsd.org/changeset/base/301929 > > > > Log: > > Do not assume that we own the use reference on the covered vnode until > > we set MNTK_UNMOUNT flag on the mp. Otherwise parallel unmount which > > wins race with us could dereference the covered vnode, and we are > > left with the locked freed memory. > > > > Reported and tested by: pho > > Sponsored by: The FreeBSD Foundation > > Approved by: re (gjb) > > MFC after: 1 week > > > Kostik, > > does this change fix (or is likely to fix) the following panic? Yes, this is exactly the problem that was reported, Peter made sure that he is able to reproduce the issue at will, and that the patch fixed it. > Thanks! > > VNASSERT failed > 0xfffff8000c926588: tag none, type VBAD > usecount 0, writecount 0, refcount 0 mountedhere 0 > VNASSERT failed > 0xfffff8000e95f000: tag none, type VBAD > usecount 0, writecount 0, refcount 0 mountedhere 0 > flags () > lock type zfs: EXCL by thread 0xfffff80020921a00 (pid 2017, zfs, tid > 100794) > panic: No vop_unlock(0xfffff8000e95f000, 0xfffffe004df8a980) > cpuid = 2 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > 0xfffffe004df8a820 > vpanic() at vpanic+0x182/frame 0xfffffe004df8a8a0 > kassert_panic() at kassert_panic+0x126/frame 0xfffffe004df8a910 > VOP_UNLOCK_APV() at VOP_UNLOCK_APV+0x94/frame 0xfffffe004df8a940 > dounmount() at dounmount+0x138/frame 0xfffffe004df8a9c0 > sys_unmount() at sys_unmount+0x35d/frame 0xfffffe004df8aae0 > amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe004df8abf0 > Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe004df8abf0 > --- syscall (22, FreeBSD ELF64, sys_unmount), rip = 0x8012f4e4a, rsp = > 0x7fffffffc298, rbp = 0x7fffffffc300 --- > KDB: enter: panic > [ thread pid 2017 tid 100794 ] > Stopped at kdb_enter+0x3b: movq $0,kdb_why > > P.S. Not sure why two VNASSERTs are reported here, but this is copied > verbatim from a console. Most likely you got two CPUs checking the same assert, but only one was able to enter the panic state. Look at the backtraces of running threads on other processors. > > > Modified: > > head/sys/kern/vfs_mount.c > > > -- > Andriy Gapon From owner-svn-src-all@freebsd.org Tue Jun 21 20:13:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 682CFAC595E; Tue, 21 Jun 2016 20:13:21 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16B702D28; Tue, 21 Jun 2016 20:13:21 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LKDKCA034488; Tue, 21 Jun 2016 20:13:20 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LKDK15034484; Tue, 21 Jun 2016 20:13:20 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606212013.u5LKDK15034484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 21 Jun 2016 20:13: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: r302066 - in stable/10: share/man/man4 sys/dev/filemon sys/kern sys/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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 20:13:21 -0000 Author: bdrewery Date: Tue Jun 21 20:13:19 2016 New Revision: 302066 URL: https://svnweb.freebsd.org/changeset/base/302066 Log: MFC r297156,r297157,r297158,r297159,r297161,r297172,r297200,r297201,r297202, r297203,r297256: r297156: Track filemon usage via a proc.p_filemon pointer rather than its own lists. r297157: Stop tracking stat(2). r297158: Consolidate open(2) and openat(2) code. r297159: Use curthread for vn_fullpath. r297161: Attempt to use the namecache for openat(2) path resolution. r297172: Consolidate common link(2) logic. r297200: Follow-up r297156: Close the log in filemon_dtr rather than in the last reference. r297201: Return any log write failure encountered when closing the filemon fd. r297202: Remove unused done argument to copyinstr(9). r297203: Handle copyin failures. r297256: Remove unneeded return left from refactoring. Relnotes: yes (filemon stability/performance updates) Sponsored by: EMC / Isilon Storage Division Deleted: stable/10/sys/dev/filemon/filemon_lock.c Modified: stable/10/share/man/man4/filemon.4 stable/10/sys/dev/filemon/filemon.c stable/10/sys/dev/filemon/filemon_wrapper.c stable/10/sys/kern/kern_fork.c stable/10/sys/sys/param.h stable/10/sys/sys/proc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/filemon.4 ============================================================================== --- stable/10/share/man/man4/filemon.4 Tue Jun 21 18:16:45 2016 (r302065) +++ stable/10/share/man/man4/filemon.4 Tue Jun 21 20:13:19 2016 (r302066) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 9, 2016 +.Dd June 21, 2016 .Dt FILEMON 4 .Os .Sh NAME @@ -83,8 +83,6 @@ System calls are denoted using the follo .It Ql R .Xr open 2 for read -.It Ql S -.Xr stat 2 .It Ql W .Xr open 2 for write @@ -116,6 +114,10 @@ Each takes a single argument. Write the internal tracing buffer to the supplied open file descriptor. .It Dv FILEMON_SET_PID Child process ID to trace. +This should normally be done under the control of a parent in the child after +.Xr fork 2 +but before anything else. +See the example below. .El .Sh RETURN VALUES .\" .Rv -std ioctl @@ -138,6 +140,35 @@ The .Nm handle is already associated with a file descriptor. .El +.Pp +The +.Fn ioctl +system call +with +.Dv FILEMON_SET_PID +will fail if: +.Bl -tag -width Er +.It Bq Er ESRCH +No process having the specified process ID exists. +.It Bq Er EBUSY +The process ID specified is already being traced and was not the current +process. +.El +.Pp +The +.Fn close +system call on the filemon file descriptor may fail with the errors from +.Xr write 2 +if any error is encountered while writing the log. +It may also fail if: +.Bl -tag -width Er +.It Bq Er EFAULT +An invalid address was used for a traced system call argument, resulting in +no log entry for the system call. +.It Bq Er ENAMETOOLONG +An argument for a traced system call was too long, resulting in +no log entry for the system call. +.El .Sh FILES .Bl -tag -width ".Pa /dev/filemon" .It Pa /dev/filemon @@ -198,14 +229,5 @@ A device appeared in .Fx 9.1 . .Sh BUGS -Loading -.Nm -may reduce system performance for the noted syscalls. -.Pp -Only children of the set process are logged. -Processes can escape being traced by double forking. -This is not seen as a problem as the intended use is build monitoring, which -does not make sense to have daemons for. -.Pp Unloading the module may panic the system, thus requires using .Ic kldunload -f . Modified: stable/10/sys/dev/filemon/filemon.c ============================================================================== --- stable/10/sys/dev/filemon/filemon.c Tue Jun 21 18:16:45 2016 (r302065) +++ stable/10/sys/dev/filemon/filemon.c Tue Jun 21 20:13:19 2016 (r302066) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2011, David E. O'Brien. * Copyright (c) 2009-2011, Juniper Networks, Inc. - * Copyright (c) 2015, EMC Corp. + * Copyright (c) 2015-2016, EMC Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -80,23 +79,112 @@ static struct cdevsw filemon_cdevsw = { MALLOC_DECLARE(M_FILEMON); MALLOC_DEFINE(M_FILEMON, "filemon", "File access monitor"); +/* + * The filemon->lock protects several things currently: + * - fname1/fname2/msgbufr are pre-allocated and used per syscall + * for logging and copyins rather than stack variables. + * - Serializing the filemon's log output. + * - Preventing inheritance or removal of the filemon into proc.p_filemon. + */ struct filemon { - TAILQ_ENTRY(filemon) link; /* Link into the in-use list. */ - struct sx lock; /* Lock mutex for this filemon. */ + struct sx lock; /* Lock for this filemon. */ struct file *fp; /* Output file pointer. */ - struct proc *p; /* The process being monitored. */ char fname1[MAXPATHLEN]; /* Temporary filename buffer. */ char fname2[MAXPATHLEN]; /* Temporary filename buffer. */ char msgbufr[1024]; /* Output message buffer. */ + int error; /* Log write error, returned on close(2). */ + u_int refcnt; /* Pointer reference count. */ + u_int proccnt; /* Process count. */ }; -static TAILQ_HEAD(, filemon) filemons_inuse = TAILQ_HEAD_INITIALIZER(filemons_inuse); -static TAILQ_HEAD(, filemon) filemons_free = TAILQ_HEAD_INITIALIZER(filemons_free); -static struct sx access_lock; - static struct cdev *filemon_dev; +static void filemon_output(struct filemon *filemon, char *msg, size_t len); + +static __inline struct filemon * +filemon_acquire(struct filemon *filemon) +{ + + if (filemon != NULL) + refcount_acquire(&filemon->refcnt); + return (filemon); +} + +/* + * Release a reference and free on the last one. + */ +static void +filemon_release(struct filemon *filemon) +{ + + if (refcount_release(&filemon->refcnt) == 0) + return; + /* + * There are valid cases of releasing while locked, such as in + * filemon_untrack_processes, but none which are done where there + * is not at least 1 reference remaining. + */ + sx_assert(&filemon->lock, SA_UNLOCKED); + + sx_destroy(&filemon->lock); + free(filemon, M_FILEMON); +} + +/* + * Acquire the proc's p_filemon reference and lock the filemon. + * The proc's p_filemon may not match this filemon on return. + */ +static struct filemon * +filemon_proc_get(struct proc *p) +{ + struct filemon *filemon; + + PROC_LOCK(p); + filemon = filemon_acquire(p->p_filemon); + PROC_UNLOCK(p); + + if (filemon == NULL) + return (NULL); + /* + * The p->p_filemon may have changed by now. That case is handled + * by the exit and fork hooks and filemon_attach_proc specially. + */ + sx_xlock(&filemon->lock); + return (filemon); +} + +/* Remove and release the filemon on the given process. */ +static void +filemon_proc_drop(struct proc *p) +{ + struct filemon *filemon; + + KASSERT(p->p_filemon != NULL, ("%s: proc %p NULL p_filemon", + __func__, p)); + sx_assert(&p->p_filemon->lock, SA_XLOCKED); + PROC_LOCK(p); + filemon = p->p_filemon; + p->p_filemon = NULL; + --filemon->proccnt; + PROC_UNLOCK(p); + /* + * This should not be the last reference yet. filemon_release() + * cannot be called with filemon locked, which the caller expects + * will stay locked. + */ + KASSERT(filemon->refcnt > 1, ("%s: proc %p dropping filemon %p " + "with last reference", __func__, p, filemon)); + filemon_release(filemon); +} + +/* Unlock and release the filemon. */ +static __inline void +filemon_drop(struct filemon *filemon) +{ + + sx_xunlock(&filemon->lock); + filemon_release(filemon); +} -#include "filemon_lock.c" #include "filemon_wrapper.c" static void @@ -115,35 +203,151 @@ filemon_comment(struct filemon *filemon) filemon_output(filemon, filemon->msgbufr, len); } +/* + * Invalidate the passed filemon in all processes. + */ static void -filemon_dtr(void *data) +filemon_untrack_processes(struct filemon *filemon) { - struct filemon *filemon = data; + struct proc *p; - if (filemon != NULL) { - struct file *fp; + sx_assert(&filemon->lock, SA_XLOCKED); - /* Follow same locking order as filemon_pid_check. */ - filemon_lock_write(); - sx_xlock(&filemon->lock); + /* Avoid allproc loop if there is no need. */ + if (filemon->proccnt == 0) + return; + + /* + * Processes in this list won't go away while here since + * filemon_event_process_exit() will lock on filemon->lock + * which we hold. + */ + sx_slock(&allproc_lock); + FOREACH_PROC_IN_SYSTEM(p) { + /* + * No PROC_LOCK is needed to compare here since it is + * guaranteed to not change since we have its filemon + * locked. Everything that changes this p_filemon will + * be locked on it. + */ + if (p->p_filemon == filemon) + filemon_proc_drop(p); + } + sx_sunlock(&allproc_lock); + + /* + * It's possible some references were acquired but will be + * dropped shortly as they are restricted from being + * inherited. There is at least the reference in cdevpriv remaining. + */ + KASSERT(filemon->refcnt > 0, ("%s: filemon %p should have " + "references still.", __func__, filemon)); + KASSERT(filemon->proccnt == 0, ("%s: filemon %p should not have " + "attached procs still.", __func__, filemon)); +} - /* Remove from the in-use list. */ - TAILQ_REMOVE(&filemons_inuse, filemon, link); +/* + * Close out the log. + */ +static void +filemon_close_log(struct filemon *filemon) +{ + struct file *fp; + struct timeval now; + size_t len; - fp = filemon->fp; - filemon->fp = NULL; - filemon->p = NULL; + sx_assert(&filemon->lock, SA_XLOCKED); + if (filemon->fp == NULL) + return; - /* Add to the free list. */ - TAILQ_INSERT_TAIL(&filemons_free, filemon, link); + getmicrotime(&now); - /* Give up write access. */ - sx_xunlock(&filemon->lock); - filemon_unlock_write(); + len = snprintf(filemon->msgbufr, + sizeof(filemon->msgbufr), + "# Stop %ju.%06ju\n# Bye bye\n", + (uintmax_t)now.tv_sec, (uintmax_t)now.tv_usec); + + filemon_output(filemon, filemon->msgbufr, len); + fp = filemon->fp; + filemon->fp = NULL; + + sx_xunlock(&filemon->lock); + fdrop(fp, curthread); + sx_xlock(&filemon->lock); +} - if (fp != NULL) - fdrop(fp, curthread); +/* + * The devfs file is being closed. Untrace all processes. It is possible + * filemon_close/close(2) was not called. + */ +static void +filemon_dtr(void *data) +{ + struct filemon *filemon = data; + + if (filemon == NULL) + return; + + sx_xlock(&filemon->lock); + /* + * Detach the filemon. It cannot be inherited after this. + */ + filemon_untrack_processes(filemon); + filemon_close_log(filemon); + filemon_drop(filemon); +} + +/* Attach the filemon to the process. */ +static int +filemon_attach_proc(struct filemon *filemon, struct proc *p) +{ + struct filemon *filemon2; + + sx_assert(&filemon->lock, SA_XLOCKED); + PROC_LOCK_ASSERT(p, MA_OWNED); + KASSERT((p->p_flag & P_WEXIT) == 0, + ("%s: filemon %p attaching to exiting process %p", + __func__, filemon, p)); + + if (p->p_filemon == filemon) + return (0); + /* + * Don't allow truncating other process traces. It is + * not really intended to trace procs other than curproc + * anyhow. + */ + if (p->p_filemon != NULL && p != curproc) + return (EBUSY); + /* + * Historic behavior of filemon has been to let a child initiate + * tracing on itself and cease existing tracing. Bmake + * .META + .MAKE relies on this. It is only relevant for attaching to + * curproc. + */ + while (p->p_filemon != NULL) { + PROC_UNLOCK(p); + sx_xunlock(&filemon->lock); + while ((filemon2 = filemon_proc_get(p)) != NULL) { + /* It may have changed. */ + if (p->p_filemon == filemon2) + filemon_proc_drop(p); + filemon_drop(filemon2); + } + sx_xlock(&filemon->lock); + PROC_LOCK(p); + /* + * It may have been attached to, though unlikely. + * Try again if needed. + */ } + + KASSERT(p->p_filemon == NULL, + ("%s: proc %p didn't detach filemon %p", __func__, p, + p->p_filemon)); + p->p_filemon = filemon_acquire(filemon); + ++filemon->proccnt; + + return (0); } static int @@ -178,10 +382,16 @@ filemon_ioctl(struct cdev *dev, u_long c /* Set the monitored process ID. */ case FILEMON_SET_PID: + /* Invalidate any existing processes already set. */ + filemon_untrack_processes(filemon); + error = pget(*((pid_t *)data), PGET_CANDEBUG | PGET_NOTWEXIT, &p); if (error == 0) { - filemon->p = p; + KASSERT(p->p_filemon != filemon, + ("%s: proc %p didn't untrack filemon %p", + __func__, p, filemon)); + error = filemon_attach_proc(filemon, p); PROC_UNLOCK(p); } break; @@ -199,49 +409,48 @@ static int filemon_open(struct cdev *dev, int oflags __unused, int devtype __unused, struct thread *td __unused) { + int error; struct filemon *filemon; - /* Get exclusive write access. */ - filemon_lock_write(); - - if ((filemon = TAILQ_FIRST(&filemons_free)) != NULL) - TAILQ_REMOVE(&filemons_free, filemon, link); - - /* Give up write access. */ - filemon_unlock_write(); - - if (filemon == NULL) { - filemon = malloc(sizeof(struct filemon), M_FILEMON, - M_WAITOK | M_ZERO); - sx_init(&filemon->lock, "filemon"); - } - - devfs_set_cdevpriv(filemon, filemon_dtr); + filemon = malloc(sizeof(*filemon), M_FILEMON, + M_WAITOK | M_ZERO); + sx_init(&filemon->lock, "filemon"); + refcount_init(&filemon->refcnt, 1); + + error = devfs_set_cdevpriv(filemon, filemon_dtr); + if (error != 0) + filemon_release(filemon); - /* Get exclusive write access. */ - filemon_lock_write(); - - /* Add to the in-use list. */ - TAILQ_INSERT_TAIL(&filemons_inuse, filemon, link); - - /* Give up write access. */ - filemon_unlock_write(); - - return (0); + return (error); } +/* Called on close of last devfs file handle, before filemon_dtr(). */ static int filemon_close(struct cdev *dev __unused, int flag __unused, int fmt __unused, struct thread *td __unused) { + struct filemon *filemon; + int error; - return (0); + if ((error = devfs_get_cdevpriv((void **) &filemon)) != 0) + return (error); + + sx_xlock(&filemon->lock); + filemon_close_log(filemon); + error = filemon->error; + sx_xunlock(&filemon->lock); + /* + * Processes are still being traced but won't log anything + * now. After this call returns filemon_dtr() is called which + * will detach processes. + */ + + return (error); } static void filemon_load(void *dummy __unused) { - sx_init(&access_lock, "filemons_inuse"); /* Install the syscall wrappers. */ filemon_wrapper_install(); @@ -253,38 +462,11 @@ filemon_load(void *dummy __unused) static int filemon_unload(void) { - struct filemon *filemon; - int error = 0; - - /* Get exclusive write access. */ - filemon_lock_write(); - - if (TAILQ_FIRST(&filemons_inuse) != NULL) - error = EBUSY; - else { - destroy_dev(filemon_dev); - - /* Deinstall the syscall wrappers. */ - filemon_wrapper_deinstall(); - } - /* Give up write access. */ - filemon_unlock_write(); + destroy_dev(filemon_dev); + filemon_wrapper_deinstall(); - if (error == 0) { - /* free() filemon structs free list. */ - filemon_lock_write(); - while ((filemon = TAILQ_FIRST(&filemons_free)) != NULL) { - TAILQ_REMOVE(&filemons_free, filemon, link); - sx_destroy(&filemon->lock); - free(filemon, M_FILEMON); - } - filemon_unlock_write(); - - sx_destroy(&access_lock); - } - - return (error); + return (0); } static int Modified: stable/10/sys/dev/filemon/filemon_wrapper.c ============================================================================== --- stable/10/sys/dev/filemon/filemon_wrapper.c Tue Jun 21 18:16:45 2016 (r302065) +++ stable/10/sys/dev/filemon/filemon_wrapper.c Tue Jun 21 20:13:19 2016 (r302066) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2011, David E. O'Brien. * Copyright (c) 2009-2011, Juniper Networks, Inc. - * Copyright (c) 2015, EMC Corp. + * Copyright (c) 2015-2016, EMC Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,8 +29,9 @@ #include __FBSDID("$FreeBSD$"); -#include #include +#include +#include #include #include @@ -45,6 +46,7 @@ filemon_output(struct filemon *filemon, { struct uio auio; struct iovec aiov; + int error; if (filemon->fp == NULL) return; @@ -62,56 +64,33 @@ filemon_output(struct filemon *filemon, if (filemon->fp->f_type == DTYPE_VNODE) bwillwrite(); - fo_write(filemon->fp, &auio, curthread->td_ucred, 0, curthread); -} - -static struct filemon * -filemon_pid_check(struct proc *p) -{ - struct filemon *filemon; - - filemon_lock_read(); - if (TAILQ_EMPTY(&filemons_inuse)) { - filemon_unlock_read(); - return (NULL); - } - sx_slock(&proctree_lock); - while (p->p_pid != 0) { - TAILQ_FOREACH(filemon, &filemons_inuse, link) { - if (p == filemon->p) { - sx_sunlock(&proctree_lock); - sx_xlock(&filemon->lock); - filemon_unlock_read(); - return (filemon); - } - } - p = proc_realparent(p); - } - sx_sunlock(&proctree_lock); - filemon_unlock_read(); - return (NULL); + error = fo_write(filemon->fp, &auio, curthread->td_ucred, 0, curthread); + if (error != 0) + filemon->error = error; } static int filemon_wrapper_chdir(struct thread *td, struct chdir_args *uap) { - int ret; - size_t done; + int error, ret; size_t len; struct filemon *filemon; if ((ret = sys_chdir(td, uap)) == 0) { - if ((filemon = filemon_pid_check(curproc)) != NULL) { - copyinstr(uap->path, filemon->fname1, - sizeof(filemon->fname1), &done); + if ((filemon = filemon_proc_get(curproc)) != NULL) { + if ((error = copyinstr(uap->path, filemon->fname1, + sizeof(filemon->fname1), NULL)) != 0) { + filemon->error = error; + goto copyfail; + } len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "C %d %s\n", curproc->p_pid, filemon->fname1); filemon_output(filemon, filemon->msgbufr, len); - - sx_xunlock(&filemon->lock); +copyfail: + filemon_drop(filemon); } } @@ -126,12 +105,11 @@ filemon_event_process_exec(void *arg __u char *fullpath, *freepath; size_t len; - if ((filemon = filemon_pid_check(p)) != NULL) { + if ((filemon = filemon_proc_get(p)) != NULL) { fullpath = ""; freepath = NULL; - vn_fullpath(FIRST_THREAD_IN_PROC(p), imgp->vp, &fullpath, - &freepath); + vn_fullpath(curthread, imgp->vp, &fullpath, &freepath); len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "E %d %s\n", @@ -139,321 +117,244 @@ filemon_event_process_exec(void *arg __u filemon_output(filemon, filemon->msgbufr, len); - sx_xunlock(&filemon->lock); + filemon_drop(filemon); free(freepath, M_TEMP); } } -static int -filemon_wrapper_open(struct thread *td, struct open_args *uap) +static void +_filemon_wrapper_openat(struct thread *td, char *upath, int flags, int fd) { - int ret; - size_t done; + int error; size_t len; + struct file *fp; struct filemon *filemon; + char *atpath, *freepath; + cap_rights_t rights; - if ((ret = sys_open(td, uap)) == 0) { - if ((filemon = filemon_pid_check(curproc)) != NULL) { - copyinstr(uap->path, filemon->fname1, - sizeof(filemon->fname1), &done); - - if (uap->flags & O_RDWR) { - /* - * We'll get the W record below, but need - * to also output an R to distingish from - * O_WRONLY. - */ - len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "R %d %s\n", - curproc->p_pid, filemon->fname1); - filemon_output(filemon, filemon->msgbufr, len); - } - + if ((filemon = filemon_proc_get(curproc)) != NULL) { + atpath = ""; + freepath = NULL; + fp = NULL; + if ((error = copyinstr(upath, filemon->fname1, + sizeof(filemon->fname1), NULL)) != 0) { + filemon->error = error; + goto copyfail; + } + + if (filemon->fname1[0] != '/' && fd != AT_FDCWD) { + /* + * rats - we cannot do too much about this. + * the trace should show a dir we read + * recently.. output an A record as a clue + * until we can do better. + * XXX: This may be able to come out with + * the namecache lookup now. + */ len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "%c %d %s\n", - (uap->flags & O_ACCMODE) ? 'W':'R', + sizeof(filemon->msgbufr), "A %d %s\n", curproc->p_pid, filemon->fname1); filemon_output(filemon, filemon->msgbufr, len); - - sx_xunlock(&filemon->lock); + /* + * Try to resolve the path from the vnode using the + * namecache. It may be inaccurate, but better + * than nothing. + */ + if (getvnode(td->td_proc->p_fd, fd, + cap_rights_init(&rights, CAP_LOOKUP), &fp) == 0) { + vn_fullpath(td, fp->f_vnode, &atpath, + &freepath); + } + } + if (flags & O_RDWR) { + /* + * We'll get the W record below, but need + * to also output an R to distinguish from + * O_WRONLY. + */ + len = snprintf(filemon->msgbufr, + sizeof(filemon->msgbufr), "R %d %s%s%s\n", + curproc->p_pid, atpath, + atpath[0] != '\0' ? "/" : "", filemon->fname1); + filemon_output(filemon, filemon->msgbufr, len); } - } - return (ret); + len = snprintf(filemon->msgbufr, + sizeof(filemon->msgbufr), "%c %d %s%s%s\n", + (flags & O_ACCMODE) ? 'W':'R', + curproc->p_pid, atpath, + atpath[0] != '\0' ? "/" : "", filemon->fname1); + filemon_output(filemon, filemon->msgbufr, len); +copyfail: + filemon_drop(filemon); + if (fp != NULL) + fdrop(fp, td); + free(freepath, M_TEMP); + } } static int -filemon_wrapper_openat(struct thread *td, struct openat_args *uap) +filemon_wrapper_open(struct thread *td, struct open_args *uap) { int ret; - size_t done; - size_t len; - struct filemon *filemon; - - if ((ret = sys_openat(td, uap)) == 0) { - if ((filemon = filemon_pid_check(curproc)) != NULL) { - copyinstr(uap->path, filemon->fname1, - sizeof(filemon->fname1), &done); - - filemon->fname2[0] = '\0'; - if (filemon->fname1[0] != '/' && uap->fd != AT_FDCWD) { - /* - * rats - we cannot do too much about this. - * the trace should show a dir we read - * recently.. output an A record as a clue - * until we can do better. - */ - len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "A %d %s\n", - curproc->p_pid, filemon->fname1); - filemon_output(filemon, filemon->msgbufr, len); - } - if (uap->flag & O_RDWR) { - /* - * We'll get the W record below, but need - * to also output an R to distingish from - * O_WRONLY. - */ - len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "R %d %s%s\n", - curproc->p_pid, filemon->fname2, filemon->fname1); - filemon_output(filemon, filemon->msgbufr, len); - } - - - len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "%c %d %s%s\n", - (uap->flag & O_ACCMODE) ? 'W':'R', - curproc->p_pid, filemon->fname2, filemon->fname1); - filemon_output(filemon, filemon->msgbufr, len); - sx_xunlock(&filemon->lock); - } - } + if ((ret = sys_open(td, uap)) == 0) + _filemon_wrapper_openat(td, uap->path, uap->flags, AT_FDCWD); return (ret); } static int -filemon_wrapper_rename(struct thread *td, struct rename_args *uap) +filemon_wrapper_openat(struct thread *td, struct openat_args *uap) { int ret; - size_t done; - size_t len; - struct filemon *filemon; - if ((ret = sys_rename(td, uap)) == 0) { - if ((filemon = filemon_pid_check(curproc)) != NULL) { - copyinstr(uap->from, filemon->fname1, - sizeof(filemon->fname1), &done); - copyinstr(uap->to, filemon->fname2, - sizeof(filemon->fname2), &done); - - len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "M %d '%s' '%s'\n", - curproc->p_pid, filemon->fname1, filemon->fname2); - - filemon_output(filemon, filemon->msgbufr, len); - - sx_xunlock(&filemon->lock); - } - } + if ((ret = sys_openat(td, uap)) == 0) + _filemon_wrapper_openat(td, uap->path, uap->flag, uap->fd); return (ret); } static int -filemon_wrapper_link(struct thread *td, struct link_args *uap) +filemon_wrapper_rename(struct thread *td, struct rename_args *uap) { - int ret; - size_t done; + int error, ret; size_t len; struct filemon *filemon; - if ((ret = sys_link(td, uap)) == 0) { - if ((filemon = filemon_pid_check(curproc)) != NULL) { - copyinstr(uap->path, filemon->fname1, - sizeof(filemon->fname1), &done); - copyinstr(uap->link, filemon->fname2, - sizeof(filemon->fname2), &done); + if ((ret = sys_rename(td, uap)) == 0) { + if ((filemon = filemon_proc_get(curproc)) != NULL) { + if (((error = copyinstr(uap->from, filemon->fname1, + sizeof(filemon->fname1), NULL)) != 0) || + ((error = copyinstr(uap->to, filemon->fname2, + sizeof(filemon->fname2), NULL)) != 0)) { + filemon->error = error; + goto copyfail; + } len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "L %d '%s' '%s'\n", + sizeof(filemon->msgbufr), "M %d '%s' '%s'\n", curproc->p_pid, filemon->fname1, filemon->fname2); filemon_output(filemon, filemon->msgbufr, len); - - sx_xunlock(&filemon->lock); +copyfail: + filemon_drop(filemon); } } return (ret); } -static int -filemon_wrapper_symlink(struct thread *td, struct symlink_args *uap) +static void +_filemon_wrapper_link(struct thread *td, char *upath1, char *upath2) { - int ret; - size_t done; - size_t len; struct filemon *filemon; + size_t len; + int error; - if ((ret = sys_symlink(td, uap)) == 0) { - if ((filemon = filemon_pid_check(curproc)) != NULL) { - copyinstr(uap->path, filemon->fname1, - sizeof(filemon->fname1), &done); - copyinstr(uap->link, filemon->fname2, - sizeof(filemon->fname2), &done); - - len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "L %d '%s' '%s'\n", - curproc->p_pid, filemon->fname1, filemon->fname2); + if ((filemon = filemon_proc_get(curproc)) != NULL) { + if (((error = copyinstr(upath1, filemon->fname1, + sizeof(filemon->fname1), NULL)) != 0) || + ((error = copyinstr(upath2, filemon->fname2, + sizeof(filemon->fname2), NULL)) != 0)) { + filemon->error = error; + goto copyfail; + } - filemon_output(filemon, filemon->msgbufr, len); + len = snprintf(filemon->msgbufr, + sizeof(filemon->msgbufr), "L %d '%s' '%s'\n", + curproc->p_pid, filemon->fname1, filemon->fname2); - sx_xunlock(&filemon->lock); - } + filemon_output(filemon, filemon->msgbufr, len); +copyfail: + filemon_drop(filemon); } - - return (ret); } static int -filemon_wrapper_linkat(struct thread *td, struct linkat_args *uap) +filemon_wrapper_link(struct thread *td, struct link_args *uap) { int ret; - size_t done; - size_t len; - struct filemon *filemon; - - if ((ret = sys_linkat(td, uap)) == 0) { - if ((filemon = filemon_pid_check(curproc)) != NULL) { - copyinstr(uap->path1, filemon->fname1, - sizeof(filemon->fname1), &done); - copyinstr(uap->path2, filemon->fname2, - sizeof(filemon->fname2), &done); - - len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "L %d '%s' '%s'\n", - curproc->p_pid, filemon->fname1, filemon->fname2); - - filemon_output(filemon, filemon->msgbufr, len); - sx_xunlock(&filemon->lock); - } - } + if ((ret = sys_link(td, uap)) == 0) + _filemon_wrapper_link(td, uap->path, uap->link); return (ret); } static int -filemon_wrapper_stat(struct thread *td, struct stat_args *uap) +filemon_wrapper_symlink(struct thread *td, struct symlink_args *uap) { int ret; - size_t done; - size_t len; - struct filemon *filemon; - if ((ret = sys_stat(td, uap)) == 0) { - if ((filemon = filemon_pid_check(curproc)) != NULL) { - copyinstr(uap->path, filemon->fname1, - sizeof(filemon->fname1), &done); - - len = snprintf(filemon->msgbufr, - sizeof(filemon->msgbufr), "S %d %s\n", - curproc->p_pid, filemon->fname1); - - filemon_output(filemon, filemon->msgbufr, len); - - sx_xunlock(&filemon->lock); - } - } + if ((ret = sys_symlink(td, uap)) == 0) + _filemon_wrapper_link(td, uap->path, uap->link); return (ret); } -#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) static int -filemon_wrapper_freebsd32_stat(struct thread *td, - struct freebsd32_stat_args *uap) +filemon_wrapper_linkat(struct thread *td, struct linkat_args *uap) { int ret; - size_t done; - size_t len; - struct filemon *filemon; - - if ((ret = freebsd32_stat(td, uap)) == 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Jun 21 20:14:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAF35AC59D0; Tue, 21 Jun 2016 20:14:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA0D82E75; Tue, 21 Jun 2016 20:14:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LKEWme034573; Tue, 21 Jun 2016 20:14:32 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LKEWEP034572; Tue, 21 Jun 2016 20:14:32 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606212014.u5LKEWEP034572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 21 Jun 2016 20:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302067 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 20:14:34 -0000 Author: bdrewery Date: Tue Jun 21 20:14:32 2016 New Revision: 302067 URL: https://svnweb.freebsd.org/changeset/base/302067 Log: Fix top-level builds with fmake / 9.x. Reported by: allanjude Approved by: re (marius) Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Tue Jun 21 20:13:19 2016 (r302066) +++ head/Makefile Tue Jun 21 20:14:32 2016 (r302067) @@ -103,7 +103,7 @@ # This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION # can be cached for sub-makes. -.if ${MAKE_VERSION} >= 20140620 +.if ${MAKE_VERSION} >= 20140620 && defined(.PARSEDIR) .include .endif @@ -218,7 +218,9 @@ _CAN_USE_META_MODE?= yes .endfor .if !defined(_CAN_USE_META_MODE) _MAKE+= MK_META_MODE=no +.if defined(.PARSEDIR) .unexport META_MODE +.endif .elif defined(MK_META_MODE) && ${MK_META_MODE} == "yes" .if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig) # Require filemon be loaded to provide a working incremental build From owner-svn-src-all@freebsd.org Tue Jun 21 20:15:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4908AC5A5E; Tue, 21 Jun 2016 20:15:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8576D2FE7; Tue, 21 Jun 2016 20:15:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LKFUJH034654; Tue, 21 Jun 2016 20:15:30 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LKFU1g034653; Tue, 21 Jun 2016 20:15:30 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606212015.u5LKFU1g034653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 21 Jun 2016 20:15: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: r302068 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 20:15:31 -0000 Author: bdrewery Date: Tue Jun 21 20:15:30 2016 New Revision: 302068 URL: https://svnweb.freebsd.org/changeset/base/302068 Log: MFC r271049: Note that script(1) consumes filemon(4). Modified: stable/10/share/man/man4/filemon.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/filemon.4 ============================================================================== --- stable/10/share/man/man4/filemon.4 Tue Jun 21 20:14:32 2016 (r302067) +++ stable/10/share/man/man4/filemon.4 Tue Jun 21 20:15:30 2016 (r302068) @@ -221,6 +221,7 @@ buffer contents to it. .Sh SEE ALSO .Xr dtrace 1 , .Xr ktrace 1 , +.Xr script 1 , .Xr truss 1 , .Xr ioctl 2 .Sh HISTORY From owner-svn-src-all@freebsd.org Tue Jun 21 20:18:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F254AC5AE4; Tue, 21 Jun 2016 20:18:20 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21C6F12BE; Tue, 21 Jun 2016 20:18:20 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LKIJcF034786; Tue, 21 Jun 2016 20:18:19 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LKIJ7C034784; Tue, 21 Jun 2016 20:18:19 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201606212018.u5LKIJ7C034784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 21 Jun 2016 20:18:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302069 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 20:18:20 -0000 Author: ken Date: Tue Jun 21 20:18:19 2016 New Revision: 302069 URL: https://svnweb.freebsd.org/changeset/base/302069 Log: Fix a bug that caused da(4) instances to hang around after the underlying device is gone. The problem was that when disk_gone() is called, if the GEOM disk creation process has not yet happened, the withering process couldn't start. We didn't record any state in the GEOM disk code, and so the d_gone() callback to the da(4) driver never happened. The solution is to track the state of the creation process, and initiate the withering process from g_disk_create() if the disk is being created. This change does add fields to struct disk, and so I have bumped DISK_VERSION. geom_disk.c: Track where we are in the disk creation process, and check to see whether our underlying disk has gone away or not. In disk_gone(), set a new d_goneflag variable that g_disk_create() can check to see if it needs to clean up the disk instance. geom_disk.h: Add a mutex to struct disk (for internal use) disk init level, and a gone flag. Bump DISK_VERSION because the size of struct disk has changed and fields have been added at the beginning. Sponsored by: Spectra Logic Approved by: re (marius) Modified: head/sys/geom/geom_disk.c head/sys/geom/geom_disk.h Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Tue Jun 21 20:15:30 2016 (r302068) +++ head/sys/geom/geom_disk.c Tue Jun 21 20:18:19 2016 (r302069) @@ -669,6 +669,22 @@ g_disk_create(void *arg, int flag) return; g_topology_assert(); dp = arg; + + mtx_lock(&dp->d_mtx); + dp->d_init_level = DISK_INIT_START; + + /* + * If the disk has already gone away, we can just stop here and + * call the user's callback to tell him we've cleaned things up. + */ + if (dp->d_goneflag != 0) { + mtx_unlock(&dp->d_mtx); + if (dp->d_gone != NULL) + dp->d_gone(dp); + return; + } + mtx_unlock(&dp->d_mtx); + sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); mtx_init(&sc->start_mtx, "g_disk_start", NULL, MTX_DEF); mtx_init(&sc->done_mtx, "g_disk_done", NULL, MTX_DEF); @@ -704,6 +720,21 @@ g_disk_create(void *arg, int flag) pp->private = sc; dp->d_geom = gp; g_error_provider(pp, 0); + + mtx_lock(&dp->d_mtx); + dp->d_init_level = DISK_INIT_DONE; + + /* + * If the disk has gone away at this stage, start the withering + * process for it. + */ + if (dp->d_goneflag != 0) { + mtx_unlock(&dp->d_mtx); + g_wither_provider(pp, ENXIO); + return; + } + mtx_unlock(&dp->d_mtx); + } /* @@ -754,6 +785,9 @@ g_disk_destroy(void *ptr, int flag) dp->d_geom = NULL; g_wither_geom(gp, ENXIO); } + + mtx_destroy(&dp->d_mtx); + g_free(dp); } @@ -817,6 +851,12 @@ disk_create(struct disk *dp, int version dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); dp->d_geom = NULL; + + snprintf(dp->d_mtx_name, sizeof(dp->d_mtx_name), "%s%ddlk", + dp->d_name, dp->d_unit); + mtx_init(&dp->d_mtx, dp->d_mtx_name, NULL, MTX_DEF); + dp->d_init_level = DISK_INIT_NONE; + g_disk_ident_adjust(dp->d_ident, sizeof(dp->d_ident)); g_post_event(g_disk_create, dp, M_WAITOK, dp, NULL); } @@ -838,6 +878,30 @@ disk_gone(struct disk *dp) struct g_geom *gp; struct g_provider *pp; + mtx_lock(&dp->d_mtx); + dp->d_goneflag = 1; + + /* + * If we're still in the process of creating this disk (the + * g_disk_create() function is still queued, or is in + * progress), the init level will not yet be DISK_INIT_DONE. + * + * If that is the case, g_disk_create() will see d_goneflag + * and take care of cleaning things up. + * + * If the disk has already been created, we default to + * withering the provider as usual below. + * + * If the caller has not set a d_gone() callback, he will + * not be any worse off by returning here, because the geom + * has not been fully setup in any case. + */ + if (dp->d_init_level < DISK_INIT_DONE) { + mtx_unlock(&dp->d_mtx); + return; + } + mtx_unlock(&dp->d_mtx); + gp = dp->d_geom; if (gp != NULL) { pp = LIST_FIRST(&gp->provider); Modified: head/sys/geom/geom_disk.h ============================================================================== --- head/sys/geom/geom_disk.h Tue Jun 21 20:15:30 2016 (r302068) +++ head/sys/geom/geom_disk.h Tue Jun 21 20:18:19 2016 (r302069) @@ -60,11 +60,21 @@ typedef int disk_ioctl_t(struct disk *, struct g_geom; struct devstat; +typedef enum { + DISK_INIT_NONE, + DISK_INIT_START, + DISK_INIT_DONE +} disk_init_level; + struct disk { /* Fields which are private to geom_disk */ struct g_geom *d_geom; struct devstat *d_devstat; + int d_goneflag; int d_destroyed; + struct mtx d_mtx; + char d_mtx_name[24]; + disk_init_level d_init_level; /* Shared fields */ u_int d_flags; @@ -125,7 +135,8 @@ int disk_resize(struct disk *dp, int fla #define DISK_VERSION_02 0x5856105b #define DISK_VERSION_03 0x5856105c #define DISK_VERSION_04 0x5856105d -#define DISK_VERSION DISK_VERSION_04 +#define DISK_VERSION_05 0x5856105e +#define DISK_VERSION DISK_VERSION_05 #endif /* _KERNEL */ #endif /* _GEOM_GEOM_DISK_H_ */ From owner-svn-src-all@freebsd.org Tue Jun 21 20:20:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E397AC5BAC; Tue, 21 Jun 2016 20:20:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EBEB1670; Tue, 21 Jun 2016 20:20:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LKKU42035037; Tue, 21 Jun 2016 20:20:30 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LKKUcx035036; Tue, 21 Jun 2016 20:20:30 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606212020.u5LKKUcx035036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 21 Jun 2016 20:20: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: r302070 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 20:20:31 -0000 Author: bdrewery Date: Tue Jun 21 20:20:30 2016 New Revision: 302070 URL: https://svnweb.freebsd.org/changeset/base/302070 Log: MFC r297160,r297196: r297160: Document openat(2) behavior. r297196: Spell out 'system calls'. Modified: stable/10/share/man/man4/filemon.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/filemon.4 ============================================================================== --- stable/10/share/man/man4/filemon.4 Tue Jun 21 20:18:19 2016 (r302069) +++ stable/10/share/man/man4/filemon.4 Tue Jun 21 20:20:30 2016 (r302070) @@ -51,7 +51,7 @@ calls. .Pp .Nm is not intended to be a security auditing tool. -Many syscalls are not tracked and binaries of foreign ABI will not be fully +Many system calls are not tracked and binaries of foreign ABI will not be fully audited. It is intended for auditing of processes for the purpose of determining its dependencies in an efficient and easily parsable format. @@ -64,6 +64,9 @@ to handle incremental builds more smartl System calls are denoted using the following single letters: .Pp .Bl -tag -width indent -compact +.It Ql A +.Xr openat 2 . +The next log entry may be lacking an absolute path or be inaccurate. .It Ql C .Xr chdir 2 .It Ql D @@ -82,9 +85,13 @@ System calls are denoted using the follo .Xr rename 2 .It Ql R .Xr open 2 +or +.Xr openat 2 for read .It Ql W .Xr open 2 +or +.Xr openat 2 for write .It Ql X .Xr _exit 2 From owner-svn-src-all@freebsd.org Tue Jun 21 20:28:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00C82AC5EA2; Tue, 21 Jun 2016 20:28:32 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4DB61E12; Tue, 21 Jun 2016 20:28:31 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LKSUiF039042; Tue, 21 Jun 2016 20:28:30 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LKSUiS039041; Tue, 21 Jun 2016 20:28:30 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201606212028.u5LKSUiS039041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 21 Jun 2016 20:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302071 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 20:28:32 -0000 Author: ken Date: Tue Jun 21 20:28:30 2016 New Revision: 302071 URL: https://svnweb.freebsd.org/changeset/base/302071 Log: Bump __FreeBSD_version to 1100118 for r302069, which breaks binary compatibility for loadable modules that depend on struct disk. Approved by: re (delphij) Sponsored by: Spectra Logic Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Jun 21 20:20:30 2016 (r302070) +++ head/sys/sys/param.h Tue Jun 21 20:28:30 2016 (r302071) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100117 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100118 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Tue Jun 21 20:32:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9748AAC5154; Tue, 21 Jun 2016 20:32:35 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7302E250D; Tue, 21 Jun 2016 20:32:35 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LKWYld042591; Tue, 21 Jun 2016 20:32:34 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LKWYCF042588; Tue, 21 Jun 2016 20:32:34 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606212032.u5LKWYCF042588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 21 Jun 2016 20:32:34 +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: r302072 - in stable/10/sys: dev/filemon modules X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 20:32:35 -0000 Author: bdrewery Date: Tue Jun 21 20:32:34 2016 New Revision: 302072 URL: https://svnweb.freebsd.org/changeset/base/302072 Log: MFC r300892,r300893,r301130,r301404,r301414,r301460: r300892: Rename function to be less generic. r300893: Don't truncate existing error when writing the log. r301130: Enable filemon on all architectures. r301404: Support all architectures by just using sysent. r301414: Fix build after r301404. r301460: Cleanup COMPAT_FREEBSD32 support. Modified: stable/10/sys/dev/filemon/filemon.c stable/10/sys/dev/filemon/filemon_wrapper.c stable/10/sys/modules/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/filemon/filemon.c ============================================================================== --- stable/10/sys/dev/filemon/filemon.c Tue Jun 21 20:28:30 2016 (r302071) +++ stable/10/sys/dev/filemon/filemon.c Tue Jun 21 20:32:34 2016 (r302072) @@ -54,16 +54,12 @@ __FBSDID("$FreeBSD$"); #include "filemon.h" -#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) +#if defined(COMPAT_FREEBSD32) #include #include - -extern struct sysentvec ia32_freebsd_sysvec; +#include #endif -extern struct sysentvec elf32_freebsd_sysvec; -extern struct sysentvec elf64_freebsd_sysvec; - static d_close_t filemon_close; static d_ioctl_t filemon_ioctl; static d_open_t filemon_open; @@ -188,7 +184,7 @@ filemon_drop(struct filemon *filemon) #include "filemon_wrapper.c" static void -filemon_comment(struct filemon *filemon) +filemon_write_header(struct filemon *filemon) { int len; struct timeval now; @@ -377,7 +373,7 @@ filemon_ioctl(struct cdev *dev, u_long c &filemon->fp); if (error == 0) /* Write the file header. */ - filemon_comment(filemon); + filemon_write_header(filemon); break; /* Set the monitored process ID. */ Modified: stable/10/sys/dev/filemon/filemon_wrapper.c ============================================================================== --- stable/10/sys/dev/filemon/filemon_wrapper.c Tue Jun 21 20:28:30 2016 (r302071) +++ stable/10/sys/dev/filemon/filemon_wrapper.c Tue Jun 21 20:32:34 2016 (r302072) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "opt_compat.h" @@ -65,7 +66,7 @@ filemon_output(struct filemon *filemon, bwillwrite(); error = fo_write(filemon->fp, &auio, curthread->td_ucred, 0, curthread); - if (error != 0) + if (error != 0 && filemon->error == 0) filemon->error = error; } @@ -402,33 +403,26 @@ filemon_event_process_fork(void *arg __u static void filemon_wrapper_install(void) { -#if defined(__LP64__) - struct sysent *sv_table = elf64_freebsd_sysvec.sv_table; -#else - struct sysent *sv_table = elf32_freebsd_sysvec.sv_table; -#endif - - sv_table[SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir; - sv_table[SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; - sv_table[SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; - sv_table[SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; - sv_table[SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; - sv_table[SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link; - sv_table[SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink; - sv_table[SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; - -#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) - sv_table = ia32_freebsd_sysvec.sv_table; - - sv_table[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir; - sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; - sv_table[FREEBSD32_SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; - sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; - sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; - sv_table[FREEBSD32_SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link; - sv_table[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink; - sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; -#endif /* COMPAT_ARCH32 */ + + sysent[SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir; + sysent[SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; + sysent[SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; + sysent[SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; + sysent[SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; + sysent[SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link; + sysent[SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink; + sysent[SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; + +#if defined(COMPAT_FREEBSD32) + freebsd32_sysent[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir; + freebsd32_sysent[FREEBSD32_SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; + freebsd32_sysent[FREEBSD32_SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; + freebsd32_sysent[FREEBSD32_SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; + freebsd32_sysent[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; + freebsd32_sysent[FREEBSD32_SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link; + freebsd32_sysent[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink; + freebsd32_sysent[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; +#endif /* COMPAT_FREEBSD32 */ filemon_exec_tag = EVENTHANDLER_REGISTER(process_exec, filemon_event_process_exec, NULL, EVENTHANDLER_PRI_LAST); @@ -441,33 +435,26 @@ filemon_wrapper_install(void) static void filemon_wrapper_deinstall(void) { -#if defined(__LP64__) - struct sysent *sv_table = elf64_freebsd_sysvec.sv_table; -#else - struct sysent *sv_table = elf32_freebsd_sysvec.sv_table; -#endif - - sv_table[SYS_chdir].sy_call = (sy_call_t *)sys_chdir; - sv_table[SYS_open].sy_call = (sy_call_t *)sys_open; - sv_table[SYS_openat].sy_call = (sy_call_t *)sys_openat; - sv_table[SYS_rename].sy_call = (sy_call_t *)sys_rename; - sv_table[SYS_unlink].sy_call = (sy_call_t *)sys_unlink; - sv_table[SYS_link].sy_call = (sy_call_t *)sys_link; - sv_table[SYS_symlink].sy_call = (sy_call_t *)sys_symlink; - sv_table[SYS_linkat].sy_call = (sy_call_t *)sys_linkat; - -#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) - sv_table = ia32_freebsd_sysvec.sv_table; - - sv_table[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *)sys_chdir; - sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *)sys_open; - sv_table[FREEBSD32_SYS_openat].sy_call = (sy_call_t *)sys_openat; - sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *)sys_rename; - sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *)sys_unlink; - sv_table[FREEBSD32_SYS_link].sy_call = (sy_call_t *)sys_link; - sv_table[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *)sys_symlink; - sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *)sys_linkat; -#endif /* COMPAT_ARCH32 */ + + sysent[SYS_chdir].sy_call = (sy_call_t *)sys_chdir; + sysent[SYS_open].sy_call = (sy_call_t *)sys_open; + sysent[SYS_openat].sy_call = (sy_call_t *)sys_openat; + sysent[SYS_rename].sy_call = (sy_call_t *)sys_rename; + sysent[SYS_unlink].sy_call = (sy_call_t *)sys_unlink; + sysent[SYS_link].sy_call = (sy_call_t *)sys_link; + sysent[SYS_symlink].sy_call = (sy_call_t *)sys_symlink; + sysent[SYS_linkat].sy_call = (sy_call_t *)sys_linkat; + +#if defined(COMPAT_FREEBSD32) + freebsd32_sysent[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *)sys_chdir; + freebsd32_sysent[FREEBSD32_SYS_open].sy_call = (sy_call_t *)sys_open; + freebsd32_sysent[FREEBSD32_SYS_openat].sy_call = (sy_call_t *)sys_openat; + freebsd32_sysent[FREEBSD32_SYS_rename].sy_call = (sy_call_t *)sys_rename; + freebsd32_sysent[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *)sys_unlink; + freebsd32_sysent[FREEBSD32_SYS_link].sy_call = (sy_call_t *)sys_link; + freebsd32_sysent[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *)sys_symlink; + freebsd32_sysent[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *)sys_linkat; +#endif /* COMPAT_FREEBSD32 */ EVENTHANDLER_DEREGISTER(process_exec, filemon_exec_tag); EVENTHANDLER_DEREGISTER(process_exit, filemon_exit_tag); Modified: stable/10/sys/modules/Makefile ============================================================================== --- stable/10/sys/modules/Makefile Tue Jun 21 20:28:30 2016 (r302071) +++ stable/10/sys/modules/Makefile Tue Jun 21 20:32:34 2016 (r302072) @@ -110,7 +110,7 @@ SUBDIR= \ fdc \ fdescfs \ ${_fe} \ - ${_filemon} \ + filemon \ firewire \ firmware \ fuse \ @@ -388,7 +388,6 @@ SUBDIR= \ zlib \ .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -_filemon= filemon _imgact_binmisc= imgact_binmisc _vmware= vmware .endif From owner-svn-src-all@freebsd.org Tue Jun 21 21:55:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99BC0AC53EA; Tue, 21 Jun 2016 21:55:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74DA722BC; Tue, 21 Jun 2016 21:55:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LLt3Og072330; Tue, 21 Jun 2016 21:55:03 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LLt3sH072326; Tue, 21 Jun 2016 21:55:03 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606212155.u5LLt3sH072326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 21 Jun 2016 21:55:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302073 - in head: share/mk sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 21:55:04 -0000 Author: bdrewery Date: Tue Jun 21 21:55:03 2016 New Revision: 302073 URL: https://svnweb.freebsd.org/changeset/base/302073 Log: META_MODE: Don't generate or read _EXTRADEPEND dependencies when using filemon. The DPADD data in .depend will be redundant with what is in the .meta file. Also extend NO_EXTRADEPEND support to bsd.prog.mk. Approved by: re (blanket, META_MODE) Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/bsd.dep.mk head/share/mk/bsd.prog.mk head/share/mk/sys.mk head/sys/conf/kern.post.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Tue Jun 21 20:32:34 2016 (r302072) +++ head/share/mk/bsd.dep.mk Tue Jun 21 21:55:03 2016 (r302073) @@ -72,10 +72,16 @@ tags: ${SRCS} .endif .endif +.if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon) +_meta_filemon= 1 +.endif + # Skip reading .depend when not needed to speed up tree-walks # and simple lookups. +# Also skip generating or including .depend.* files if in meta+filemon mode +# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used. .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \ - make(install*) || make(analyze) + make(install*) || make(analyze) || defined(_meta_filemon) _SKIP_READ_DEPEND= 1 .if ${MK_DIRDEPS_BUILD} == "no" .MAKE.DEPENDFILE= /dev/null @@ -157,9 +163,6 @@ ${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$/ .endfor -.if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon) -_meta_filemon= 1 -.endif .if ${MAKE_VERSION} < 20160220 DEPEND_MP?= -MP .endif @@ -173,8 +176,6 @@ DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,} DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./} DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}} DEPEND_CFLAGS+= -MT${.TARGET} -# Skip generating or including .depend.* files if in meta+filemon mode since -# it will track dependencies itself. OBJS_DEPEND_GUESS is still used though. .if !defined(_meta_filemon) .if defined(.PARSEDIR) # Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS @@ -201,7 +202,7 @@ CFLAGS+= ${DEPEND_CFLAGS} .depend: .include # If using filemon then _EXTRADEPEND is skipped since it is not needed. -.if empty(.MAKE.MODE:Mnofilemon) +.if defined(_meta_filemon) # this depend: bypasses that below # the dependency helps when bootstrapping depend: beforedepend ${DPSRCS} ${SRCS} afterdepend @@ -245,15 +246,18 @@ depend: beforedepend ${DEPENDFILE} after DPSRCS+= ${SRCS} # A .depend file will only be generated if there are commands in -# beforedepend/_EXTRADEPEND/afterdepend. The target is kept -# to allow 'make depend' to generate files. +# beforedepend/_EXTRADEPEND/afterdepend The _EXTRADEPEND target is +# ignored if using meta+filemon since it handles all dependencies. The other +# targets are kept as they be used for generating something. The target is +# kept to allow 'make depend' to generate files. ${DEPENDFILE}: ${DPSRCS} .if exists(${.OBJDIR}/${DEPENDFILE}) || \ - ((commands(beforedepend) || commands(_EXTRADEPEND) || \ + ((commands(beforedepend) || \ + (!defined(_meta_filemon) && commands(_EXTRADEPEND)) || \ commands(afterdepend)) && !empty(.MAKE.MODE:Mmeta)) rm -f ${DEPENDFILE} .endif -.if target(_EXTRADEPEND) +.if !defined(_meta_filemon) && target(_EXTRADEPEND) _EXTRADEPEND: .USE ${DEPENDFILE}: _EXTRADEPEND .endif Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Tue Jun 21 20:32:34 2016 (r302072) +++ head/share/mk/bsd.prog.mk Tue Jun 21 21:55:03 2016 (r302073) @@ -178,6 +178,7 @@ CLEANFILES+= ${OBJS} .include .if defined(PROG) +.if !defined(NO_EXTRADEPEND) _EXTRADEPEND: .if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib) .if defined(DPADD) && !empty(DPADD) @@ -193,6 +194,7 @@ _EXTRADEPEND: .endif .endif .endif +.endif # !defined(NO_EXTRADEPEND) .endif .if !target(install) Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Tue Jun 21 20:32:34 2016 (r302072) +++ head/share/mk/sys.mk Tue Jun 21 21:55:03 2016 (r302073) @@ -75,6 +75,8 @@ META_MODE?= normal # buildworld -> installworld -> buildworld to rebuild everything. # Since the build is self-reliant and bootstraps everything it needs, # this should not be a real problem for incremental builds. +# XXX: This relies on the existing host tools retaining ABI compatibility +# through upgrades since they won't be rebuilt on header/library changes. # Note that these are prefix matching, so /lib matches /libexec. .MAKE.META.IGNORE_PATHS+= \ ${__MAKE_SHELL} \ Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Tue Jun 21 20:32:34 2016 (r302072) +++ head/sys/conf/kern.post.mk Tue Jun 21 21:55:03 2016 (r302073) @@ -189,11 +189,16 @@ genassym.o: $S/$M/$M/genassym.c ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h +.if !empty(.MAKE.MODE:Unormal:Mmeta) && empty(.MAKE.MODE:Unormal:Mnofilemon) +_meta_filemon= 1 +.endif # Skip reading .depend when not needed to speed up tree-walks # and simple lookups. +# Also skip generating or including .depend.* files if in meta+filemon mode +# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used. .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \ make(install*) || make(kernel-obj) || make(kernel-clean*) || \ - make(kernel-install*) + make(kernel-install*) || defined(_meta_filemon) _SKIP_READ_DEPEND= 1 .MAKE.DEPENDFILE= /dev/null .endif @@ -203,11 +208,6 @@ SRCS= assym.s vnode_if.h ${BEFORE_DEPEND ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \ ${MFILES:T:S/.m$/.h/} DEPENDFILES= .depend .depend.* -# Skip generating or including .depend.* files if in meta+filemon mode since -# it will track dependencies itself. OBJS_DEPEND_GUESS is still used though. -.if !empty(.MAKE.MODE:Unormal:Mmeta) && empty(.MAKE.MODE:Unormal:Mnofilemon) -_meta_filemon= 1 -.endif DEPENDOBJS+= ${SYSTEM_OBJS} genassym.o DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:C/^/.depend./} .if ${MAKE_VERSION} < 20160220 From owner-svn-src-all@freebsd.org Tue Jun 21 22:19:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7563CAC5A00; Tue, 21 Jun 2016 22:19:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50D282F7D; Tue, 21 Jun 2016 22:19:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5LMJ7TK080138; Tue, 21 Jun 2016 22:19:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5LMJ7qT080133; Tue, 21 Jun 2016 22:19:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201606212219.u5LMJ7qT080133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 21 Jun 2016 22:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302074 - in head: sys/dev/cxgbe/tom sys/kern sys/sys tests/sys/aio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 22:19:08 -0000 Author: jhb Date: Tue Jun 21 22:19:06 2016 New Revision: 302074 URL: https://svnweb.freebsd.org/changeset/base/302074 Log: Account for AIO socket operations in thread/process resource usage. File and disk-backed I/O requests store counts of read/written disk blocks in each AIO job so that they can be charged to the thread that completes an AIO request via aio_return() or aio_waitcomplete(). This change extends AIO jobs to store counts of received/sent messages and updates socket backends to set these counts accordingly. Note that the socket backends are careful to only charge a single messages for each AIO request even though a single request on a blocking socket might invoke sosend or soreceive multiple times. This is to mimic the resource accounting of synchronous read/write. Adjust the UNIX socketpair AIO test to verify that the message resource usage counts update accordingly for aio_read and aio_write. Approved by: re (hrs) Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D6911 Modified: head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/kern/sys_socket.c head/sys/kern/vfs_aio.c head/sys/sys/aio.h head/tests/sys/aio/aio_test.c Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Tue Jun 21 21:55:03 2016 (r302073) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Tue Jun 21 22:19:06 2016 (r302074) @@ -360,6 +360,8 @@ insert_ddp_data(struct toepcb *toep, uin placed = n; if (placed > job->uaiocb.aio_nbytes - copied) placed = job->uaiocb.aio_nbytes - copied; + if (placed > 0) + job->msgrcv = 1; if (!aio_clear_cancel_function(job)) { /* * Update the copied length for when @@ -602,6 +604,7 @@ handle_ddp_data(struct toepcb *toep, __b toep->rx_credits += len; #endif + job->msgrcv = 1; if (db->cancel_pending) { /* * Update the job's length but defer completion to the @@ -756,6 +759,8 @@ handle_ddp_close(struct toepcb *toep, st placed = len; if (placed > job->uaiocb.aio_nbytes - copied) placed = job->uaiocb.aio_nbytes - copied; + if (placed > 0) + job->msgrcv = 1; if (!aio_clear_cancel_function(job)) { /* * Update the copied length for when @@ -1458,6 +1463,7 @@ sbcopy: if (copied != 0) { sbdrop_locked(sb, copied); job->aio_received += copied; + job->msgrcv = 1; copied = job->aio_received; inp = sotoinpcb(so); if (!INP_TRY_WLOCK(inp)) { Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Tue Jun 21 21:55:03 2016 (r302073) +++ head/sys/kern/sys_socket.c Tue Jun 21 22:19:06 2016 (r302074) @@ -563,6 +563,7 @@ soaio_process_job(struct socket *so, str struct uio uio; struct iovec iov; size_t cnt, done; + long ru_before; int error, flags; SOCKBUF_UNLOCK(sb); @@ -585,23 +586,33 @@ retry: uio.uio_td = td; flags = MSG_NBIO; - /* TODO: Charge ru_msg* to job. */ + /* + * For resource usage accounting, only count a completed request + * as a single message to avoid counting multiple calls to + * sosend/soreceive on a blocking socket. + */ if (sb == &so->so_rcv) { uio.uio_rw = UIO_READ; + ru_before = td->td_ru.ru_msgrcv; #ifdef MAC error = mac_socket_check_receive(fp->f_cred, so); if (error == 0) #endif error = soreceive(so, NULL, &uio, NULL, NULL, &flags); + if (td->td_ru.ru_msgrcv != ru_before) + job->msgrcv = 1; } else { uio.uio_rw = UIO_WRITE; + ru_before = td->td_ru.ru_msgsnd; #ifdef MAC error = mac_socket_check_send(fp->f_cred, so); if (error == 0) #endif error = sosend(so, NULL, &uio, NULL, NULL, flags, td); + if (td->td_ru.ru_msgsnd != ru_before) + job->msgsnd = 1; if (error == EPIPE && (so->so_options & SO_NOSIGPIPE) == 0) { PROC_LOCK(job->userproc); kern_psignal(job->userproc, SIGPIPE); Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Jun 21 21:55:03 2016 (r302073) +++ head/sys/kern/vfs_aio.c Tue Jun 21 22:19:06 2016 (r302074) @@ -743,9 +743,11 @@ aio_process_rw(struct kaiocb *job) struct uio auio; struct iovec aiov; ssize_t cnt; + long msgsnd_st, msgsnd_end; + long msgrcv_st, msgrcv_end; + long oublock_st, oublock_end; + long inblock_st, inblock_end; int error; - int oublock_st, oublock_end; - int inblock_st, inblock_end; KASSERT(job->uaiocb.aio_lio_opcode == LIO_READ || job->uaiocb.aio_lio_opcode == LIO_WRITE, @@ -769,8 +771,11 @@ aio_process_rw(struct kaiocb *job) auio.uio_segflg = UIO_USERSPACE; auio.uio_td = td; + msgrcv_st = td->td_ru.ru_msgrcv; + msgsnd_st = td->td_ru.ru_msgsnd; inblock_st = td->td_ru.ru_inblock; oublock_st = td->td_ru.ru_oublock; + /* * aio_aqueue() acquires a reference to the file that is * released in aio_free_entry(). @@ -787,11 +792,15 @@ aio_process_rw(struct kaiocb *job) auio.uio_rw = UIO_WRITE; error = fo_write(fp, &auio, fp->f_cred, FOF_OFFSET, td); } + msgrcv_end = td->td_ru.ru_msgrcv; + msgsnd_end = td->td_ru.ru_msgsnd; inblock_end = td->td_ru.ru_inblock; oublock_end = td->td_ru.ru_oublock; - job->inputcharge = inblock_end - inblock_st; - job->outputcharge = oublock_end - oublock_st; + job->msgrcv = msgrcv_end - msgrcv_st; + job->msgsnd = msgsnd_end - msgsnd_st; + job->inblock = inblock_end - inblock_st; + job->outblock = oublock_end - oublock_st; if ((error) && (auio.uio_resid != cnt)) { if (error == ERESTART || error == EINTR || error == EWOULDBLOCK) @@ -1805,13 +1814,10 @@ kern_aio_return(struct thread *td, struc status = job->uaiocb._aiocb_private.status; error = job->uaiocb._aiocb_private.error; td->td_retval[0] = status; - if (job->uaiocb.aio_lio_opcode == LIO_WRITE) { - td->td_ru.ru_oublock += job->outputcharge; - job->outputcharge = 0; - } else if (job->uaiocb.aio_lio_opcode == LIO_READ) { - td->td_ru.ru_inblock += job->inputcharge; - job->inputcharge = 0; - } + td->td_ru.ru_oublock += job->outblock; + td->td_ru.ru_inblock += job->inblock; + td->td_ru.ru_msgsnd += job->msgsnd; + td->td_ru.ru_msgrcv += job->msgrcv; aio_free_entry(job); AIO_UNLOCK(ki); ops->store_error(ujob, error); @@ -2327,9 +2333,9 @@ aio_physwakeup(struct bio *bp) error = bp->bio_error; nblks = btodb(nbytes); if (job->uaiocb.aio_lio_opcode == LIO_WRITE) - job->outputcharge += nblks; + job->outblock += nblks; else - job->inputcharge += nblks; + job->inblock += nblks; if (error) aio_complete(job, -1, error); @@ -2395,13 +2401,10 @@ kern_aio_waitcomplete(struct thread *td, status = job->uaiocb._aiocb_private.status; error = job->uaiocb._aiocb_private.error; td->td_retval[0] = status; - if (job->uaiocb.aio_lio_opcode == LIO_WRITE) { - td->td_ru.ru_oublock += job->outputcharge; - job->outputcharge = 0; - } else if (job->uaiocb.aio_lio_opcode == LIO_READ) { - td->td_ru.ru_inblock += job->inputcharge; - job->inputcharge = 0; - } + td->td_ru.ru_oublock += job->outblock; + td->td_ru.ru_inblock += job->inblock; + td->td_ru.ru_msgsnd += job->msgsnd; + td->td_ru.ru_msgrcv += job->msgrcv; aio_free_entry(job); AIO_UNLOCK(ki); ops->store_aiocb(ujobp, ujob); Modified: head/sys/sys/aio.h ============================================================================== --- head/sys/sys/aio.h Tue Jun 21 21:55:03 2016 (r302073) +++ head/sys/sys/aio.h Tue Jun 21 22:19:06 2016 (r302074) @@ -119,8 +119,10 @@ struct kaiocb { TAILQ_ENTRY(kaiocb) plist; /* (a) lists of pending / done jobs */ TAILQ_ENTRY(kaiocb) allist; /* (a) list of all jobs in proc */ int jobflags; /* (a) job flags */ - int inputcharge; /* (*) input blocks */ - int outputcharge; /* (*) output blocks */ + int inblock; /* (*) input blocks */ + int outblock; /* (*) output blocks */ + int msgsnd; /* (*) messages sent */ + int msgrcv; /* (*) messages received */ struct proc *userproc; /* (*) user process */ struct ucred *cred; /* (*) active credential when created */ struct file *fd_file; /* (*) pointer to file structure */ Modified: head/tests/sys/aio/aio_test.c ============================================================================== --- head/tests/sys/aio/aio_test.c Tue Jun 21 21:55:03 2016 (r302073) +++ head/tests/sys/aio/aio_test.c Tue Jun 21 22:19:06 2016 (r302074) @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -455,6 +456,7 @@ ATF_TC_BODY(aio_unix_socketpair_test, tc { struct aio_unix_socketpair_arg arg; struct aio_context ac; + struct rusage ru_before, ru_after; int sockets[2]; ATF_REQUIRE_KERNEL_MODULE("aio"); @@ -467,8 +469,17 @@ ATF_TC_BODY(aio_unix_socketpair_test, tc aio_context_init(&ac, sockets[0], sockets[1], UNIX_SOCKETPAIR_LEN, UNIX_SOCKETPAIR_TIMEOUT, aio_unix_socketpair_cleanup, &arg); + ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_before) != -1, + "getrusage failed: %s", strerror(errno)); aio_write_test(&ac); + ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, + "getrusage failed: %s", strerror(errno)); + ATF_REQUIRE(ru_after.ru_msgsnd == ru_before.ru_msgsnd + 1); + ru_before = ru_after; aio_read_test(&ac); + ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, + "getrusage failed: %s", strerror(errno)); + ATF_REQUIRE(ru_after.ru_msgrcv == ru_before.ru_msgrcv + 1); aio_unix_socketpair_cleanup(&arg); } From owner-svn-src-all@freebsd.org Tue Jun 21 23:59:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C65EAC518D; Tue, 21 Jun 2016 23:59:52 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D28531CA0; Tue, 21 Jun 2016 23:59:51 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-pf0-x244.google.com with SMTP id t190so2349673pfb.2; Tue, 21 Jun 2016 16:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=k1XlRIHaoh1jmh1C04R90ae/BFOGnAg9TBY55etdSv8=; b=hZjk5QphvSZljkfKnB5aSPeiQTnVnOd0D5GQuzKkuPS3UIiAESzg25IZLgoaGgA+Ag tS0Ib/wbc5tUgy0yzu5agHc+w70mccSlSJ7KKvJINn2txk5B8F3hm5DgCDJqB6kuxPtM c9SECA5tcGcoKMyscKpiV1SrKWw4/6IrWdMQY8sNw84XjFhhfE3r4gsXNbK7BI+jDk+C aTOncnm14CztIxhEMc5DWlQcGDmxCRByQLJx9auB9VtVvpRF81+DXWXJT/eJcdIpUypk 1+mt/eQgwclJPtlIXvvnjFJRg0F0ja1KS2wSmZ3lePEHsDrJeYd49d0PlfKFRUr8LRXG WU0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=k1XlRIHaoh1jmh1C04R90ae/BFOGnAg9TBY55etdSv8=; b=C+pcTfSsxQ/6y5OWZTeE9N+y/30jiIRHKy9N0zBzc13Ijr6Q+Fpf2sFeJs0BdleZY1 IwyisqE0Vmll50gEeBprjXY57ylZbAQbwE3Te/OH84qfrxyof7TYLA6h1GSbx6bQ/KEB +wMHXLmSiA/+UIj8oeXfF+oOr44cto8hgZiDqIxDaSyQhSuX2is0qe62V0bY9jYI/TzM WZ1bJD7LBTokba6ZehpBR0fVDQf0+vGG1YpXxkc6AG3LEeLM9wpVn7DLHBJBL5f5tE0z 8zyjvIl5E53ZaHVMgb6tRDyfdPmfqtd4AKyiVVBhLHzqWJFO9WedTmNNPu6D/uKwRjR2 wz8g== X-Gm-Message-State: ALyK8tJprSmNZzIHUjx2uDTvp8dxVpsO9eM9fmUs982+16Q3gSACb2A4rv3ceUr9lntscA== X-Received: by 10.98.38.132 with SMTP id m126mr6349208pfm.57.1466553590440; Tue, 21 Jun 2016 16:59:50 -0700 (PDT) Received: from [10.192.166.0] ([12.32.117.8]) by smtp.googlemail.com with ESMTPSA id tj10sm7351428pab.21.2016.06.21.16.59.49 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2016 16:59:49 -0700 (PDT) Sender: Navdeep Parhar Subject: Re: svn commit: r302054 - in head/sys: contrib/ipfilter/netinet dev/usb/net kern net netgraph netinet netinet6 netipsec netpfil/ipfw netpfil/pf To: "Bjoern A. Zeeb" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201606211348.u5LDmom9081605@repo.freebsd.org> From: Navdeep Parhar Message-ID: Date: Tue, 21 Jun 2016 16:59:48 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <201606211348.u5LDmom9081605@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2016 23:59:52 -0000 This causes a panic when a NIC driver module is unloaded from a kernel without VIMAGE. if_vnet is NULL and if_detach_internal tries to dereference it. Regards, Navdeep On 06/21/2016 06:48, Bjoern A. Zeeb wrote: > Author: bz > Date: Tue Jun 21 13:48:49 2016 > New Revision: 302054 > URL: https://svnweb.freebsd.org/changeset/base/302054 > > Log: > Get closer to a VIMAGE network stack teardown from top to bottom rather > than removing the network interfaces first. This change is rather larger > and convoluted as the ordering requirements cannot be separated. > > Move the pfil(9) framework to SI_SUB_PROTO_PFIL, move Firewalls and > related modules to their own SI_SUB_PROTO_FIREWALL. > Move initialization of "physical" interfaces to SI_SUB_DRIVERS, > move virtual (cloned) interfaces to SI_SUB_PSEUDO. > Move Multicast to SI_SUB_PROTO_MC. > > Re-work parts of multicast initialisation and teardown, not taking the > huge amount of memory into account if used as a module yet. > > For interface teardown we try to do as many of them as we can on > SI_SUB_INIT_IF, but for some this makes no sense, e.g., when tunnelling > over a higher layer protocol such as IP. In that case the interface > has to go along (or before) the higher layer protocol is shutdown. > > Kernel hhooks need to go last on teardown as they may be used at various > higher layers and we cannot remove them before we cleaned up the higher > layers. > > For interface teardown there are multiple paths: > (a) a cloned interface is destroyed (inside a VIMAGE or in the base system), > (b) any interface is moved from a virtual network stack to a different > network stack ("vmove"), or (c) a virtual network stack is being shut down. > All code paths go through if_detach_internal() where we, depending on the > vmove flag or the vnet state, make a decision on how much to shut down; > in case we are destroying a VNET the individual protocol layers will > cleanup their own parts thus we cannot do so again for each interface as > we end up with, e.g., double-frees, destroying locks twice or acquiring > already destroyed locks. > When calling into protocol cleanups we equally have to tell them > whether they need to detach upper layer protocols ("ulp") or not > (e.g., in6_ifdetach()). > > Provide or enahnce helper functions to do proper cleanup at a protocol > rather than at an interface level. > > Approved by: re (hrs) > Obtained from: projects/vnet > Reviewed by: gnn, jhb > Sponsored by: The FreeBSD Foundation > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D6747 > > Modified: > head/sys/contrib/ipfilter/netinet/mlfk_ipl.c > head/sys/dev/usb/net/usb_ethernet.c > head/sys/kern/kern_hhook.c > head/sys/net/if.c > head/sys/net/if_bridge.c > head/sys/net/if_disc.c > head/sys/net/if_edsc.c > head/sys/net/if_enc.c > head/sys/net/if_epair.c > head/sys/net/if_lagg.c > head/sys/net/if_loop.c > head/sys/net/if_vlan.c > head/sys/net/pfil.c > head/sys/net/route.c > head/sys/net/vnet.c > head/sys/net/vnet.h > head/sys/netgraph/ng_eiface.c > head/sys/netgraph/ng_iface.c > head/sys/netinet/igmp.c > head/sys/netinet/in.c > head/sys/netinet/in_var.h > head/sys/netinet/ip_id.c > head/sys/netinet/ip_input.c > head/sys/netinet/ip_mroute.c > head/sys/netinet6/in6.c > head/sys/netinet6/in6_ifattach.c > head/sys/netinet6/in6_ifattach.h > head/sys/netinet6/ip6_input.c > head/sys/netinet6/ip6_mroute.c > head/sys/netinet6/mld6.c > head/sys/netinet6/nd6.c > head/sys/netinet6/nd6.h > head/sys/netipsec/ipsec.c > head/sys/netipsec/xform_tcp.c > head/sys/netpfil/ipfw/dn_sched.h > head/sys/netpfil/ipfw/ip_dummynet.c > head/sys/netpfil/ipfw/ip_fw2.c > head/sys/netpfil/ipfw/ip_fw_nat.c > head/sys/netpfil/pf/pf_ioctl.c > > Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c > ============================================================================== > --- head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -287,7 +287,7 @@ static moduledata_t ipfiltermod = { > }; > > > -DECLARE_MODULE(ipfilter, ipfiltermod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); > +DECLARE_MODULE(ipfilter, ipfiltermod, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY); > #ifdef MODULE_VERSION > MODULE_VERSION(ipfilter, 1); > #endif > > Modified: head/sys/dev/usb/net/usb_ethernet.c > ============================================================================== > --- head/sys/dev/usb/net/usb_ethernet.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/dev/usb/net/usb_ethernet.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -641,5 +641,9 @@ uether_rxflush(struct usb_ether *ue) > } > } > > -DECLARE_MODULE(uether, uether_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); > +/* > + * USB net drivers are run by DRIVER_MODULE() thus SI_SUB_DRIVERS, > + * SI_ORDER_MIDDLE. Run uether after that. > + */ > +DECLARE_MODULE(uether, uether_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); > MODULE_VERSION(uether, 1); > > Modified: head/sys/kern/kern_hhook.c > ============================================================================== > --- head/sys/kern/kern_hhook.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/kern/kern_hhook.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -510,7 +510,7 @@ hhook_vnet_uninit(const void *unused __u > /* > * When a vnet is created and being initialised, init the V_hhook_vhead_list. > */ > -VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBUF, SI_ORDER_FIRST, > +VNET_SYSINIT(hhook_vnet_init, SI_SUB_INIT_IF, SI_ORDER_FIRST, > hhook_vnet_init, NULL); > > /* > @@ -518,5 +518,5 @@ VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBU > * points to clean up on vnet tear down, but in case the KPI is misused, > * provide a function to clean up and free memory for a vnet being destroyed. > */ > -VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_MBUF, SI_ORDER_ANY, > +VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_INIT_IF, SI_ORDER_FIRST, > hhook_vnet_uninit, NULL); > > Modified: head/sys/net/if.c > ============================================================================== > --- head/sys/net/if.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/if.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -914,6 +914,16 @@ if_detach(struct ifnet *ifp) > CURVNET_RESTORE(); > } > > +/* > + * The vmove flag, if set, indicates that we are called from a callpath > + * that is moving an interface to a different vnet instance. > + * > + * The shutdown flag, if set, indicates that we are called in the > + * process of shutting down a vnet instance. Currently only the > + * vnet_if_return SYSUNINIT function sets it. Note: we can be called > + * on a vnet instance shutdown without this flag being set, e.g., when > + * the cloned interfaces are destoyed as first thing of teardown. > + */ > static int > if_detach_internal(struct ifnet *ifp, int vmove, struct if_clone **ifcp) > { > @@ -921,8 +931,10 @@ if_detach_internal(struct ifnet *ifp, in > int i; > struct domain *dp; > struct ifnet *iter; > - int found = 0; > + int found = 0, shutdown; > > + shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && > + ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; > IFNET_WLOCK(); > TAILQ_FOREACH(iter, &V_ifnet, if_link) > if (iter == ifp) { > @@ -930,10 +942,6 @@ if_detach_internal(struct ifnet *ifp, in > found = 1; > break; > } > -#ifdef VIMAGE > - if (found) > - curvnet->vnet_ifcnt--; > -#endif > IFNET_WUNLOCK(); > if (!found) { > /* > @@ -951,19 +959,58 @@ if_detach_internal(struct ifnet *ifp, in > #endif > } > > - /* Check if this is a cloned interface or not. */ > + /* > + * At this point we know the interface still was on the ifnet list > + * and we removed it so we are in a stable state. > + */ > +#ifdef VIMAGE > + curvnet->vnet_ifcnt--; > +#endif > + > + /* > + * In any case (destroy or vmove) detach us from the groups > + * and remove/wait for pending events on the taskq. > + * XXX-BZ in theory an interface could still enqueue a taskq change? > + */ > + if_delgroups(ifp); > + > + taskqueue_drain(taskqueue_swi, &ifp->if_linktask); > + > + /* > + * Check if this is a cloned interface or not. Must do even if > + * shutting down as a if_vmove_reclaim() would move the ifp and > + * the if_clone_addgroup() will have a corrupted string overwise > + * from a gibberish pointer. > + */ > if (vmove && ifcp != NULL) > *ifcp = if_clone_findifc(ifp); > > + if_down(ifp); > + > /* > - * Remove/wait for pending events. > + * On VNET shutdown abort here as the stack teardown will do all > + * the work top-down for us. > + */ > + if (shutdown) { > + /* > + * In case of a vmove we are done here without error. > + * If we would signal an error it would lead to the same > + * abort as if we did not find the ifnet anymore. > + * if_detach() calls us in void context and does not care > + * about an early abort notification, so life is splendid :) > + */ > + goto finish_vnet_shutdown; > + } > + > + /* > + * At this point we are not tearing down a VNET and are either > + * going to destroy or vmove the interface and have to cleanup > + * accordingly. > */ > - taskqueue_drain(taskqueue_swi, &ifp->if_linktask); > > /* > * Remove routes and flush queues. > */ > - if_down(ifp); > #ifdef ALTQ > if (ALTQ_IS_ENABLED(&ifp->if_snd)) > altq_disable(&ifp->if_snd); > @@ -1018,8 +1065,8 @@ if_detach_internal(struct ifnet *ifp, in > } > > rt_flushifroutes(ifp); > - if_delgroups(ifp); > > +finish_vnet_shutdown: > /* > * We cannot hold the lock over dom_ifdetach calls as they might > * sleep, for example trying to drain a callout, thus open up the > @@ -1048,7 +1095,7 @@ if_detach_internal(struct ifnet *ifp, in > * unused if_index in target vnet and calls if_grow() if necessary, > * and finally find an unused if_xname for the target vnet. > */ > -void > +static void > if_vmove(struct ifnet *ifp, struct vnet *new_vnet) > { > struct if_clone *ifc; > @@ -1115,6 +1162,7 @@ if_vmove_loan(struct thread *td, struct > { > struct prison *pr; > struct ifnet *difp; > + int shutdown; > > /* Try to find the prison within our visibility. */ > sx_slock(&allprison_lock); > @@ -1135,12 +1183,22 @@ if_vmove_loan(struct thread *td, struct > /* XXX Lock interfaces to avoid races. */ > CURVNET_SET_QUIET(pr->pr_vnet); > difp = ifunit(ifname); > - CURVNET_RESTORE(); > if (difp != NULL) { > + CURVNET_RESTORE(); > prison_free(pr); > return (EEXIST); > } > > + /* Make sure the VNET is stable. */ > + shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && > + ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; > + if (shutdown) { > + CURVNET_RESTORE(); > + prison_free(pr); > + return (EBUSY); > + } > + CURVNET_RESTORE(); > + > /* Move the interface into the child jail/vnet. */ > if_vmove(ifp, pr->pr_vnet); > > @@ -1157,6 +1215,7 @@ if_vmove_reclaim(struct thread *td, char > struct prison *pr; > struct vnet *vnet_dst; > struct ifnet *ifp; > + int shutdown; > > /* Try to find the prison within our visibility. */ > sx_slock(&allprison_lock); > @@ -1184,6 +1243,15 @@ if_vmove_reclaim(struct thread *td, char > return (EEXIST); > } > > + /* Make sure the VNET is stable. */ > + shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && > + ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; > + if (shutdown) { > + CURVNET_RESTORE(); > + prison_free(pr); > + return (EBUSY); > + } > + > /* Get interface back from child jail/vnet. */ > if_vmove(ifp, vnet_dst); > CURVNET_RESTORE(); > @@ -2642,8 +2710,22 @@ ifioctl(struct socket *so, u_long cmd, c > struct ifreq *ifr; > int error; > int oif_flags; > +#ifdef VIMAGE > + int shutdown; > +#endif > > CURVNET_SET(so->so_vnet); > +#ifdef VIMAGE > + /* Make sure the VNET is stable. */ > + shutdown = (so->so_vnet->vnet_state > SI_SUB_VNET && > + so->so_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; > + if (shutdown) { > + CURVNET_RESTORE(); > + return (EBUSY); > + } > +#endif > + > + > switch (cmd) { > case SIOCGIFCONF: > error = ifconf(cmd, data); > > Modified: head/sys/net/if_bridge.c > ============================================================================== > --- head/sys/net/if_bridge.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/if_bridge.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -541,7 +541,7 @@ vnet_bridge_uninit(const void *unused __ > V_bridge_cloner = NULL; > BRIDGE_LIST_LOCK_DESTROY(); > } > -VNET_SYSUNINIT(vnet_bridge_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_bridge_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, > vnet_bridge_uninit, NULL); > > static int > > Modified: head/sys/net/if_disc.c > ============================================================================== > --- head/sys/net/if_disc.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/if_disc.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -137,7 +137,7 @@ vnet_disc_init(const void *unused __unus > V_disc_cloner = if_clone_simple(discname, disc_clone_create, > disc_clone_destroy, 0); > } > -VNET_SYSINIT(vnet_disc_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSINIT(vnet_disc_init, SI_SUB_PSEUDO, SI_ORDER_ANY, > vnet_disc_init, NULL); > > static void > @@ -146,7 +146,7 @@ vnet_disc_uninit(const void *unused __un > > if_clone_detach(V_disc_cloner); > } > -VNET_SYSUNINIT(vnet_disc_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_disc_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, > vnet_disc_uninit, NULL); > > static int > > Modified: head/sys/net/if_edsc.c > ============================================================================== > --- head/sys/net/if_edsc.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/if_edsc.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -336,7 +336,7 @@ vnet_edsc_uninit(const void *unused __un > */ > if_clone_detach(V_edsc_cloner); > } > -VNET_SYSUNINIT(vnet_edsc_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_edsc_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, > vnet_edsc_uninit, NULL); > > /* > > Modified: head/sys/net/if_enc.c > ============================================================================== > --- head/sys/net/if_enc.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/if_enc.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -136,7 +136,6 @@ enc_clone_destroy(struct ifnet *ifp) > sc = ifp->if_softc; > KASSERT(sc == V_enc_sc, ("sc != ifp->if_softc")); > > - enc_remove_hhooks(sc); > bpfdetach(ifp); > if_detach(ifp); > if_free(ifp); > @@ -170,10 +169,6 @@ enc_clone_create(struct if_clone *ifc, i > ifp->if_softc = sc; > if_attach(ifp); > bpfattach(ifp, DLT_ENC, sizeof(struct enchdr)); > - if (enc_add_hhooks(sc) != 0) { > - enc_clone_destroy(ifp); > - return (ENXIO); > - } > return (0); > } > > @@ -369,18 +364,44 @@ vnet_enc_init(const void *unused __unuse > V_enc_cloner = if_clone_simple(encname, enc_clone_create, > enc_clone_destroy, 1); > } > -VNET_SYSINIT(vnet_enc_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSINIT(vnet_enc_init, SI_SUB_PSEUDO, SI_ORDER_ANY, > vnet_enc_init, NULL); > > static void > +vnet_enc_init_proto(void *unused __unused) > +{ > + KASSERT(V_enc_sc != NULL, ("%s: V_enc_sc is %p\n", __func__, V_enc_sc)); > + > + if (enc_add_hhooks(V_enc_sc) != 0) > + enc_clone_destroy(V_enc_sc->sc_ifp); > +} > +VNET_SYSINIT(vnet_enc_init_proto, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > + vnet_enc_init_proto, NULL); > + > +static void > vnet_enc_uninit(const void *unused __unused) > { > + KASSERT(V_enc_sc != NULL, ("%s: V_enc_sc is %p\n", __func__, V_enc_sc)); > > if_clone_detach(V_enc_cloner); > } > -VNET_SYSUNINIT(vnet_enc_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_enc_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, > vnet_enc_uninit, NULL); > > +/* > + * The hhook consumer needs to go before ip[6]_destroy are called on > + * SI_ORDER_THIRD. > + */ > +static void > +vnet_enc_uninit_hhook(const void *unused __unused) > +{ > + KASSERT(V_enc_sc != NULL, ("%s: V_enc_sc is %p\n", __func__, V_enc_sc)); > + > + enc_remove_hhooks(V_enc_sc); > +} > +VNET_SYSUNINIT(vnet_enc_uninit_hhook, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH, > + vnet_enc_uninit_hhook, NULL); > + > static int > enc_modevent(module_t mod, int type, void *data) > { > @@ -401,4 +422,4 @@ static moduledata_t enc_mod = { > 0 > }; > > -DECLARE_MODULE(if_enc, enc_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); > +DECLARE_MODULE(if_enc, enc_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); > > Modified: head/sys/net/if_epair.c > ============================================================================== > --- head/sys/net/if_epair.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/if_epair.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -963,7 +963,7 @@ vnet_epair_init(const void *unused __unu > netisr_register_vnet(&epair_nh); > #endif > } > -VNET_SYSINIT(vnet_epair_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSINIT(vnet_epair_init, SI_SUB_PSEUDO, SI_ORDER_ANY, > vnet_epair_init, NULL); > > static void > @@ -975,7 +975,7 @@ vnet_epair_uninit(const void *unused __u > #endif > if_clone_detach(V_epair_cloner); > } > -VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, > vnet_epair_uninit, NULL); > > static int > @@ -1012,5 +1012,5 @@ static moduledata_t epair_mod = { > 0 > }; > > -DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); > +DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); > MODULE_VERSION(if_epair, 1); > > Modified: head/sys/net/if_lagg.c > ============================================================================== > --- head/sys/net/if_lagg.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/if_lagg.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -271,7 +271,7 @@ vnet_lagg_uninit(const void *unused __un > if_clone_detach(V_lagg_cloner); > LAGG_LIST_LOCK_DESTROY(); > } > -VNET_SYSUNINIT(vnet_lagg_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_lagg_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, > vnet_lagg_uninit, NULL); > > static int > > Modified: head/sys/net/if_loop.c > ============================================================================== > --- head/sys/net/if_loop.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/if_loop.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -156,7 +156,7 @@ vnet_loif_init(const void *unused __unus > 1); > #endif > } > -VNET_SYSINIT(vnet_loif_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSINIT(vnet_loif_init, SI_SUB_PSEUDO, SI_ORDER_ANY, > vnet_loif_init, NULL); > > #ifdef VIMAGE > @@ -167,7 +167,7 @@ vnet_loif_uninit(const void *unused __un > if_clone_detach(V_lo_cloner); > V_loif = NULL; > } > -VNET_SYSUNINIT(vnet_loif_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_loif_uninit, SI_SUB_INIT_IF, SI_ORDER_SECOND, > vnet_loif_uninit, NULL); > #endif > > > Modified: head/sys/net/if_vlan.c > ============================================================================== > --- head/sys/net/if_vlan.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/if_vlan.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -823,7 +823,7 @@ vnet_vlan_uninit(const void *unused __un > > if_clone_detach(V_vlan_cloner); > } > -VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, > +VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_INIT_IF, SI_ORDER_FIRST, > vnet_vlan_uninit, NULL); > #endif > > > Modified: head/sys/net/pfil.c > ============================================================================== > --- head/sys/net/pfil.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/pfil.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -383,17 +383,14 @@ vnet_pfil_uninit(const void *unused __un > PFIL_LOCK_DESTROY_REAL(&V_pfil_lock); > } > > -/* Define startup order. */ > -#define PFIL_SYSINIT_ORDER SI_SUB_PROTO_BEGIN > -#define PFIL_MODEVENT_ORDER (SI_ORDER_FIRST) /* On boot slot in here. */ > -#define PFIL_VNET_ORDER (PFIL_MODEVENT_ORDER + 2) /* Later still. */ > - > /* > * Starting up. > * > * VNET_SYSINIT is called for each existing vnet and each new vnet. > + * Make sure the pfil bits are first before any possible subsystem which > + * might piggyback on the SI_SUB_PROTO_PFIL. > */ > -VNET_SYSINIT(vnet_pfil_init, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, > +VNET_SYSINIT(vnet_pfil_init, SI_SUB_PROTO_PFIL, SI_ORDER_FIRST, > vnet_pfil_init, NULL); > > /* > @@ -401,5 +398,5 @@ VNET_SYSINIT(vnet_pfil_init, PFIL_SYSINI > * > * VNET_SYSUNINIT is called for each exiting vnet as it exits. > */ > -VNET_SYSUNINIT(vnet_pfil_uninit, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, > +VNET_SYSUNINIT(vnet_pfil_uninit, SI_SUB_PROTO_PFIL, SI_ORDER_FIRST, > vnet_pfil_uninit, NULL); > > Modified: head/sys/net/route.c > ============================================================================== > --- head/sys/net/route.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/route.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -334,7 +334,7 @@ vnet_route_uninit(const void *unused __u > free(V_rt_tables, M_RTABLE); > uma_zdestroy(V_rtzone); > } > -VNET_SYSUNINIT(vnet_route_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, > +VNET_SYSUNINIT(vnet_route_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, > vnet_route_uninit, 0); > #endif > > > Modified: head/sys/net/vnet.c > ============================================================================== > --- head/sys/net/vnet.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/vnet.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -331,8 +331,7 @@ vnet_init_done(void *unused __unused) > > curvnet = NULL; > } > - > -SYSINIT(vnet_init_done, SI_SUB_VNET_DONE, SI_ORDER_FIRST, vnet_init_done, > +SYSINIT(vnet_init_done, SI_SUB_VNET_DONE, SI_ORDER_ANY, vnet_init_done, > NULL); > > /* > > Modified: head/sys/net/vnet.h > ============================================================================== > --- head/sys/net/vnet.h Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/net/vnet.h Tue Jun 21 13:48:49 2016 (r302054) > @@ -111,8 +111,8 @@ vnet_##name##_init(const void *unused) \ > { \ > VNET_PCPUSTAT_ALLOC(name, M_WAITOK); \ > } \ > -VNET_SYSINIT(vnet_ ## name ## _init, SI_SUB_PROTO_IFATTACHDOMAIN, \ > - SI_ORDER_ANY, vnet_ ## name ## _init, NULL) > +VNET_SYSINIT(vnet_ ## name ## _init, SI_SUB_INIT_IF, \ > + SI_ORDER_FIRST, vnet_ ## name ## _init, NULL) > > #define VNET_PCPUSTAT_SYSUNINIT(name) \ > static void \ > @@ -120,8 +120,8 @@ vnet_##name##_uninit(const void *unused) > { \ > VNET_PCPUSTAT_FREE(name); \ > } \ > -VNET_SYSUNINIT(vnet_ ## name ## _uninit, SI_SUB_PROTO_IFATTACHDOMAIN, \ > - SI_ORDER_ANY, vnet_ ## name ## _uninit, NULL) > +VNET_SYSUNINIT(vnet_ ## name ## _uninit, SI_SUB_INIT_IF, \ > + SI_ORDER_FIRST, vnet_ ## name ## _uninit, NULL) > > #ifdef SYSCTL_OID > #define SYSCTL_VNET_PCPUSTAT(parent, nbr, name, type, array, desc) \ > > Modified: head/sys/netgraph/ng_eiface.c > ============================================================================== > --- head/sys/netgraph/ng_eiface.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netgraph/ng_eiface.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -679,5 +679,5 @@ vnet_ng_eiface_uninit(const void *unused > > delete_unrhdr(V_ng_eiface_unit); > } > -VNET_SYSUNINIT(vnet_ng_eiface_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_ng_eiface_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, > vnet_ng_eiface_uninit, NULL); > > Modified: head/sys/netgraph/ng_iface.c > ============================================================================== > --- head/sys/netgraph/ng_iface.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netgraph/ng_iface.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -786,5 +786,5 @@ vnet_ng_iface_uninit(const void *unused) > > delete_unrhdr(V_ng_iface_unit); > } > -VNET_SYSUNINIT(vnet_ng_iface_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_ng_iface_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, > vnet_ng_iface_uninit, NULL); > > Modified: head/sys/netinet/igmp.c > ============================================================================== > --- head/sys/netinet/igmp.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet/igmp.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -227,7 +227,8 @@ static VNET_DEFINE(int, current_state_ti > #define V_state_change_timers_running VNET(state_change_timers_running) > #define V_current_state_timers_running VNET(current_state_timers_running) > > -static VNET_DEFINE(LIST_HEAD(, igmp_ifsoftc), igi_head); > +static VNET_DEFINE(LIST_HEAD(, igmp_ifsoftc), igi_head) = > + LIST_HEAD_INITIALIZER(igi_head); > static VNET_DEFINE(struct igmpstat, igmpstat) = { > .igps_version = IGPS_VERSION_3, > .igps_len = sizeof(struct igmpstat), > @@ -701,10 +702,6 @@ igi_delete_locked(const struct ifnet *if > return; > } > } > - > -#ifdef INVARIANTS > - panic("%s: igmp_ifsoftc not found for ifp %p\n", __func__, ifp); > -#endif > } > > /* > @@ -3595,57 +3592,28 @@ igmp_rec_type_to_str(const int type) > } > #endif > > -static void > -igmp_init(void *unused __unused) > -{ > - > - CTR1(KTR_IGMPV3, "%s: initializing", __func__); > - > - IGMP_LOCK_INIT(); > - > - m_raopt = igmp_ra_alloc(); > - > - netisr_register(&igmp_nh); > -} > -SYSINIT(igmp_init, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, igmp_init, NULL); > - > -static void > -igmp_uninit(void *unused __unused) > -{ > - > - CTR1(KTR_IGMPV3, "%s: tearing down", __func__); > - > - netisr_unregister(&igmp_nh); > - > - m_free(m_raopt); > - m_raopt = NULL; > - > - IGMP_LOCK_DESTROY(); > -} > -SYSUNINIT(igmp_uninit, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, igmp_uninit, NULL); > - > +#ifdef VIMAGE > static void > vnet_igmp_init(const void *unused __unused) > { > > - CTR1(KTR_IGMPV3, "%s: initializing", __func__); > - > - LIST_INIT(&V_igi_head); > + netisr_register_vnet(&igmp_nh); > } > -VNET_SYSINIT(vnet_igmp_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_igmp_init, > - NULL); > +VNET_SYSINIT(vnet_igmp_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, > + vnet_igmp_init, NULL); > > static void > vnet_igmp_uninit(const void *unused __unused) > { > > + /* This can happen when we shutdown the entire network stack. */ > CTR1(KTR_IGMPV3, "%s: tearing down", __func__); > > - KASSERT(LIST_EMPTY(&V_igi_head), > - ("%s: igi list not empty; ifnets not detached?", __func__)); > + netisr_unregister_vnet(&igmp_nh); > } > -VNET_SYSUNINIT(vnet_igmp_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, > +VNET_SYSUNINIT(vnet_igmp_uninit, SI_SUB_PROTO_MC, SI_ORDER_ANY, > vnet_igmp_uninit, NULL); > +#endif > > #ifdef DDB > DB_SHOW_COMMAND(igi_list, db_show_igi_list) > @@ -3682,14 +3650,24 @@ static int > igmp_modevent(module_t mod, int type, void *unused __unused) > { > > - switch (type) { > - case MOD_LOAD: > - case MOD_UNLOAD: > - break; > - default: > - return (EOPNOTSUPP); > - } > - return (0); > + switch (type) { > + case MOD_LOAD: > + CTR1(KTR_IGMPV3, "%s: initializing", __func__); > + IGMP_LOCK_INIT(); > + m_raopt = igmp_ra_alloc(); > + netisr_register(&igmp_nh); > + break; > + case MOD_UNLOAD: > + CTR1(KTR_IGMPV3, "%s: tearing down", __func__); > + netisr_unregister(&igmp_nh); > + m_free(m_raopt); > + m_raopt = NULL; > + IGMP_LOCK_DESTROY(); > + break; > + default: > + return (EOPNOTSUPP); > + } > + return (0); > } > > static moduledata_t igmp_mod = { > @@ -3697,4 +3675,4 @@ static moduledata_t igmp_mod = { > igmp_modevent, > 0 > }; > -DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); > +DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE); > > Modified: head/sys/netinet/in.c > ============================================================================== > --- head/sys/netinet/in.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet/in.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -895,6 +895,39 @@ in_scrubprefix(struct in_ifaddr *target, > > #undef rtinitflags > > +void > +in_ifscrub_all(void) > +{ > + struct ifnet *ifp; > + struct ifaddr *ifa, *nifa; > + struct ifaliasreq ifr; > + > + IFNET_RLOCK(); > + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { > + /* Cannot lock here - lock recursion. */ > + /* IF_ADDR_RLOCK(ifp); */ > + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { > + if (ifa->ifa_addr->sa_family != AF_INET) > + continue; > + > + /* > + * This is ugly but the only way for legacy IP to > + * cleanly remove addresses and everything attached. > + */ > + bzero(&ifr, sizeof(ifr)); > + ifr.ifra_addr = *ifa->ifa_addr; > + if (ifa->ifa_dstaddr) > + ifr.ifra_broadaddr = *ifa->ifa_dstaddr; > + (void)in_control(NULL, SIOCDIFADDR, (caddr_t)&ifr, > + ifp, NULL); > + } > + /* IF_ADDR_RUNLOCK(ifp); */ > + in_purgemaddrs(ifp); > + igmp_domifdetach(ifp); > + } > + IFNET_RUNLOCK(); > +} > + > /* > * Return 1 if the address might be a local broadcast address. > */ > > Modified: head/sys/netinet/in_var.h > ============================================================================== > --- head/sys/netinet/in_var.h Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet/in_var.h Tue Jun 21 13:48:49 2016 (r302054) > @@ -376,6 +376,7 @@ int in_control(struct socket *, u_long, > struct thread *); > int in_addprefix(struct in_ifaddr *, int); > int in_scrubprefix(struct in_ifaddr *, u_int); > +void in_ifscrub_all(void); > void ip_input(struct mbuf *); > void ip_direct_input(struct mbuf *); > void in_ifadown(struct ifaddr *ifa, int); > > Modified: head/sys/netinet/ip_id.c > ============================================================================== > --- head/sys/netinet/ip_id.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet/ip_id.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -294,4 +294,4 @@ ipid_sysuninit(void) > counter_u64_free(V_ip_id); > mtx_destroy(&V_ip_id_mtx); > } > -VNET_SYSUNINIT(ip_id, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY, ipid_sysuninit, NULL); > +VNET_SYSUNINIT(ip_id, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ipid_sysuninit, NULL); > > Modified: head/sys/netinet/ip_input.c > ============================================================================== > --- head/sys/netinet/ip_input.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet/ip_input.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -370,6 +370,7 @@ ip_init(void) > static void > ip_destroy(void *unused __unused) > { > + struct ifnet *ifp; > int error; > > #ifdef RSS > @@ -393,11 +394,21 @@ ip_destroy(void *unused __unused) > "type HHOOK_TYPE_IPSEC_OUT, id HHOOK_IPSEC_INET: " > "error %d returned\n", __func__, error); > } > - /* Cleanup in_ifaddr hash table; should be empty. */ > - hashdestroy(V_in_ifaddrhashtbl, M_IFADDR, V_in_ifaddrhmask); > + > + /* Remove the IPv4 addresses from all interfaces. */ > + in_ifscrub_all(); > + > + /* Make sure the IPv4 routes are gone as well. */ > + IFNET_RLOCK(); > + TAILQ_FOREACH(ifp, &V_ifnet, if_link) > + rt_flushifroutes_af(ifp, AF_INET); > + IFNET_RUNLOCK(); > > /* Destroy IP reassembly queue. */ > ipreass_destroy(); > + > + /* Cleanup in_ifaddr hash table; should be empty. */ > + hashdestroy(V_in_ifaddrhashtbl, M_IFADDR, V_in_ifaddrhmask); > } > > VNET_SYSUNINIT(ip, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip_destroy, NULL); > > Modified: head/sys/netinet/ip_mroute.c > ============================================================================== > --- head/sys/netinet/ip_mroute.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet/ip_mroute.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -2822,7 +2822,7 @@ vnet_mroute_init(const void *unused __un > callout_init(&V_bw_meter_ch, 1); > } > > -VNET_SYSINIT(vnet_mroute_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_mroute_init, > +VNET_SYSINIT(vnet_mroute_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mroute_init, > NULL); > > static void > @@ -2833,7 +2833,7 @@ vnet_mroute_uninit(const void *unused __ > V_nexpire = NULL; > } > > -VNET_SYSUNINIT(vnet_mroute_uninit, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, > +VNET_SYSUNINIT(vnet_mroute_uninit, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, > vnet_mroute_uninit, NULL); > > static int > @@ -2946,4 +2946,4 @@ static moduledata_t ip_mroutemod = { > 0 > }; > > -DECLARE_MODULE(ip_mroute, ip_mroutemod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); > +DECLARE_MODULE(ip_mroute, ip_mroutemod, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE); > > Modified: head/sys/netinet6/in6.c > ============================================================================== > --- head/sys/netinet6/in6.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet6/in6.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -2419,7 +2419,7 @@ in6_domifdetach(struct ifnet *ifp, void > > mld_domifdetach(ifp); > scope6_ifdetach(ext->scope6_id); > - nd6_ifdetach(ext->nd_ifinfo); > + nd6_ifdetach(ifp, ext->nd_ifinfo); > lltable_free(ext->lltable); > COUNTER_ARRAY_FREE(ext->in6_ifstat, > sizeof(struct in6_ifstat) / sizeof(uint64_t)); > > Modified: head/sys/netinet6/in6_ifattach.c > ============================================================================== > --- head/sys/netinet6/in6_ifattach.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet6/in6_ifattach.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -761,19 +761,30 @@ in6_ifattach(struct ifnet *ifp, struct i > > /* > * NOTE: in6_ifdetach() does not support loopback if at this moment. > - * We don't need this function in bsdi, because interfaces are never removed > - * from the ifnet list in bsdi. > + * > + * When shutting down a VNET we clean up layers top-down. In that case > + * upper layer protocols (ulp) are cleaned up already and locks are destroyed > + * and we must not call into these cleanup functions anymore, thus purgeulp > + * is set to 0 in that case by in6_ifdetach_destroy(). > + * The normal case of destroying a (cloned) interface still needs to cleanup > + * everything related to the interface and will have purgeulp set to 1. > */ > -void > -in6_ifdetach(struct ifnet *ifp) > +static void > +_in6_ifdetach(struct ifnet *ifp, int purgeulp) > { > struct ifaddr *ifa, *next; > > if (ifp->if_afdata[AF_INET6] == NULL) > return; > > - /* remove neighbor management table */ > - nd6_purge(ifp); > + /* > + * Remove neighbor management table. > + * Enabling the nd6_purge will panic on vmove for interfaces on VNET > + * teardown as the IPv6 layer is cleaned up already and the locks > + * are destroyed. > + */ > + if (purgeulp) > + nd6_purge(ifp); > > /* > * nuke any of IPv6 addresses we have > @@ -784,9 +795,11 @@ in6_ifdetach(struct ifnet *ifp) > continue; > in6_purgeaddr(ifa); > } > - in6_pcbpurgeif0(&V_udbinfo, ifp); > - in6_pcbpurgeif0(&V_ulitecbinfo, ifp); > - in6_pcbpurgeif0(&V_ripcbinfo, ifp); > + if (purgeulp) { > + in6_pcbpurgeif0(&V_udbinfo, ifp); > + in6_pcbpurgeif0(&V_ulitecbinfo, ifp); > + in6_pcbpurgeif0(&V_ripcbinfo, ifp); > + } > /* leave from all multicast groups joined */ > in6_purgemaddrs(ifp); > > @@ -798,7 +811,22 @@ in6_ifdetach(struct ifnet *ifp) > * prefixes after removing all addresses above. > * (Or can we just delay calling nd6_purge until at this point?) > */ > - nd6_purge(ifp); > + if (purgeulp) > + nd6_purge(ifp); > +} > + > +void > +in6_ifdetach(struct ifnet *ifp) > +{ > + > + _in6_ifdetach(ifp, 1); > +} > + > +void > +in6_ifdetach_destroy(struct ifnet *ifp) > +{ > + > + _in6_ifdetach(ifp, 0); > } > > int > > Modified: head/sys/netinet6/in6_ifattach.h > ============================================================================== > --- head/sys/netinet6/in6_ifattach.h Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet6/in6_ifattach.h Tue Jun 21 13:48:49 2016 (r302054) > @@ -37,6 +37,7 @@ > void in6_ifattach(struct ifnet *, struct ifnet *); > void in6_ifattach_destroy(void); > void in6_ifdetach(struct ifnet *); > +void in6_ifdetach_destroy(struct ifnet *); > int in6_get_tmpifid(struct ifnet *, u_int8_t *, const u_int8_t *, int); > void in6_tmpaddrtimer(void *); > int in6_get_hw_ifid(struct ifnet *, struct in6_addr *); > > Modified: head/sys/netinet6/ip6_input.c > ============================================================================== > --- head/sys/netinet6/ip6_input.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet6/ip6_input.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -113,6 +113,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -314,6 +315,8 @@ ip6proto_unregister(short ip6proto) > static void > ip6_destroy(void *unused __unused) > { > + struct ifaddr *ifa, *nifa; > + struct ifnet *ifp; > int error; > > #ifdef RSS > @@ -336,9 +339,30 @@ ip6_destroy(void *unused __unused) > "type HHOOK_TYPE_IPSEC_OUT, id HHOOK_IPSEC_INET6: " > "error %d returned\n", __func__, error); > } > - hashdestroy(V_in6_ifaddrhashtbl, M_IFADDR, V_in6_ifaddrhmask); > + > + /* Cleanup addresses. */ > + IFNET_RLOCK(); > + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { > + /* Cannot lock here - lock recursion. */ > + /* IF_ADDR_LOCK(ifp); */ > + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { > + > + if (ifa->ifa_addr->sa_family != AF_INET6) > + continue; > + in6_purgeaddr(ifa); > + } > + /* IF_ADDR_UNLOCK(ifp); */ > + in6_ifdetach_destroy(ifp); > + mld_domifdetach(ifp); > + /* Make sure any routes are gone as well. */ > + rt_flushifroutes_af(ifp, AF_INET6); > + } > + IFNET_RUNLOCK(); > + > nd6_destroy(); > in6_ifattach_destroy(); > + > + hashdestroy(V_in6_ifaddrhashtbl, M_IFADDR, V_in6_ifaddrhmask); > } > > VNET_SYSUNINIT(inet6, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip6_destroy, NULL); > > Modified: head/sys/netinet6/ip6_mroute.c > ============================================================================== > --- head/sys/netinet6/ip6_mroute.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet6/ip6_mroute.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -1966,4 +1966,4 @@ static moduledata_t ip6_mroutemod = { > 0 > }; > > -DECLARE_MODULE(ip6_mroute, ip6_mroutemod, SI_SUB_PSEUDO, SI_ORDER_ANY); > +DECLARE_MODULE(ip6_mroute, ip6_mroutemod, SI_SUB_PROTO_MC, SI_ORDER_ANY); > > Modified: head/sys/netinet6/mld6.c > ============================================================================== > --- head/sys/netinet6/mld6.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet6/mld6.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -612,9 +612,6 @@ mli_delete_locked(const struct ifnet *if > return; > } > } > -#ifdef INVARIANTS > - panic("%s: mld_ifsoftc not found for ifp %p\n", __func__, ifp); > -#endif > } > > /* > @@ -3265,7 +3262,7 @@ mld_init(void *unused __unused) > mld_po.ip6po_prefer_tempaddr = IP6PO_TEMPADDR_NOTPREFER; > mld_po.ip6po_flags = IP6PO_DONTFRAG; > } > -SYSINIT(mld_init, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, mld_init, NULL); > +SYSINIT(mld_init, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, mld_init, NULL); > > static void > mld_uninit(void *unused __unused) > @@ -3274,7 +3271,7 @@ mld_uninit(void *unused __unused) > CTR1(KTR_MLD, "%s: tearing down", __func__); > MLD_LOCK_DESTROY(); > } > -SYSUNINIT(mld_uninit, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, mld_uninit, NULL); > +SYSUNINIT(mld_uninit, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, mld_uninit, NULL); > > static void > vnet_mld_init(const void *unused __unused) > @@ -3284,19 +3281,17 @@ vnet_mld_init(const void *unused __unuse > > LIST_INIT(&V_mli_head); > } > -VNET_SYSINIT(vnet_mld_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_mld_init, > +VNET_SYSINIT(vnet_mld_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mld_init, > NULL); > > static void > vnet_mld_uninit(const void *unused __unused) > { > > + /* This can happen if we shutdown the network stack. */ > CTR1(KTR_MLD, "%s: tearing down", __func__); > - > - KASSERT(LIST_EMPTY(&V_mli_head), > - ("%s: mli list not empty; ifnets not detached?", __func__)); > } > -VNET_SYSUNINIT(vnet_mld_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_mld_uninit, > +VNET_SYSUNINIT(vnet_mld_uninit, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mld_uninit, > NULL); > > static int > @@ -3318,4 +3313,4 @@ static moduledata_t mld_mod = { > mld_modevent, > 0 > }; > -DECLARE_MODULE(mld, mld_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); > +DECLARE_MODULE(mld, mld_mod, SI_SUB_PROTO_MC, SI_ORDER_ANY); > > Modified: head/sys/netinet6/nd6.c > ============================================================================== > --- head/sys/netinet6/nd6.c Tue Jun 21 07:05:49 2016 (r302053) > +++ head/sys/netinet6/nd6.c Tue Jun 21 13:48:49 2016 (r302054) > @@ -292,8 +292,19 @@ nd6_ifattach(struct ifnet *ifp) > } > > void > -nd6_ifdetach(struct nd_ifinfo *nd) > +nd6_ifdetach(struct ifnet *ifp, struct nd_ifinfo *nd) > { > + struct ifaddr *ifa, *next; > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-all@freebsd.org Wed Jun 22 07:50:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E429EB03086; Wed, 22 Jun 2016 07:50:03 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 999181CC1; Wed, 22 Jun 2016 07:50:03 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5M7o2Pg089630; Wed, 22 Jun 2016 07:50:02 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5M7nxYm089575; Wed, 22 Jun 2016 07:49:59 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201606220749.u5M7nxYm089575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Wed, 22 Jun 2016 07:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302075 - in head: contrib/libarchive contrib/libarchive/cat/test contrib/libarchive/cpio contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test c... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 07:50:04 -0000 Author: mm Date: Wed Jun 22 07:49:59 2016 New Revision: 302075 URL: https://svnweb.freebsd.org/changeset/base/302075 Log: MFV r302003,r302037,r302038,r302056: Update libarchive to 3.2.1 (bugfix and security fix release) List of vendor fixes: - fix exploitable heap overflow vulnerability in Rar decompression (vendor issue 719, CVE-2016-4302, TALOS-2016-0154) - fix exploitable stack based buffer overflow vulnebarility in mtree parse_device functionality (vendor PR 715, CVE-2016-4301, TALOS-2016-0153) - fix exploitable heap overflow vulnerability in 7-zip read_SubStreamsInfo (vendor issue 718, CVE-2016-4300, TALOS-2016-152) - fix integer overflow when computing location of volume descriptor (vendor issue 717) - fix buffer overflow when reading a crafred rar archive (vendor issue 521) - fix possible buffer overflow when reading ISO9660 archives on machines where sizeof(int) < sizeof(size_t) (vendor issue 711) - tar and cpio should fail if an input file named on the command line is missing (vendor issue 708) - fix incorrect writing of gnutar filenames that are exactly 512 bytes long (vendor issue 682) - allow tests to be run from paths that are equal or longer than 128 characters (vendor issue 657) - add memory allocation errors in archive_entry_xattr.c (vendor PR 603) - remove dead code in archive_entry_xattr_add_entry() (vendor PR 716) - fix broken decryption of ZIP files (vendor issue 553) - manpage style, typo and description fixes Post-3.2.1 vendor fixes: - fix typo in cpio version reporting (Vendor PR 725, 726) - fix argument range of ctype functions in libarchive_fe/passphrase.c - fix ctype use and avoid empty loop bodies in WARC reader MFC after: 1 week Security: CVE-2016-4300, CVE-2016-4301, CVE-2016-4302 Approved by: re (kib) Added: head/contrib/libarchive/cpio/test/test_missing_file.c - copied unchanged from r302003, vendor/libarchive/dist/cpio/test/test_missing_file.c head/contrib/libarchive/libarchive/test/test_read_format_rar_invalid1.c - copied unchanged from r302038, vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.c head/contrib/libarchive/libarchive/test/test_read_format_rar_invalid1.rar.uu - copied unchanged from r302038, vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.rar.uu head/contrib/libarchive/libarchive/test/test_write_format_gnutar_filenames.c - copied, changed from r302003, vendor/libarchive/dist/libarchive/test/test_write_format_gnutar_filenames.c head/contrib/libarchive/tar/test/test_missing_file.c - copied unchanged from r302003, vendor/libarchive/dist/tar/test/test_missing_file.c Modified: head/contrib/libarchive/NEWS head/contrib/libarchive/cat/test/main.c head/contrib/libarchive/cpio/cpio.c head/contrib/libarchive/cpio/test/main.c head/contrib/libarchive/cpio/test/test_option_version.c head/contrib/libarchive/libarchive/archive.h head/contrib/libarchive/libarchive/archive_entry.h head/contrib/libarchive/libarchive/archive_entry_xattr.c head/contrib/libarchive/libarchive/archive_ppmd7.c head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c head/contrib/libarchive/libarchive/archive_read_support_format_lha.c head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c head/contrib/libarchive/libarchive/archive_read_support_format_rar.c head/contrib/libarchive/libarchive/archive_read_support_format_warc.c head/contrib/libarchive/libarchive/archive_read_support_format_zip.c head/contrib/libarchive/libarchive/archive_write_filter.3 head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c head/contrib/libarchive/libarchive/archive_write_set_options.3 head/contrib/libarchive/libarchive/libarchive-formats.5 head/contrib/libarchive/libarchive/libarchive_changes.3 head/contrib/libarchive/libarchive/test/main.c head/contrib/libarchive/libarchive_fe/passphrase.c head/contrib/libarchive/tar/test/main.c head/contrib/libarchive/tar/write.c head/lib/libarchive/tests/Makefile head/usr.bin/bsdcat/Makefile head/usr.bin/cpio/Makefile head/usr.bin/cpio/tests/Makefile head/usr.bin/tar/Makefile head/usr.bin/tar/tests/Makefile Directory Properties: head/contrib/libarchive/ (props changed) head/contrib/libarchive/cpio/ (props changed) head/contrib/libarchive/libarchive/ (props changed) head/contrib/libarchive/libarchive_fe/ (props changed) head/contrib/libarchive/tar/ (props changed) Modified: head/contrib/libarchive/NEWS ============================================================================== --- head/contrib/libarchive/NEWS Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/NEWS Wed Jun 22 07:49:59 2016 (r302075) @@ -1,3 +1,8 @@ +Jun 20, 2016: libarchive 3.2.1 released + This fixes a handful of security and other critical issues with 3.2.0 + +May 01, 2016: libarchive 3.2.0 released + Apr 09, 2016: libarchive 3.1.901a released Another test release in preparation for 3.2.0 Modified: head/contrib/libarchive/cat/test/main.c ============================================================================== --- head/contrib/libarchive/cat/test/main.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/cat/test/main.c Wed Jun 22 07:49:59 2016 (r302075) @@ -2534,18 +2534,36 @@ usage(const char *program) static char * get_refdir(const char *d) { - char tried[512] = { '\0' }; - char buff[128]; - char *pwd, *p; + size_t tried_size, buff_size; + char *buff, *tried, *pwd = NULL, *p = NULL; + +#ifdef PATH_MAX + buff_size = PATH_MAX; +#else + buff_size = 8192; +#endif + buff = calloc(buff_size, 1); + if (buff == NULL) { + fprintf(stderr, "Unable to allocate memory\n"); + exit(1); + } + + /* Allocate a buffer to hold the various directories we checked. */ + tried_size = buff_size * 2; + tried = calloc(tried_size, 1); + if (tried == NULL) { + fprintf(stderr, "Unable to allocate memory\n"); + exit(1); + } /* If a dir was specified, try that */ if (d != NULL) { pwd = NULL; - snprintf(buff, sizeof(buff), "%s", d); + snprintf(buff, buff_size, "%s", d); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); goto failure; } @@ -2559,48 +2577,48 @@ get_refdir(const char *d) pwd[strlen(pwd) - 1] = '\0'; /* Look for a known file. */ - snprintf(buff, sizeof(buff), "%s", pwd); + snprintf(buff, buff_size, "%s", pwd); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); - snprintf(buff, sizeof(buff), "%s/test", pwd); + snprintf(buff, buff_size, "%s/test", pwd); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); #if defined(LIBRARY) - snprintf(buff, sizeof(buff), "%s/%s/test", pwd, LIBRARY); + snprintf(buff, buff_size, "%s/%s/test", pwd, LIBRARY); #else - snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM); + snprintf(buff, buff_size, "%s/%s/test", pwd, PROGRAM); #endif p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); #if defined(PROGRAM_ALIAS) - snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM_ALIAS); + snprintf(buff, buff_size, "%s/%s/test", pwd, PROGRAM_ALIAS); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); #endif if (memcmp(pwd, "/usr/obj", 8) == 0) { - snprintf(buff, sizeof(buff), "%s", pwd + 8); + snprintf(buff, buff_size, "%s", pwd + 8); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); - snprintf(buff, sizeof(buff), "%s/test", pwd + 8); + snprintf(buff, buff_size, "%s/test", pwd + 8); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); } failure: @@ -2615,7 +2633,12 @@ failure: success: free(p); free(pwd); - return strdup(buff); + free(tried); + + /* Copy result into a fresh buffer to reduce memory usage. */ + p = strdup(buff); + free(buff); + return p; } int Modified: head/contrib/libarchive/cpio/cpio.c ============================================================================== --- head/contrib/libarchive/cpio/cpio.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/cpio/cpio.c Wed Jun 22 07:49:59 2016 (r302075) @@ -498,7 +498,7 @@ long_help(void) static void version(void) { - fprintf(stdout,"bsdcpio %s -- %s\n", + fprintf(stdout,"bsdcpio %s - %s\n", BSDCPIO_VERSION_STRING, archive_version_details()); exit(0); Modified: head/contrib/libarchive/cpio/test/main.c ============================================================================== --- head/contrib/libarchive/cpio/test/main.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/cpio/test/main.c Wed Jun 22 07:49:59 2016 (r302075) @@ -2535,18 +2535,36 @@ usage(const char *program) static char * get_refdir(const char *d) { - char tried[512] = { '\0' }; - char buff[128]; - char *pwd, *p; + size_t tried_size, buff_size; + char *buff, *tried, *pwd = NULL, *p = NULL; + +#ifdef PATH_MAX + buff_size = PATH_MAX; +#else + buff_size = 8192; +#endif + buff = calloc(buff_size, 1); + if (buff == NULL) { + fprintf(stderr, "Unable to allocate memory\n"); + exit(1); + } + + /* Allocate a buffer to hold the various directories we checked. */ + tried_size = buff_size * 2; + tried = calloc(tried_size, 1); + if (tried == NULL) { + fprintf(stderr, "Unable to allocate memory\n"); + exit(1); + } /* If a dir was specified, try that */ if (d != NULL) { pwd = NULL; - snprintf(buff, sizeof(buff), "%s", d); + snprintf(buff, buff_size, "%s", d); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); goto failure; } @@ -2560,48 +2578,48 @@ get_refdir(const char *d) pwd[strlen(pwd) - 1] = '\0'; /* Look for a known file. */ - snprintf(buff, sizeof(buff), "%s", pwd); + snprintf(buff, buff_size, "%s", pwd); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); - snprintf(buff, sizeof(buff), "%s/test", pwd); + snprintf(buff, buff_size, "%s/test", pwd); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); #if defined(LIBRARY) - snprintf(buff, sizeof(buff), "%s/%s/test", pwd, LIBRARY); + snprintf(buff, buff_size, "%s/%s/test", pwd, LIBRARY); #else - snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM); + snprintf(buff, buff_size, "%s/%s/test", pwd, PROGRAM); #endif p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); #if defined(PROGRAM_ALIAS) - snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM_ALIAS); + snprintf(buff, buff_size, "%s/%s/test", pwd, PROGRAM_ALIAS); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); #endif if (memcmp(pwd, "/usr/obj", 8) == 0) { - snprintf(buff, sizeof(buff), "%s", pwd + 8); + snprintf(buff, buff_size, "%s", pwd + 8); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); - snprintf(buff, sizeof(buff), "%s/test", pwd + 8); + snprintf(buff, buff_size, "%s/test", pwd + 8); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); } failure: @@ -2616,7 +2634,12 @@ failure: success: free(p); free(pwd); - return strdup(buff); + free(tried); + + /* Copy result into a fresh buffer to reduce memory usage. */ + p = strdup(buff); + free(buff); + return p; } int Copied: head/contrib/libarchive/cpio/test/test_missing_file.c (from r302003, vendor/libarchive/dist/cpio/test/test_missing_file.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_missing_file.c Wed Jun 22 07:49:59 2016 (r302075, copy of r302003, vendor/libarchive/dist/cpio/test/test_missing_file.c) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2016 Tim Kientzle + * 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(S) ``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(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_missing_file) +{ + int r; + + assertMakeFile("file1", 0644, "file1"); + assertMakeFile("file2", 0644, "file2"); + + assertMakeFile("filelist1", 0644, "file1\nfile2\n"); + r = systemf("%s -o stdout1 2>stderr1", testprog); + assertEqualInt(r, 0); + assertTextFileContents("1 block\n", "stderr1"); + + assertMakeFile("filelist2", 0644, "file1\nfile2\nfile3\n"); + r = systemf("%s -o stdout2 2>stderr2", testprog); + assert(r != 0); + + assertMakeFile("filelist3", 0644, ""); + r = systemf("%s -o stdout3 2>stderr3", testprog); + assertEqualInt(r, 0); + assertTextFileContents("1 block\n", "stderr3"); + + assertMakeFile("filelist4", 0644, "file3\n"); + r = systemf("%s -o stdout4 2>stderr4", testprog); + assert(r != 0); +} Modified: head/contrib/libarchive/cpio/test/test_option_version.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_version.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/cpio/test/test_option_version.c Wed Jun 22 07:49:59 2016 (r302075) @@ -59,8 +59,8 @@ verify(const char *p, size_t s) ++q; --s; /* Separator. */ failure("Version: %s", p); - assertEqualMem(q, "-- ", 3); - q += 3; s -= 3; + assertEqualMem(q, "- ", 2); + q += 2; s -= 2; /* libarchive name and version number */ assert(s > 11); failure("Version: %s", p); Modified: head/contrib/libarchive/libarchive/archive.h ============================================================================== --- head/contrib/libarchive/libarchive/archive.h Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive.h Wed Jun 22 07:49:59 2016 (r302075) @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3002000 +#define ARCHIVE_VERSION_NUMBER 3002001 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(vo /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.2.0" +#define ARCHIVE_VERSION_ONLY_STRING "3.2.1" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); Modified: head/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.h Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_entry.h Wed Jun 22 07:49:59 2016 (r302075) @@ -29,7 +29,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3002000 +#define ARCHIVE_VERSION_NUMBER 3002001 /* * Note: archive_entry.h is for use outside of libarchive; the Modified: head/contrib/libarchive/libarchive/archive_entry_xattr.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_xattr.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_entry_xattr.c Wed Jun 22 07:49:59 2016 (r302075) @@ -91,16 +91,11 @@ archive_entry_xattr_add_entry(struct arc { struct ae_xattr *xp; - for (xp = entry->xattr_head; xp != NULL; xp = xp->next) - ; - if ((xp = (struct ae_xattr *)malloc(sizeof(struct ae_xattr))) == NULL) - /* XXX Error XXX */ - return; + __archive_errx(1, "Out of memory"); if ((xp->name = strdup(name)) == NULL) - /* XXX Error XXX */ - return; + __archive_errx(1, "Out of memory"); if ((xp->value = malloc(size)) != NULL) { memcpy(xp->value, value, size); Modified: head/contrib/libarchive/libarchive/archive_ppmd7.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_ppmd7.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_ppmd7.c Wed Jun 22 07:49:59 2016 (r302075) @@ -126,6 +126,11 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt3 { if (p->Base == 0 || p->Size != size) { + /* RestartModel() below assumes that p->Size >= UNIT_SIZE + (see the calculation of m->MinContext). */ + if (size < UNIT_SIZE) { + return False; + } Ppmd7_Free(p, alloc); p->AlignOffset = #ifdef PPMD_32BIT Modified: head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Wed Jun 22 07:49:59 2016 (r302075) @@ -2153,6 +2153,9 @@ read_SubStreamsInfo(struct archive_read return (-1); if (UMAX_ENTRY < f[i].numUnpackStreams) return (-1); + if (unpack_streams > SIZE_MAX - UMAX_ENTRY) { + return (-1); + } unpack_streams += (size_t)f[i].numUnpackStreams; } if ((p = header_bytes(a, 1)) == NULL) Modified: head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c Wed Jun 22 07:49:59 2016 (r302075) @@ -1091,7 +1091,7 @@ choose_volume(struct archive_read *a, st /* This condition is unlikely; by way of caution. */ vd = &(iso9660->joliet); - skipsize = LOGICAL_BLOCK_SIZE * vd->location; + skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location; skipsize = __archive_read_consume(a, skipsize); if (skipsize < 0) return ((int)skipsize); @@ -1129,7 +1129,7 @@ choose_volume(struct archive_read *a, st && iso9660->seenJoliet) { /* Switch reading data from primary to joliet. */ vd = &(iso9660->joliet); - skipsize = LOGICAL_BLOCK_SIZE * vd->location; + skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location; skipsize -= iso9660->current_position; skipsize = __archive_read_consume(a, skipsize); if (skipsize < 0) Modified: head/contrib/libarchive/libarchive/archive_read_support_format_lha.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_lha.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_read_support_format_lha.c Wed Jun 22 07:49:59 2016 (r302075) @@ -1712,6 +1712,7 @@ lha_crc16(uint16_t crc, const void *pp, for (;len >= 8; len -= 8) { /* This if statement expects compiler optimization will * remove the stament which will not be executed. */ +#undef bswap16 #if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */ # define bswap16(x) _byteswap_ushort(x) #elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8) \ Modified: head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Wed Jun 22 07:49:59 2016 (r302075) @@ -1385,12 +1385,12 @@ parse_device(dev_t *pdev, struct archive "Missing number"); return ARCHIVE_WARN; } - numbers[argc++] = (unsigned long)mtree_atol(&p); - if (argc > MAX_PACK_ARGS) { + if (argc >= MAX_PACK_ARGS) { archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, "Too many arguments"); return ARCHIVE_WARN; } + numbers[argc++] = (unsigned long)mtree_atol(&p); } if (argc < 2) { archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, Modified: head/contrib/libarchive/libarchive/archive_read_support_format_rar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_rar.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_read_support_format_rar.c Wed Jun 22 07:49:59 2016 (r302075) @@ -2127,6 +2127,12 @@ parse_codes(struct archive_read *a) rar->range_dec.Stream = &rar->bytein; __archive_ppmd7_functions.Ppmd7_Construct(&rar->ppmd7_context); + if (rar->dictionary_size == 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Invalid zero dictionary size"); + return (ARCHIVE_FATAL); + } + if (!__archive_ppmd7_functions.Ppmd7_Alloc(&rar->ppmd7_context, rar->dictionary_size, &g_szalloc)) { @@ -2884,11 +2890,10 @@ copy_from_lzss_window(struct archive_rea } windowoffs = lzss_offset_for_position(&rar->lzss, startpos); - if(windowoffs + length <= lzss_size(&rar->lzss)) + if(windowoffs + length <= lzss_size(&rar->lzss)) { memcpy(&rar->unp_buffer[rar->unp_offset], &rar->lzss.window[windowoffs], length); - else - { + } else if (length <= lzss_size(&rar->lzss)) { firstpart = lzss_size(&rar->lzss) - windowoffs; if (firstpart < 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, @@ -2900,9 +2905,14 @@ copy_from_lzss_window(struct archive_rea &rar->lzss.window[windowoffs], firstpart); memcpy(&rar->unp_buffer[rar->unp_offset + firstpart], &rar->lzss.window[0], length - firstpart); - } else + } else { memcpy(&rar->unp_buffer[rar->unp_offset], &rar->lzss.window[windowoffs], length); + } + } else { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Bad RAR file data"); + return (ARCHIVE_FATAL); } rar->unp_offset += length; if (rar->unp_offset >= rar->unp_buffer_size) Modified: head/contrib/libarchive/libarchive/archive_read_support_format_warc.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_warc.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_read_support_format_warc.c Wed Jun 22 07:49:59 2016 (r302075) @@ -535,7 +535,8 @@ xstrpisotime(const char *s, char **endpt /* as a courtesy to our callers, and since this is a non-standard * routine, we skip leading whitespace */ - for (; isspace(*s); s++); + while (isspace((unsigned char)*s)) + ++s; /* read year */ if ((tm.tm_year = strtoi_lim(s, &s, 1583, 4095)) < 0 || *s++ != '-') { @@ -639,7 +640,9 @@ _warc_rdtyp(const char *buf, size_t bsz) return WT_NONE; } /* overread whitespace */ - for (val += sizeof(_key) - 1U; val < eob && isspace(*val); val++); + val += sizeof(_key) - 1U; + while (val < eob && isspace((unsigned char)*val)) + ++val; if (val + 8U > eob) { ; @@ -676,7 +679,9 @@ _warc_rduri(const char *buf, size_t bsz) return res; } /* overread whitespace */ - for (val += sizeof(_key) - 1U; val < eob && isspace(*val); val++); + val += sizeof(_key) - 1U; + while (val < eob && isspace((unsigned char)*val)) + ++val; /* overread URL designators */ if ((uri = xmemmem(val, eob - val, "://", 3U)) == NULL) { @@ -692,7 +697,8 @@ _warc_rduri(const char *buf, size_t bsz) /* also massage eol to point to the first whitespace * after the last non-whitespace character before * the end of the line */ - for (; eol > uri && isspace(eol[-1]); eol--); + while (eol > uri && isspace((unsigned char)eol[-1])) + --eol; /* now then, inspect the URI */ if (memcmp(val, "file", 4U) == 0) { @@ -727,7 +733,7 @@ _warc_rdlen(const char *buf, size_t bsz) /* strtol kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; len = strtol(val, &on, 10); - if (on == NULL || !isspace(*on)) { + if (on == NULL || !isspace((unsigned char)*on)) { /* hm, can we trust that number? Best not. */ return -1; } @@ -750,7 +756,7 @@ _warc_rdrtm(const char *buf, size_t bsz) /* xstrpisotime() kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; res = xstrpisotime(val, &on); - if (on == NULL || !isspace(*on)) { + if (on == NULL || !isspace((unsigned char)*on)) { /* hm, can we trust that number? Best not. */ return (time_t)-1; } @@ -773,7 +779,7 @@ _warc_rdmtm(const char *buf, size_t bsz) /* xstrpisotime() kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; res = xstrpisotime(val, &on); - if (on == NULL || !isspace(*on)) { + if (on == NULL || !isspace((unsigned char)*on)) { /* hm, can we trust that number? Best not. */ return (time_t)-1; } Modified: head/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Wed Jun 22 07:49:59 2016 (r302075) @@ -181,6 +181,14 @@ struct zip { char init_decryption; /* Decryption buffer. */ + /* + * The decrypted data starts at decrypted_ptr and + * extends for decrypted_bytes_remaining. Decryption + * adds new data to the end of this block, data is returned + * to clients from the beginning. When the block hits the + * end of decrypted_buffer, it has to be shuffled back to + * the beginning of the buffer. + */ unsigned char *decrypted_buffer; unsigned char *decrypted_ptr; size_t decrypted_buffer_size; @@ -1293,8 +1301,9 @@ zip_read_data_deflate(struct archive_rea if (zip->tctx_valid || zip->cctx_valid) { if (zip->decrypted_bytes_remaining < (size_t)bytes_avail) { - size_t buff_remaining = zip->decrypted_buffer_size - - (zip->decrypted_ptr - zip->decrypted_buffer); + size_t buff_remaining = + (zip->decrypted_buffer + zip->decrypted_buffer_size) + - (zip->decrypted_ptr + zip->decrypted_bytes_remaining); if (buff_remaining > (size_t)bytes_avail) buff_remaining = (size_t)bytes_avail; Modified: head/contrib/libarchive/libarchive/archive_write_filter.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_filter.3 Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_write_filter.3 Wed Jun 22 07:49:59 2016 (r302075) @@ -43,6 +43,7 @@ .Nm archive_write_add_filter_program , .Nm archive_write_add_filter_uuencode , .Nm archive_write_add_filter_xz +.Nd functions enabling output filters .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) .Sh SYNOPSIS Modified: head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c Wed Jun 22 07:49:59 2016 (r302075) @@ -467,7 +467,7 @@ archive_write_gnutar_header(struct archi } } if (gnutar->linkname_length > GNUTAR_linkname_size) { - size_t todo = gnutar->linkname_length; + size_t length = gnutar->linkname_length + 1; struct archive_entry *temp = archive_entry_new2(&a->archive); /* Uname/gname here don't really matter since no one reads them; @@ -476,7 +476,7 @@ archive_write_gnutar_header(struct archi archive_entry_set_gname(temp, "wheel"); archive_entry_set_pathname(temp, "././@LongLink"); - archive_entry_set_size(temp, gnutar->linkname_length + 1); + archive_entry_set_size(temp, length); ret = archive_format_gnutar_header(a, buff, temp, 'K'); if (ret < ARCHIVE_WARN) goto exit_write_header; @@ -484,11 +484,12 @@ archive_write_gnutar_header(struct archi if(ret < ARCHIVE_WARN) goto exit_write_header; archive_entry_free(temp); - /* Write as many 512 bytes blocks as needed to write full name. */ - ret = __archive_write_output(a, gnutar->linkname, todo); + /* Write name and trailing null byte. */ + ret = __archive_write_output(a, gnutar->linkname, length); if(ret < ARCHIVE_WARN) goto exit_write_header; - ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)todo)); + /* Pad to 512 bytes */ + ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)length)); if (ret < ARCHIVE_WARN) goto exit_write_header; } @@ -496,7 +497,7 @@ archive_write_gnutar_header(struct archi /* If pathname is longer than 100 chars we need to add an 'L' header. */ if (gnutar->pathname_length > GNUTAR_name_size) { const char *pathname = gnutar->pathname; - size_t todo = gnutar->pathname_length; + size_t length = gnutar->pathname_length + 1; struct archive_entry *temp = archive_entry_new2(&a->archive); /* Uname/gname here don't really matter since no one reads them; @@ -505,7 +506,7 @@ archive_write_gnutar_header(struct archi archive_entry_set_gname(temp, "wheel"); archive_entry_set_pathname(temp, "././@LongLink"); - archive_entry_set_size(temp, gnutar->pathname_length + 1); + archive_entry_set_size(temp, length); ret = archive_format_gnutar_header(a, buff, temp, 'L'); if (ret < ARCHIVE_WARN) goto exit_write_header; @@ -513,11 +514,12 @@ archive_write_gnutar_header(struct archi if(ret < ARCHIVE_WARN) goto exit_write_header; archive_entry_free(temp); - /* Write as many 512 bytes blocks as needed to write full name. */ - ret = __archive_write_output(a, pathname, todo); + /* Write pathname + trailing null byte. */ + ret = __archive_write_output(a, pathname, length); if(ret < ARCHIVE_WARN) goto exit_write_header; - ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)todo)); + /* Pad to multiple of 512 bytes. */ + ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)length)); if (ret < ARCHIVE_WARN) goto exit_write_header; } Modified: head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c Wed Jun 22 07:49:59 2016 (r302075) @@ -6225,7 +6225,7 @@ isoent_gen_joliet_identifier(struct arch unsigned char *p; size_t l; int r; - int ffmax, parent_len; + size_t ffmax, parent_len; static const struct archive_rb_tree_ops rb_ops = { isoent_cmp_node_joliet, isoent_cmp_key_joliet }; @@ -6239,7 +6239,7 @@ isoent_gen_joliet_identifier(struct arch else ffmax = 128; - r = idr_start(a, idr, isoent->children.cnt, ffmax, 6, 2, &rb_ops); + r = idr_start(a, idr, isoent->children.cnt, (int)ffmax, 6, 2, &rb_ops); if (r < 0) return (r); @@ -6252,7 +6252,7 @@ isoent_gen_joliet_identifier(struct arch int ext_off, noff, weight; size_t lt; - if ((int)(l = np->file->basename_utf16.length) > ffmax) + if ((l = np->file->basename_utf16.length) > ffmax) l = ffmax; p = malloc((l+1)*2); @@ -6285,7 +6285,7 @@ isoent_gen_joliet_identifier(struct arch /* * Get a length of MBS of a full-pathname. */ - if ((int)np->file->basename_utf16.length > ffmax) { + if (np->file->basename_utf16.length > ffmax) { if (archive_strncpy_l(&iso9660->mbs, (const char *)np->identifier, l, iso9660->sconv_from_utf16be) != 0 && @@ -6302,7 +6302,9 @@ isoent_gen_joliet_identifier(struct arch /* If a length of full-pathname is longer than 240 bytes, * it violates Joliet extensions regulation. */ - if (parent_len + np->mb_len > 240) { + if (parent_len > 240 + || np->mb_len > 240 + || parent_len + np->mb_len > 240) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "The regulation of Joliet extensions;" " A length of a full-pathname of `%s' is " @@ -6314,11 +6316,11 @@ isoent_gen_joliet_identifier(struct arch /* Make an offset of the number which is used to be set * hexadecimal number to avoid duplicate identifier. */ - if ((int)l == ffmax) + if (l == ffmax) noff = ext_off - 6; - else if ((int)l == ffmax-2) + else if (l == ffmax-2) noff = ext_off - 4; - else if ((int)l == ffmax-4) + else if (l == ffmax-4) noff = ext_off - 2; else noff = ext_off; Modified: head/contrib/libarchive/libarchive/archive_write_set_options.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_options.3 Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/archive_write_set_options.3 Wed Jun 22 07:49:59 2016 (r302075) @@ -32,7 +32,7 @@ .Nm archive_write_set_format_option , .Nm archive_write_set_option , .Nm archive_write_set_options -.Nd functions controlling options for reading archives +.Nd functions controlling options for writing archives .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) .Sh SYNOPSIS Modified: head/contrib/libarchive/libarchive/libarchive-formats.5 ============================================================================== --- head/contrib/libarchive/libarchive/libarchive-formats.5 Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/libarchive-formats.5 Wed Jun 22 07:49:59 2016 (r302075) @@ -65,7 +65,6 @@ Later variants have extended this by eit areas of the header record, extending the header to multiple records, or by storing special entries that modify the interpretation of subsequent entries. -.Pp .Bl -tag -width indent .It Cm gnutar The Modified: head/contrib/libarchive/libarchive/libarchive_changes.3 ============================================================================== --- head/contrib/libarchive/libarchive/libarchive_changes.3 Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/libarchive_changes.3 Wed Jun 22 07:49:59 2016 (r302075) @@ -28,7 +28,7 @@ .Dt LIBARCHIVE_CHANGES 3 .Os .Sh NAME -.Nm changes in libarchive interface +.Nd changes in libarchive interface .\" .Sh CHANGES IN LIBARCHIVE 3 This page describes user-visible changes in libarchive3, and lists Modified: head/contrib/libarchive/libarchive/test/main.c ============================================================================== --- head/contrib/libarchive/libarchive/test/main.c Tue Jun 21 22:19:06 2016 (r302074) +++ head/contrib/libarchive/libarchive/test/main.c Wed Jun 22 07:49:59 2016 (r302075) @@ -2533,18 +2533,36 @@ usage(const char *program) static char * get_refdir(const char *d) { - char tried[512] = { '\0' }; - char buff[128]; - char *pwd, *p; + size_t tried_size, buff_size; + char *buff, *tried, *pwd = NULL, *p = NULL; + +#ifdef PATH_MAX + buff_size = PATH_MAX; +#else + buff_size = 8192; +#endif + buff = calloc(buff_size, 1); + if (buff == NULL) { + fprintf(stderr, "Unable to allocate memory\n"); + exit(1); + } + + /* Allocate a buffer to hold the various directories we checked. */ + tried_size = buff_size * 2; + tried = calloc(tried_size, 1); + if (tried == NULL) { + fprintf(stderr, "Unable to allocate memory\n"); + exit(1); + } /* If a dir was specified, try that */ if (d != NULL) { pwd = NULL; - snprintf(buff, sizeof(buff), "%s", d); + snprintf(buff, buff_size, "%s", d); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); goto failure; } @@ -2558,48 +2576,48 @@ get_refdir(const char *d) pwd[strlen(pwd) - 1] = '\0'; /* Look for a known file. */ - snprintf(buff, sizeof(buff), "%s", pwd); + snprintf(buff, buff_size, "%s", pwd); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); - snprintf(buff, sizeof(buff), "%s/test", pwd); + snprintf(buff, buff_size, "%s/test", pwd); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); #if defined(LIBRARY) - snprintf(buff, sizeof(buff), "%s/%s/test", pwd, LIBRARY); + snprintf(buff, buff_size, "%s/%s/test", pwd, LIBRARY); #else - snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM); + snprintf(buff, buff_size, "%s/%s/test", pwd, PROGRAM); #endif p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); #if defined(PROGRAM_ALIAS) - snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM_ALIAS); + snprintf(buff, buff_size, "%s/%s/test", pwd, PROGRAM_ALIAS); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); #endif if (memcmp(pwd, "/usr/obj", 8) == 0) { - snprintf(buff, sizeof(buff), "%s", pwd + 8); + snprintf(buff, buff_size, "%s", pwd + 8); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); - snprintf(buff, sizeof(buff), "%s/test", pwd + 8); + snprintf(buff, buff_size, "%s/test", pwd + 8); p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; - strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); - strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + strncat(tried, buff, tried_size - strlen(tried) - 1); + strncat(tried, "\n", tried_size - strlen(tried) - 1); } failure: @@ -2614,7 +2632,12 @@ failure: success: free(p); free(pwd); - return strdup(buff); + free(tried); + + /* Copy result into a fresh buffer to reduce memory usage. */ + p = strdup(buff); + free(buff); + return p; } int Copied: head/contrib/libarchive/libarchive/test/test_read_format_rar_invalid1.c (from r302038, vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_read_format_rar_invalid1.c Wed Jun 22 07:49:59 2016 (r302075, copy of r302038, vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.c) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2003-2016 Tim Kientzle + * 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(S) ``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(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_rar_invalid1) +{ + const char *refname = "test_read_format_rar_invalid1.rar"; + struct archive *a; + struct archive_entry *ae; + char *buff[100]; + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, refname, 10240)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_data(a, buff, 99)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} Copied: head/contrib/libarchive/libarchive/test/test_read_format_rar_invalid1.rar.uu (from r302038, vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.rar.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_read_format_rar_invalid1.rar.uu Wed Jun 22 07:49:59 2016 (r302075, copy of r302038, vendor/libarchive/dist/libarchive/test/test_read_format_rar_invalid1.rar.uu) @@ -0,0 +1,5 @@ +begin 644 test_read_format_rar_invalid1.rar +M4F%R(1H'`,^0B$4= +2,P0`I($``'1E -#include +#include #include #include #ifdef HAVE_PATHS_H #include #endif +#include #include +#include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jun 22 09:03:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44E30AC4EE0; Wed, 22 Jun 2016 09:03:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FD9420E1; Wed, 22 Jun 2016 09:03:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5M93ukJ018667; Wed, 22 Jun 2016 09:03:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5M93u0X018664; Wed, 22 Jun 2016 09:03:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201606220903.u5M93u0X018664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 22 Jun 2016 09:03:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302076 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 09:03:57 -0000 Author: hselasky Date: Wed Jun 22 09:03:55 2016 New Revision: 302076 URL: https://svnweb.freebsd.org/changeset/base/302076 Log: Update the definition for number of scratch pages to match the latest version of the XHCI specification. Make sure the code can handle the maximum number of allowed scratch pages. Submitted by: Shichun_Ma@Dell.com Approved by: re (hrs) MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/controller/xhci.h head/sys/dev/usb/controller/xhcireg.h Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Wed Jun 22 07:49:59 2016 (r302075) +++ head/sys/dev/usb/controller/xhci.c Wed Jun 22 09:03:55 2016 (r302076) @@ -210,7 +210,7 @@ static void xhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb) { struct xhci_softc *sc = XHCI_BUS2SC(bus); - uint8_t i; + uint16_t i; cb(bus, &sc->sc_hw.root_pc, &sc->sc_hw.root_pg, sizeof(struct xhci_hw_root), XHCI_PAGE_SIZE); @@ -218,7 +218,7 @@ xhci_iterate_hw_softc(struct usb_bus *bu cb(bus, &sc->sc_hw.ctx_pc, &sc->sc_hw.ctx_pg, sizeof(struct xhci_dev_ctx_addr), XHCI_PAGE_SIZE); - for (i = 0; i != XHCI_MAX_SCRATCHPADS; i++) { + for (i = 0; i != sc->sc_noscratch; i++) { cb(bus, &sc->sc_hw.scratch_pc[i], &sc->sc_hw.scratch_pg[i], XHCI_PAGE_SIZE, XHCI_PAGE_SIZE); } Modified: head/sys/dev/usb/controller/xhci.h ============================================================================== --- head/sys/dev/usb/controller/xhci.h Wed Jun 22 07:49:59 2016 (r302075) +++ head/sys/dev/usb/controller/xhci.h Wed Jun 22 09:03:55 2016 (r302076) @@ -30,7 +30,7 @@ #define XHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128) #define XHCI_MAX_ENDPOINTS 32 /* hardcoded - do not change */ -#define XHCI_MAX_SCRATCHPADS 32 +#define XHCI_MAX_SCRATCHPADS 1024 #define XHCI_MAX_EVENTS (16 * 13) #define XHCI_MAX_COMMANDS (16 * 1) #define XHCI_MAX_RSEG 1 @@ -496,14 +496,15 @@ struct xhci_softc { uint16_t sc_command_idx; uint16_t sc_imod_default; + /* number of scratch pages */ + uint16_t sc_noscratch; + uint8_t sc_event_ccs; uint8_t sc_command_ccs; /* number of XHCI device slots */ uint8_t sc_noslot; /* number of ports on root HUB */ uint8_t sc_noport; - /* number of scratch pages */ - uint8_t sc_noscratch; /* root HUB device configuration */ uint8_t sc_conf; /* root HUB port event bitmap, max 256 ports */ Modified: head/sys/dev/usb/controller/xhcireg.h ============================================================================== --- head/sys/dev/usb/controller/xhcireg.h Wed Jun 22 07:49:59 2016 (r302075) +++ head/sys/dev/usb/controller/xhcireg.h Wed Jun 22 09:03:55 2016 (r302076) @@ -52,8 +52,8 @@ #define XHCI_HCSPARAMS2 0x08 /* RO structural parameters 2 */ #define XHCI_HCS2_IST(x) ((x) & 0xF) #define XHCI_HCS2_ERST_MAX(x) (((x) >> 4) & 0xF) -#define XHCI_HCS2_SPR(x) (((x) >> 24) & 0x1) -#define XHCI_HCS2_SPB_MAX(x) (((x) >> 27) & 0x7F) +#define XHCI_HCS2_SPR(x) (((x) >> 26) & 0x1) +#define XHCI_HCS2_SPB_MAX(x) ((((x) >> 16) & 0x3E0) | (((x) >> 27) & 0x1F)) #define XHCI_HCSPARAMS3 0x0C /* RO structural parameters 3 */ #define XHCI_HCS3_U1_DEL(x) ((x) & 0xFF) #define XHCI_HCS3_U2_DEL(x) (((x) >> 16) & 0xFFFF) From owner-svn-src-all@freebsd.org Wed Jun 22 09:08:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6025A7A08F; Wed, 22 Jun 2016 09:08:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A335250C; Wed, 22 Jun 2016 09:08:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5M98Iae018908; Wed, 22 Jun 2016 09:08:18 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5M98IvT018907; Wed, 22 Jun 2016 09:08:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606220908.u5M98IvT018907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 22 Jun 2016 09:08:18 +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: r302078 - stable/10/sys/fs/devfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 09:08:19 -0000 Author: kib Date: Wed Jun 22 09:08:18 2016 New Revision: 302078 URL: https://svnweb.freebsd.org/changeset/base/302078 Log: MFC r301928: Only access vp->v_rdev for VCHR vnodes in devfs_reclaim(). Modified: stable/10/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/10/sys/fs/devfs/devfs_vnops.c Wed Jun 22 09:05:21 2016 (r302077) +++ stable/10/sys/fs/devfs/devfs_vnops.c Wed Jun 22 09:08:18 2016 (r302078) @@ -1325,10 +1325,10 @@ devfs_readlink(struct vop_readlink_args static int devfs_reclaim(struct vop_reclaim_args *ap) { - struct vnode *vp = ap->a_vp; + struct vnode *vp; struct devfs_dirent *de; - struct cdev *dev; + vp = ap->a_vp; mtx_lock(&devfs_de_interlock); de = vp->v_data; if (de != NULL) { @@ -1336,24 +1336,31 @@ devfs_reclaim(struct vop_reclaim_args *a vp->v_data = NULL; } mtx_unlock(&devfs_de_interlock); - vnode_destroy_vobject(vp); + return (0); +} + +static int +devfs_reclaim_vchr(struct vop_reclaim_args *ap) +{ + struct vnode *vp; + struct cdev *dev; + + vp = ap->a_vp; + MPASS(vp->v_type == VCHR); + + devfs_reclaim(ap); VI_LOCK(vp); dev_lock(); dev = vp->v_rdev; vp->v_rdev = NULL; - - if (dev == NULL) { - dev_unlock(); - VI_UNLOCK(vp); - return (0); - } - - dev->si_usecount -= vp->v_usecount; + if (dev != NULL) + dev->si_usecount -= vp->v_usecount; dev_unlock(); VI_UNLOCK(vp); - dev_rel(dev); + if (dev != NULL) + dev_rel(dev); return (0); } @@ -1791,7 +1798,7 @@ static struct vop_vector devfs_specops = .vop_readdir = VOP_PANIC, .vop_readlink = VOP_PANIC, .vop_reallocblks = VOP_PANIC, - .vop_reclaim = devfs_reclaim, + .vop_reclaim = devfs_reclaim_vchr, .vop_remove = devfs_remove, .vop_rename = VOP_PANIC, .vop_revoke = devfs_revoke, From owner-svn-src-all@freebsd.org Wed Jun 22 09:10:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31DEFA7A150; Wed, 22 Jun 2016 09:10:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8D762708; Wed, 22 Jun 2016 09:10:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5M9ArT3019062; Wed, 22 Jun 2016 09:10:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5M9Aric019061; Wed, 22 Jun 2016 09:10:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606220910.u5M9Aric019061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 22 Jun 2016 09:10: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: r302079 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 09:10:54 -0000 Author: kib Date: Wed Jun 22 09:10:52 2016 New Revision: 302079 URL: https://svnweb.freebsd.org/changeset/base/302079 Log: MFC r301929: Do not assume that we own the use reference on the covered vnode until we set MNTK_UNMOUNT flag on the mp. Modified: stable/10/sys/kern/vfs_mount.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_mount.c ============================================================================== --- stable/10/sys/kern/vfs_mount.c Wed Jun 22 09:08:18 2016 (r302078) +++ stable/10/sys/kern/vfs_mount.c Wed Jun 22 09:10:52 2016 (r302079) @@ -1222,7 +1222,6 @@ dounmount(struct mount *mp, int flags, s VI_LOCK(coveredvp); vholdl(coveredvp); vn_lock(coveredvp, LK_EXCLUSIVE | LK_INTERLOCK | LK_RETRY); - vdrop(coveredvp); /* * Check for mp being unmounted while waiting for the * covered vnode lock. @@ -1230,18 +1229,22 @@ dounmount(struct mount *mp, int flags, s if (coveredvp->v_mountedhere != mp || coveredvp->v_mountedhere->mnt_gen != mnt_gen_r) { VOP_UNLOCK(coveredvp, 0); + vdrop(coveredvp); vfs_rel(mp); return (EBUSY); } } + /* * Only privileged root, or (if MNT_USER is set) the user that did the * original mount is permitted to unmount this filesystem. */ error = vfs_suser(mp, td); if (error != 0) { - if (coveredvp) + if (coveredvp != NULL) { VOP_UNLOCK(coveredvp, 0); + vdrop(coveredvp); + } vfs_rel(mp); return (error); } @@ -1251,8 +1254,10 @@ dounmount(struct mount *mp, int flags, s if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 || !TAILQ_EMPTY(&mp->mnt_uppers)) { MNT_IUNLOCK(mp); - if (coveredvp) + if (coveredvp != NULL) { VOP_UNLOCK(coveredvp, 0); + vdrop(coveredvp); + } vn_finished_write(mp); return (EBUSY); } @@ -1285,6 +1290,16 @@ dounmount(struct mount *mp, int flags, s if (mp->mnt_flag & MNT_EXPUBLIC) vfs_setpublicfs(NULL, NULL, NULL); + /* + * From now, we can claim that the use reference on the + * coveredvp is ours, and the ref can be released only by + * successfull unmount by us, or left for later unmount + * attempt. The previously acquired hold reference is no + * longer needed to protect the vnode from reuse. + */ + if (coveredvp != NULL) + vdrop(coveredvp); + vfs_msync(mp, MNT_WAIT); MNT_ILOCK(mp); async_flag = mp->mnt_flag & MNT_ASYNC; From owner-svn-src-all@freebsd.org Wed Jun 22 10:32:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 286B3B3BA58; Wed, 22 Jun 2016 10:32:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E06FB12DE; Wed, 22 Jun 2016 10:32:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id E586D25D37C2; Wed, 22 Jun 2016 10:32:30 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id BA38CD1F7E4; Wed, 22 Jun 2016 10:32:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 8ZJ0xH5vZmmg; Wed, 22 Jun 2016 10:32:28 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 6821BD1F7E0; Wed, 22 Jun 2016 10:32:28 +0000 (UTC) Date: Wed, 22 Jun 2016 10:32:27 +0000 (UTC) From: "Bjoern A. Zeeb" To: Navdeep Parhar cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302054 - in head/sys: contrib/ipfilter/netinet dev/usb/net kern net netgraph netinet netinet6 netipsec netpfil/ipfw netpfil/pf In-Reply-To: Message-ID: References: <201606211348.u5LDmom9081605@repo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 10:32:35 -0000 On Tue, 21 Jun 2016, Navdeep Parhar wrote: > This causes a panic when a NIC driver module is unloaded from a kernel > without VIMAGE. if_vnet is NULL and if_detach_internal tries to > dereference it. whoops; I'll try this patch in a few minutes but if it works for you let me know and I'll get it in. Index: sys/net/if.c =================================================================== --- sys/net/if.c (revision 302079) +++ sys/net/if.c (working copy) @@ -933,8 +933,12 @@ if_detach_internal(struct ifnet *ifp, int vmove, s struct ifnet *iter; int found = 0, shutdown; +#ifdef VIMAGE shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; +#else + shutdown = 0; +#endif IFNET_WLOCK(); TAILQ_FOREACH(iter, &V_ifnet, if_link) if (iter == ifp) { /bz From owner-svn-src-all@freebsd.org Wed Jun 22 10:38:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBFAAB3BD12; Wed, 22 Jun 2016 10:38:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B65B1729; Wed, 22 Jun 2016 10:38:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MAcfTC052897; Wed, 22 Jun 2016 10:38:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MAcfDY052891; Wed, 22 Jun 2016 10:38:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201606221038.u5MAcfDY052891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 22 Jun 2016 10:38:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302080 - head/lib/libusb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 10:38:42 -0000 Author: hselasky Date: Wed Jun 22 10:38:41 2016 New Revision: 302080 URL: https://svnweb.freebsd.org/changeset/base/302080 Log: Implement libusb_hotplug_register_callback() and libusb_hotplug_deregister_callback() for the LibUSB v1.0 API and update the libusb(3) manual page. Approved by: re (kib) Requested by: swills MFC after: 1 week Added: head/lib/libusb/libusb10_hotplug.c (contents, props changed) Modified: head/lib/libusb/Makefile head/lib/libusb/libusb.3 head/lib/libusb/libusb.h head/lib/libusb/libusb10.c head/lib/libusb/libusb10.h Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Wed Jun 22 09:10:52 2016 (r302079) +++ head/lib/libusb/Makefile Wed Jun 22 10:38:41 2016 (r302080) @@ -32,6 +32,7 @@ SRCS+= libusb01.c INCS+= libusb.h SRCS+= libusb10.c SRCS+= libusb10_desc.c +SRCS+= libusb10_hotplug.c SRCS+= libusb10_io.c .if defined(COMPAT_32BIT) @@ -142,6 +143,8 @@ MLINKS += libusb.3 libusb_handle_events_ MLINKS += libusb.3 libusb_get_next_timeout.3 MLINKS += libusb.3 libusb_set_pollfd_notifiers.3 MLINKS += libusb.3 libusb_get_pollfds.3 +MLINKS += libusb.3 libusb_hotplug_register_callback.3 +MLINKS += libusb.3 libusb_hotplug_deregister_callback.3 # LibUSB v0.1 MLINKS += libusb.3 usb_open.3 Modified: head/lib/libusb/libusb.3 ============================================================================== --- head/lib/libusb/libusb.3 Wed Jun 22 09:10:52 2016 (r302079) +++ head/lib/libusb/libusb.3 Wed Jun 22 10:38:41 2016 (r302080) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2016 +.Dd June 22, 2016 .Dt LIBUSB 3 .Os .Sh NAME @@ -642,6 +642,47 @@ that libusb uses as an event source. Retrive a list of file descriptors that should be polled by your main loop as libusb event sources. Returns a NULL-terminated list on success or NULL on failure. +.Pp +.Ft int +.Fn libusb_hotplug_register_callback "libusb_context *ctx" "libusb_hotplug_event events" "libusb_hotplug_flag flags" "int vendor_id" "int product_id" "int dev_class" "libusb_hotplug_callback_fn cb_fn" "void *user_data" "libusb_hotplug_callback_handle *handle" +This function registers a hotplug filter. +The +.Fa events +argument select which events makes the hotplug filter trigger. +Available event values are LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED and LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT. +One or more events must be specified. +The +.Fa vendor_id , +.Fa product_id +and +.Fa dev_class +arguments can be set to LIBUSB_HOTPLUG_MATCH_ANY to match any value in the USB device descriptor. +Else the specified value is used for matching. +If the +.Fa flags +argument is set to LIBUSB_HOTPLUG_ENUMERATE, all currently attached and matching USB devices will be passed to the hotplug filter, given by the +.Fa cb_fn +argument. +Else the +.Fa flags +argument should be set to LIBUSB_HOTPLUG_NO_FLAGS. +This function returns 0 upon success or a LIBUSB_ERROR code on failure. +.Pp +.Ft int +.Fn libusb_hotplug_callback_fn "libusb_context *ctx" "libusb_device *device" "libusb_hotplug_event event" "void *user_data" +The hotplug filter function. +If this function returns non-zero, the filter is removed. +Else the filter is kept and can receive more events. +The +.Fa user_data +argument is the same as given when the filter was registered. +The +.Fa event +argument can be either of LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED or LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT. +.Pp +.Ft void +.Fn libusb_hotplug_deregister_callback "libusb_context *ctx" "libusb_hotplug_callback_handle handle" +This function unregisters a hotplug filter. .Sh LIBUSB VERSION 0.1 COMPATIBILITY The library is also compliant with LibUSB version 0.1.12. .Pp Modified: head/lib/libusb/libusb.h ============================================================================== --- head/lib/libusb/libusb.h Wed Jun 22 09:10:52 2016 (r302079) +++ head/lib/libusb/libusb.h Wed Jun 22 10:38:41 2016 (r302080) @@ -236,12 +236,25 @@ enum libusb_debug_level { LIBUSB_DEBUG_TRANSFER=2, }; +#define LIBUSB_HOTPLUG_MATCH_ANY -1 + +typedef enum { + LIBUSB_HOTPLUG_NO_FLAGS = 0, + LIBUSB_HOTPLUG_ENUMERATE = 1 << 0, +} libusb_hotplug_flag; + +typedef enum { + LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = 1, + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 2, +} libusb_hotplug_event; + /* libusb structures */ struct libusb_context; struct libusb_device; struct libusb_transfer; struct libusb_device_handle; +struct libusb_hotplug_callback_handle; struct libusb_pollfd { int fd; @@ -263,6 +276,7 @@ typedef struct libusb_device_handle libu typedef struct libusb_pollfd libusb_pollfd; typedef void (*libusb_pollfd_added_cb) (int fd, short events, void *user_data); typedef void (*libusb_pollfd_removed_cb) (int fd, void *user_data); +typedef struct libusb_hotplug_callback_handle *libusb_hotplug_callback_handle; typedef struct libusb_device_descriptor { uint8_t bLength; @@ -539,6 +553,14 @@ int libusb_interrupt_transfer(libusb_dev uint16_t libusb_cpu_to_le16(uint16_t x); uint16_t libusb_le16_to_cpu(uint16_t x); +/* Hotplug support */ + +typedef int (*libusb_hotplug_callback_fn)(libusb_context *ctx, + libusb_device *device, libusb_hotplug_event event, void *user_data); + +int libusb_hotplug_register_callback(libusb_context *ctx, libusb_hotplug_event events, libusb_hotplug_flag flags, int vendor_id, int product_id, int dev_class, libusb_hotplug_callback_fn cb_fn, void *user_data, libusb_hotplug_callback_handle *handle); +void libusb_hotplug_deregister_callback(libusb_context *ctx, libusb_hotplug_callback_handle handle); + #if 0 { /* indent fix */ #endif Modified: head/lib/libusb/libusb10.c ============================================================================== --- head/lib/libusb/libusb10.c Wed Jun 22 09:10:52 2016 (r302079) +++ head/lib/libusb/libusb10.c Wed Jun 22 10:38:41 2016 (r302080) @@ -134,24 +134,34 @@ libusb_init(libusb_context **context) } TAILQ_INIT(&ctx->pollfds); TAILQ_INIT(&ctx->tr_done); + TAILQ_INIT(&ctx->hotplug_cbh); + TAILQ_INIT(&ctx->hotplug_devs); if (pthread_mutex_init(&ctx->ctx_lock, NULL) != 0) { free(ctx); return (LIBUSB_ERROR_NO_MEM); } + if (pthread_mutex_init(&ctx->hotplug_lock, NULL) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } if (pthread_condattr_init(&attr) != 0) { pthread_mutex_destroy(&ctx->ctx_lock); + pthread_mutex_destroy(&ctx->hotplug_lock); free(ctx); return (LIBUSB_ERROR_NO_MEM); } if (pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) != 0) { pthread_mutex_destroy(&ctx->ctx_lock); + pthread_mutex_destroy(&ctx->hotplug_lock); pthread_condattr_destroy(&attr); free(ctx); return (LIBUSB_ERROR_OTHER); } if (pthread_cond_init(&ctx->ctx_cond, &attr) != 0) { pthread_mutex_destroy(&ctx->ctx_lock); + pthread_mutex_destroy(&ctx->hotplug_lock); pthread_condattr_destroy(&attr); free(ctx); return (LIBUSB_ERROR_NO_MEM); @@ -159,10 +169,12 @@ libusb_init(libusb_context **context) pthread_condattr_destroy(&attr); ctx->ctx_handler = NO_THREAD; + ctx->hotplug_handler = NO_THREAD; ret = pipe(ctx->ctrl_pipe); if (ret < 0) { pthread_mutex_destroy(&ctx->ctx_lock); + pthread_mutex_destroy(&ctx->hotplug_lock); pthread_cond_destroy(&ctx->ctx_cond); free(ctx); return (LIBUSB_ERROR_OTHER); @@ -195,12 +207,27 @@ libusb_exit(libusb_context *ctx) if (ctx == NULL) return; + /* stop hotplug thread, if any */ + + if (ctx->hotplug_handler != NO_THREAD) { + pthread_t td; + void *ptr; + + HOTPLUG_LOCK(ctx); + td = ctx->hotplug_handler; + ctx->hotplug_handler = NO_THREAD; + HOTPLUG_UNLOCK(ctx); + + pthread_join(td, &ptr); + } + /* XXX cleanup devices */ libusb10_remove_pollfd(ctx, &ctx->ctx_poll); close(ctx->ctrl_pipe[0]); close(ctx->ctrl_pipe[1]); pthread_mutex_destroy(&ctx->ctx_lock); + pthread_mutex_destroy(&ctx->hotplug_lock); pthread_cond_destroy(&ctx->ctx_cond); pthread_mutex_lock(&default_context_lock); Modified: head/lib/libusb/libusb10.h ============================================================================== --- head/lib/libusb/libusb10.h Wed Jun 22 09:10:52 2016 (r302079) +++ head/lib/libusb/libusb10.h Wed Jun 22 10:38:41 2016 (r302080) @@ -36,6 +36,8 @@ #define CTX_LOCK(ctx) pthread_mutex_lock(&(ctx)->ctx_lock) #define CTX_TRYLOCK(ctx) pthread_mutex_trylock(&(ctx)->ctx_lock) #define CTX_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->ctx_lock) +#define HOTPLUG_LOCK(ctx) pthread_mutex_lock(&(ctx)->hotplug_lock) +#define HOTPLUG_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->hotplug_lock) #define DPRINTF(ctx, dbg, format, args...) do { \ if ((ctx)->debug == dbg) { \ @@ -72,6 +74,16 @@ struct libusb_super_transfer { #define LIBUSB_SUPER_XFER_ST_PEND 1 }; +struct libusb_hotplug_callback_handle { + TAILQ_ENTRY(libusb_hotplug_callback_handle) entry; + int events; + int vendor; + int product; + int devclass; + libusb_hotplug_callback_fn fn; + void *user_data; +}; + struct libusb_context { int debug; int debug_fixed; @@ -80,12 +92,16 @@ struct libusb_context { int tr_done_gen; pthread_mutex_t ctx_lock; + pthread_mutex_t hotplug_lock; pthread_cond_t ctx_cond; + pthread_t hotplug_handler; pthread_t ctx_handler; #define NO_THREAD ((pthread_t)-1) TAILQ_HEAD(, libusb_super_pollfd) pollfds; TAILQ_HEAD(, libusb_super_transfer) tr_done; + TAILQ_HEAD(, libusb_hotplug_callback_handle) hotplug_cbh; + TAILQ_HEAD(, libusb_device) hotplug_devs; struct libusb_super_pollfd ctx_poll; @@ -103,6 +119,8 @@ struct libusb_device { struct libusb_context *ctx; + TAILQ_ENTRY(libusb_device) hotplug_entry; + TAILQ_HEAD(, libusb_super_transfer) tr_head; struct libusb20_device *os_priv; Added: head/lib/libusb/libusb10_hotplug.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libusb/libusb10_hotplug.c Wed Jun 22 10:38:41 2016 (r302080) @@ -0,0 +1,237 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2016 Hans Petter Selasky. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * 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. + */ + +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#define libusb_device_handle libusb20_device + +#include "libusb20.h" +#include "libusb20_desc.h" +#include "libusb20_int.h" +#include "libusb.h" +#include "libusb10.h" + +static int +libusb_hotplug_equal(libusb_device *_adev, libusb_device *_bdev) +{ + struct libusb20_device *adev = _adev->os_priv; + struct libusb20_device *bdev = _bdev->os_priv; + + if (adev->bus_number != bdev->bus_number) + return (0); + if (adev->device_address != bdev->device_address) + return (0); + if (memcmp(&adev->ddesc, &bdev->ddesc, sizeof(adev->ddesc))) + return (0); + if (memcmp(&adev->session_data, &bdev->session_data, sizeof(adev->session_data))) + return (0); + return (1); +} + +static int +libusb_hotplug_filter(libusb_context *ctx, libusb_hotplug_callback_handle pcbh, + libusb_device *dev, libusb_hotplug_event event) +{ + if (!(pcbh->events & event)) + return (0); + if (pcbh->vendor != LIBUSB_HOTPLUG_MATCH_ANY && + pcbh->vendor != libusb20_dev_get_device_desc(dev->os_priv)->idVendor) + return (0); + if (pcbh->product != LIBUSB_HOTPLUG_MATCH_ANY && + pcbh->product != libusb20_dev_get_device_desc(dev->os_priv)->idProduct) + return (0); + if (pcbh->devclass != LIBUSB_HOTPLUG_MATCH_ANY && + pcbh->devclass != libusb20_dev_get_device_desc(dev->os_priv)->bDeviceClass) + return (0); + return (pcbh->fn(ctx, dev, event, pcbh->user_data)); +} + +static void * +libusb_hotplug_scan(void *arg) +{ + TAILQ_HEAD(, libusb_device) hotplug_devs; + libusb_hotplug_callback_handle acbh; + libusb_hotplug_callback_handle bcbh; + libusb_context *ctx = arg; + libusb_device **ppdev; + libusb_device *temp; + libusb_device *adev; + libusb_device *bdev; + unsigned do_loop = 1; + ssize_t count; + ssize_t x; + + while (do_loop) { + usleep(4000000); + + HOTPLUG_LOCK(ctx); + + TAILQ_INIT(&hotplug_devs); + + if (ctx->hotplug_handler != NO_THREAD) { + count = libusb_get_device_list(ctx, &ppdev); + if (count < 0) + continue; + for (x = 0; x != count; x++) { + TAILQ_INSERT_TAIL(&hotplug_devs, ppdev[x], + hotplug_entry); + } + libusb_free_device_list(ppdev, 0); + } else { + do_loop = 0; + } + + /* figure out which devices are gone */ + TAILQ_FOREACH_SAFE(adev, &ctx->hotplug_devs, hotplug_entry, temp) { + TAILQ_FOREACH(bdev, &hotplug_devs, hotplug_entry) { + if (libusb_hotplug_equal(adev, bdev)) + break; + } + if (bdev == NULL) { + TAILQ_REMOVE(&ctx->hotplug_devs, adev, hotplug_entry); + TAILQ_FOREACH_SAFE(acbh, &ctx->hotplug_cbh, entry, bcbh) { + if (libusb_hotplug_filter(ctx, acbh, adev, + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT) == 0) + continue; + TAILQ_REMOVE(&ctx->hotplug_cbh, acbh, entry); + free(acbh); + } + libusb_unref_device(adev); + } + } + + /* figure out which devices are new */ + TAILQ_FOREACH_SAFE(adev, &hotplug_devs, hotplug_entry, temp) { + TAILQ_FOREACH(bdev, &ctx->hotplug_devs, hotplug_entry) { + if (libusb_hotplug_equal(adev, bdev)) + break; + } + if (bdev == NULL) { + TAILQ_REMOVE(&hotplug_devs, adev, hotplug_entry); + TAILQ_INSERT_TAIL(&ctx->hotplug_devs, adev, hotplug_entry); + TAILQ_FOREACH_SAFE(acbh, &ctx->hotplug_cbh, entry, bcbh) { + if (libusb_hotplug_filter(ctx, acbh, adev, + LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) == 0) + continue; + TAILQ_REMOVE(&ctx->hotplug_cbh, acbh, entry); + free(acbh); + } + } + } + HOTPLUG_UNLOCK(ctx); + + /* unref remaining devices */ + while ((adev = TAILQ_FIRST(&hotplug_devs)) != NULL) { + TAILQ_REMOVE(&hotplug_devs, adev, hotplug_entry); + libusb_unref_device(adev); + } + } + return (NULL); +} + +int libusb_hotplug_register_callback(libusb_context *ctx, + libusb_hotplug_event events, libusb_hotplug_flag flags, + int vendor_id, int product_id, int dev_class, + libusb_hotplug_callback_fn cb_fn, void *user_data, + libusb_hotplug_callback_handle *phandle) +{ + libusb_hotplug_callback_handle handle; + struct libusb_device *adev; + + ctx = GET_CONTEXT(ctx); + + if (ctx == NULL || cb_fn == NULL || events == 0 || + vendor_id < -1 || vendor_id > 0xffff || + product_id < -1 || product_id > 0xffff || + dev_class < -1 || dev_class > 0xff) + return (LIBUSB_ERROR_INVALID_PARAM); + + handle = malloc(sizeof(*handle)); + if (handle == NULL) + return (LIBUSB_ERROR_NO_MEM); + + HOTPLUG_LOCK(ctx); + if (ctx->hotplug_handler == NO_THREAD) { + if (pthread_create(&ctx->hotplug_handler, NULL, + &libusb_hotplug_scan, ctx) != 0) + ctx->hotplug_handler = NO_THREAD; + } + handle->events = events; + handle->vendor = vendor_id; + handle->product = product_id; + handle->devclass = dev_class; + handle->fn = cb_fn; + handle->user_data = user_data; + + if (flags & LIBUSB_HOTPLUG_ENUMERATE) { + TAILQ_FOREACH(adev, &ctx->hotplug_devs, hotplug_entry) { + if (libusb_hotplug_filter(ctx, handle, adev, + LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) == 0) + continue; + free(handle); + handle = NULL; + break; + } + } + if (handle != NULL) + TAILQ_INSERT_TAIL(&ctx->hotplug_cbh, handle, entry); + HOTPLUG_UNLOCK(ctx); + + if (phandle != NULL) + *phandle = handle; + return (LIBUSB_SUCCESS); +} + +void libusb_hotplug_deregister_callback(libusb_context *ctx, + libusb_hotplug_callback_handle handle) +{ + ctx = GET_CONTEXT(ctx); + + if (ctx == NULL || handle == NULL) + return; + + HOTPLUG_LOCK(ctx); + TAILQ_REMOVE(&ctx->hotplug_cbh, handle, entry); + HOTPLUG_UNLOCK(ctx); + + free(handle); +} From owner-svn-src-all@freebsd.org Wed Jun 22 11:29:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24E49AC598B; Wed, 22 Jun 2016 11:29:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9F9E2EE2; Wed, 22 Jun 2016 11:29:22 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MBTMxS071428; Wed, 22 Jun 2016 11:29:22 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MBTMun071427; Wed, 22 Jun 2016 11:29:22 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201606221129.u5MBTMun071427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 22 Jun 2016 11:29:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302081 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 11:29:23 -0000 Author: ae Date: Wed Jun 22 11:29:21 2016 New Revision: 302081 URL: https://svnweb.freebsd.org/changeset/base/302081 Log: Fix the NULL pointer dereference for unresolved link layer entries in the netinet6 code. Copy link layer address only when corresponding entry has LLE_VALID flag. PR: 210379 Approved by: re (kib) Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Wed Jun 22 10:38:41 2016 (r302080) +++ head/sys/netinet6/in6.c Wed Jun 22 11:29:21 2016 (r302081) @@ -2322,10 +2322,16 @@ in6_lltable_dump_entry(struct lltable *l sdl = &ndpc.sdl; sdl->sdl_family = AF_LINK; sdl->sdl_len = sizeof(*sdl); - sdl->sdl_alen = ifp->if_addrlen; sdl->sdl_index = ifp->if_index; sdl->sdl_type = ifp->if_type; - bcopy(lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); + if ((lle->la_flags & LLE_VALID) == LLE_VALID) { + sdl->sdl_alen = ifp->if_addrlen; + bcopy(lle->ll_addr, LLADDR(sdl), + ifp->if_addrlen); + } else { + sdl->sdl_alen = 0; + bzero(LLADDR(sdl), ifp->if_addrlen); + } if (lle->la_expire != 0) ndpc.rtm.rtm_rmx.rmx_expire = lle->la_expire + lle->lle_remtime / hz + From owner-svn-src-all@freebsd.org Wed Jun 22 11:45:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02381A7A268; Wed, 22 Jun 2016 11:45:32 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C34351D28; Wed, 22 Jun 2016 11:45:31 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MBjU9a078656; Wed, 22 Jun 2016 11:45:30 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MBjUg1078655; Wed, 22 Jun 2016 11:45:30 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606221145.u5MBjUg1078655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 22 Jun 2016 11:45:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302083 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 11:45:32 -0000 Author: bz Date: Wed Jun 22 11:45:30 2016 New Revision: 302083 URL: https://svnweb.freebsd.org/changeset/base/302083 Log: After r302054 unloading an network interface driver on a kernel without VIMAGE support would dereference a NULL point unconditionally leading to a panic. Wrap the entire VIMAGE related code with #ifdefs rather than just the decision making part to save an extra bit of resources. Reported by: np Sponsored by: The FreeBSD Foundation MFC After: 13 days Approved by: re (marius) Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Jun 22 11:38:26 2016 (r302082) +++ head/sys/net/if.c Wed Jun 22 11:45:30 2016 (r302083) @@ -931,10 +931,13 @@ if_detach_internal(struct ifnet *ifp, in int i; struct domain *dp; struct ifnet *iter; - int found = 0, shutdown; + int found = 0; +#ifdef VIMAGE + int shutdown; shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; +#endif IFNET_WLOCK(); TAILQ_FOREACH(iter, &V_ifnet, if_link) if (iter == ifp) { @@ -987,6 +990,7 @@ if_detach_internal(struct ifnet *ifp, in if_down(ifp); +#ifdef VIMAGE /* * On VNET shutdown abort here as the stack teardown will do all * the work top-down for us. @@ -1001,6 +1005,7 @@ if_detach_internal(struct ifnet *ifp, in */ goto finish_vnet_shutdown; } +#endif /* * At this point we are not tearing down a VNET and are either @@ -1066,7 +1071,9 @@ if_detach_internal(struct ifnet *ifp, in rt_flushifroutes(ifp); +#ifdef VIMAGE finish_vnet_shutdown: +#endif /* * We cannot hold the lock over dom_ifdetach calls as they might * sleep, for example trying to drain a callout, thus open up the From owner-svn-src-all@freebsd.org Wed Jun 22 12:05:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C5DDA7AF21; Wed, 22 Jun 2016 12:05:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DBEA2874; Wed, 22 Jun 2016 12:05:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MC58cd086058; Wed, 22 Jun 2016 12:05:08 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MC58Dc086057; Wed, 22 Jun 2016 12:05:08 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201606221205.u5MC58Dc086057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 22 Jun 2016 12:05:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302084 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 12:05:09 -0000 Author: andrew Date: Wed Jun 22 12:05:08 2016 New Revision: 302084 URL: https://svnweb.freebsd.org/changeset/base/302084 Log: Fix a race when the hardware has raised an exception with an unknown or uncategorised reason. We need to read the fault address register before enabling interrupts as the interrupt handler may cause this register to change. Approved by: re (marius, kib) Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Jun 22 11:45:30 2016 (r302083) +++ head/sys/arm64/arm64/trap.c Wed Jun 22 12:05:08 2016 (r302084) @@ -313,13 +313,11 @@ do_el1h_sync(struct trapframe *frame) * instruction results in an exception with an unknown reason. */ static void -el0_excp_unknown(struct trapframe *frame) +el0_excp_unknown(struct trapframe *frame, uint64_t far) { struct thread *td; - uint64_t far; td = curthread; - far = READ_SPECIALREG(far_el1); call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far); userret(td, frame); } @@ -342,6 +340,7 @@ do_el0_sync(struct trapframe *frame) esr = READ_SPECIALREG(esr_el1); exception = ESR_ELx_EXCEPTION(esr); switch (exception) { + case EXCP_UNKNOWN: case EXCP_INSN_ABORT_L: case EXCP_DATA_ABORT_L: case EXCP_DATA_ABORT: @@ -371,7 +370,7 @@ do_el0_sync(struct trapframe *frame) data_abort(frame, esr, far, 1); break; case EXCP_UNKNOWN: - el0_excp_unknown(frame); + el0_excp_unknown(frame, far); break; case EXCP_SP_ALIGN: call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_sp); From owner-svn-src-all@freebsd.org Wed Jun 22 12:53:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E85E8AC5BF0; Wed, 22 Jun 2016 12:53:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9906242B; Wed, 22 Jun 2016 12:53:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MCrAGX004349; Wed, 22 Jun 2016 12:53:10 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MCrAbx004348; Wed, 22 Jun 2016 12:53:10 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606221253.u5MCrAbx004348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 22 Jun 2016 12:53:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302086 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 12:53:12 -0000 Author: bz Date: Wed Jun 22 12:53:10 2016 New Revision: 302086 URL: https://svnweb.freebsd.org/changeset/base/302086 Log: Add more fields to if_debug.c for ddb(4) 'show ifnet'; resort some fields to match the order in the struct. Especially needed if_pf_kif to do pf(4) VNET debugging. Approved by: re (marius) Obtained from: projects/vnet MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/net/if_debug.c Modified: head/sys/net/if_debug.c ============================================================================== --- head/sys/net/if_debug.c Wed Jun 22 12:12:13 2016 (r302085) +++ head/sys/net/if_debug.c Wed Jun 22 12:53:10 2016 (r302086) @@ -65,6 +65,10 @@ if_show_ifnet(struct ifnet *ifp) IF_DB_PRINTF("%d", if_index_reserved); IF_DB_PRINTF("%p", if_softc); IF_DB_PRINTF("%p", if_l2com); + IF_DB_PRINTF("%p", if_llsoftc); + IF_DB_PRINTF("%d", if_amcount); + IF_DB_PRINTF("%p", if_addr); + IF_DB_PRINTF("%p", if_broadcastaddr); IF_DB_PRINTF("%p", if_afdata); IF_DB_PRINTF("%d", if_afdata_initialized); IF_DB_PRINTF("%u", if_fib); @@ -72,10 +76,13 @@ if_show_ifnet(struct ifnet *ifp) IF_DB_PRINTF("%p", if_home_vnet); IF_DB_PRINTF("%p", if_vlantrunk); IF_DB_PRINTF("%p", if_bpf); - IF_DB_PRINTF("%p", if_addr); - IF_DB_PRINTF("%p", if_llsoftc); - IF_DB_PRINTF("%p", if_label); IF_DB_PRINTF("%u", if_pcount); + IF_DB_PRINTF("%p", if_bridge); + IF_DB_PRINTF("%p", if_lagg); + IF_DB_PRINTF("%p", if_pf_kif); + IF_DB_PRINTF("%p", if_carp); + IF_DB_PRINTF("%p", if_label); + IF_DB_PRINTF("%p", if_netmap); IF_DB_PRINTF("0x%08x", if_flags); IF_DB_PRINTF("0x%08x", if_drv_flags); IF_DB_PRINTF("0x%08x", if_capabilities); From owner-svn-src-all@freebsd.org Wed Jun 22 14:39:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27C7DB69F78; Wed, 22 Jun 2016 14:39:15 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3D772640; Wed, 22 Jun 2016 14:39:14 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MEdE0M042150; Wed, 22 Jun 2016 14:39:14 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MEdE3o042149; Wed, 22 Jun 2016 14:39:14 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201606221439.u5MEdE3o042149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 22 Jun 2016 14:39:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302087 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 14:39:15 -0000 Author: ken Date: Wed Jun 22 14:39:13 2016 New Revision: 302087 URL: https://svnweb.freebsd.org/changeset/base/302087 Log: Fix a bug that caused da(4) peripheral drivers to not fully go away after the underlying device went away. The problem was that callers who queue the GEOM resize provider event didn't check to make sure that the provider had not been withered. For the other equivalent case, g_new_provider_event(), the code checks to see whether the provider has been withered before queueing a g_new_provider_event() to the event thread. In some cases, a resize provider event would come through after the provider had been withered and all of the existing consumers had been orphaned. When the resize event triggered a taste of the provider, that would attach a new consumer to the now withered provider. The wither washer (g_wither_washer() would never be able to completely tear down the GEOM because of the consumers that were hanging around. The solution was to check the G_PF_WITHER provider flag before queueing the g_resize_provider_event(), and add an assert to g_resize_provider_event() to insure that it isn't called on a withered provider. sys/geom/geom_subr.c: In g_resize_provider(), don't try to continue if the G_PF_WITHER flag is set. In g_resize_provider_event(), add an assert that the G_PF_WITHER flag is not set. In g_access(), if a provider has an error, print out the name of the provider with the error. Sponsored by: Spectra Logic Approved by: re (marius) MFC after: 3 days Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Wed Jun 22 12:53:10 2016 (r302086) +++ head/sys/geom/geom_subr.c Wed Jun 22 14:39:13 2016 (r302087) @@ -620,6 +620,8 @@ g_resize_provider_event(void *arg, int f g_free(hh); G_VALID_PROVIDER(pp); + KASSERT(!(pp->flags & G_PF_WITHER), + ("g_resize_provider_event but withered")); g_trace(G_T_TOPOLOGY, "g_resize_provider_event(%p)", pp); LIST_FOREACH_SAFE(cp, &pp->consumers, consumers, cp2) { @@ -662,6 +664,8 @@ g_resize_provider(struct g_provider *pp, struct g_hh00 *hh; G_VALID_PROVIDER(pp); + if (pp->flags & G_PF_WITHER) + return; if (size == pp->mediasize) return; @@ -909,8 +913,11 @@ g_access(struct g_consumer *cp, int dcr, else if (dcw > 0 && pe > 0) return (EPERM); /* If we try to open more but provider is error'ed: fail */ - else if ((dcr > 0 || dcw > 0 || dce > 0) && pp->error != 0) + else if ((dcr > 0 || dcw > 0 || dce > 0) && pp->error != 0) { + printf("%s(%d): provider %s has error\n", + __func__, __LINE__, pp->name); return (pp->error); + } /* Ok then... */ From owner-svn-src-all@freebsd.org Wed Jun 22 15:51:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81C5CAC532E; Wed, 22 Jun 2016 15:51:40 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id 7428A1944; Wed, 22 Jun 2016 15:51:39 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id 7C4E617E46; Wed, 22 Jun 2016 08:46:13 -0700 (PDT) Date: Wed, 22 Jun 2016 08:46:13 -0700 From: hiren panchasara To: "Andrey V. Elsukov" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302081 - head/sys/netinet6 Message-ID: <20160622154613.GR60812@strugglingcoder.info> References: <201606221129.u5MBTMun071427@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3ig5MTpp3LwprTX9" Content-Disposition: inline In-Reply-To: <201606221129.u5MBTMun071427@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 15:51:40 -0000 --3ig5MTpp3LwprTX9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 06/22/16 at 11:29P, Andrey V. Elsukov wrote: > Author: ae > Date: Wed Jun 22 11:29:21 2016 > New Revision: 302081 > URL: https://svnweb.freebsd.org/changeset/base/302081 >=20 > Log: > Fix the NULL pointer dereference for unresolved link layer entries in > the netinet6 code. Copy link layer address only when corresponding entry > has LLE_VALID flag. > =20 > PR: 210379 > Approved by: re (kib) >=20 > Modified: > head/sys/netinet6/in6.c Cursory look tells me that this bug is also present in 10. Is that true? If so, is it possible for you to mfc this? Cheers, Hiren --3ig5MTpp3LwprTX9 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJXarLBXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/lx9MIAKa0ydc/njGrR5i61FZ/eHMW Q+hRfF9Wx+VN0mkscN8WUycSYdSLoIH49IeXEbr/aV10DJNqXvA+LPhhPJnHLeoY 1YRShL83NiKXYDSScDddtEe3agXnDNltnM4GNCpWfGTnLZioxWCtHQN+mAqHPrHn XeiYRhw6luoJ7pkeX+g2/vBYNBPrKXRoK+alq6wL7NpEIIGrJ8qHtSUNEfLEOzs2 kGyBjl2g5Kfhk1xBGPLtyNxRdUK2btErXU0+jqnJlWqta598QZAuPDdJUzA6mIY6 y8S2rPFjg6f6b11RN+66sCAR+pPC7dejQG9PVfFGF9YWZhmHHCO+Jr4UySpIywQ= =zgcR -----END PGP SIGNATURE----- --3ig5MTpp3LwprTX9-- From owner-svn-src-all@freebsd.org Wed Jun 22 19:07:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56A75B721BD; Wed, 22 Jun 2016 19:07:42 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27CF32409; Wed, 22 Jun 2016 19:07:42 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MJ7fw1044888; Wed, 22 Jun 2016 19:07:41 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MJ7fJC044887; Wed, 22 Jun 2016 19:07:41 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606221907.u5MJ7fJC044887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 22 Jun 2016 19:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302088 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 19:07:42 -0000 Author: bdrewery Date: Wed Jun 22 19:07:41 2016 New Revision: 302088 URL: https://svnweb.freebsd.org/changeset/base/302088 Log: WITH_META_MODE: Whitelist 'make kernel-toolchain' Approved by: re (blanket, META_MODE) Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Wed Jun 22 14:39:13 2016 (r302087) +++ head/Makefile Wed Jun 22 19:07:41 2016 (r302088) @@ -150,9 +150,9 @@ TGTS+= ${BITGTS} # the ones that benefit from it. META_TGT_WHITELIST+= \ _* build32 buildfiles buildincludes buildkernel buildsoft \ - buildworld everything kernel-toolchains kernel kernels libraries \ - native-xtools showconfig tinderbox toolchain toolchains universe \ - world worlds xdev xdev-build + buildworld everything kernel-toolchain kernel-toolchains kernel \ + kernels libraries native-xtools showconfig tinderbox toolchain \ + toolchains universe world worlds xdev xdev-build .ORDER: buildworld installworld .ORDER: buildworld distributeworld From owner-svn-src-all@freebsd.org Wed Jun 22 20:15:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F583AC5322; Wed, 22 Jun 2016 20:15:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF4F42672; Wed, 22 Jun 2016 20:15:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MKFcBj071036; Wed, 22 Jun 2016 20:15:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MKFbiA071033; Wed, 22 Jun 2016 20:15:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606222015.u5MKFbiA071033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 22 Jun 2016 20:15:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302089 - in head/sys: sys vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 20:15:39 -0000 Author: kib Date: Wed Jun 22 20:15:37 2016 New Revision: 302089 URL: https://svnweb.freebsd.org/changeset/base/302089 Log: Fix a LOR between vnode locks and allproc_lock. There is an order between covered vnode lock and allproc_lock, which is established by calling mountcheckdirs() while owning the covered vnode lock. mountcheckdirs() iterates over the processes, protected by allproc_lock. This order is needed and seems to be not avoidable. On the other hand, various VM daemons also need to iterate over all processes, and they lock and unlock user maps. Since unlock of the user map may trigger processing of the deferred map entries, it causes vnode locking to occur. Or, when vmspace is freed, dropping references on the vnode-backed object also lock vnodes. We get reverted order comparing with the mount/unmount order. For VM daemons, there is no need to own allproc_lock while we operate on vmspaces. If the process is held, it serves as the marker for allproc list, which allows to continue the iteration. Add _PHOLD_LITE() macro, similar to _PHOLD(), but not causing swap-in of the kernel stacks. It is used instead of _PHOLD() in vm code, since e.g. calling faultin() in OOM conditions only exaggerates the problem. Modernize comment describing PHOLD. Reported by: lists@yamagi.org Tested by: pho (previous version) Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 3 week Approved by: re (gjb) Differential revision: https://reviews.freebsd.org/D6679 Modified: head/sys/sys/proc.h head/sys/vm/vm_glue.c head/sys/vm/vm_pageout.c Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Wed Jun 22 19:07:41 2016 (r302088) +++ head/sys/sys/proc.h Wed Jun 22 20:15:37 2016 (r302089) @@ -827,7 +827,20 @@ extern pid_t pid_max; #define SESS_LOCKED(s) mtx_owned(&(s)->s_mtx) #define SESS_LOCK_ASSERT(s, type) mtx_assert(&(s)->s_mtx, (type)) -/* Hold process U-area in memory, normally for ptrace/procfs work. */ +/* + * Non-zero p_lock ensures that: + * - exit1() is not performed until p_lock reaches zero; + * - the process' threads stack are not swapped out if they are currently + * not (P_INMEM). + * + * PHOLD() asserts that the process (except the current process) is + * not exiting, increments p_lock and swaps threads stacks into memory, + * if needed. + * _PHOLD() is same as PHOLD(), it takes the process locked. + * _PHOLD_LITE() also takes the process locked, but comparing with + * _PHOLD(), it only guarantees that exit1() is not executed, + * faultin() is not called. + */ #define PHOLD(p) do { \ PROC_LOCK(p); \ _PHOLD(p); \ @@ -841,6 +854,12 @@ extern pid_t pid_max; if (((p)->p_flag & P_INMEM) == 0) \ faultin((p)); \ } while (0) +#define _PHOLD_LITE(p) do { \ + PROC_LOCK_ASSERT((p), MA_OWNED); \ + KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc, \ + ("PHOLD of exiting process %p", p)); \ + (p)->p_lock++; \ +} while (0) #define PROC_ASSERT_HELD(p) do { \ KASSERT((p)->p_lock > 0, ("process %p not held", p)); \ } while (0) Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Wed Jun 22 19:07:41 2016 (r302088) +++ head/sys/vm/vm_glue.c Wed Jun 22 20:15:37 2016 (r302089) @@ -863,22 +863,32 @@ retry: struct vmspace *vm; int minslptime = 100000; int slptime; - + + PROC_LOCK(p); /* * Watch out for a process in * creation. It may have no * address space or lock yet. */ - if (p->p_state == PRS_NEW) + if (p->p_state == PRS_NEW) { + PROC_UNLOCK(p); continue; + } /* * An aio daemon switches its * address space while running. * Perform a quick check whether * a process has P_SYSTEM. + * Filter out exiting processes. */ - if ((p->p_flag & P_SYSTEM) != 0) + if ((p->p_flag & (P_SYSTEM | P_WEXIT)) != 0) { + PROC_UNLOCK(p); continue; + } + _PHOLD_LITE(p); + PROC_UNLOCK(p); + sx_sunlock(&allproc_lock); + /* * Do not swapout a process that * is waiting for VM data @@ -893,16 +903,15 @@ retry: */ vm = vmspace_acquire_ref(p); if (vm == NULL) - continue; + goto nextproc2; if (!vm_map_trylock(&vm->vm_map)) goto nextproc1; PROC_LOCK(p); - if (p->p_lock != 0 || - (p->p_flag & (P_STOPPED_SINGLE|P_TRACED|P_SYSTEM|P_WEXIT) - ) != 0) { + if (p->p_lock != 1 || (p->p_flag & (P_STOPPED_SINGLE | + P_TRACED | P_SYSTEM)) != 0) goto nextproc; - } + /* * only aiod changes vmspace, however it will be * skipped because of the if statement above checking @@ -977,12 +986,12 @@ retry: if ((action & VM_SWAP_NORMAL) || ((action & VM_SWAP_IDLE) && (minslptime > swap_idle_threshold2))) { + _PRELE(p); if (swapout(p) == 0) didswap++; PROC_UNLOCK(p); vm_map_unlock(&vm->vm_map); vmspace_free(vm); - sx_sunlock(&allproc_lock); goto retry; } } @@ -991,7 +1000,9 @@ nextproc: vm_map_unlock(&vm->vm_map); nextproc1: vmspace_free(vm); - continue; +nextproc2: + sx_slock(&allproc_lock); + PRELE(p); } sx_sunlock(&allproc_lock); /* Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Wed Jun 22 19:07:41 2016 (r302088) +++ head/sys/vm/vm_pageout.c Wed Jun 22 20:15:37 2016 (r302089) @@ -1485,19 +1485,21 @@ vm_pageout_oom(int shortage) PROC_UNLOCK(p); continue; } - _PHOLD(p); + _PHOLD_LITE(p); + PROC_UNLOCK(p); + sx_sunlock(&allproc_lock); if (!vm_map_trylock_read(&vm->vm_map)) { - _PRELE(p); - PROC_UNLOCK(p); vmspace_free(vm); + sx_slock(&allproc_lock); + PRELE(p); continue; } - PROC_UNLOCK(p); size = vmspace_swap_count(vm); if (shortage == VM_OOM_MEM) size += vm_pageout_oom_pagecount(vm); vm_map_unlock_read(&vm->vm_map); vmspace_free(vm); + sx_slock(&allproc_lock); /* * If this process is bigger than the biggest one, @@ -1812,9 +1814,13 @@ again: if ((p->p_flag & P_INMEM) == 0) limit = 0; /* XXX */ vm = vmspace_acquire_ref(p); + _PHOLD_LITE(p); PROC_UNLOCK(p); - if (vm == NULL) + if (vm == NULL) { + PRELE(p); continue; + } + sx_sunlock(&allproc_lock); size = vmspace_resident_count(vm); if (size >= limit) { @@ -1859,6 +1865,8 @@ again: } #endif vmspace_free(vm); + sx_slock(&allproc_lock); + PRELE(p); } sx_sunlock(&allproc_lock); if (tryagain != 0 && attempts <= 10) From owner-svn-src-all@freebsd.org Wed Jun 22 20:31:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AF9AAC5835; Wed, 22 Jun 2016 20:31:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14D7711F8; Wed, 22 Jun 2016 20:31:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MKVotI077834; Wed, 22 Jun 2016 20:31:50 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MKVo2r077832; Wed, 22 Jun 2016 20:31:50 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606222031.u5MKVo2r077832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 22 Jun 2016 20:31:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302090 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 20:31:51 -0000 Author: bdrewery Date: Wed Jun 22 20:31:49 2016 New Revision: 302090 URL: https://svnweb.freebsd.org/changeset/base/302090 Log: Add AFLAGS.IMPSRC and document A[C]FLAGS Approved by: re (gjb) Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/bsd.README head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.README ============================================================================== --- head/share/mk/bsd.README Wed Jun 22 20:15:37 2016 (r302089) +++ head/share/mk/bsd.README Wed Jun 22 20:31:49 2016 (r302090) @@ -120,6 +120,8 @@ object. The following variables are common: +AFLAGS.${SRC} + Flags dependent on source file name. ACFLAGS.${SRC} Flags dependent on source file name. CFLAGS.${SRC} @@ -255,6 +257,11 @@ It has seven targets: It sets/uses the following variables: +AFLAGS Flags to the assembler when assembling .s files. + +ACFLAGS Flags to the compiler when preprocessing and + assembling .S files. + BINGRP Binary group. BINOWN Binary owner. Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Wed Jun 22 20:15:37 2016 (r302089) +++ head/share/mk/bsd.sys.mk Wed Jun 22 20:31:49 2016 (r302090) @@ -174,6 +174,7 @@ CFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} CFLAGS+= ${CFLAGS.${COMPILER_TYPE}} CXXFLAGS+= ${CXXFLAGS.${COMPILER_TYPE}} +AFLAGS+= ${AFLAGS.${.IMPSRC:T}} ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}} CFLAGS+= ${CFLAGS.${.IMPSRC:T}} CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}} From owner-svn-src-all@freebsd.org Wed Jun 22 21:00:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B1EDAC5EF1; Wed, 22 Jun 2016 21:00:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE7E92178; Wed, 22 Jun 2016 21:00:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5ML0T91086310; Wed, 22 Jun 2016 21:00:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5ML0TRd086309; Wed, 22 Jun 2016 21:00:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201606222100.u5ML0TRd086309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 22 Jun 2016 21:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302091 - head/sys/geom/mirror X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 21:00:30 -0000 Author: markj Date: Wed Jun 22 21:00:28 2016 New Revision: 302091 URL: https://svnweb.freebsd.org/changeset/base/302091 Log: Do not complete pending gmirror BIOs when tearing down the provider. This will result in lock recursion and is more generally incorrect since the completion handlers will just reinsert the BIOs into the queue we're trying to drain. Reviewed by: imp, ngie Approved by: re (gjb) MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6908 Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Wed Jun 22 20:31:49 2016 (r302090) +++ head/sys/geom/mirror/g_mirror.c Wed Jun 22 21:00:28 2016 (r302091) @@ -2121,8 +2121,21 @@ g_mirror_destroy_provider(struct g_mirro g_topology_lock(); g_error_provider(sc->sc_provider, ENXIO); mtx_lock(&sc->sc_queue_mtx); - while ((bp = bioq_takefirst(&sc->sc_queue)) != NULL) - g_io_deliver(bp, ENXIO); + while ((bp = bioq_takefirst(&sc->sc_queue)) != NULL) { + /* + * Abort any pending I/O that wasn't generated by us. + * Synchronization requests and requests destined for individual + * mirror components can be destroyed immediately. + */ + if (bp->bio_to == sc->sc_provider && + bp->bio_from->geom != sc->sc_sync.ds_geom) { + g_io_deliver(bp, ENXIO); + } else { + if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_SYNC) != 0) + free(bp->bio_data, M_MIRROR); + g_destroy_bio(bp); + } + } mtx_unlock(&sc->sc_queue_mtx); G_MIRROR_DEBUG(0, "Device %s: provider %s destroyed.", sc->sc_name, sc->sc_provider->name); From owner-svn-src-all@freebsd.org Wed Jun 22 21:11:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BA3CB722DF; Wed, 22 Jun 2016 21:11:29 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A53528EE; Wed, 22 Jun 2016 21:11:29 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MLBSAC090839; Wed, 22 Jun 2016 21:11:28 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MLBRHn090827; Wed, 22 Jun 2016 21:11:27 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201606222111.u5MLBRHn090827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 22 Jun 2016 21:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302092 - in head/lib/libc: aarch64/sys amd64/sys arm/sys i386/sys mips/sys powerpc/sys powerpc64/sys riscv/sys sparc64/sys sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 21:11:29 -0000 Author: brooks Date: Wed Jun 22 21:11:27 2016 New Revision: 302092 URL: https://svnweb.freebsd.org/changeset/base/302092 Log: Replace use of the pipe(2) system call with pipe2(2) with a zero flags value. This eliminates the need for machine dependant assembly wrappers for pipe(2). It also make passing an invalid address to pipe(2) return EFAULT rather than triggering a segfault. Document this behavior (which was already true for pipe2(2), but undocumented). Reviewed by: andrew Approved by: re (gjb) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D6815 Added: head/lib/libc/sys/pipe.c (contents, props changed) Deleted: head/lib/libc/aarch64/sys/pipe.S head/lib/libc/amd64/sys/pipe.S head/lib/libc/arm/sys/pipe.S head/lib/libc/i386/sys/pipe.S head/lib/libc/mips/sys/pipe.S head/lib/libc/powerpc/sys/pipe.S head/lib/libc/powerpc64/sys/pipe.S head/lib/libc/riscv/sys/pipe.S head/lib/libc/sparc64/sys/pipe.S Modified: head/lib/libc/aarch64/sys/Makefile.inc head/lib/libc/amd64/sys/Makefile.inc head/lib/libc/arm/sys/Makefile.inc head/lib/libc/i386/sys/Makefile.inc head/lib/libc/mips/sys/Makefile.inc head/lib/libc/powerpc/sys/Makefile.inc head/lib/libc/powerpc64/sys/Makefile.inc head/lib/libc/riscv/sys/Makefile.inc head/lib/libc/sparc64/sys/Makefile.inc head/lib/libc/sys/Makefile.inc head/lib/libc/sys/pipe.2 Modified: head/lib/libc/aarch64/sys/Makefile.inc ============================================================================== --- head/lib/libc/aarch64/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/aarch64/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -6,7 +6,6 @@ SRCS+= __vdso_gettc.c #MDASM= ptrace.S MDASM= cerror.S \ - pipe.S \ shmat.S \ sigreturn.S \ syscall.S \ Modified: head/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- head/lib/libc/amd64/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/amd64/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -4,7 +4,7 @@ SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \ amd64_set_gsbase.c __vdso_gettc.c -MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ +MDASM= vfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \ sbrk.S setlogin.S sigreturn.S # Don't generate default code for these syscalls: Modified: head/lib/libc/arm/sys/Makefile.inc ============================================================================== --- head/lib/libc/arm/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/arm/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -2,7 +2,7 @@ SRCS+= __vdso_gettc.c -MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S +MDASM= Ovfork.S brk.S cerror.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S # Don't generate default code for these syscalls: NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o Modified: head/lib/libc/i386/sys/Makefile.inc ============================================================================== --- head/lib/libc/i386/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/i386/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -8,7 +8,7 @@ SRCS+= i386_get_fsbase.c i386_get_gsbase i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c \ __vdso_gettc.c -MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ +MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \ sbrk.S setlogin.S sigreturn.S syscall.S # Don't generate default code for these syscalls: Modified: head/lib/libc/mips/sys/Makefile.inc ============================================================================== --- head/lib/libc/mips/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/mips/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -3,7 +3,7 @@ SRCS+= trivial-vdso_tc.c MDASM= Ovfork.S brk.S cerror.S exect.S \ - pipe.S ptrace.S sbrk.S syscall.S + ptrace.S sbrk.S syscall.S # Don't generate default code for these syscalls: NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o Modified: head/lib/libc/powerpc/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpc/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/powerpc/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -1,6 +1,6 @@ # $FreeBSD$ -MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S +MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S # Don't generate default code for these syscalls: NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o Modified: head/lib/libc/powerpc64/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpc64/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/powerpc64/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -1,6 +1,6 @@ # $FreeBSD$ -MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S +MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S # Don't generate default code for these syscalls: NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o Modified: head/lib/libc/riscv/sys/Makefile.inc ============================================================================== --- head/lib/libc/riscv/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/riscv/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -4,7 +4,6 @@ SRCS+= trivial-vdso_tc.c #MDASM= ptrace.S MDASM= cerror.S \ - pipe.S \ shmat.S \ sigreturn.S \ syscall.S \ Modified: head/lib/libc/sparc64/sys/Makefile.inc ============================================================================== --- head/lib/libc/sparc64/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/sparc64/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -12,7 +12,7 @@ SRCS+= __sparc_sigtramp_setup.c \ CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu -MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S +MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S sigaction1.S # Don't generate default code for these syscalls: NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/sys/Makefile.inc Wed Jun 22 21:11:27 2016 (r302092) @@ -28,6 +28,8 @@ SRCS+= futimens.c utimensat.c NOASM+= futimens.o utimensat.o PSEUDO+= _futimens.o _utimensat.o +SRCS+= pipe.c + INTERPOSED = \ accept \ accept4 \ Modified: head/lib/libc/sys/pipe.2 ============================================================================== --- head/lib/libc/sys/pipe.2 Wed Jun 22 21:00:28 2016 (r302091) +++ head/lib/libc/sys/pipe.2 Wed Jun 22 21:11:27 2016 (r302092) @@ -28,7 +28,7 @@ .\" @(#)pipe.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 1, 2013 +.Dd June 22, 2016 .Dt PIPE 2 .Os .Sh NAME @@ -118,6 +118,9 @@ and .Fn pipe2 system calls will fail if: .Bl -tag -width Er +.It Bq Er EFAULT +.Ar fildes +argument points to an invalid memory location. .It Bq Er EMFILE Too many descriptors are active. .It Bq Er ENFILE Added: head/lib/libc/sys/pipe.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/pipe.c Wed Jun 22 21:11:27 2016 (r302092) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2016 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include + +__weak_reference(__sys_pipe, pipe); +__weak_reference(__sys_pipe, _pipe); + +extern int __sys_pipe2(int fildes[2], int flags); + +int +__sys_pipe(int fildes[2]) +{ + + return (__sys_pipe2(fildes, 0)); +} From owner-svn-src-all@freebsd.org Wed Jun 22 21:12:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 270F6B724BB; Wed, 22 Jun 2016 21:12:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 021522CDC; Wed, 22 Jun 2016 21:12:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MLCs87093490; Wed, 22 Jun 2016 21:12:54 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MLCse9093489; Wed, 22 Jun 2016 21:12:54 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201606222112.u5MLCse9093489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 22 Jun 2016 21:12:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302093 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 21:12:55 -0000 Author: brooks Date: Wed Jun 22 21:12:53 2016 New Revision: 302093 URL: https://svnweb.freebsd.org/changeset/base/302093 Log: Add support for COMPAT10 keywords in syscalls.master. Approved by: re (gjb) Sponsored by: DARPA, AFRL Modified: head/sys/kern/makesyscalls.sh Modified: head/sys/kern/makesyscalls.sh ============================================================================== --- head/sys/kern/makesyscalls.sh Wed Jun 22 21:11:27 2016 (r302092) +++ head/sys/kern/makesyscalls.sh Wed Jun 22 21:12:53 2016 (r302093) @@ -9,6 +9,7 @@ compat=COMPAT_43 compat4=COMPAT_FREEBSD4 compat6=COMPAT_FREEBSD6 compat7=COMPAT_FREEBSD7 +compat10=COMPAT_FREEBSD10 # output files: sysnames="syscalls.c" @@ -33,6 +34,8 @@ syscompat6="sysent.compat6.$$" syscompat6dcl="sysent.compat6dcl.$$" syscompat7="sysent.compat7.$$" syscompat7dcl="sysent.compat7dcl.$$" +syscompat10="sysent.compat10.$$" +syscompat10dcl="sysent.compat10dcl.$$" sysent="sysent.switch.$$" sysinc="sysinc.switch.$$" sysarg="sysarg.switch.$$" @@ -47,9 +50,9 @@ else capenabled="" fi -trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp $systraceret" 0 +trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 $syscompat10dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp $systraceret" 0 -touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp $systraceret +touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 $syscompat10dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp $systraceret case $# in 0) echo "usage: $0 input-file " 1>&2 @@ -88,6 +91,8 @@ s/\$//g syscompat6dcl = \"$syscompat6dcl\" syscompat7 = \"$syscompat7\" syscompat7dcl = \"$syscompat7dcl\" + syscompat10 = \"$syscompat10\" + syscompat10dcl = \"$syscompat10dcl\" sysent = \"$sysent\" syssw = \"$syssw\" sysinc = \"$sysinc\" @@ -102,6 +107,7 @@ s/\$//g compat4 = \"$compat4\" compat6 = \"$compat6\" compat7 = \"$compat7\" + compat10 = \"$compat10\" syscallprefix = \"$syscallprefix\" switchname = \"$switchname\" namesname = \"$namesname\" @@ -123,6 +129,7 @@ s/\$//g printf "\n#ifdef %s\n\n", compat4 > syscompat4 printf "\n#ifdef %s\n\n", compat6 > syscompat6 printf "\n#ifdef %s\n\n", compat7 > syscompat7 + printf "\n#ifdef %s\n\n", compat10 > syscompat10 printf "/*\n * System call names.\n *\n" > sysnames printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames @@ -206,6 +213,7 @@ s/\$//g print > syscompat4 print > syscompat6 print > syscompat7 + print > syscompat10 print > sysnames print > systrace print > systracetmp @@ -221,6 +229,7 @@ s/\$//g print > syscompat4 print > syscompat6 print > syscompat7 + print > syscompat10 print > sysnames print > systrace print > systracetmp @@ -236,6 +245,7 @@ s/\$//g print > syscompat4 print > syscompat6 print > syscompat7 + print > syscompat10 print > sysnames print > systrace print > systracetmp @@ -342,6 +352,8 @@ s/\$//g argalias = "freebsd6_" argalias if (flag("COMPAT7")) argalias = "freebsd7_" argalias + if (flag("COMPAT10")) + argalias = "freebsd10_" argalias } f++ @@ -493,7 +505,7 @@ s/\$//g next } type("COMPAT") || type("COMPAT4") || type("COMPAT6") || \ - type("COMPAT7") { + type("COMPAT7") || type("COMPAT10") { if (flag("COMPAT")) { ncompat++ out = syscompat @@ -522,6 +534,13 @@ s/\$//g wrap = "compat7" prefix = "freebsd7_" descr = "freebsd7" + } else if (flag("COMPAT10")) { + ncompat10++ + out = syscompat10 + outdcl = syscompat10dcl + wrap = "compat10" + prefix = "freebsd10_" + descr = "freebsd10" } parseline() if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \ @@ -559,7 +578,8 @@ s/\$//g printf("/* %d = %s %s */\n", syscall, descr, funcalias) > sysent printf("\t\"%s.%s\",\t\t/* %d = %s %s */\n", wrap, funcalias, syscall, descr, funcalias) > sysnames - if (flag("COMPAT") || flag("COMPAT4") || flag("COMPAT6")) { + # XXX-BD: why no COMPAT7? + if (flag("COMPAT") || flag("COMPAT4") || flag("COMPAT6") || flag("COMPAT10")) { printf("\t\t\t\t/* %d is %s %s */\n", syscall, descr, funcalias) > syshdr } else if (!flag("NODEF")) { @@ -596,7 +616,7 @@ s/\$//g END { printf "\n#define AS(name) (sizeof(struct name) / sizeof(register_t))\n" > sysinc - if (ncompat != 0 || ncompat4 != 0 || ncompat6 != 0 || ncompat7 != 0) + if (ncompat != 0 || ncompat4 != 0 || ncompat6 != 0 || ncompat7 != 0 || ncompat10 != 0) printf "#include \"opt_compat.h\"\n\n" > syssw if (ncompat != 0) { @@ -630,11 +650,18 @@ s/\$//g printf "#define compat7(n, name) 0, (sy_call_t *)nosys\n" > sysinc printf "#endif\n" > sysinc } - + if (ncompat10 != 0) { + printf "\n#ifdef %s\n", compat10 > sysinc + printf "#define compat10(n, name) n, (sy_call_t *)__CONCAT(freebsd10_,name)\n" > sysinc + printf "#else\n" > sysinc + printf "#define compat10(n, name) 0, (sy_call_t *)nosys\n" > sysinc + printf "#endif\n" > sysinc + } printf("\n#endif /* %s */\n\n", compat) > syscompatdcl printf("\n#endif /* %s */\n\n", compat4) > syscompat4dcl printf("\n#endif /* %s */\n\n", compat6) > syscompat6dcl printf("\n#endif /* %s */\n\n", compat7) > syscompat7dcl + printf("\n#endif /* %s */\n\n", compat10) > syscompat10dcl printf("\n#undef PAD_\n") > sysprotoend printf("#undef PADL_\n") > sysprotoend @@ -657,6 +684,7 @@ cat $sysarg $sysdcl \ $syscompat4 $syscompat4dcl \ $syscompat6 $syscompat6dcl \ $syscompat7 $syscompat7dcl \ + $syscompat10 $syscompat10dcl \ $sysaue $sysprotoend > $sysproto cat $systracetmp >> $systrace cat $systraceret >> $systrace From owner-svn-src-all@freebsd.org Wed Jun 22 21:16:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4373B725A9; Wed, 22 Jun 2016 21:16:00 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B9662EC8; Wed, 22 Jun 2016 21:16:00 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MLFx8F093630; Wed, 22 Jun 2016 21:15:59 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MLFxBD093628; Wed, 22 Jun 2016 21:15:59 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201606222115.u5MLFxBD093628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 22 Jun 2016 21:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302094 - in head/sys: compat/freebsd32 kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 21:16:00 -0000 Author: brooks Date: Wed Jun 22 21:15:59 2016 New Revision: 302094 URL: https://svnweb.freebsd.org/changeset/base/302094 Log: Mark the pipe() system call as COMPAT10. As of r302092 libc uses pipe2() with a zero flags value instead of pipe(). Commit with regenerated files and implementation to follow. Approved by: re (gjb) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D6816 Modified: head/sys/compat/freebsd32/syscalls.master head/sys/kern/syscalls.master Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Wed Jun 22 21:12:53 2016 (r302093) +++ head/sys/compat/freebsd32/syscalls.master Wed Jun 22 21:15:59 2016 (r302094) @@ -29,6 +29,7 @@ ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) ; COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat) ; COMPAT7 included on COMPAT7 #ifdef (FreeBSD 7 compat) +; COMPAT10 included on COMPAT10 #ifdef (FreeBSD 10 compat) ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only ; NOSTD implemented but as a lkm that can be statically @@ -124,7 +125,7 @@ 40 AUE_LSTAT COMPAT { int freebsd32_lstat(char *path, \ struct ostat *ub); } 41 AUE_DUP NOPROTO { int dup(u_int fd); } -42 AUE_PIPE NOPROTO { int pipe(void); } +42 AUE_PIPE COMPAT10 { int freebsd32_pipe(void); } 43 AUE_GETEGID NOPROTO { gid_t getegid(void); } 44 AUE_PROFILE NOPROTO { int profil(caddr_t samples, size_t size, \ size_t offset, u_int scale); } Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed Jun 22 21:12:53 2016 (r302093) +++ head/sys/kern/syscalls.master Wed Jun 22 21:15:59 2016 (r302094) @@ -28,6 +28,7 @@ ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) ; COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat) ; COMPAT7 included on COMPAT7 #ifdef (FreeBSD 7 compat) +; COMPAT10 included on COMPAT7 #ifdef (FreeBSD 10 compat) ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only ; NOSTD implemented but as a lkm that can be statically @@ -123,7 +124,7 @@ 39 AUE_GETPPID STD { pid_t getppid(void); } 40 AUE_LSTAT COMPAT { int lstat(char *path, struct ostat *ub); } 41 AUE_DUP STD { int dup(u_int fd); } -42 AUE_PIPE STD { int pipe(void); } +42 AUE_PIPE COMPAT10 { int pipe(void); } 43 AUE_GETEGID STD { gid_t getegid(void); } 44 AUE_PROFILE STD { int profil(caddr_t samples, size_t size, \ size_t offset, u_int scale); } From owner-svn-src-all@freebsd.org Wed Jun 22 21:18:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36DB2B72622; Wed, 22 Jun 2016 21:18:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 012051158; Wed, 22 Jun 2016 21:18:21 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MLILgX093761; Wed, 22 Jun 2016 21:18:21 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MLIJjQ093748; Wed, 22 Jun 2016 21:18:19 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201606222118.u5MLIJjQ093748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 22 Jun 2016 21:18:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302095 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 21:18:22 -0000 Author: brooks Date: Wed Jun 22 21:18:19 2016 New Revision: 302095 URL: https://svnweb.freebsd.org/changeset/base/302095 Log: Generate syscall tables and update pipe() implementation after r302094. Mark the pipe() system call as COMPAT10. As of r302092 libc uses pipe2() with a zero flags value instead of pipe(). Approved by: re (gjb) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D6816 Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/sys_pipe.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/compat/freebsd32/freebsd32_misc.c Wed Jun 22 21:18:19 2016 (r302095) @@ -272,6 +272,15 @@ freebsd4_freebsd32_getfsstat(struct thre } #endif +#ifdef COMPAT_FREEBSD10 +int +freebsd10_freebsd32_pipe(struct thread *td, + struct freebsd10_freebsd32_pipe_args *uap) { + + return (freebsd10_pipe(td, (struct freebsd10_pipe_args*)uap)); +} +#endif + int freebsd32_sigaltstack(struct thread *td, struct freebsd32_sigaltstack_args *uap) Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/compat/freebsd32/freebsd32_proto.h Wed Jun 22 21:18:19 2016 (r302095) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 296572 2016-03-09 19:05:11Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -61,6 +61,9 @@ struct freebsd32_recvfrom_args { char from_l_[PADL_(uint32_t)]; uint32_t from; char from_r_[PADR_(uint32_t)]; char fromlenaddr_l_[PADL_(uint32_t)]; uint32_t fromlenaddr; char fromlenaddr_r_[PADR_(uint32_t)]; }; +struct freebsd10_freebsd32_pipe_args { + register_t dummy; +}; struct ofreebsd32_sigpending_args { register_t dummy; }; @@ -1099,6 +1102,28 @@ int freebsd7_freebsd32_shmctl(struct thr #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + +#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) +#define PAD64_REQUIRED +#endif +#ifdef PAD64_REQUIRED +#else +#endif +#ifdef PAD64_REQUIRED +#else +#endif +#ifdef PAD64_REQUIRED +#else +#endif +#ifdef PAD64_REQUIRED +#else +#endif +int freebsd10_freebsd32_pipe(struct thread *, struct freebsd10_freebsd32_pipe_args *); + +#endif /* COMPAT_FREEBSD10 */ + #define FREEBSD32_SYS_AUE_freebsd32_wait4 AUE_WAIT4 #define FREEBSD32_SYS_AUE_freebsd4_freebsd32_getfsstat AUE_GETFSSTAT #define FREEBSD32_SYS_AUE_ofreebsd32_lseek AUE_LSEEK @@ -1107,6 +1132,7 @@ int freebsd7_freebsd32_shmctl(struct thr #define FREEBSD32_SYS_AUE_freebsd32_recvfrom AUE_RECVFROM #define FREEBSD32_SYS_AUE_ofreebsd32_stat AUE_STAT #define FREEBSD32_SYS_AUE_ofreebsd32_lstat AUE_LSTAT +#define FREEBSD32_SYS_AUE_freebsd10_freebsd32_pipe AUE_PIPE #define FREEBSD32_SYS_AUE_ofreebsd32_sigaction AUE_SIGACTION #define FREEBSD32_SYS_AUE_ofreebsd32_sigprocmask AUE_SIGPROCMASK #define FREEBSD32_SYS_AUE_ofreebsd32_sigpending AUE_SIGPENDING Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Wed Jun 22 21:18:19 2016 (r302095) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 296572 2016-03-09 19:05:11Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #define FREEBSD32_SYS_syscall 0 @@ -48,7 +48,7 @@ #define FREEBSD32_SYS_getppid 39 /* 40 is old freebsd32_lstat */ #define FREEBSD32_SYS_dup 41 -#define FREEBSD32_SYS_pipe 42 + /* 42 is freebsd10 freebsd32_pipe */ #define FREEBSD32_SYS_getegid 43 #define FREEBSD32_SYS_profil 44 #define FREEBSD32_SYS_ktrace 45 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Jun 22 21:18:19 2016 (r302095) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 296572 2016-03-09 19:05:11Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ const char *freebsd32_syscallnames[] = { @@ -52,7 +52,7 @@ const char *freebsd32_syscallnames[] = { "getppid", /* 39 = getppid */ "compat.freebsd32_lstat", /* 40 = old freebsd32_lstat */ "dup", /* 41 = dup */ - "pipe", /* 42 = pipe */ + "compat10.freebsd32_pipe", /* 42 = freebsd10 freebsd32_pipe */ "getegid", /* 43 = getegid */ "profil", /* 44 = profil */ "ktrace", /* 45 = ktrace */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Wed Jun 22 21:18:19 2016 (r302095) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 296572 2016-03-09 19:05:11Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #include "opt_compat.h" @@ -42,6 +42,12 @@ #define compat7(n, name) 0, (sy_call_t *)nosys #endif +#ifdef COMPAT_FREEBSD10 +#define compat10(n, name) n, (sy_call_t *)__CONCAT(freebsd10_,name) +#else +#define compat10(n, name) 0, (sy_call_t *)nosys +#endif + /* The casts are bogus but will do for now. */ struct sysent freebsd32_sysent[] = { #if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) @@ -89,7 +95,7 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)sys_getppid, AUE_GETPPID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 39 = getppid */ { compat(AS(ofreebsd32_lstat_args),freebsd32_lstat), AUE_LSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 40 = old freebsd32_lstat */ { AS(dup_args), (sy_call_t *)sys_dup, AUE_DUP, NULL, 0, 0, 0, SY_THR_STATIC }, /* 41 = dup */ - { 0, (sy_call_t *)sys_pipe, AUE_PIPE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 42 = pipe */ + { compat10(0,freebsd32_pipe), AUE_PIPE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 42 = freebsd10 freebsd32_pipe */ { 0, (sy_call_t *)sys_getegid, AUE_GETEGID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 43 = getegid */ { AS(profil_args), (sy_call_t *)sys_profil, AUE_PROFILE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 44 = profil */ { AS(ktrace_args), (sy_call_t *)sys_ktrace, AUE_KTRACE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 45 = ktrace */ Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Jun 22 21:18:19 2016 (r302095) @@ -293,11 +293,6 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } - /* pipe */ - case 42: { - *n_args = 0; - break; - } /* getegid */ case 43: { *n_args = 0; @@ -3768,9 +3763,6 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; - /* pipe */ - case 42: - break; /* getegid */ case 43: break; @@ -9083,8 +9075,6 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; - /* pipe */ - case 42: /* getegid */ case 43: /* profil */ Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/kern/init_sysent.c Wed Jun 22 21:18:19 2016 (r302095) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #include "opt_compat.h" @@ -38,6 +38,12 @@ #define compat7(n, name) 0, (sy_call_t *)nosys #endif +#ifdef COMPAT_FREEBSD10 +#define compat10(n, name) n, (sy_call_t *)__CONCAT(freebsd10_,name) +#else +#define compat10(n, name) 0, (sy_call_t *)nosys +#endif + /* The casts are bogus but will do for now. */ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 0 = syscall */ @@ -82,7 +88,7 @@ struct sysent sysent[] = { { 0, (sy_call_t *)sys_getppid, AUE_GETPPID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = getppid */ { compat(AS(olstat_args),lstat), AUE_LSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 40 = old lstat */ { AS(dup_args), (sy_call_t *)sys_dup, AUE_DUP, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = dup */ - { 0, (sy_call_t *)sys_pipe, AUE_PIPE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = pipe */ + { compat10(0,pipe), AUE_PIPE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = freebsd10 pipe */ { 0, (sy_call_t *)sys_getegid, AUE_GETEGID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = getegid */ { AS(profil_args), (sy_call_t *)sys_profil, AUE_PROFILE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = profil */ { AS(ktrace_args), (sy_call_t *)sys_ktrace, AUE_KTRACE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 45 = ktrace */ Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/kern/sys_pipe.c Wed Jun 22 21:18:19 2016 (r302095) @@ -89,6 +89,8 @@ * in the structure may have changed. */ +#include "opt_compat.h" + #include __FBSDID("$FreeBSD$"); @@ -445,9 +447,10 @@ kern_pipe(struct thread *td, int fildes[ return (0); } +#ifdef COMPAT_FREEBSD10 /* ARGSUSED */ int -sys_pipe(struct thread *td, struct pipe_args *uap) +freebsd10_pipe(struct thread *td, struct freebsd10_pipe_args *uap __unused) { int error; int fildes[2]; @@ -461,6 +464,7 @@ sys_pipe(struct thread *td, struct pipe_ return (0); } +#endif int sys_pipe2(struct thread *td, struct pipe2_args *uap) Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/kern/syscalls.c Wed Jun 22 21:18:19 2016 (r302095) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ const char *syscallnames[] = { @@ -49,7 +49,7 @@ const char *syscallnames[] = { "getppid", /* 39 = getppid */ "compat.lstat", /* 40 = old lstat */ "dup", /* 41 = dup */ - "pipe", /* 42 = pipe */ + "compat10.pipe", /* 42 = freebsd10 pipe */ "getegid", /* 43 = getegid */ "profil", /* 44 = profil */ "ktrace", /* 45 = ktrace */ Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/kern/systrace_args.c Wed Jun 22 21:18:19 2016 (r302095) @@ -290,11 +290,6 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } - /* pipe */ - case 42: { - *n_args = 0; - break; - } /* getegid */ case 43: { *n_args = 0; @@ -3775,9 +3770,6 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; - /* pipe */ - case 42: - break; /* getegid */ case 43: break; @@ -9040,8 +9032,6 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; - /* pipe */ - case 42: /* getegid */ case 43: /* profil */ Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/sys/syscall.h Wed Jun 22 21:18:19 2016 (r302095) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #define SYS_syscall 0 @@ -48,7 +48,7 @@ #define SYS_getppid 39 /* 40 is old lstat */ #define SYS_dup 41 -#define SYS_pipe 42 + /* 42 is freebsd10 pipe */ #define SYS_getegid 43 #define SYS_profil 44 #define SYS_ktrace 45 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/sys/syscall.mk Wed Jun 22 21:18:19 2016 (r302095) @@ -1,7 +1,7 @@ # FreeBSD system call object files. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb +# created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks MIASM = \ syscall.o \ exit.o \ @@ -39,7 +39,6 @@ MIASM = \ kill.o \ getppid.o \ dup.o \ - pipe.o \ getegid.o \ profil.o \ ktrace.o \ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Wed Jun 22 21:15:59 2016 (r302094) +++ head/sys/sys/sysproto.h Wed Jun 22 21:18:19 2016 (r302095) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 21:37:33Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 302094 2016-06-22 21:15:59Z brooks */ #ifndef _SYS_SYSPROTO_H_ @@ -183,7 +183,7 @@ struct getppid_args { struct dup_args { char fd_l_[PADL_(u_int)]; u_int fd; char fd_r_[PADR_(u_int)]; }; -struct pipe_args { +struct freebsd10_pipe_args { register_t dummy; }; struct getegid_args { @@ -1824,7 +1824,6 @@ int sys_sync(struct thread *, struct syn int sys_kill(struct thread *, struct kill_args *); int sys_getppid(struct thread *, struct getppid_args *); int sys_dup(struct thread *, struct dup_args *); -int sys_pipe(struct thread *, struct pipe_args *); int sys_getegid(struct thread *, struct getegid_args *); int sys_profil(struct thread *, struct profil_args *); int sys_ktrace(struct thread *, struct ktrace_args *); @@ -2499,6 +2498,13 @@ int freebsd7_shmctl(struct thread *, str #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + +int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *); + +#endif /* COMPAT_FREEBSD10 */ + #define SYS_AUE_syscall AUE_NULL #define SYS_AUE_exit AUE_EXIT #define SYS_AUE_fork AUE_FORK @@ -2540,7 +2546,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_getppid AUE_GETPPID #define SYS_AUE_olstat AUE_LSTAT #define SYS_AUE_dup AUE_DUP -#define SYS_AUE_pipe AUE_PIPE +#define SYS_AUE_freebsd10_pipe AUE_PIPE #define SYS_AUE_getegid AUE_GETEGID #define SYS_AUE_profil AUE_PROFILE #define SYS_AUE_ktrace AUE_KTRACE From owner-svn-src-all@freebsd.org Thu Jun 23 00:09:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 118D0AC5B19; Thu, 23 Jun 2016 00:09:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6B0D1BF3; Thu, 23 Jun 2016 00:09:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8BC1AB917; Wed, 22 Jun 2016 20:09:40 -0400 (EDT) From: John Baldwin To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302094 - in head/sys: compat/freebsd32 kern Date: Wed, 22 Jun 2016 17:09:34 -0700 Message-ID: <5096414.4TN0ypqLNM@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201606222115.u5MLFxBD093628@repo.freebsd.org> References: <201606222115.u5MLFxBD093628@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 22 Jun 2016 20:09:40 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:09:42 -0000 On Wednesday, June 22, 2016 09:15:59 PM Brooks Davis wrote: > Author: brooks > Date: Wed Jun 22 21:15:59 2016 > New Revision: 302094 > URL: https://svnweb.freebsd.org/changeset/base/302094 > > Log: > Mark the pipe() system call as COMPAT10. > > As of r302092 libc uses pipe2() with a zero flags value instead of pipe(). > > Commit with regenerated files and implementation to follow. This breaks the build on at least i386 because other ABIs depend on being able to call sys_pipe directly. You should at least add COMPAT_FREEBSD10 to GENERIC on architectures that shipped a 10.x release. That will fix the build breakage on i386, but it's also the policy we follow for all the other compat knobs. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Jun 23 00:09:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FBA7AC5B1D; Thu, 23 Jun 2016 00:09:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E51641BF6; Thu, 23 Jun 2016 00:09:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0A50BB97F; Wed, 22 Jun 2016 20:09:42 -0400 (EDT) From: John Baldwin To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302094 - in head/sys: compat/freebsd32 kern Date: Wed, 22 Jun 2016 15:36:42 -0700 Message-ID: <29935239.gerWokA4VB@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201606222115.u5MLFxBD093628@repo.freebsd.org> References: <201606222115.u5MLFxBD093628@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 22 Jun 2016 20:09:42 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:09:43 -0000 On Wednesday, June 22, 2016 09:15:59 PM Brooks Davis wrote: > Author: brooks > Date: Wed Jun 22 21:15:59 2016 > New Revision: 302094 > URL: https://svnweb.freebsd.org/changeset/base/302094 > > Log: > Mark the pipe() system call as COMPAT10. > > As of r302092 libc uses pipe2() with a zero flags value instead of pipe(). > > Commit with regenerated files and implementation to follow. I think open() already uses openat() in libc as well? open() should be under COMPAT10 as well in that case. It does make the output of things like ktrace and truss a bit odd to see functions in section (2) show up as something else. Arguably we should move pipe.2 to pipe.3 (and same for open.2) except that we document their aliases in the same pages. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Jun 23 00:29:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CFF2B72139; Thu, 23 Jun 2016 00:29:04 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E5022752; Thu, 23 Jun 2016 00:29:04 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N0T3M4065545; Thu, 23 Jun 2016 00:29:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N0T3Ht065544; Thu, 23 Jun 2016 00:29:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201606230029.u5N0T3Ht065544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 23 Jun 2016 00:29:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302096 - head/sys/compat/svr4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:29:04 -0000 Author: brooks Date: Thu Jun 23 00:29:03 2016 New Revision: 302096 URL: https://svnweb.freebsd.org/changeset/base/302096 Log: Declare a svr4 version of pipe() now that sys_pipe() is no more. Approved by: re (implicit, fixing build) Sponsored by: DARPA, AFRL Modified: head/sys/compat/svr4/syscalls.master Modified: head/sys/compat/svr4/syscalls.master ============================================================================== --- head/sys/compat/svr4/syscalls.master Wed Jun 22 21:18:19 2016 (r302095) +++ head/sys/compat/svr4/syscalls.master Thu Jun 23 00:29:03 2016 (r302096) @@ -87,7 +87,7 @@ int pgid); } 40 AUE_NULL UNIMPL xenix 41 AUE_NULL NOPROTO { int dup(u_int fd); } -42 AUE_NULL NOPROTO { int pipe(void); } +42 AUE_NULL STD { int svr4_pipe(void); } 43 AUE_NULL STD { int svr4_sys_times(struct tms *tp); } 44 AUE_NULL UNIMPL profil 45 AUE_NULL UNIMPL plock From owner-svn-src-all@freebsd.org Thu Jun 23 00:30:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 670CCB721AE; Thu, 23 Jun 2016 00:30:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F32828BF; Thu, 23 Jun 2016 00:30:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N0UAMD065649; Thu, 23 Jun 2016 00:30:10 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N0UAaA065643; Thu, 23 Jun 2016 00:30:10 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201606230030.u5N0UAaA065643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 23 Jun 2016 00:30:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302097 - head/sys/compat/svr4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:30:11 -0000 Author: brooks Date: Thu Jun 23 00:30:09 2016 New Revision: 302097 URL: https://svnweb.freebsd.org/changeset/base/302097 Log: Regen post r302096 and implement svr4_pipe(). Approved by: re (implict, fixing build) Sponsored by: DARPA, AFRL Modified: head/sys/compat/svr4/svr4_filio.c head/sys/compat/svr4/svr4_proto.h head/sys/compat/svr4/svr4_syscall.h head/sys/compat/svr4/svr4_syscallnames.c head/sys/compat/svr4/svr4_sysent.c Modified: head/sys/compat/svr4/svr4_filio.c ============================================================================== --- head/sys/compat/svr4/svr4_filio.c Thu Jun 23 00:29:03 2016 (r302096) +++ head/sys/compat/svr4/svr4_filio.c Thu Jun 23 00:30:09 2016 (r302097) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -250,3 +251,19 @@ svr4_fil_ioctl(fp, td, retval, fd, cmd, return 0; /* ENOSYS really */ } } + +int +svr4_pipe(struct thread *td, struct svr4_pipe_args *uap) { + int error; + int fildes[2]; + + error = kern_pipe(td, fildes, 0, NULL, NULL); + if (error) + return (error); + + td->td_retval[0] = fildes[0]; + td->td_retval[1] = fildes[1]; + + return (0); +} + Modified: head/sys/compat/svr4/svr4_proto.h ============================================================================== --- head/sys/compat/svr4/svr4_proto.h Thu Jun 23 00:29:03 2016 (r302096) +++ head/sys/compat/svr4/svr4_proto.h Thu Jun 23 00:30:09 2016 (r302097) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/svr4/syscalls.master 227691 2011-11-19 06:35:15Z ed + * created from FreeBSD: head/sys/compat/svr4/syscalls.master 302096 2016-06-23 00:29:03Z brooks */ #ifndef _SVR4_SYSPROTO_H_ @@ -12,8 +12,10 @@ #include #include #include +#include #include #include +#include #include @@ -93,6 +95,9 @@ struct svr4_sys_pgrpsys_args { char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)]; char pgid_l_[PADL_(int)]; int pgid; char pgid_r_[PADR_(int)]; }; +struct svr4_pipe_args { + register_t dummy; +}; struct svr4_sys_times_args { char tp_l_[PADL_(struct tms *)]; struct tms * tp; char tp_r_[PADR_(struct tms *)]; }; @@ -422,6 +427,7 @@ int svr4_sys_access(struct thread *, str int svr4_sys_nice(struct thread *, struct svr4_sys_nice_args *); int svr4_sys_kill(struct thread *, struct svr4_sys_kill_args *); int svr4_sys_pgrpsys(struct thread *, struct svr4_sys_pgrpsys_args *); +int svr4_pipe(struct thread *, struct svr4_pipe_args *); int svr4_sys_times(struct thread *, struct svr4_sys_times_args *); int svr4_sys_signal(struct thread *, struct svr4_sys_signal_args *); int svr4_sys_msgsys(struct thread *, struct svr4_sys_msgsys_args *); @@ -509,6 +515,12 @@ int svr4_sys_sendto(struct thread *, str #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + + +#endif /* COMPAT_FREEBSD10 */ + #define SVR4_SYS_AUE_svr4_sys_open AUE_NULL #define SVR4_SYS_AUE_svr4_sys_wait AUE_NULL #define SVR4_SYS_AUE_svr4_sys_creat AUE_NULL @@ -525,6 +537,7 @@ int svr4_sys_sendto(struct thread *, str #define SVR4_SYS_AUE_svr4_sys_nice AUE_NULL #define SVR4_SYS_AUE_svr4_sys_kill AUE_NULL #define SVR4_SYS_AUE_svr4_sys_pgrpsys AUE_NULL +#define SVR4_SYS_AUE_svr4_pipe AUE_NULL #define SVR4_SYS_AUE_svr4_sys_times AUE_NULL #define SVR4_SYS_AUE_svr4_sys_signal AUE_NULL #define SVR4_SYS_AUE_svr4_sys_msgsys AUE_NULL Modified: head/sys/compat/svr4/svr4_syscall.h ============================================================================== --- head/sys/compat/svr4/svr4_syscall.h Thu Jun 23 00:29:03 2016 (r302096) +++ head/sys/compat/svr4/svr4_syscall.h Thu Jun 23 00:30:09 2016 (r302097) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/svr4/syscalls.master 227691 2011-11-19 06:35:15Z ed + * created from FreeBSD: head/sys/compat/svr4/syscalls.master 302096 2016-06-23 00:29:03Z brooks */ #define SVR4_SYS_exit 1 @@ -38,7 +38,7 @@ #define SVR4_SYS_svr4_sys_kill 37 #define SVR4_SYS_svr4_sys_pgrpsys 39 #define SVR4_SYS_dup 41 -#define SVR4_SYS_pipe 42 +#define SVR4_SYS_svr4_pipe 42 #define SVR4_SYS_svr4_sys_times 43 #define SVR4_SYS_setgid 46 #define SVR4_SYS_getgid 47 Modified: head/sys/compat/svr4/svr4_syscallnames.c ============================================================================== --- head/sys/compat/svr4/svr4_syscallnames.c Thu Jun 23 00:29:03 2016 (r302096) +++ head/sys/compat/svr4/svr4_syscallnames.c Thu Jun 23 00:30:09 2016 (r302097) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/svr4/syscalls.master 227691 2011-11-19 06:35:15Z ed + * created from FreeBSD: head/sys/compat/svr4/syscalls.master 302096 2016-06-23 00:29:03Z brooks */ const char *svr4_syscallnames[] = { @@ -49,7 +49,7 @@ const char *svr4_syscallnames[] = { "svr4_sys_pgrpsys", /* 39 = svr4_sys_pgrpsys */ "#40", /* 40 = xenix */ "dup", /* 41 = dup */ - "pipe", /* 42 = pipe */ + "svr4_pipe", /* 42 = svr4_pipe */ "svr4_sys_times", /* 43 = svr4_sys_times */ "#44", /* 44 = profil */ "#45", /* 45 = plock */ Modified: head/sys/compat/svr4/svr4_sysent.c ============================================================================== --- head/sys/compat/svr4/svr4_sysent.c Thu Jun 23 00:29:03 2016 (r302096) +++ head/sys/compat/svr4/svr4_sysent.c Thu Jun 23 00:30:09 2016 (r302097) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/svr4/syscalls.master 227691 2011-11-19 06:35:15Z ed + * created from FreeBSD: head/sys/compat/svr4/syscalls.master 302096 2016-06-23 00:29:03Z brooks */ #include @@ -61,7 +61,7 @@ struct sysent svr4_sysent[] = { { AS(svr4_sys_pgrpsys_args), (sy_call_t *)svr4_sys_pgrpsys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 39 = svr4_sys_pgrpsys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 40 = xenix */ { AS(dup_args), (sy_call_t *)sys_dup, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 41 = dup */ - { 0, (sy_call_t *)sys_pipe, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 42 = pipe */ + { 0, (sy_call_t *)svr4_pipe, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 42 = svr4_pipe */ { AS(svr4_sys_times_args), (sy_call_t *)svr4_sys_times, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 43 = svr4_sys_times */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 44 = profil */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 45 = plock */ From owner-svn-src-all@freebsd.org Thu Jun 23 00:30:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26791B72203; Thu, 23 Jun 2016 00:30:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 17C362A11; Thu, 23 Jun 2016 00:30:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by freefall.freebsd.org (Postfix) with ESMTP id B7E3B1A37; Thu, 23 Jun 2016 00:30:33 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Thu, 23 Jun 2016 00:30:32 +0000 From: Glen Barber To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302096 - head/sys/compat/svr4 Message-ID: <20160623003032.GP10155@FreeBSD.org> References: <201606230029.u5N0T3Ht065544@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nLMor0SRtNCuLS/8" Content-Disposition: inline In-Reply-To: <201606230029.u5N0T3Ht065544@repo.freebsd.org> X-Operating-System: FreeBSD 11.0-CURRENT amd64 X-SCUD-Definition: Sudden Completely Unexpected Dataloss X-SULE-Definition: Sudden Unexpected Learning Event X-PEKBAC-Definition: Problem Exists, Keyboard Between Admin/Computer User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:30:34 -0000 --nLMor0SRtNCuLS/8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 23, 2016 at 12:29:03AM +0000, Brooks Davis wrote: > Author: brooks > Date: Thu Jun 23 00:29:03 2016 > New Revision: 302096 > URL: https://svnweb.freebsd.org/changeset/base/302096 >=20 > Log: > Declare a svr4 version of pipe() now that sys_pipe() is no more. > =20 > Approved by: re (implicit, fixing build) Thank you. Glen --nLMor0SRtNCuLS/8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXay2kAAoJEAMUWKVHj+KT5tgQAI62yEQweWqNwQ4xMwAENlag wwModYZXZzy0Jh0AKE4JAwQvfNGqcBmdhyFFtvEgfzLllkVa/+i1CCjvs3k9ist+ qbZQQldpBTmR8WOgxwe891GfR5eSDdgB3Xwq8fKwlokAVdRCbbVmjlGu3B6nh6SQ oLFZ08sylyTC/NzTOt1vpVdUtgrqqt38N/NEkNBUhLTjoRjM+WtBLfIh3Rpwr3Pk ttNgwOBEhEyg7aQW1Z3x21D1sjcyAbYKRTkxae8adfYmE2wwJzA/Sc/Ur6vfKJMx xf/tx93Lj0JUBuRVS/JLAJaEySW2ctYOOawm5oRJYMmVK5XGEougery9dpuVtcDe 8K+jBouylMr9lG7/S5kVWPpDB5aPcqGfDsraCNCbfGWvMJ6tIqOLfIp3KA5IwuYm T1BrsZx4J2hO56wsOcYVId2s0Xr3JX0n5epVPr77+BAdmyiC+Reb5j3nkkcYqWSp Oo1674r7qRjwNsQ/ODDT5zvhzTrd5RD4Dc1LOcHY/lYvdE7QxYefI19Pf3PZk/sZ eQNzzwS+ic+yvlXvvynolu3ftQKMMkml+uQSqMYu3Bru50Had98Awhiejkng6Wtj 5wG9k7PJzEBxGepFqtHeF9E6pA7b5aJH7mqetahqtfMNHZ4Bt9WIeW2Ikrb47pLH uFVpqCzmFBvo7fZ1jw9R =KDG6 -----END PGP SIGNATURE----- --nLMor0SRtNCuLS/8-- From owner-svn-src-all@freebsd.org Thu Jun 23 00:33:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29659B72474; Thu, 23 Jun 2016 00:33:00 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EAF992DE1; Thu, 23 Jun 2016 00:32:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N0WxLG069003; Thu, 23 Jun 2016 00:32:59 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N0WxNF069002; Thu, 23 Jun 2016 00:32:59 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606230032.u5N0WxNF069002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 23 Jun 2016 00:32:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302098 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:33:00 -0000 Author: bz Date: Thu Jun 23 00:32:58 2016 New Revision: 302098 URL: https://svnweb.freebsd.org/changeset/base/302098 Log: No longer mark TCP TW zone NO_FREE. Timewait code does a proper cleanup after itself. Reviewed by: gnn Approved by: re (gjb) Obtained from: projects/vnet MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6922 Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Jun 23 00:30:09 2016 (r302097) +++ head/sys/netinet/tcp_timewait.c Thu Jun 23 00:32:58 2016 (r302098) @@ -186,7 +186,7 @@ tcp_tw_init(void) { V_tcptw_zone = uma_zcreate("tcptw", sizeof(struct tcptw), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); TUNABLE_INT_FETCH("net.inet.tcp.maxtcptw", &maxtcptw); if (maxtcptw == 0) uma_zone_set_max(V_tcptw_zone, tcptw_auto_size()); From owner-svn-src-all@freebsd.org Thu Jun 23 00:34:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF041B72529; Thu, 23 Jun 2016 00:34:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF7622F6C; Thu, 23 Jun 2016 00:34:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N0Y3md069104; Thu, 23 Jun 2016 00:34:03 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N0Y3Ea069103; Thu, 23 Jun 2016 00:34:03 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606230034.u5N0Y3Ea069103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 23 Jun 2016 00:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302099 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:34:05 -0000 Author: bz Date: Thu Jun 23 00:34:03 2016 New Revision: 302099 URL: https://svnweb.freebsd.org/changeset/base/302099 Log: Check the V_tcbinfo.ipi_count to hit 0 before doing the full TCP cleanup. That way timers can finish cleanly and we do not gamble with a DELAY(). Reviewed by: gnn, jtl Approved by: re (gjb) Obtained from: projects/vnet MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6923 Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu Jun 23 00:32:58 2016 (r302098) +++ head/sys/netinet/tcp_subr.c Thu Jun 23 00:34:03 2016 (r302099) @@ -731,18 +731,19 @@ tcp_init(void) static void tcp_destroy(void *unused __unused) { - int error; + int error, n; /* * All our processes are gone, all our sockets should be cleaned * up, which means, we should be past the tcp_discardcb() calls. - * Sleep to let all tcpcb timers really disappear and then cleanup. - * Timewait will cleanup its queue and will be ready to go. - * XXX-BZ In theory a few ticks should be good enough to make sure - * the timers are all really gone. We should see if we could use a - * better metric here and, e.g., check a tcbcb count as an optimization? + * Sleep to let all tcpcb timers really disappear and cleanup. */ - DELAY(1000000 / hz); + do { + pause("tcpdes", hz/10); + INP_LIST_RLOCK(&V_tcbinfo); + n = V_tcbinfo.ipi_count; + INP_LIST_RUNLOCK(&V_tcbinfo); + } while (n != 0); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); From owner-svn-src-all@freebsd.org Thu Jun 23 00:37:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AA74B725BE; Thu, 23 Jun 2016 00:37:58 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 608421269; Thu, 23 Jun 2016 00:37:58 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id F069E5A9F27; Thu, 23 Jun 2016 00:37:56 +0000 (UTC) Date: Thu, 23 Jun 2016 00:37:56 +0000 From: Brooks Davis To: Glen Barber Cc: Brooks Davis , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302096 - head/sys/compat/svr4 Message-ID: <20160623003756.GA41630@spindle.one-eyed-alien.net> References: <201606230029.u5N0T3Ht065544@repo.freebsd.org> <20160623003032.GP10155@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k+w/mQv8wyuph6w0" Content-Disposition: inline In-Reply-To: <20160623003032.GP10155@FreeBSD.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:37:58 -0000 --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 23, 2016 at 12:30:32AM +0000, Glen Barber wrote: > On Thu, Jun 23, 2016 at 12:29:03AM +0000, Brooks Davis wrote: > > Author: brooks > > Date: Thu Jun 23 00:29:03 2016 > > New Revision: 302096 > > URL: https://svnweb.freebsd.org/changeset/base/302096 > >=20 > > Log: > > Declare a svr4 version of pipe() now that sys_pipe() is no more. > > =20 > > Approved by: re (implicit, fixing build) >=20 > Thank you. Sorry about the breakage. I thought I'd done a successful i386 build, but apparently not with the compat portion of the patch. -- Brooks --k+w/mQv8wyuph6w0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJXay9kAAoJEKzQXbSebgfA5JsH/3Ht8/aeVI5g7uJ8mPH/Sq+j E4Yg+SjnrEM4SXwPIrudNeEGyff+TjcT/Ar22GtRtzBB01VIcA8UvhD9Nz/hey+T jJlSXdgJhE7BU7hPX5bkKlZjh5v8A52UX1VTz8/iHqeZG3OLgg2I4qKMCfF5yNTy JBRwOMKQAEPDZNeYYsQ2wqJwv7F7aeI//sKCXL7KGqCg2UV6SupMePBsHij6Ctjh k30hz4ZPGiXbO0vst7o5S06zbKiQ71L75b6mD1q0Q9RTtBi4tmBl7pm9FBbI4fuV i2SYI9FbZgMHJ3Ev6IDyFyovkY9ilA72e/OLUoJ/JgUYFuYW7yEuck6XHxDef4c= =gNvR -----END PGP SIGNATURE----- --k+w/mQv8wyuph6w0-- From owner-svn-src-all@freebsd.org Thu Jun 23 00:39:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D117CB7264C; Thu, 23 Jun 2016 00:39:49 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD21C13DE; Thu, 23 Jun 2016 00:39:49 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 749475A9F2A; Thu, 23 Jun 2016 00:39:48 +0000 (UTC) Date: Thu, 23 Jun 2016 00:39:48 +0000 From: Brooks Davis To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302094 - in head/sys: compat/freebsd32 kern Message-ID: <20160623003948.GB41630@spindle.one-eyed-alien.net> References: <201606222115.u5MLFxBD093628@repo.freebsd.org> <5096414.4TN0ypqLNM@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5/uDoXvLw7AC5HRs" Content-Disposition: inline In-Reply-To: <5096414.4TN0ypqLNM@ralph.baldwin.cx> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:39:49 -0000 --5/uDoXvLw7AC5HRs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 22, 2016 at 05:09:34PM -0700, John Baldwin wrote: > On Wednesday, June 22, 2016 09:15:59 PM Brooks Davis wrote: > > Author: brooks > > Date: Wed Jun 22 21:15:59 2016 > > New Revision: 302094 > > URL: https://svnweb.freebsd.org/changeset/base/302094 > >=20 > > Log: > > Mark the pipe() system call as COMPAT10. > > =20 > > As of r302092 libc uses pipe2() with a zero flags value instead of pi= pe(). > > =20 > > Commit with regenerated files and implementation to follow. >=20 > This breaks the build on at least i386 because other ABIs depend on being > able to call sys_pipe directly. You should at least add COMPAT_FREEBSD10 > to GENERIC on architectures that shipped a 10.x release. That will fix t= he > build breakage on i386, but it's also the policy we follow for all the ot= her > compat knobs. It was actually that sys_pipe() was renamed by the COMPAT10 tag. I've copied the implementation to a svr4_pipe(). -- Brooks --5/uDoXvLw7AC5HRs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJXay/TAAoJEKzQXbSebgfAUwkIAI+9MNKDIAiT4QUcT+7yGNMb wBMrSkCbjaWjxUc5DVUjjL3uPMtx+dfFIAW8JR7KSpQytqfI0rKDVcHJbDNRrivx Np/X+cJbmNXUJUKltgS+31XotNR6nmA0UoARslVPTBklF6+3BfjJ9pSGOGzYEuyc vQT/mSMX8NK3TUhDqKeXGtPWvxA0yjMdDflUnlnEm0zXQPlggpnG6j3BBkabSdLy +AJIoYk5aNj2SdtH+3noH5tP2YF4oB2m6hwn6OrIVC43jey0+VvalalMHhkaGIPK u4Qev1/r8f4V3/2yzNwBvj3TXayKfXc35Q3mn6Duhr94LiPx1GuxUkcgdtbwcYg= =SHFd -----END PGP SIGNATURE----- --5/uDoXvLw7AC5HRs-- From owner-svn-src-all@freebsd.org Thu Jun 23 00:54:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7A07B72993; Thu, 23 Jun 2016 00:54:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94C4A1CD7; Thu, 23 Jun 2016 00:54:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N0sEPo076502; Thu, 23 Jun 2016 00:54:14 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N0sESS076501; Thu, 23 Jun 2016 00:54:14 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606230054.u5N0sESS076501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 23 Jun 2016 00:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302100 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:54:15 -0000 Author: adrian Date: Thu Jun 23 00:54:14 2016 New Revision: 302100 URL: https://svnweb.freebsd.org/changeset/base/302100 Log: [ath] fix comments! I keep asking myself "what do these fields mean" and so now I've clarified it for myself. Tested: * Reading the comments, going "a-ha!" a couple times. Approved by: re (gjb) Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Thu Jun 23 00:34:03 2016 (r302099) +++ head/sys/dev/ath/if_athvar.h Thu Jun 23 00:54:14 2016 (r302100) @@ -370,9 +370,9 @@ struct ath_txq { */ struct { TAILQ_HEAD(axq_q_f_s, ath_buf) axq_q; - u_int axq_depth; + u_int axq_depth; /* how many frames (1 per legacy, 1 per A-MPDU list) are in the FIFO queue */ } fifo; - u_int axq_fifo_depth; /* depth of FIFO frames */ + u_int axq_fifo_depth; /* how many FIFO slots are active */ /* * XXX the holdingbf field is protected by the TXBUF lock From owner-svn-src-all@freebsd.org Thu Jun 23 00:56:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FC41B72AB4; Thu, 23 Jun 2016 00:56:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C72541F5A; Thu, 23 Jun 2016 00:56:55 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N0usQs076790; Thu, 23 Jun 2016 00:56:54 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N0usOG076788; Thu, 23 Jun 2016 00:56:54 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606230056.u5N0usOG076788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 23 Jun 2016 00:56:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302101 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 00:56:56 -0000 Author: adrian Date: Thu Jun 23 00:56:54 2016 New Revision: 302101 URL: https://svnweb.freebsd.org/changeset/base/302101 Log: [iwm] Use vap->iv_myaddr instead of ic->ic_macaddr when vap != NULL. ic_macaddr is only used for the initial mac address provided by NVM. We should rather use vap->iv_myaddr when vap != NULL, to allow the MAC address to be changed later with ifconfig(8). Submitted by: Imre Vadasz Reviewed by: avos Approved by: re (gjb) Obtained from: DragonflyBSD git 4aee7a78275676d22d14c04177bd0c9377d91478 Differential Revision: https://reviews.freebsd.org/D6743 Modified: head/sys/dev/iwm/if_iwm_mac_ctxt.c head/sys/dev/iwm/if_iwm_scan.c Modified: head/sys/dev/iwm/if_iwm_mac_ctxt.c ============================================================================== --- head/sys/dev/iwm/if_iwm_mac_ctxt.c Thu Jun 23 00:54:14 2016 (r302100) +++ head/sys/dev/iwm/if_iwm_mac_ctxt.c Thu Jun 23 00:56:54 2016 (r302101) @@ -275,7 +275,7 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_s */ cmd->tsf_id = htole32(IWM_DEFAULT_TSFID); - IEEE80211_ADDR_COPY(cmd->node_addr, ic->ic_macaddr); + IEEE80211_ADDR_COPY(cmd->node_addr, vap->iv_myaddr); /* * XXX should we error out if in_assoc is 1 and ni == NULL? Modified: head/sys/dev/iwm/if_iwm_scan.c ============================================================================== --- head/sys/dev/iwm/if_iwm_scan.c Thu Jun 23 00:54:14 2016 (r302100) +++ head/sys/dev/iwm/if_iwm_scan.c Thu Jun 23 00:56:54 2016 (r302101) @@ -371,6 +371,8 @@ iwm_mvm_scan_request(struct iwm_softc *s .dataflags = { IWM_HCMD_DFL_NOCOPY, }, }; struct iwm_scan_cmd *cmd = sc->sc_scan_cmd; + struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); int is_assoc = 0; int ret; uint32_t status; @@ -421,8 +423,9 @@ iwm_mvm_scan_request(struct iwm_softc *s cmd->tx_cmd.len = htole16(iwm_mvm_fill_probe_req(sc, (struct ieee80211_frame *)cmd->data, - sc->sc_ic.ic_macaddr, n_ssids, ssid, ssid_len, - NULL, 0, sc->sc_capa_max_probe_len)); + vap ? vap->iv_myaddr : ic->ic_macaddr, n_ssids, + ssid, ssid_len, NULL, 0, + sc->sc_capa_max_probe_len)); cmd->channel_count = iwm_mvm_scan_fill_channels(sc, cmd, flags, n_ssids, basic_ssid); From owner-svn-src-all@freebsd.org Thu Jun 23 01:00:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 859E6B72B8A; Thu, 23 Jun 2016 01:00:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 392692155; Thu, 23 Jun 2016 01:00:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N10DqH076982; Thu, 23 Jun 2016 01:00:13 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N10DWI076981; Thu, 23 Jun 2016 01:00:13 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606230100.u5N10DWI076981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 23 Jun 2016 01:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302102 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 01:00:14 -0000 Author: adrian Date: Thu Jun 23 01:00:13 2016 New Revision: 302102 URL: https://svnweb.freebsd.org/changeset/base/302102 Log: [iwm] Fix iwm_dma_contig_free(). dma->map is always NULL here. * When bus_dmamem_alloc is used, the bus_dmamap_t is usually set to NULL, so we were never actually freeing any dma memory allocations done via iwm_dma_contig_alloc(). So we should check dma->vaddr instead of dma->map here. * Also, the dmamap is actually supposed to be invalidated as part of bus_dmamem_free(), so bus_dmamap_destroy() is never needed here. Submitted by: Imre Vadasz Approved by: re (gjb) Obtained from: DragonflyBSD git ef2b29a7ba6ca8a9d2c82ab591c0622227ff84cb Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Jun 23 00:56:54 2016 (r302101) +++ head/sys/dev/iwm/if_iwm.c Thu Jun 23 01:00:13 2016 (r302102) @@ -721,6 +721,7 @@ iwm_dma_contig_alloc(bus_dma_tag_t tag, dma->tag = NULL; dma->size = size; + dma->vaddr = NULL; error = bus_dma_tag_create(tag, alignment, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, size, @@ -735,8 +736,11 @@ iwm_dma_contig_alloc(bus_dma_tag_t tag, error = bus_dmamap_load(dma->tag, dma->map, dma->vaddr, size, iwm_dma_map_addr, &dma->paddr, BUS_DMA_NOWAIT); - if (error != 0) + if (error != 0) { + bus_dmamem_free(dma->tag, dma->vaddr, dma->map); + dma->vaddr = NULL; goto fail; + } bus_dmamap_sync(dma->tag, dma->map, BUS_DMASYNC_PREWRITE); @@ -749,16 +753,12 @@ fail: iwm_dma_contig_free(dma); static void iwm_dma_contig_free(struct iwm_dma_info *dma) { - if (dma->map != NULL) { - if (dma->vaddr != NULL) { - bus_dmamap_sync(dma->tag, dma->map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(dma->tag, dma->map); - bus_dmamem_free(dma->tag, dma->vaddr, dma->map); - dma->vaddr = NULL; - } - bus_dmamap_destroy(dma->tag, dma->map); - dma->map = NULL; + if (dma->vaddr != NULL) { + bus_dmamap_sync(dma->tag, dma->map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(dma->tag, dma->map); + bus_dmamem_free(dma->tag, dma->vaddr, dma->map); + dma->vaddr = NULL; } if (dma->tag != NULL) { bus_dma_tag_destroy(dma->tag); From owner-svn-src-all@freebsd.org Thu Jun 23 01:11:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C7A8B72E4A; Thu, 23 Jun 2016 01:11:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C20EF283E; Thu, 23 Jun 2016 01:11:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N1Bq50081941; Thu, 23 Jun 2016 01:11:52 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N1BqK2081938; Thu, 23 Jun 2016 01:11:52 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606230111.u5N1BqK2081938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 23 Jun 2016 01:11:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302103 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 01:11:54 -0000 Author: adrian Date: Thu Jun 23 01:11:52 2016 New Revision: 302103 URL: https://svnweb.freebsd.org/changeset/base/302103 Log: [iwm] Add and use iwm_phy_db_free(), to plug phy_db memory leak. (Together with other iwm(4) memory leak fixes) Memory leakage in M_DEVBUF is now at ca. 2KB for each iwm(4) module load/unload cycle. Submitted by: Imre Vadasz Approved by: re (gjb) Obtained from: DragonflyBSD git eaf551a1d464c643e98ce5781971dd32124e9af1 Differential Revision: https://reviews.freebsd.org/D6819 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_phy_db.c head/sys/dev/iwm/if_iwm_phy_db.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Jun 23 01:00:13 2016 (r302102) +++ head/sys/dev/iwm/if_iwm.c Thu Jun 23 01:11:52 2016 (r302103) @@ -5014,6 +5014,8 @@ iwm_detach_local(struct iwm_softc *sc, i if (do_net80211) ieee80211_ifdetach(&sc->sc_ic); + iwm_phy_db_free(sc); + /* Free descriptor rings */ iwm_free_rx_ring(sc, &sc->rxq); for (i = 0; i < nitems(sc->txq); i++) Modified: head/sys/dev/iwm/if_iwm_phy_db.c ============================================================================== --- head/sys/dev/iwm/if_iwm_phy_db.c Thu Jun 23 01:00:13 2016 (r302102) +++ head/sys/dev/iwm/if_iwm_phy_db.c Thu Jun 23 01:11:52 2016 (r302103) @@ -451,3 +451,33 @@ iwm_send_phy_db_data(struct iwm_softc *s __func__); return 0; } + +static void +iwm_phy_db_free_section(struct iwm_softc *sc, + enum iwm_phy_db_section_type type, uint16_t chg_id) +{ + struct iwm_phy_db_entry *entry = + iwm_phy_db_get_section(sc, type, chg_id); + if (!entry) + return; + + if (entry->data != NULL) + free(entry->data, M_DEVBUF); + entry->data = NULL; + entry->size = 0; +} + +void +iwm_phy_db_free(struct iwm_softc *sc) +{ + int i; + + iwm_phy_db_free_section(sc, IWM_PHY_DB_CFG, 0); + iwm_phy_db_free_section(sc, IWM_PHY_DB_CALIB_NCH, 0); + + for (i = 0; i < IWM_NUM_PAPD_CH_GROUPS; i++) + iwm_phy_db_free_section(sc, IWM_PHY_DB_CALIB_CHG_PAPD, i); + + for (i = 0; i < IWM_NUM_TXP_CH_GROUPS; i++) + iwm_phy_db_free_section(sc, IWM_PHY_DB_CALIB_CHG_TXP, i); +} Modified: head/sys/dev/iwm/if_iwm_phy_db.h ============================================================================== --- head/sys/dev/iwm/if_iwm_phy_db.h Thu Jun 23 01:00:13 2016 (r302102) +++ head/sys/dev/iwm/if_iwm_phy_db.h Thu Jun 23 01:11:52 2016 (r302103) @@ -109,4 +109,5 @@ extern int iwm_phy_db_set_section(struct iwm_softc *sc, struct iwm_calib_res_notif_phy_db *phy_db_notif); extern int iwm_send_phy_db_data(struct iwm_softc *sc); +extern void iwm_phy_db_free(struct iwm_softc *sc); #endif /* __IF_IWM_PHY_DB_H__ */ From owner-svn-src-all@freebsd.org Thu Jun 23 01:13:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98061B72F00; Thu, 23 Jun 2016 01:13:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 742CE2BBD; Thu, 23 Jun 2016 01:13:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N1DUGD084030; Thu, 23 Jun 2016 01:13:30 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N1DUgD084028; Thu, 23 Jun 2016 01:13:30 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606230113.u5N1DUgD084028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 23 Jun 2016 01:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302104 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 01:13:31 -0000 Author: adrian Date: Thu Jun 23 01:13:30 2016 New Revision: 302104 URL: https://svnweb.freebsd.org/changeset/base/302104 Log: [iwm] Use mbuf for large firmware commands, like OpenBSD does. We also need to consider the size of large firmware commands in iwm_alloc_tx_ring(), in the dma tag creation, when qid == IWM_MVM_CMD_QUEUE. The old code apparently only allocated a 2KB (MCLBYTES) sized buffer when it actually expected 4KB. Submitted by: Imre Vadasz Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D6824 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_util.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Jun 23 01:11:52 2016 (r302103) +++ head/sys/dev/iwm/if_iwm.c Thu Jun 23 01:13:30 2016 (r302104) @@ -956,6 +956,8 @@ iwm_alloc_tx_ring(struct iwm_softc *sc, { bus_addr_t paddr; bus_size_t size; + size_t maxsize; + int nsegments; int i, error; ring->qid = qid; @@ -988,9 +990,18 @@ iwm_alloc_tx_ring(struct iwm_softc *sc, } ring->cmd = ring->cmd_dma.vaddr; + /* FW commands may require more mapped space than packets. */ + if (qid == IWM_MVM_CMD_QUEUE) { + maxsize = IWM_RBUF_SIZE; + nsegments = 1; + } else { + maxsize = MCLBYTES; + nsegments = IWM_MAX_SCATTER - 2; + } + error = bus_dma_tag_create(sc->sc_dmat, 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, - IWM_MAX_SCATTER - 2, MCLBYTES, 0, NULL, NULL, &ring->data_dmat); + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, maxsize, + nsegments, maxsize, 0, NULL, NULL, &ring->data_dmat); if (error != 0) { device_printf(sc->sc_dev, "could not create TX buf DMA tag\n"); goto fail; Modified: head/sys/dev/iwm/if_iwm_util.c ============================================================================== --- head/sys/dev/iwm/if_iwm_util.c Thu Jun 23 01:11:52 2016 (r302103) +++ head/sys/dev/iwm/if_iwm_util.c Thu Jun 23 01:13:30 2016 (r302104) @@ -157,19 +157,6 @@ __FBSDID("$FreeBSD$"); #include #include -static void -iwm_dma_map_mem(void *arg, bus_dma_segment_t *segs, int nsegs, int error) -{ - if (error != 0) - return; - KASSERT(nsegs <= 2, ("too many DMA segments, %d should be <= 2", - nsegs)); - if (nsegs > 1) - KASSERT(segs[1].ds_addr == segs[0].ds_addr + segs[0].ds_len, - ("fragmented DMA memory")); - *(bus_addr_t *)arg = segs[0].ds_addr; -} - /* * Send a command to the firmware. We try to implement the Linux * driver interface for the routine. @@ -183,12 +170,15 @@ iwm_send_cmd(struct iwm_softc *sc, struc struct iwm_tx_ring *ring = &sc->txq[IWM_MVM_CMD_QUEUE]; struct iwm_tfd *desc; struct iwm_tx_data *data; - struct iwm_device_cmd *cmd = NULL; + struct iwm_device_cmd *cmd; + struct mbuf *m; + bus_dma_segment_t seg; bus_addr_t paddr; uint32_t addr_lo; int error = 0, i, paylen, off; int code; int async, wantresp; + int nsegs; code = hcmd->id; async = hcmd->flags & IWM_CMD_ASYNC; @@ -231,15 +221,24 @@ iwm_send_cmd(struct iwm_softc *sc, struc error = EINVAL; goto out; } - error = bus_dmamem_alloc(ring->data_dmat, (void **)&cmd, - BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &data->map); - if (error != 0) + m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, IWM_RBUF_SIZE); + if (m == NULL) { + error = ENOBUFS; goto out; - error = bus_dmamap_load(ring->data_dmat, data->map, - cmd, paylen + sizeof(cmd->hdr), iwm_dma_map_mem, - &paddr, BUS_DMA_NOWAIT); - if (error != 0) + } + + m->m_len = m->m_pkthdr.len = m->m_ext.ext_size; + error = bus_dmamap_load_mbuf_sg(ring->data_dmat, + data->map, m, &seg, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: can't map mbuf, error %d\n", __func__, error); + m_freem(m); goto out; + } + data->m = m; /* mbuf will be freed in iwm_cmd_done() */ + cmd = mtod(m, struct iwm_device_cmd *); + paddr = seg.ds_addr; } else { cmd = &ring->cmd[ring->cur]; paddr = data->cmd_paddr; @@ -319,8 +318,6 @@ iwm_send_cmd(struct iwm_softc *sc, struc } } out: - if (cmd && paylen > sizeof(cmd->data)) - bus_dmamem_free(ring->data_dmat, cmd, data->map); if (wantresp && error != 0) { iwm_free_resp(sc, hcmd); } From owner-svn-src-all@freebsd.org Thu Jun 23 01:14:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E8B2B72FA1; Thu, 23 Jun 2016 01:14:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF8CD2D48; Thu, 23 Jun 2016 01:14:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N1EYdN084135; Thu, 23 Jun 2016 01:14:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N1EXLP084132; Thu, 23 Jun 2016 01:14:33 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606230114.u5N1EXLP084132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 23 Jun 2016 01:14:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302105 - in head/sys/dev/bhnd: . bcma bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 01:14:35 -0000 Author: adrian Date: Thu Jun 23 01:14:33 2016 New Revision: 302105 URL: https://svnweb.freebsd.org/changeset/base/302105 Log: [BHND/bcma] Add implementation of BHND_BUS_RESET_CORE function for BCMA This patch addes missing implementation of BHND_BUS_RESET_CORE function for BCMA. The reset procedure is very simple: enable reset mode, stop clocking, enable clocking & force clock gating, disable reset mode, stop clock gating. Tested: * (michael) Tested on ASUS RT-N53 for enabling/reset USB core Submitted by: Michael Zhilin Approved by: re (gjb) Modified: head/sys/dev/bhnd/bcma/bcma.c head/sys/dev/bhnd/bhnd_core.h head/sys/dev/bhnd/bhndb/bhndb.c Modified: head/sys/dev/bhnd/bcma/bcma.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma.c Thu Jun 23 01:13:30 2016 (r302104) +++ head/sys/dev/bhnd/bcma/bcma.c Thu Jun 23 01:14:33 2016 (r302105) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include "bcma_eromreg.h" #include "bcma_eromvar.h" +#include int bcma_probe(device_t dev) @@ -218,9 +219,33 @@ bcma_reset_core(device_t dev, device_t c if (dinfo->res_agent == NULL) return (ENODEV); - // TODO - perform reset + /* Start reset */ + bhnd_bus_write_4(dinfo->res_agent, BHND_RESET_CF, BHND_RESET_CF_ENABLE); + bhnd_bus_read_4(dinfo->res_agent, BHND_RESET_CF); + DELAY(10); + + /* Disable clock */ + bhnd_bus_write_4(dinfo->res_agent, BHND_CF, flags); + bhnd_bus_read_4(dinfo->res_agent, BHND_CF); + DELAY(10); + + /* Enable clocks & force clock gating */ + bhnd_bus_write_4(dinfo->res_agent, BHND_CF, BHND_CF_CLOCK_EN | + BHND_CF_FGC | flags); + bhnd_bus_read_4(dinfo->res_agent, BHND_CF); + DELAY(10); + + /* Complete reset */ + bhnd_bus_write_4(dinfo->res_agent, BHND_RESET_CF, 0); + bhnd_bus_read_4(dinfo->res_agent, BHND_RESET_CF); + DELAY(10); + + /* Release force clock gating */ + bhnd_bus_write_4(dinfo->res_agent, BHND_CF, BHND_CF_CLOCK_EN | flags); + bhnd_bus_read_4(dinfo->res_agent, BHND_CF); + DELAY(10); - return (ENXIO); + return (0); } static int Modified: head/sys/dev/bhnd/bhnd_core.h ============================================================================== --- head/sys/dev/bhnd/bhnd_core.h Thu Jun 23 01:13:30 2016 (r302104) +++ head/sys/dev/bhnd/bhnd_core.h Thu Jun 23 01:14:33 2016 (r302105) @@ -25,19 +25,27 @@ #define _BHND_BHND_CORE_H_ /* Common core control flags */ -#define BHND_CF_BIST_EN 0x8000 /**< ??? */ +#define BHND_CF 0x0408 +#define BHND_CF_BIST_EN 0x8000 /**< built-in self test */ #define BHND_CF_PME_EN 0x4000 /**< ??? */ #define BHND_CF_CORE_BITS 0x3ffc /**< core specific flag mask */ #define BHND_CF_FGC 0x0002 /**< force clock gating */ #define BHND_CF_CLOCK_EN 0x0001 /**< enable clock */ /* Common core status flags */ +#define BHND_SF 0x0500 #define BHND_SF_BIST_DONE 0x8000 /**< ??? */ #define BHND_SF_BIST_ERROR 0x4000 /**< ??? */ #define BHND_SF_GATED_CLK 0x2000 /**< clock gated */ #define BHND_SF_DMA64 0x1000 /**< supports 64-bit DMA */ #define BHND_SF_CORE_BITS 0x0fff /**< core-specific status mask */ +/*Reset core control flags */ +#define BHND_RESET_CF 0x0800 +#define BHND_RESET_CF_ENABLE 0x0001 + +#define BHND_RESET_SF 0x0804 + /* * A register that is common to all cores to * communicate w/PMU regarding clock control. Modified: head/sys/dev/bhnd/bhndb/bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.c Thu Jun 23 01:13:30 2016 (r302104) +++ head/sys/dev/bhnd/bhndb/bhndb.c Thu Jun 23 01:14:33 2016 (r302105) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include "bhndb_private.h" /* Debugging flags */ -static u_long bhndb_debug = 0; +static u_long bhndb_debug = -1; TUNABLE_ULONG("hw.bhndb.debug", &bhndb_debug); enum { @@ -596,8 +596,10 @@ bhndb_generic_init_full_config(device_t hostb = NULL; /* Fetch the full set of bhnd-attached cores */ - if ((error = device_get_children(sc->bus_dev, &devs, &ndevs))) + if ((error = device_get_children(sc->bus_dev, &devs, &ndevs))) { + device_printf(sc->dev, "unable to get children\n"); return (error); + } /* Find our host bridge device */ hostb = BHNDB_FIND_HOSTB_DEVICE(dev, child); From owner-svn-src-all@freebsd.org Thu Jun 23 01:15:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0794B72070; Thu, 23 Jun 2016 01:15:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDCBF2EA7; Thu, 23 Jun 2016 01:15:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N1FZIY084246; Thu, 23 Jun 2016 01:15:35 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N1FZVI084245; Thu, 23 Jun 2016 01:15:35 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606230115.u5N1FZVI084245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 23 Jun 2016 01:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302106 - head/sys/dev/bhnd/bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 01:15:37 -0000 Author: adrian Date: Thu Jun 23 01:15:35 2016 New Revision: 302106 URL: https://svnweb.freebsd.org/changeset/base/302106 Log: revert error commit from previous commit. my bad! Approved by: re (implicit) Modified: head/sys/dev/bhnd/bhndb/bhndb.c Modified: head/sys/dev/bhnd/bhndb/bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.c Thu Jun 23 01:14:33 2016 (r302105) +++ head/sys/dev/bhnd/bhndb/bhndb.c Thu Jun 23 01:15:35 2016 (r302106) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include "bhndb_private.h" /* Debugging flags */ -static u_long bhndb_debug = -1; +static u_long bhndb_debug = 0; TUNABLE_ULONG("hw.bhndb.debug", &bhndb_debug); enum { From owner-svn-src-all@freebsd.org Thu Jun 23 01:47:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61513B72976; Thu, 23 Jun 2016 01:47:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D3871E8A; Thu, 23 Jun 2016 01:47:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N1lUYe096036; Thu, 23 Jun 2016 01:47:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N1lUUc096034; Thu, 23 Jun 2016 01:47:30 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230147.u5N1lUUc096034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 01:47: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: r302107 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 01:47:31 -0000 Author: sephe Date: Thu Jun 23 01:47:30 2016 New Revision: 302107 URL: https://svnweb.freebsd.org/changeset/base/302107 Log: MFC 299889,299890,299892 299889 hyperv/vmbus: Simplify event processing While I'm here, remove useless comment and unnecessary return. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6332 299890 hyperv/vmbus: Simplify event processing For channel0, it will never be processed on event handling path, so there is no need to install it. After skipping in the channel0 installation, we could discard the channel0 check on event handling hot code path. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6333 299892 hyperv/vmbus: Fix event processing loop indentation. No functional changes. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6334 Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/10/sys/dev/hyperv/vmbus/hv_connection.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jun 23 01:15:35 2016 (r302106) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jun 23 01:47:30 2016 (r302107) @@ -186,7 +186,14 @@ vmbus_channel_process_offer(hv_vmbus_cha * Make sure this is a new offer */ mtx_lock(&hv_vmbus_g_connection.channel_lock); - hv_vmbus_g_connection.channels[relid] = new_channel; + if (relid == 0) { + /* + * XXX channel0 will not be processed; skip it. + */ + printf("VMBUS: got channel0 offer\n"); + } else { + hv_vmbus_g_connection.channels[relid] = new_channel; + } TAILQ_FOREACH(channel, &hv_vmbus_g_connection.channel_anchor, list_entry) { Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 01:15:35 2016 (r302106) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 01:47:30 2016 (r302107) @@ -303,7 +303,6 @@ hv_vmbus_on_events(int cpu) int rel_id; int maxdword; hv_vmbus_synic_event_flags *event; - /* int maxdword = PAGE_SIZE >> 3; */ KASSERT(cpu <= mp_maxid, ("VMBUS: hv_vmbus_on_events: " "cpu out of range!")); @@ -317,9 +316,12 @@ hv_vmbus_on_events(int cpu) /* * receive size is 1/2 page and divide that by 4 bytes */ - if (synch_test_and_clear_bit(0, &event->flags32[0])) + if (synch_test_and_clear_bit(0, &event->flags32[0])) { recv_interrupt_page = hv_vmbus_g_connection.recv_interrupt_page; + } else { + return; + } } else { /* * On Host with Win8 or above, the event page can be @@ -333,36 +335,32 @@ hv_vmbus_on_events(int cpu) /* * Check events */ - if (recv_interrupt_page != NULL) { - for (dword = 0; dword < maxdword; dword++) { - if (recv_interrupt_page[dword]) { - for (bit = 0; bit < HV_CHANNEL_DWORD_LEN; bit++) { + for (dword = 0; dword < maxdword; dword++) { + if (recv_interrupt_page[dword] == 0) + continue; + + for (bit = 0; bit < HV_CHANNEL_DWORD_LEN; bit++) { if (synch_test_and_clear_bit(bit, - (uint32_t *) &recv_interrupt_page[dword])) { - rel_id = (dword << 5) + bit; - if (rel_id == 0) { - /* - * Special case - - * vmbus channel protocol msg. - */ - continue; - } else { - hv_vmbus_channel * channel = hv_vmbus_g_connection.channels[rel_id]; + (uint32_t *)&recv_interrupt_page[dword])) { + struct hv_vmbus_channel *channel; + + rel_id = (dword << 5) + bit; + channel = + hv_vmbus_g_connection.channels[rel_id]; + /* if channel is closed or closing */ if (channel == NULL || channel->rxq == NULL) continue; - if (channel->batched_reading) - hv_ring_buffer_read_begin(&channel->inbound); - taskqueue_enqueue_fast(channel->rxq, &channel->channel_task); - } + if (channel->batched_reading) { + hv_ring_buffer_read_begin( + &channel->inbound); + } + taskqueue_enqueue(channel->rxq, + &channel->channel_task); } - } - } - } + } } - - return; } /** From owner-svn-src-all@freebsd.org Thu Jun 23 02:21:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78BB9B7314F; Thu, 23 Jun 2016 02:21:38 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52C692E08; Thu, 23 Jun 2016 02:21:38 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N2Lb8o010585; Thu, 23 Jun 2016 02:21:37 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N2Lbtp010582; Thu, 23 Jun 2016 02:21:37 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230221.u5N2Lbtp010582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 02:21: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: r302108 - in stable/10: share/man/man9 sys/amd64/include sys/i386/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 02:21:38 -0000 Author: sephe Date: Thu Jun 23 02:21:37 2016 New Revision: 302108 URL: https://svnweb.freebsd.org/changeset/base/302108 Log: MFC 299912 atomic: Add testandclear on i386/amd64 Reviewed by: kib Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6381 Modified: stable/10/share/man/man9/atomic.9 stable/10/sys/amd64/include/atomic.h stable/10/sys/i386/include/atomic.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/atomic.9 ============================================================================== --- stable/10/share/man/man9/atomic.9 Thu Jun 23 01:47:30 2016 (r302107) +++ stable/10/share/man/man9/atomic.9 Thu Jun 23 02:21:37 2016 (r302108) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 14, 2015 +.Dd May 12, 2016 .Dt ATOMIC 9 .Os .Sh NAME @@ -65,6 +65,8 @@ .Ft .Fn atomic_swap_ "volatile *p" " v" .Ft int +.Fn atomic_testandclear_ "volatile *p" "u_int v" +.Ft int .Fn atomic_testandset_ "volatile *p" "u_int v" .Sh DESCRIPTION Each of the atomic operations is guaranteed to be atomic across multiple @@ -313,6 +315,15 @@ and .Dq Li 16 and do not have any variants with memory barriers at this time. .Bl -hang +.It Fn atomic_testandclear p v +.Bd -literal -compact +bit = 1 << (v % (sizeof(*p) * NBBY)); +tmp = (*p & bit) != 0; +*p &= ~bit; +return (tmp); +.Ed +.El +.Bl -hang .It Fn atomic_testandset p v .Bd -literal -compact bit = 1 << (v % (sizeof(*p) * NBBY)); @@ -324,6 +335,8 @@ return (tmp); .Pp The .Fn atomic_testandset +and +.Fn atomic_testandclear functions are only implemented for the types .Dq Li int , .Dq Li long @@ -352,6 +365,8 @@ and functions return the value at the specified address. The .Fn atomic_testandset +and +.Fn atomic_testandclear function returns the result of the test operation. .Sh EXAMPLES This example uses the @@ -429,3 +444,6 @@ and .Fn atomic_testandset operations were added in .Fx 10.0 . +.Fn atomic_testandclear +operation was added in +.Fx 11.0 . Modified: stable/10/sys/amd64/include/atomic.h ============================================================================== --- stable/10/sys/amd64/include/atomic.h Thu Jun 23 01:47:30 2016 (r302107) +++ stable/10/sys/amd64/include/atomic.h Thu Jun 23 02:21:37 2016 (r302108) @@ -84,6 +84,8 @@ u_int atomic_fetchadd_int(volatile u_int u_long atomic_fetchadd_long(volatile u_long *p, u_long v); int atomic_testandset_int(volatile u_int *p, u_int v); int atomic_testandset_long(volatile u_long *p, u_int v); +int atomic_testandclear_int(volatile u_int *p, u_int v); +int atomic_testandclear_long(volatile u_long *p, u_int v); #define ATOMIC_LOAD(TYPE, LOP) \ u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p) @@ -241,6 +243,40 @@ atomic_testandset_long(volatile u_long * return (res); } +static __inline int +atomic_testandclear_int(volatile u_int *p, u_int v) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " btrl %2,%1 ; " + " setc %0 ; " + "# atomic_testandclear_int" + : "=q" (res), /* 0 */ + "+m" (*p) /* 1 */ + : "Ir" (v & 0x1f) /* 2 */ + : "cc"); + return (res); +} + +static __inline int +atomic_testandclear_long(volatile u_long *p, u_int v) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " btrq %2,%1 ; " + " setc %0 ; " + "# atomic_testandclear_long" + : "=q" (res), /* 0 */ + "+m" (*p) /* 1 */ + : "Jr" ((u_long)(v & 0x3f)) /* 2 */ + : "cc"); + return (res); +} + /* * We assume that a = b will do atomic loads and stores. Due to the * IA32 memory model, a simple store guarantees release semantics. @@ -462,6 +498,7 @@ u_long atomic_swap_long(volatile u_long #define atomic_readandclear_32 atomic_readandclear_int #define atomic_fetchadd_32 atomic_fetchadd_int #define atomic_testandset_32 atomic_testandset_int +#define atomic_testandclear_32 atomic_testandclear_int /* Operations on 64-bit quad words. */ #define atomic_set_64 atomic_set_long @@ -485,6 +522,7 @@ u_long atomic_swap_long(volatile u_long #define atomic_readandclear_64 atomic_readandclear_long #define atomic_fetchadd_64 atomic_fetchadd_long #define atomic_testandset_64 atomic_testandset_long +#define atomic_testandclear_64 atomic_testandclear_long /* Operations on pointers. */ #define atomic_set_ptr atomic_set_long Modified: stable/10/sys/i386/include/atomic.h ============================================================================== --- stable/10/sys/i386/include/atomic.h Thu Jun 23 01:47:30 2016 (r302107) +++ stable/10/sys/i386/include/atomic.h Thu Jun 23 02:21:37 2016 (r302108) @@ -86,6 +86,7 @@ void atomic_##NAME##_barr_##TYPE(volatil int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); int atomic_testandset_int(volatile u_int *p, u_int v); +int atomic_testandclear_int(volatile u_int *p, u_int v); #define ATOMIC_LOAD(TYPE, LOP) \ u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p) @@ -224,6 +225,23 @@ atomic_testandset_int(volatile u_int *p, return (res); } +static __inline int +atomic_testandclear_int(volatile u_int *p, u_int v) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " btrl %2,%1 ; " + " setc %0 ; " + "# atomic_testandclear_int" + : "=q" (res), /* 0 */ + "+m" (*p) /* 1 */ + : "Ir" (v & 0x1f) /* 2 */ + : "cc"); + return (res); +} + /* * We assume that a = b will do atomic loads and stores. Due to the * IA32 memory model, a simple store guarantees release semantics. @@ -549,6 +567,13 @@ atomic_testandset_long(volatile u_long * return (atomic_testandset_int((volatile u_int *)p, v)); } +static __inline int +atomic_testandclear_long(volatile u_long *p, u_int v) +{ + + return (atomic_testandclear_int((volatile u_int *)p, v)); +} + /* Read the current value and store a new value in the destination. */ #ifdef __GNUCLIKE_ASM @@ -675,6 +700,7 @@ u_long atomic_swap_long(volatile u_long #define atomic_readandclear_32 atomic_readandclear_int #define atomic_fetchadd_32 atomic_fetchadd_int #define atomic_testandset_32 atomic_testandset_int +#define atomic_testandclear_32 atomic_testandclear_int /* Operations on pointers. */ #define atomic_set_ptr(p, v) \ From owner-svn-src-all@freebsd.org Thu Jun 23 02:37:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 448FAB7343C; Thu, 23 Jun 2016 02:37:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 030D31702; Thu, 23 Jun 2016 02:37:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N2bP7T014472; Thu, 23 Jun 2016 02:37:25 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N2bO4X014467; Thu, 23 Jun 2016 02:37:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230237.u5N2bO4X014467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 02:37:24 +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: r302109 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 02:37:26 -0000 Author: sephe Date: Thu Jun 23 02:37:24 2016 New Revision: 302109 URL: https://svnweb.freebsd.org/changeset/base/302109 Log: MFC 299927,300101,300102,300105,300107 299927 hyperv/vmbus: Use atomic_testandclear Prepare to use unsigned long for event channel bit array. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6382 300101 hyperv/vmbus: Use unsigned long for event bits. And move base channel id calculation out of inner loop. This prepares for more event processing optimization. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6384 300102 hyperv/vmbus: Reduce the # of event loops by recording event flag count Use vmbus softc to save vmbus per-cpu data. More stuffs will be moved into vmbus softc. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6403 300105 hyperv/vmbus: Use atomic swap and flsl to process event flags Greatly reduce the locked instructions and reduce number of inner loops. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6404 300107 hyperv/vmbus: Avoid two unnecessary protocol checks on isr handling path MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6405 Added: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h - copied, changed from r300102, head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel.c Thu Jun 23 02:21:37 2016 (r302108) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c Thu Jun 23 02:37:24 2016 (r302109) @@ -42,7 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include "hv_vmbus_priv.h" +#include +#include static int vmbus_channel_create_gpadl_header( /* must be phys and virt contiguous*/ @@ -199,6 +200,8 @@ hv_vmbus_channel_open( new_channel->on_channel_callback = pfn_on_channel_callback; new_channel->channel_callback_context = context; + vmbus_on_channel_open(new_channel); + new_channel->rxq = hv_vmbus_g_context.hv_event_queue[new_channel->target_cpu]; TASK_INIT(&new_channel->channel_task, 0, VmbusProcessChannelEvent, new_channel); Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 02:21:37 2016 (r302108) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 02:37:24 2016 (r302109) @@ -36,11 +36,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include "hv_vmbus_priv.h" +#include +#include /* * Globals @@ -290,76 +292,71 @@ hv_vmbus_disconnect(void) { return (ret); } -/** - * Handler for events - */ -void -hv_vmbus_on_events(int cpu) +static __inline void +vmbus_event_flags_proc(unsigned long *event_flags, int flag_cnt) { - int bit; - int dword; - void *page_addr; - uint32_t* recv_interrupt_page = NULL; - int rel_id; - int maxdword; - hv_vmbus_synic_event_flags *event; + int f; - KASSERT(cpu <= mp_maxid, ("VMBUS: hv_vmbus_on_events: " - "cpu out of range!")); + for (f = 0; f < flag_cnt; ++f) { + uint32_t rel_id_base; + unsigned long flags; + int bit; - page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu]; - event = (hv_vmbus_synic_event_flags *) - page_addr + HV_VMBUS_MESSAGE_SINT; - if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) || - (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7)) { - maxdword = HV_MAX_NUM_CHANNELS_SUPPORTED >> 5; - /* - * receive size is 1/2 page and divide that by 4 bytes - */ - if (synch_test_and_clear_bit(0, &event->flags32[0])) { - recv_interrupt_page = - hv_vmbus_g_connection.recv_interrupt_page; - } else { - return; + if (event_flags[f] == 0) + continue; + + flags = atomic_swap_long(&event_flags[f], 0); + rel_id_base = f << HV_CHANNEL_ULONG_SHIFT; + + while ((bit = ffsl(flags)) != 0) { + struct hv_vmbus_channel *channel; + uint32_t rel_id; + + --bit; /* NOTE: ffsl is 1-based */ + flags &= ~(1UL << bit); + + rel_id = rel_id_base + bit; + channel = hv_vmbus_g_connection.channels[rel_id]; + + /* if channel is closed or closing */ + if (channel == NULL || channel->rxq == NULL) + continue; + + if (channel->batched_reading) + hv_ring_buffer_read_begin(&channel->inbound); + taskqueue_enqueue(channel->rxq, &channel->channel_task); } - } else { - /* - * On Host with Win8 or above, the event page can be - * checked directly to get the id of the channel - * that has the pending interrupt. - */ - maxdword = HV_EVENT_FLAGS_DWORD_COUNT; - recv_interrupt_page = event->flags32; } +} + +void +vmbus_event_proc(struct vmbus_softc *sc, int cpu) +{ + hv_vmbus_synic_event_flags *event; + + event = ((hv_vmbus_synic_event_flags *) + hv_vmbus_g_context.syn_ic_event_page[cpu]) + HV_VMBUS_MESSAGE_SINT; /* - * Check events + * On Host with Win8 or above, the event page can be checked directly + * to get the id of the channel that has the pending interrupt. */ - for (dword = 0; dword < maxdword; dword++) { - if (recv_interrupt_page[dword] == 0) - continue; + vmbus_event_flags_proc(event->flagsul, + VMBUS_SC_PCPU_GET(sc, event_flag_cnt, cpu)); +} - for (bit = 0; bit < HV_CHANNEL_DWORD_LEN; bit++) { - if (synch_test_and_clear_bit(bit, - (uint32_t *)&recv_interrupt_page[dword])) { - struct hv_vmbus_channel *channel; - - rel_id = (dword << 5) + bit; - channel = - hv_vmbus_g_connection.channels[rel_id]; - - /* if channel is closed or closing */ - if (channel == NULL || channel->rxq == NULL) - continue; - - if (channel->batched_reading) { - hv_ring_buffer_read_begin( - &channel->inbound); - } - taskqueue_enqueue(channel->rxq, - &channel->channel_task); - } - } +void +vmbus_event_proc_compat(struct vmbus_softc *sc __unused, int cpu) +{ + hv_vmbus_synic_event_flags *event; + + event = ((hv_vmbus_synic_event_flags *) + hv_vmbus_g_context.syn_ic_event_page[cpu]) + HV_VMBUS_MESSAGE_SINT; + + if (atomic_testandclear_int(&event->flags32[0], 0)) { + vmbus_event_flags_proc( + hv_vmbus_g_connection.recv_interrupt_page, + HV_MAX_NUM_CHANNELS_SUPPORTED >> HV_CHANNEL_ULONG_SHIFT); } } @@ -414,3 +411,30 @@ hv_vmbus_set_event(hv_vmbus_channel *cha return (ret); } + +void +vmbus_on_channel_open(const struct hv_vmbus_channel *chan) +{ + volatile int *flag_cnt_ptr; + int flag_cnt; + + flag_cnt = (chan->offer_msg.child_rel_id / HV_CHANNEL_ULONG_LEN) + 1; + flag_cnt_ptr = VMBUS_PCPU_PTR(event_flag_cnt, chan->target_cpu); + + for (;;) { + int old_flag_cnt; + + old_flag_cnt = *flag_cnt_ptr; + if (old_flag_cnt >= flag_cnt) + break; + if (atomic_cmpset_int(flag_cnt_ptr, old_flag_cnt, flag_cnt)) { + if (bootverbose) { + printf("VMBUS: channel%u update " + "cpu%d flag_cnt to %d\n", + chan->offer_msg.child_rel_id, + chan->target_cpu, flag_cnt); + } + break; + } + } +} Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 02:21:37 2016 (r302108) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 02:37:24 2016 (r302109) @@ -60,11 +60,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include "hv_vmbus_priv.h" +#include +#include #include #include "acpi_if.h" +struct vmbus_softc *vmbus_sc; + static device_t vmbus_devp; static int vmbus_inited; static hv_setup_args setup_args; /* only CPU 0 supported at this time */ @@ -143,6 +146,7 @@ handled: static inline int hv_vmbus_isr(struct trapframe *frame) { + struct vmbus_softc *sc = vmbus_get_softc(); int cpu; hv_vmbus_message* msg; void* page_addr; @@ -154,8 +158,7 @@ hv_vmbus_isr(struct trapframe *frame) * before checking for messages. This is the way they do it * in Windows when running as a guest in Hyper-V */ - - hv_vmbus_on_events(cpu); + sc->vmbus_event_proc(sc, cpu); /* Check if there are actual msgs to be process */ page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu]; @@ -455,6 +458,7 @@ vmbus_cpuset_setthread_task(void *xmask, static int vmbus_bus_init(void) { + struct vmbus_softc *sc; int i, j, n, ret; char buf[MAXCOMLEN + 1]; cpuset_t cpu_mask; @@ -463,6 +467,7 @@ vmbus_bus_init(void) return (0); vmbus_inited = 1; + sc = vmbus_get_softc(); ret = hv_vmbus_init(); @@ -559,6 +564,12 @@ vmbus_bus_init(void) if (ret != 0) goto cleanup1; + if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 || + hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) + sc->vmbus_event_proc = vmbus_event_proc_compat; + else + sc->vmbus_event_proc = vmbus_event_proc; + hv_vmbus_request_channel_offers(); vmbus_scan(); @@ -593,12 +604,26 @@ vmbus_bus_init(void) return (ret); } +static void +vmbus_event_proc_dummy(struct vmbus_softc *sc __unused, int cpu __unused) +{ +} + static int vmbus_attach(device_t dev) { if(bootverbose) device_printf(dev, "VMBUS: attach dev: %p\n", dev); + vmbus_devp = dev; + vmbus_sc = device_get_softc(dev); + + /* + * Event processing logic will be configured: + * - After the vmbus protocol version negotiation. + * - Before we request channel offers. + */ + vmbus_sc->vmbus_event_proc = vmbus_event_proc_dummy; /* * If the system has already booted and thread @@ -616,7 +641,7 @@ vmbus_attach(device_t dev) static void vmbus_init(void) { - if (vm_guest != VM_GUEST_HV) + if (vm_guest != VM_GUEST_HV || vmbus_get_softc() == NULL) return; /* @@ -720,9 +745,11 @@ static device_method_t vmbus_methods[] = { 0, 0 } }; -static char driver_name[] = "vmbus"; -static driver_t vmbus_driver = { driver_name, vmbus_methods,0, }; - +static driver_t vmbus_driver = { + "vmbus", + vmbus_methods, + sizeof(struct vmbus_softc) +}; devclass_t vmbus_devclass; Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 02:21:37 2016 (r302108) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 02:37:24 2016 (r302109) @@ -57,10 +57,18 @@ typedef uint16_t hv_vmbus_status; #define HV_EVENT_FLAGS_COUNT (256 * 8) #define HV_EVENT_FLAGS_BYTE_COUNT (256) #define HV_EVENT_FLAGS_DWORD_COUNT (256 / sizeof(uint32_t)) +#define HV_EVENT_FLAGS_ULONG_COUNT (256 / sizeof(unsigned long)) /** * max channel count <== event_flags_dword_count * bit_of_dword */ +#ifdef __LP64__ +#define HV_CHANNEL_ULONG_LEN (64) +#define HV_CHANNEL_ULONG_SHIFT (6) +#else +#define HV_CHANNEL_ULONG_LEN (32) +#define HV_CHANNEL_ULONG_SHIFT (5) +#endif #define HV_CHANNEL_DWORD_LEN (32) #define HV_CHANNEL_MAX_COUNT \ ((HV_EVENT_FLAGS_DWORD_COUNT) * HV_CHANNEL_DWORD_LEN) @@ -575,7 +583,9 @@ typedef struct { typedef union { uint8_t flags8[HV_EVENT_FLAGS_BYTE_COUNT]; uint32_t flags32[HV_EVENT_FLAGS_DWORD_COUNT]; + unsigned long flagsul[HV_EVENT_FLAGS_ULONG_COUNT]; } hv_vmbus_synic_event_flags; +CTASSERT(sizeof(hv_vmbus_synic_event_flags) == HV_EVENT_FLAGS_BYTE_COUNT); #define HV_X64_CPUID_MIN (0x40000005) #define HV_X64_CPUID_MAX (0x4000ffff) @@ -743,7 +753,6 @@ int hv_vmbus_connect(void); int hv_vmbus_disconnect(void); int hv_vmbus_post_message(void *buffer, size_t buf_size); int hv_vmbus_set_event(hv_vmbus_channel *channel); -void hv_vmbus_on_events(int cpu); /** * Event Timer interfaces Copied and modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h (from r300102, head/sys/dev/hyperv/vmbus/vmbus_var.h) ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 18 03:19:53 2016 (r300102, copy source) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 02:37:24 2016 (r302109) @@ -36,6 +36,7 @@ struct vmbus_pcpu_data { } __aligned(CACHE_LINE_SIZE); struct vmbus_softc { + void (*vmbus_event_proc)(struct vmbus_softc *, int); struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; }; @@ -47,11 +48,15 @@ vmbus_get_softc(void) return vmbus_sc; } -#define VMBUS_PCPU_GET(field, cpu) \ - (vmbus_get_softc())->vmbus_pcpu[cpu].field -#define VMBUS_PCPU_PTR(field, cpu) \ - &(vmbus_get_softc())->vmbus_pcpu[cpu].field +#define VMBUS_SC_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field +#define VMBUS_SC_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field +#define VMBUS_PCPU_GET(field, cpu) \ + VMBUS_SC_PCPU_GET(vmbus_get_softc(), field, (cpu)) +#define VMBUS_PCPU_PTR(field, cpu) \ + VMBUS_SC_PCPU_PTR(vmbus_get_softc(), field, (cpu)) void vmbus_on_channel_open(const struct hv_vmbus_channel *); +void vmbus_event_proc(struct vmbus_softc *, int); +void vmbus_event_proc_compat(struct vmbus_softc *, int); #endif /* !_VMBUS_VAR_H_ */ From owner-svn-src-all@freebsd.org Thu Jun 23 02:53:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE668B73767; Thu, 23 Jun 2016 02:53:01 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A55B82059; Thu, 23 Jun 2016 02:53:01 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N2r0Tg021628; Thu, 23 Jun 2016 02:53:00 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N2r0lM021624; Thu, 23 Jun 2016 02:53:00 GMT (envelope-from np@FreeBSD.org) Message-Id: <201606230253.u5N2r0lM021624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 23 Jun 2016 02:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302110 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 02:53:02 -0000 Author: np Date: Thu Jun 23 02:53:00 2016 New Revision: 302110 URL: https://svnweb.freebsd.org/changeset/base/302110 Log: cxgbe(4): Merge netmap support from the ncxgbe/ncxl interfaces to the vcxgbe/vcxl interfaces and retire the 'n' interfaces. The main cxgbe/cxl interfaces and tunables related to them are not affected by any of this and will continue to operate as usual. The driver used to create an additional 'n' interface for every cxgbe/cxl interface if "device netmap" was in the kernel. The 'n' interface shared the wire with the main interface but was otherwise autonomous (with its own MAC address, etc.). It did not have normal tx/rx but had a specialized netmap-only data path. r291665 added another set of virtual interfaces (the 'v' interfaces) to the driver. These had normal tx/rx but no netmap support. This revision consolidates the features of both the interfaces into the 'v' interface which now has a normal data path, TOE support, and native netmap support. The 'v' interfaces need to be created explicitly with the hw.cxgbe.num_vis tunable. This means "device netmap" will not result in the automatic creation of any virtual interfaces. The following tunables can be used to override the default number of queues allocated for each 'v' interface. nofld* = 0 will disable TOE on the virtual interface and nnm* = 0 to will disable native netmap support. # number of normal NIC queues hw.cxgbe.ntxq_vi hw.cxgbe.nrxq_vi # number of TOE queues hw.cxgbe.nofldtxq_vi hw.cxgbe.nofldrxq_vi # number of netmap queues hw.cxgbe.nnmtxq_vi hw.cxgbe.nnmrxq_vi hw.cxgbe.nnm{t,r}xq{10,1}g tunables have been removed. --- tl;dr version --- The workflow for netmap on cxgbe starting with FreeBSD 11 is: 1) "device netmap" in the kernel config. 2) "hw.cxgbe.num_vis=2" in loader.conf. num_vis > 2 is ok too, you'll end up with multiple autonomous netmap-capable interfaces for every port. 3) "dmesg | grep vcxl | grep netmap" to verify that the interface has netmap queues. 4) Use any of the 'v' interfaces for netmap. pkt-gen -i vcxl... . One major improvement is that the netmap interface has a normal data path as expected. 5) Just ignore the cxl interfaces if you want to use netmap only. No need to bring them up. The vcxl interfaces are completely independent and everything should just work. --------------------- Approved by: re@ (gjb@) Relnotes: Yes Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Thu Jun 23 02:37:24 2016 (r302109) +++ head/sys/dev/cxgbe/adapter.h Thu Jun 23 02:53:00 2016 (r302110) @@ -208,7 +208,6 @@ enum { INTR_RXQ = (1 << 4), /* All NIC rxq's take interrupts */ INTR_OFLD_RXQ = (1 << 5), /* All TOE rxq's take interrupts */ INTR_ALL = (INTR_RXQ | INTR_OFLD_RXQ), - VI_NETMAP = (1 << 6), /* adapter debug_flags */ DF_DUMP_MBOX = (1 << 0), @@ -230,7 +229,7 @@ struct vi_info { unsigned long flags; int if_flags; - uint16_t *rss; + uint16_t *rss, *nm_rss; uint16_t viid; int16_t xact_addr_filt;/* index of exact MAC address filter */ uint16_t rss_size; /* size of VI's RSS table slice */ @@ -251,6 +250,10 @@ struct vi_info { int first_ofld_txq; /* index of first offload tx queue */ int nofldrxq; /* # of offload rx queues */ int first_ofld_rxq; /* index of first offload rx queue */ + int nnmtxq; + int first_nm_txq; + int nnmrxq; + int first_nm_rxq; int tmr_idx; int pktc_idx; int qsize_rxq; @@ -362,6 +365,11 @@ enum { IQS_DISABLED = 0, IQS_BUSY = 1, IQS_IDLE = 2, + + /* netmap related flags */ + NM_OFF = 0, + NM_ON = 1, + NM_BUSY = 2, }; /* @@ -765,8 +773,11 @@ struct adapter { struct irq { struct resource *res; int rid; + volatile int nm_state; /* NM_OFF, NM_ON, or NM_BUSY */ void *tag; - } *irq; + struct sge_rxq *rxq; + struct sge_nm_rxq *nm_rxq; + } __aligned(CACHE_LINE_SIZE) *irq; bus_dma_tag_t dmat; /* Parent DMA tag */ @@ -911,11 +922,11 @@ struct adapter { for (q = &vi->pi->adapter->sge.ofld_rxq[vi->first_ofld_rxq], iter = 0; \ iter < vi->nofldrxq; ++iter, ++q) #define for_each_nm_txq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.nm_txq[vi->first_txq], iter = 0; \ - iter < vi->ntxq; ++iter, ++q) + for (q = &vi->pi->adapter->sge.nm_txq[vi->first_nm_txq], iter = 0; \ + iter < vi->nnmtxq; ++iter, ++q) #define for_each_nm_rxq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.nm_rxq[vi->first_rxq], iter = 0; \ - iter < vi->nrxq; ++iter, ++q) + for (q = &vi->pi->adapter->sge.nm_rxq[vi->first_nm_rxq], iter = 0; \ + iter < vi->nnmrxq; ++iter, ++q) #define for_each_vi(_pi, _iter, _vi) \ for ((_vi) = (_pi)->vi, (_iter) = 0; (_iter) < (_pi)->nvi; \ ++(_iter), ++(_vi)) @@ -1087,8 +1098,8 @@ void vi_tick(void *); #ifdef DEV_NETMAP /* t4_netmap.c */ -int create_netmap_ifnet(struct port_info *); -int destroy_netmap_ifnet(struct port_info *); +void cxgbe_nm_attach(struct vi_info *); +void cxgbe_nm_detach(struct vi_info *); void t4_nm_intr(void *); #endif @@ -1109,6 +1120,7 @@ int t4_setup_vi_queues(struct vi_info *) int t4_teardown_vi_queues(struct vi_info *); void t4_intr_all(void *); void t4_intr(void *); +void t4_vi_intr(void *); void t4_intr_err(void *); void t4_intr_evt(void *); void t4_wrq_tx_locked(struct adapter *, struct sge_wrq *, struct wrqe *); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Jun 23 02:37:24 2016 (r302109) +++ head/sys/dev/cxgbe/t4_main.c Thu Jun 23 02:53:00 2016 (r302110) @@ -230,6 +230,14 @@ TUNABLE_INT("hw.cxgbe.ntxq1g", &t4_ntxq1 static int t4_nrxq1g = -1; TUNABLE_INT("hw.cxgbe.nrxq1g", &t4_nrxq1g); +#define NTXQ_VI 1 +static int t4_ntxq_vi = -1; +TUNABLE_INT("hw.cxgbe.ntxq_vi", &t4_ntxq_vi); + +#define NRXQ_VI 1 +static int t4_nrxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nrxq_vi", &t4_nrxq_vi); + static int t4_rsrv_noflowq = 0; TUNABLE_INT("hw.cxgbe.rsrv_noflowq", &t4_rsrv_noflowq); @@ -249,24 +257,24 @@ TUNABLE_INT("hw.cxgbe.nofldtxq1g", &t4_n #define NOFLDRXQ_1G 1 static int t4_nofldrxq1g = -1; TUNABLE_INT("hw.cxgbe.nofldrxq1g", &t4_nofldrxq1g); + +#define NOFLDTXQ_VI 1 +static int t4_nofldtxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nofldtxq_vi", &t4_nofldtxq_vi); + +#define NOFLDRXQ_VI 1 +static int t4_nofldrxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nofldrxq_vi", &t4_nofldrxq_vi); #endif #ifdef DEV_NETMAP -#define NNMTXQ_10G 2 -static int t4_nnmtxq10g = -1; -TUNABLE_INT("hw.cxgbe.nnmtxq10g", &t4_nnmtxq10g); - -#define NNMRXQ_10G 2 -static int t4_nnmrxq10g = -1; -TUNABLE_INT("hw.cxgbe.nnmrxq10g", &t4_nnmrxq10g); - -#define NNMTXQ_1G 1 -static int t4_nnmtxq1g = -1; -TUNABLE_INT("hw.cxgbe.nnmtxq1g", &t4_nnmtxq1g); - -#define NNMRXQ_1G 1 -static int t4_nnmrxq1g = -1; -TUNABLE_INT("hw.cxgbe.nnmrxq1g", &t4_nnmrxq1g); +#define NNMTXQ_VI 2 +static int t4_nnmtxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nnmtxq_vi", &t4_nnmtxq_vi); + +#define NNMRXQ_VI 2 +static int t4_nnmrxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nnmrxq_vi", &t4_nnmrxq_vi); #endif /* @@ -387,18 +395,18 @@ struct intrs_and_queues { uint16_t ntxq1g; /* # of NIC txq's for each 1G port */ uint16_t nrxq1g; /* # of NIC rxq's for each 1G port */ uint16_t rsrv_noflowq; /* Flag whether to reserve queue 0 */ -#ifdef TCP_OFFLOAD uint16_t nofldtxq10g; /* # of TOE txq's for each 10G port */ uint16_t nofldrxq10g; /* # of TOE rxq's for each 10G port */ uint16_t nofldtxq1g; /* # of TOE txq's for each 1G port */ uint16_t nofldrxq1g; /* # of TOE rxq's for each 1G port */ -#endif -#ifdef DEV_NETMAP - uint16_t nnmtxq10g; /* # of netmap txq's for each 10G port */ - uint16_t nnmrxq10g; /* # of netmap rxq's for each 10G port */ - uint16_t nnmtxq1g; /* # of netmap txq's for each 1G port */ - uint16_t nnmrxq1g; /* # of netmap rxq's for each 1G port */ -#endif + + /* The vcxgbe/vcxl interfaces use these and not the ones above. */ + uint16_t ntxq_vi; /* # of NIC txq's */ + uint16_t nrxq_vi; /* # of NIC rxq's */ + uint16_t nofldtxq_vi; /* # of TOE txq's */ + uint16_t nofldrxq_vi; /* # of TOE rxq's */ + uint16_t nnmtxq_vi; /* # of netmap txq's */ + uint16_t nnmrxq_vi; /* # of netmap rxq's */ }; struct filter_entry { @@ -802,10 +810,10 @@ t4_attach(device_t dev) goto done; /* error message displayed already */ /* - * Number of VIs to create per-port. The first VI is the - * "main" regular VI for the port. The second VI is used for - * netmap if present, and any remaining VIs are used for - * additional virtual interfaces. + * Number of VIs to create per-port. The first VI is the "main" regular + * VI for the port. The rest are additional virtual interfaces on the + * same physical port. Note that the main VI does not have native + * netmap support but the extra VIs do. * * Limit the number of VIs per port to the number of available * MAC addresses per port. @@ -814,9 +822,6 @@ t4_attach(device_t dev) num_vis = t4_num_vis; else num_vis = 1; -#ifdef DEV_NETMAP - num_vis++; -#endif if (num_vis > nitems(vi_mac_funcs)) { num_vis = nitems(vi_mac_funcs); device_printf(dev, "Number of VIs limited to %d\n", num_vis); @@ -831,7 +836,6 @@ t4_attach(device_t dev) n10g = n1g = 0; for_each_port(sc, i) { struct port_info *pi; - struct vi_info *vi; pi = malloc(sizeof(*pi), M_CXGBE, M_ZERO | M_WAITOK); sc->port[i] = pi; @@ -839,7 +843,10 @@ t4_attach(device_t dev) /* These must be set before t4_port_init */ pi->adapter = sc; pi->port_id = i; - pi->nvi = num_vis; + /* + * XXX: vi[0] is special so we can't delay this allocation until + * pi->nvi's final value is known. + */ pi->vi = malloc(sizeof(struct vi_info) * num_vis, M_CXGBE, M_ZERO | M_WAITOK); @@ -881,26 +888,12 @@ t4_attach(device_t dev) if (is_10G_port(pi) || is_40G_port(pi)) { n10g++; - for_each_vi(pi, j, vi) { - vi->tmr_idx = t4_tmr_idx_10g; - vi->pktc_idx = t4_pktc_idx_10g; - } } else { n1g++; - for_each_vi(pi, j, vi) { - vi->tmr_idx = t4_tmr_idx_1g; - vi->pktc_idx = t4_pktc_idx_1g; - } } pi->linkdnrc = -1; - for_each_vi(pi, j, vi) { - vi->qsize_rxq = t4_qsize_rxq; - vi->qsize_txq = t4_qsize_txq; - vi->pi = pi; - } - pi->dev = device_add_child(dev, is_t4(sc) ? "cxgbe" : "cxl", -1); if (pi->dev == NULL) { device_printf(dev, @@ -915,12 +908,11 @@ t4_attach(device_t dev) /* * Interrupt type, # of interrupts, # of rx/tx queues, etc. */ -#ifdef DEV_NETMAP - num_vis--; -#endif rc = cfg_itype_and_nqueues(sc, n10g, n1g, num_vis, &iaq); if (rc != 0) goto done; /* error message displayed already */ + if (iaq.nrxq_vi + iaq.nofldrxq_vi + iaq.nnmrxq_vi == 0) + num_vis = 1; sc->intr_type = iaq.intr_type; sc->intr_count = iaq.nirq; @@ -929,8 +921,8 @@ t4_attach(device_t dev) s->nrxq = n10g * iaq.nrxq10g + n1g * iaq.nrxq1g; s->ntxq = n10g * iaq.ntxq10g + n1g * iaq.ntxq1g; if (num_vis > 1) { - s->nrxq += (n10g + n1g) * (num_vis - 1); - s->ntxq += (n10g + n1g) * (num_vis - 1); + s->nrxq += (n10g + n1g) * (num_vis - 1) * iaq.nrxq_vi; + s->ntxq += (n10g + n1g) * (num_vis - 1) * iaq.ntxq_vi; } s->neq = s->ntxq + s->nrxq; /* the free list in an rxq is an eq */ s->neq += sc->params.nports + 1;/* ctrl queues: 1 per port + 1 mgmt */ @@ -940,8 +932,10 @@ t4_attach(device_t dev) s->nofldrxq = n10g * iaq.nofldrxq10g + n1g * iaq.nofldrxq1g; s->nofldtxq = n10g * iaq.nofldtxq10g + n1g * iaq.nofldtxq1g; if (num_vis > 1) { - s->nofldrxq += (n10g + n1g) * (num_vis - 1); - s->nofldtxq += (n10g + n1g) * (num_vis - 1); + s->nofldrxq += (n10g + n1g) * (num_vis - 1) * + iaq.nofldrxq_vi; + s->nofldtxq += (n10g + n1g) * (num_vis - 1) * + iaq.nofldtxq_vi; } s->neq += s->nofldtxq + s->nofldrxq; s->niq += s->nofldrxq; @@ -953,8 +947,10 @@ t4_attach(device_t dev) } #endif #ifdef DEV_NETMAP - s->nnmrxq = n10g * iaq.nnmrxq10g + n1g * iaq.nnmrxq1g; - s->nnmtxq = n10g * iaq.nnmtxq10g + n1g * iaq.nnmtxq1g; + if (num_vis > 1) { + s->nnmrxq = (n10g + n1g) * (num_vis - 1) * iaq.nnmrxq_vi; + s->nnmtxq = (n10g + n1g) * (num_vis - 1) * iaq.nnmtxq_vi; + } s->neq += s->nnmtxq + s->nnmrxq; s->niq += s->nnmrxq; @@ -998,62 +994,64 @@ t4_attach(device_t dev) if (pi == NULL) continue; + pi->nvi = num_vis; for_each_vi(pi, j, vi) { -#ifdef DEV_NETMAP - if (j == 1) { - vi->flags |= VI_NETMAP | INTR_RXQ; - vi->first_rxq = nm_rqidx; - vi->first_txq = nm_tqidx; - if (is_10G_port(pi) || is_40G_port(pi)) { - vi->nrxq = iaq.nnmrxq10g; - vi->ntxq = iaq.nnmtxq10g; - } else { - vi->nrxq = iaq.nnmrxq1g; - vi->ntxq = iaq.nnmtxq1g; - } - nm_rqidx += vi->nrxq; - nm_tqidx += vi->ntxq; - continue; - } -#endif + vi->pi = pi; + vi->qsize_rxq = t4_qsize_rxq; + vi->qsize_txq = t4_qsize_txq; vi->first_rxq = rqidx; vi->first_txq = tqidx; if (is_10G_port(pi) || is_40G_port(pi)) { + vi->tmr_idx = t4_tmr_idx_10g; + vi->pktc_idx = t4_pktc_idx_10g; vi->flags |= iaq.intr_flags_10g & INTR_RXQ; - vi->nrxq = j == 0 ? iaq.nrxq10g : 1; - vi->ntxq = j == 0 ? iaq.ntxq10g : 1; + vi->nrxq = j == 0 ? iaq.nrxq10g : iaq.nrxq_vi; + vi->ntxq = j == 0 ? iaq.ntxq10g : iaq.ntxq_vi; } else { + vi->tmr_idx = t4_tmr_idx_1g; + vi->pktc_idx = t4_pktc_idx_1g; vi->flags |= iaq.intr_flags_1g & INTR_RXQ; - vi->nrxq = j == 0 ? iaq.nrxq1g : 1; - vi->ntxq = j == 0 ? iaq.ntxq1g : 1; + vi->nrxq = j == 0 ? iaq.nrxq1g : iaq.nrxq_vi; + vi->ntxq = j == 0 ? iaq.ntxq1g : iaq.ntxq_vi; } + rqidx += vi->nrxq; + tqidx += vi->ntxq; - if (vi->ntxq > 1) + if (j == 0 && vi->ntxq > 1) vi->rsrv_noflowq = iaq.rsrv_noflowq ? 1 : 0; else vi->rsrv_noflowq = 0; - rqidx += vi->nrxq; - tqidx += vi->ntxq; - #ifdef TCP_OFFLOAD - if (!is_offload(sc)) - continue; vi->first_ofld_rxq = ofld_rqidx; vi->first_ofld_txq = ofld_tqidx; if (is_10G_port(pi) || is_40G_port(pi)) { vi->flags |= iaq.intr_flags_10g & INTR_OFLD_RXQ; - vi->nofldrxq = j == 0 ? iaq.nofldrxq10g : 1; - vi->nofldtxq = j == 0 ? iaq.nofldtxq10g : 1; + vi->nofldrxq = j == 0 ? iaq.nofldrxq10g : + iaq.nofldrxq_vi; + vi->nofldtxq = j == 0 ? iaq.nofldtxq10g : + iaq.nofldtxq_vi; } else { vi->flags |= iaq.intr_flags_1g & INTR_OFLD_RXQ; - vi->nofldrxq = j == 0 ? iaq.nofldrxq1g : 1; - vi->nofldtxq = j == 0 ? iaq.nofldtxq1g : 1; + vi->nofldrxq = j == 0 ? iaq.nofldrxq1g : + iaq.nofldrxq_vi; + vi->nofldtxq = j == 0 ? iaq.nofldtxq1g : + iaq.nofldtxq_vi; } ofld_rqidx += vi->nofldrxq; ofld_tqidx += vi->nofldtxq; #endif +#ifdef DEV_NETMAP + if (j > 0) { + vi->first_nm_rxq = nm_rqidx; + vi->first_nm_txq = nm_tqidx; + vi->nnmrxq = iaq.nnmrxq_vi; + vi->nnmtxq = iaq.nnmtxq_vi; + nm_rqidx += vi->nnmrxq; + nm_tqidx += vi->nnmtxq; + } +#endif } } @@ -1275,7 +1273,10 @@ cxgbe_vi_attach(device_t dev, struct vi_ EVENTHANDLER_PRI_ANY); ether_ifattach(ifp, vi->hw_addr); - +#ifdef DEV_NETMAP + if (vi->nnmrxq != 0) + cxgbe_nm_attach(vi); +#endif sb = sbuf_new_auto(); sbuf_printf(sb, "%d txq, %d rxq (NIC)", vi->ntxq, vi->nrxq); #ifdef TCP_OFFLOAD @@ -1283,6 +1284,11 @@ cxgbe_vi_attach(device_t dev, struct vi_ sbuf_printf(sb, "; %d txq, %d rxq (TOE)", vi->nofldtxq, vi->nofldrxq); #endif +#ifdef DEV_NETMAP + if (ifp->if_capabilities & IFCAP_NETMAP) + sbuf_printf(sb, "; %d txq, %d rxq (netmap)", + vi->nnmtxq, vi->nnmrxq); +#endif sbuf_finish(sb); device_printf(dev, "%s\n", sbuf_data(sb)); sbuf_delete(sb); @@ -1308,21 +1314,8 @@ cxgbe_attach(device_t dev) for_each_vi(pi, i, vi) { if (i == 0) continue; -#ifdef DEV_NETMAP - if (vi->flags & VI_NETMAP) { - /* - * media handled here to keep - * implementation private to this file - */ - ifmedia_init(&vi->media, IFM_IMASK, cxgbe_media_change, - cxgbe_media_status); - build_medialist(pi, &vi->media); - vi->dev = device_add_child(dev, is_t4(pi->adapter) ? - "ncxgbe" : "ncxl", device_get_unit(dev)); - } else -#endif - vi->dev = device_add_child(dev, is_t4(pi->adapter) ? - "vcxgbe" : "vcxl", -1); + vi->dev = device_add_child(dev, is_t4(pi->adapter) ? + "vcxgbe" : "vcxl", -1); if (vi->dev == NULL) { device_printf(dev, "failed to add VI %d\n", i); continue; @@ -1348,6 +1341,10 @@ cxgbe_vi_detach(struct vi_info *vi) EVENTHANDLER_DEREGISTER(vlan_config, vi->vlan_c); /* Let detach proceed even if these fail. */ +#ifdef DEV_NETMAP + if (ifp->if_capabilities & IFCAP_NETMAP) + cxgbe_nm_detach(vi); +#endif cxgbe_uninit_synchronized(vi); callout_drain(&vi->tick); vi_full_uninit(vi); @@ -1710,7 +1707,7 @@ vi_get_counter(struct ifnet *ifp, ift_co uint64_t drops; drops = 0; - if ((vi->flags & (VI_INIT_DONE | VI_NETMAP)) == VI_INIT_DONE) { + if (vi->flags & VI_INIT_DONE) { int i; struct sge_txq *txq; @@ -2379,28 +2376,29 @@ cfg_itype_and_nqueues(struct adapter *sc { int rc, itype, navail, nrxq10g, nrxq1g, n; int nofldrxq10g = 0, nofldrxq1g = 0; - int nnmrxq10g = 0, nnmrxq1g = 0; bzero(iaq, sizeof(*iaq)); iaq->ntxq10g = t4_ntxq10g; iaq->ntxq1g = t4_ntxq1g; + iaq->ntxq_vi = t4_ntxq_vi; iaq->nrxq10g = nrxq10g = t4_nrxq10g; iaq->nrxq1g = nrxq1g = t4_nrxq1g; + iaq->nrxq_vi = t4_nrxq_vi; iaq->rsrv_noflowq = t4_rsrv_noflowq; #ifdef TCP_OFFLOAD if (is_offload(sc)) { iaq->nofldtxq10g = t4_nofldtxq10g; iaq->nofldtxq1g = t4_nofldtxq1g; + iaq->nofldtxq_vi = t4_nofldtxq_vi; iaq->nofldrxq10g = nofldrxq10g = t4_nofldrxq10g; iaq->nofldrxq1g = nofldrxq1g = t4_nofldrxq1g; + iaq->nofldrxq_vi = t4_nofldrxq_vi; } #endif #ifdef DEV_NETMAP - iaq->nnmtxq10g = t4_nnmtxq10g; - iaq->nnmtxq1g = t4_nnmtxq1g; - iaq->nnmrxq10g = nnmrxq10g = t4_nnmrxq10g; - iaq->nnmrxq1g = nnmrxq1g = t4_nnmrxq1g; + iaq->nnmtxq_vi = t4_nnmtxq_vi; + iaq->nnmrxq_vi = t4_nnmrxq_vi; #endif for (itype = INTR_MSIX; itype; itype >>= 1) { @@ -2424,14 +2422,17 @@ restart: /* * Best option: an interrupt vector for errors, one for the - * firmware event queue, and one for every rxq (NIC, TOE, and - * netmap). + * firmware event queue, and one for every rxq (NIC and TOE) of + * every VI. The VIs that support netmap use the same + * interrupts for the NIC rx queues and the netmap rx queues + * because only one set of queues is active at a time. */ iaq->nirq = T4_EXTRA_INTR; - iaq->nirq += n10g * (nrxq10g + nofldrxq10g + nnmrxq10g); - iaq->nirq += n10g * 2 * (num_vis - 1); - iaq->nirq += n1g * (nrxq1g + nofldrxq1g + nnmrxq1g); - iaq->nirq += n1g * 2 * (num_vis - 1); + iaq->nirq += n10g * (nrxq10g + nofldrxq10g); + iaq->nirq += n1g * (nrxq1g + nofldrxq1g); + iaq->nirq += (n10g + n1g) * (num_vis - 1) * + max(iaq->nrxq_vi, iaq->nnmrxq_vi); /* See comment above. */ + iaq->nirq += (n10g + n1g) * (num_vis - 1) * iaq->nofldrxq_vi; if (iaq->nirq <= navail && (itype != INTR_MSI || powerof2(iaq->nirq))) { iaq->intr_flags_10g = INTR_ALL; @@ -2439,43 +2440,44 @@ restart: goto allocate; } + /* Disable the VIs (and netmap) if there aren't enough intrs */ + if (num_vis > 1) { + device_printf(sc->dev, "virtual interfaces disabled " + "because num_vis=%u with current settings " + "(nrxq10g=%u, nrxq1g=%u, nofldrxq10g=%u, " + "nofldrxq1g=%u, nrxq_vi=%u nofldrxq_vi=%u, " + "nnmrxq_vi=%u) would need %u interrupts but " + "only %u are available.\n", num_vis, nrxq10g, + nrxq1g, nofldrxq10g, nofldrxq1g, iaq->nrxq_vi, + iaq->nofldrxq_vi, iaq->nnmrxq_vi, iaq->nirq, + navail); + num_vis = 1; + iaq->ntxq_vi = iaq->nrxq_vi = 0; + iaq->nofldtxq_vi = iaq->nofldrxq_vi = 0; + iaq->nnmtxq_vi = iaq->nnmrxq_vi = 0; + goto restart; + } + /* * Second best option: a vector for errors, one for the firmware * event queue, and vectors for either all the NIC rx queues or * all the TOE rx queues. The queues that don't get vectors * will forward their interrupts to those that do. - * - * Note: netmap rx queues cannot be created early and so they - * can't be setup to receive forwarded interrupts for others. */ iaq->nirq = T4_EXTRA_INTR; if (nrxq10g >= nofldrxq10g) { iaq->intr_flags_10g = INTR_RXQ; iaq->nirq += n10g * nrxq10g; - iaq->nirq += n10g * (num_vis - 1); -#ifdef DEV_NETMAP - iaq->nnmrxq10g = min(nnmrxq10g, nrxq10g); -#endif } else { iaq->intr_flags_10g = INTR_OFLD_RXQ; iaq->nirq += n10g * nofldrxq10g; -#ifdef DEV_NETMAP - iaq->nnmrxq10g = min(nnmrxq10g, nofldrxq10g); -#endif } if (nrxq1g >= nofldrxq1g) { iaq->intr_flags_1g = INTR_RXQ; iaq->nirq += n1g * nrxq1g; - iaq->nirq += n1g * (num_vis - 1); -#ifdef DEV_NETMAP - iaq->nnmrxq1g = min(nnmrxq1g, nrxq1g); -#endif } else { iaq->intr_flags_1g = INTR_OFLD_RXQ; iaq->nirq += n1g * nofldrxq1g; -#ifdef DEV_NETMAP - iaq->nnmrxq1g = min(nnmrxq1g, nofldrxq1g); -#endif } if (iaq->nirq <= navail && (itype != INTR_MSI || powerof2(iaq->nirq))) @@ -2483,12 +2485,12 @@ restart: /* * Next best option: an interrupt vector for errors, one for the - * firmware event queue, and at least one per VI. At this - * point we know we'll have to downsize nrxq and/or nofldrxq - * and/or nnmrxq to fit what's available to us. + * firmware event queue, and at least one per main-VI. At this + * point we know we'll have to downsize nrxq and/or nofldrxq to + * fit what's available to us. */ iaq->nirq = T4_EXTRA_INTR; - iaq->nirq += (n10g + n1g) * num_vis; + iaq->nirq += n10g + n1g; if (iaq->nirq <= navail) { int leftover = navail - iaq->nirq; @@ -2508,9 +2510,6 @@ restart: #ifdef TCP_OFFLOAD iaq->nofldrxq10g = min(n, nofldrxq10g); #endif -#ifdef DEV_NETMAP - iaq->nnmrxq10g = min(n, nnmrxq10g); -#endif } if (n1g > 0) { @@ -2529,9 +2528,6 @@ restart: #ifdef TCP_OFFLOAD iaq->nofldrxq1g = min(n, nofldrxq1g); #endif -#ifdef DEV_NETMAP - iaq->nnmrxq1g = min(n, nnmrxq1g); -#endif } if (itype != INTR_MSI || powerof2(iaq->nirq)) @@ -2547,10 +2543,6 @@ restart: if (is_offload(sc)) iaq->nofldrxq10g = iaq->nofldrxq1g = 1; #endif -#ifdef DEV_NETMAP - iaq->nnmrxq10g = iaq->nnmrxq1g = 1; -#endif - allocate: navail = iaq->nirq; rc = 0; @@ -3823,6 +3815,7 @@ setup_intr_handlers(struct adapter *sc) struct irq *irq; struct port_info *pi; struct vi_info *vi; + struct sge *sge = &sc->sge; struct sge_rxq *rxq; #ifdef TCP_OFFLOAD struct sge_ofld_rxq *ofld_rxq; @@ -3854,7 +3847,7 @@ setup_intr_handlers(struct adapter *sc) rid++; /* The second one is always the firmware event queue */ - rc = t4_alloc_irq(sc, irq, rid, t4_intr_evt, &sc->sge.fwq, "evt"); + rc = t4_alloc_irq(sc, irq, rid, t4_intr_evt, &sge->fwq, "evt"); if (rc != 0) return (rc); irq++; @@ -3864,29 +3857,37 @@ setup_intr_handlers(struct adapter *sc) pi = sc->port[p]; for_each_vi(pi, v, vi) { vi->first_intr = rid - 1; + + if (vi->nnmrxq > 0) { + int n = max(vi->nrxq, vi->nnmrxq); + + MPASS(vi->flags & INTR_RXQ); + + rxq = &sge->rxq[vi->first_rxq]; #ifdef DEV_NETMAP - if (vi->flags & VI_NETMAP) { - for_each_nm_rxq(vi, q, nm_rxq) { - snprintf(s, sizeof(s), "%d-%d", p, q); + nm_rxq = &sge->nm_rxq[vi->first_nm_rxq]; +#endif + for (q = 0; q < n; q++) { + snprintf(s, sizeof(s), "%x%c%x", p, + 'a' + v, q); + if (q < vi->nrxq) + irq->rxq = rxq++; +#ifdef DEV_NETMAP + if (q < vi->nnmrxq) + irq->nm_rxq = nm_rxq++; +#endif rc = t4_alloc_irq(sc, irq, rid, - t4_nm_intr, nm_rxq, s); + t4_vi_intr, irq, s); if (rc != 0) return (rc); irq++; rid++; vi->nintr++; } - continue; - } -#endif - if (vi->flags & INTR_RXQ) { + } else if (vi->flags & INTR_RXQ) { for_each_rxq(vi, q, rxq) { - if (v == 0) - snprintf(s, sizeof(s), "%d.%d", - p, q); - else - snprintf(s, sizeof(s), - "%d(%d).%d", p, v, q); + snprintf(s, sizeof(s), "%x%c%x", p, + 'a' + v, q); rc = t4_alloc_irq(sc, irq, rid, t4_intr, rxq, s); if (rc != 0) @@ -3903,7 +3904,8 @@ setup_intr_handlers(struct adapter *sc) #ifdef TCP_OFFLOAD if (vi->flags & INTR_OFLD_RXQ) { for_each_ofld_rxq(vi, q, ofld_rxq) { - snprintf(s, sizeof(s), "%d,%d", p, q); + snprintf(s, sizeof(s), "%x%c%x", p, + 'A' + v, q); rc = t4_alloc_irq(sc, irq, rid, t4_intr, ofld_rxq, s); if (rc != 0) @@ -4074,14 +4076,6 @@ vi_full_init(struct vi_info *vi) if (rc != 0) goto done; /* error message displayed already */ -#ifdef DEV_NETMAP - /* Netmap VIs configure RSS when netmap is enabled. */ - if (vi->flags & VI_NETMAP) { - vi->flags |= VI_INIT_DONE; - return (0); - } -#endif - /* * Setup RSS for this VI. Save a copy of the RSS table for later use. */ @@ -4206,10 +4200,6 @@ vi_full_uninit(struct vi_info *vi) if (vi->flags & VI_INIT_DONE) { /* Need to quiesce queues. */ -#ifdef DEV_NETMAP - if (vi->flags & VI_NETMAP) - goto skip; -#endif /* XXX: Only for the first VI? */ if (IS_MAIN_VI(vi)) @@ -4237,10 +4227,8 @@ vi_full_uninit(struct vi_info *vi) } #endif free(vi->rss, M_CXGBE); + free(vi->nm_rss, M_CXGBE); } -#ifdef DEV_NETMAP -skip: -#endif t4_teardown_vi_queues(vi); vi->flags &= ~VI_INIT_DONE; @@ -4975,7 +4963,7 @@ vi_sysctls(struct vi_info *vi) ctx = device_get_sysctl_ctx(vi->dev); /* - * dev.[nv](cxgbe|cxl).X. + * dev.v?(cxgbe|cxl).X. */ oid = device_get_sysctl_tree(vi->dev); children = SYSCTL_CHILDREN(oid); @@ -4991,12 +4979,11 @@ vi_sysctls(struct vi_info *vi) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "first_txq", CTLFLAG_RD, &vi->first_txq, 0, "index of first tx queue"); - if (vi->flags & VI_NETMAP) - return; - - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rsrv_noflowq", CTLTYPE_INT | - CTLFLAG_RW, vi, 0, sysctl_noflowq, "IU", - "Reserve queue 0 for non-flowid packets"); + if (IS_MAIN_VI(vi)) { + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rsrv_noflowq", + CTLTYPE_INT | CTLFLAG_RW, vi, 0, sysctl_noflowq, "IU", + "Reserve queue 0 for non-flowid packets"); + } #ifdef TCP_OFFLOAD if (vi->nofldrxq != 0) { @@ -5014,6 +5001,20 @@ vi_sysctls(struct vi_info *vi) "index of first TOE tx queue"); } #endif +#ifdef DEV_NETMAP + if (vi->nnmrxq != 0) { + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nnmrxq", CTLFLAG_RD, + &vi->nnmrxq, 0, "# of netmap rx queues"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nnmtxq", CTLFLAG_RD, + &vi->nnmtxq, 0, "# of netmap tx queues"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "first_nm_rxq", + CTLFLAG_RD, &vi->first_nm_rxq, 0, + "index of first netmap rx queue"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "first_nm_txq", + CTLFLAG_RD, &vi->first_nm_txq, 0, + "index of first netmap tx queue"); + } +#endif SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "holdoff_tmr_idx", CTLTYPE_INT | CTLFLAG_RW, vi, 0, sysctl_holdoff_tmr_idx, "I", @@ -8871,9 +8872,6 @@ t4_ioctl(struct cdev *dev, unsigned long struct sge_txq *txq; struct sge_wrq *wrq; - if (vi->flags & VI_NETMAP) - continue; - for_each_rxq(vi, i, rxq) { #if defined(INET) || defined(INET6) rxq->lro.lro_queued = 0; @@ -9187,6 +9185,9 @@ tweak_tunables(void) #endif } + if (t4_ntxq_vi < 1) + t4_ntxq_vi = min(nc, NTXQ_VI); + if (t4_nrxq10g < 1) { #ifdef RSS t4_nrxq10g = rss_getnumbuckets(); @@ -9204,6 +9205,9 @@ tweak_tunables(void) #endif } + if (t4_nrxq_vi < 1) + t4_nrxq_vi = min(nc, NRXQ_VI); + #ifdef TCP_OFFLOAD if (t4_nofldtxq10g < 1) t4_nofldtxq10g = min(nc, NOFLDTXQ_10G); @@ -9211,12 +9215,18 @@ tweak_tunables(void) if (t4_nofldtxq1g < 1) t4_nofldtxq1g = min(nc, NOFLDTXQ_1G); + if (t4_nofldtxq_vi < 1) + t4_nofldtxq_vi = min(nc, NOFLDTXQ_VI); + if (t4_nofldrxq10g < 1) t4_nofldrxq10g = min(nc, NOFLDRXQ_10G); if (t4_nofldrxq1g < 1) t4_nofldrxq1g = min(nc, NOFLDRXQ_1G); + if (t4_nofldrxq_vi < 1) + t4_nofldrxq_vi = min(nc, NOFLDRXQ_VI); + if (t4_toecaps_allowed == -1) t4_toecaps_allowed = FW_CAPS_CONFIG_TOE; @@ -9242,17 +9252,11 @@ tweak_tunables(void) #endif #ifdef DEV_NETMAP - if (t4_nnmtxq10g < 1) - t4_nnmtxq10g = min(nc, NNMTXQ_10G); - - if (t4_nnmtxq1g < 1) - t4_nnmtxq1g = min(nc, NNMTXQ_1G); - - if (t4_nnmrxq10g < 1) - t4_nnmrxq10g = min(nc, NNMRXQ_10G); + if (t4_nnmtxq_vi < 1) + t4_nnmtxq_vi = min(nc, NNMTXQ_VI); - if (t4_nnmrxq1g < 1) - t4_nnmrxq1g = min(nc, NNMRXQ_1G); + if (t4_nnmrxq_vi < 1) + t4_nnmrxq_vi = min(nc, NNMRXQ_VI); #endif if (t4_tmr_idx_10g < 0 || t4_tmr_idx_10g >= SGE_NTIMERS) Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Thu Jun 23 02:37:24 2016 (r302109) +++ head/sys/dev/cxgbe/t4_netmap.c Thu Jun 23 02:53:00 2016 (r302110) @@ -85,198 +85,6 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_holdo static int nm_cong_drop = 1; TUNABLE_INT("hw.cxgbe.nm_cong_drop", &nm_cong_drop); -/* netmap ifnet routines */ -static void cxgbe_nm_init(void *); -static int cxgbe_nm_ioctl(struct ifnet *, unsigned long, caddr_t); -static int cxgbe_nm_transmit(struct ifnet *, struct mbuf *); -static void cxgbe_nm_qflush(struct ifnet *); - -static int cxgbe_nm_init_synchronized(struct vi_info *); -static int cxgbe_nm_uninit_synchronized(struct vi_info *); - -/* T4 netmap VI (ncxgbe) interface */ -static int ncxgbe_probe(device_t); -static int ncxgbe_attach(device_t); -static int ncxgbe_detach(device_t); -static device_method_t ncxgbe_methods[] = { - DEVMETHOD(device_probe, ncxgbe_probe), - DEVMETHOD(device_attach, ncxgbe_attach), - DEVMETHOD(device_detach, ncxgbe_detach), - { 0, 0 } -}; -static driver_t ncxgbe_driver = { - "ncxgbe", - ncxgbe_methods, - sizeof(struct vi_info) -}; - -/* T5 netmap VI (ncxl) interface */ -static driver_t ncxl_driver = { - "ncxl", - ncxgbe_methods, - sizeof(struct vi_info) -}; - -static void -cxgbe_nm_init(void *arg) -{ - struct vi_info *vi = arg; - struct adapter *sc = vi->pi->adapter; - - if (begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4nminit") != 0) - return; - cxgbe_nm_init_synchronized(vi); - end_synchronized_op(sc, 0); - - return; -} - -static int -cxgbe_nm_init_synchronized(struct vi_info *vi) -{ - struct adapter *sc = vi->pi->adapter; - struct ifnet *ifp = vi->ifp; - int rc = 0; - - ASSERT_SYNCHRONIZED_OP(sc); - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - return (0); /* already running */ - - if (!(sc->flags & FULL_INIT_DONE) && - ((rc = adapter_full_init(sc)) != 0)) - return (rc); /* error message displayed already */ - - if (!(vi->flags & VI_INIT_DONE) && - ((rc = vi_full_init(vi)) != 0)) - return (rc); /* error message displayed already */ - - rc = update_mac_settings(ifp, XGMAC_ALL); - if (rc) - return (rc); /* error message displayed already */ - - ifp->if_drv_flags |= IFF_DRV_RUNNING; - callout_reset(&vi->tick, hz, vi_tick, vi); - - return (rc); -} - -static int -cxgbe_nm_uninit_synchronized(struct vi_info *vi) -{ -#ifdef INVARIANTS - struct adapter *sc = vi->pi->adapter; -#endif - struct ifnet *ifp = vi->ifp; - - ASSERT_SYNCHRONIZED_OP(sc); - - callout_stop(&vi->tick); - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - - return (0); -} - -static int -cxgbe_nm_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) -{ - int rc = 0, mtu, flags; - struct vi_info *vi = ifp->if_softc; - struct adapter *sc = vi->pi->adapter; - struct ifreq *ifr = (struct ifreq *)data; - uint32_t mask; - - MPASS(vi->ifp == ifp); - - switch (cmd) { - case SIOCSIFMTU: - mtu = ifr->ifr_mtu; - if ((mtu < ETHERMIN) || (mtu > ETHERMTU_JUMBO)) - return (EINVAL); - - rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4nmtu"); - if (rc) - return (rc); - ifp->if_mtu = mtu; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - rc = update_mac_settings(ifp, XGMAC_MTU); - end_synchronized_op(sc, 0); - break; - - case SIOCSIFFLAGS: - rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4nflg"); - if (rc) - return (rc); - - if (ifp->if_flags & IFF_UP) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - flags = vi->if_flags; - if ((ifp->if_flags ^ flags) & *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jun 23 02:53:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48010B7379B; Thu, 23 Jun 2016 02:53:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 246E721A4; Thu, 23 Jun 2016 02:53:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N2rOX2021687; Thu, 23 Jun 2016 02:53:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N2rO6b021686; Thu, 23 Jun 2016 02:53:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230253.u5N2rO6b021686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 02:53:24 +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: r302111 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 02:53:25 -0000 Author: sephe Date: Thu Jun 23 02:53:24 2016 New Revision: 302111 URL: https://svnweb.freebsd.org/changeset/base/302111 Log: MFC 300108,300111,300112,300120,300121 300108 hyperv/vmbus: Minor white space and style cleanup MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6407 300111 hyperv/vmbus: Utilize curcpu MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6408 300112 hyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task It is not an SWI handler for a long time. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6409 300120 hyperv/vmbus: Remove useless modevent handler MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6410 300121 hyperv/vmbus: Nuke unnecessary function indirection MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6411 Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 02:53:00 2016 (r302110) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 02:53:24 2016 (r302111) @@ -74,28 +74,18 @@ static hv_setup_args setup_args; /* only static char *vmbus_ids[] = { "VMBUS", NULL }; -/** - * @brief Software interrupt thread routine to handle channel messages from - * the hypervisor. - */ static void -vmbus_msg_swintr(void *arg, int pending __unused) +vmbus_msg_task(void *arg __unused, int pending __unused) { - int cpu; - void* page_addr; - hv_vmbus_channel_msg_header *hdr; - hv_vmbus_channel_msg_table_entry *entry; - hv_vmbus_channel_msg_type msg_type; - hv_vmbus_message* msg; - - cpu = (int)(long)arg; - KASSERT(cpu <= mp_maxid, ("VMBUS: vmbus_msg_swintr: " - "cpu out of range!")); - - page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu]; - msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT; + hv_vmbus_message *msg; + msg = ((hv_vmbus_message *)hv_vmbus_g_context.syn_ic_msg_page[curcpu]) + + HV_VMBUS_MESSAGE_SINT; for (;;) { + const hv_vmbus_channel_msg_table_entry *entry; + hv_vmbus_channel_msg_header *hdr; + hv_vmbus_channel_msg_type msg_type; + if (msg->header.message_type == HV_MESSAGE_TYPE_NONE) break; /* no message */ @@ -108,32 +98,29 @@ vmbus_msg_swintr(void *arg, int pending } entry = &g_channel_message_table[msg_type]; - if (entry->messageHandler) entry->messageHandler(hdr); handled: - msg->header.message_type = HV_MESSAGE_TYPE_NONE; - - /* - * Make sure the write to message_type (ie set to - * HV_MESSAGE_TYPE_NONE) happens before we read the - * message_pending and EOMing. Otherwise, the EOMing will - * not deliver any more messages - * since there is no empty slot - * - * NOTE: - * mb() is used here, since atomic_thread_fence_seq_cst() - * will become compiler fence on UP kernel. - */ - mb(); - - if (msg->header.message_flags.u.message_pending) { + msg->header.message_type = HV_MESSAGE_TYPE_NONE; + /* + * Make sure the write to message_type (ie set to + * HV_MESSAGE_TYPE_NONE) happens before we read the + * message_pending and EOMing. Otherwise, the EOMing will + * not deliver any more messages + * since there is no empty slot + * + * NOTE: + * mb() is used here, since atomic_thread_fence_seq_cst() + * will become compiler fence on UP kernel. + */ + mb(); + if (msg->header.message_flags.u.message_pending) { /* * This will cause message queue rescan to possibly * deliver another msg from the hypervisor */ wrmsr(HV_X64_MSR_EOM, 0); - } + } } } @@ -147,11 +134,9 @@ static inline int hv_vmbus_isr(struct trapframe *frame) { struct vmbus_softc *sc = vmbus_get_softc(); - int cpu; - hv_vmbus_message* msg; - void* page_addr; - - cpu = PCPU_GET(cpuid); + int cpu = curcpu; + hv_vmbus_message *msg; + void *page_addr; /* * The Windows team has advised that we check for events @@ -162,7 +147,7 @@ hv_vmbus_isr(struct trapframe *frame) /* Check if there are actual msgs to be process */ page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu]; - msg = (hv_vmbus_message*) page_addr + HV_VMBUS_TIMER_SINT; + msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_TIMER_SINT; /* we call eventtimer process the message */ if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) { @@ -193,7 +178,7 @@ hv_vmbus_isr(struct trapframe *frame) } } - msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT; + msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_MESSAGE_SINT; if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) { taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu], &hv_vmbus_g_context.hv_msg_task[cpu]); @@ -534,7 +519,7 @@ vmbus_bus_init(void) taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[j], 1, PI_NET, "hvmsg%d", j); TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0, - vmbus_msg_swintr, (void *)(long)j); + vmbus_msg_task, NULL); CPU_SETOF(j, &cpu_mask); TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, &cpu_mask); @@ -654,8 +639,8 @@ vmbus_init(void) vmbus_bus_init(); } -static void -vmbus_bus_exit(void) +static int +vmbus_detach(device_t dev) { int i; @@ -681,49 +666,6 @@ vmbus_bus_exit(void) vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); - return; -} - -static void -vmbus_exit(void) -{ - vmbus_bus_exit(); -} - -static int -vmbus_detach(device_t dev) -{ - vmbus_exit(); - return (0); -} - -static void -vmbus_mod_load(void) -{ - if(bootverbose) - printf("VMBUS: load\n"); -} - -static void -vmbus_mod_unload(void) -{ - if(bootverbose) - printf("VMBUS: unload\n"); -} - -static int -vmbus_modevent(module_t mod, int what, void *arg) -{ - switch (what) { - - case MOD_LOAD: - vmbus_mod_load(); - break; - case MOD_UNLOAD: - vmbus_mod_unload(); - break; - } - return (0); } @@ -753,7 +695,7 @@ static driver_t vmbus_driver = { devclass_t vmbus_devclass; -DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, vmbus_modevent, 0); +DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL); MODULE_DEPEND(vmbus, acpi, 1, 1, 1); MODULE_VERSION(vmbus, 1); From owner-svn-src-all@freebsd.org Thu Jun 23 03:14:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F206B73D5E; Thu, 23 Jun 2016 03:14:11 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED75F2E25; Thu, 23 Jun 2016 03:14:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N3EAsi030113; Thu, 23 Jun 2016 03:14:10 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N3E9Qe030109; Thu, 23 Jun 2016 03:14:09 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230314.u5N3E9Qe030109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 03:14:09 +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: r302112 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 03:14:11 -0000 Author: sephe Date: Thu Jun 23 03:14:09 2016 New Revision: 302112 URL: https://svnweb.freebsd.org/changeset/base/302112 Log: MFC 300122,300123,300124,300126,300127,300129,300455 300122 hyperv: Set vm_guest to VM_GUEST_VM, if hypervisor is not Hyper-V Reviewed by: kib MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6412 300123 hyperv/vmbus: Staticize vmbus_devclass Reviewed by: Jun Su MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6414 300124 hyperv/vmbus: Reindent and cleanup devmethods. While I'm here, use DEVMETHOD_END. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6415 300126 hyperv/vmbus: Fix SYSINIT function prototype and usage. Reviewed by: Jun Su MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6416 300127 hyperv/vmbus: Minor function definition style fixup Reviewed by: Jun Su MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6417 300129 hyperv/vmbus: Use consistent device description as other devices MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6418 300455 hyperv: Move guest id setup to early place And - Rework the guest id composition. - Nuke useless saved guest_id. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6430 Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 02:53:24 2016 (r302111) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 03:14:09 2016 (r302112) @@ -152,7 +152,8 @@ hv_vmbus_negotiate_version(hv_vmbus_chan * Send a connect request on the partition service connection */ int -hv_vmbus_connect(void) { +hv_vmbus_connect(void) +{ int ret = 0; uint32_t version; hv_vmbus_channel_msg_info* msg_info = NULL; @@ -274,7 +275,8 @@ hv_vmbus_connect(void) { * Send a disconnect request on the partition service connection */ int -hv_vmbus_disconnect(void) { +hv_vmbus_disconnect(void) +{ int ret = 0; hv_vmbus_channel_unload msg; @@ -398,7 +400,8 @@ int hv_vmbus_post_message(void *buffer, * Send an event notification to the parent */ int -hv_vmbus_set_event(hv_vmbus_channel *channel) { +hv_vmbus_set_event(hv_vmbus_channel *channel) +{ int ret = 0; uint32_t child_rel_id = channel->offer_msg.child_rel_id; Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 02:53:24 2016 (r302111) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 03:14:09 2016 (r302112) @@ -50,6 +50,35 @@ __FBSDID("$FreeBSD$"); #define HYPERV_INTERFACE 0x31237648 /* HV#1 */ +/* + * The guest OS needs to register the guest ID with the hypervisor. + * The guest ID is a 64 bit entity and the structure of this ID is + * specified in the Hyper-V specification: + * + * http://msdn.microsoft.com/en-us/library/windows/ + * hardware/ff542653%28v=vs.85%29.aspx + * + * While the current guideline does not specify how FreeBSD guest ID(s) + * need to be generated, our plan is to publish the guidelines for + * FreeBSD and other guest operating systems that currently are hosted + * on Hyper-V. The implementation here conforms to this yet + * unpublished guidelines. + * + * Bit(s) + * 63 - Indicates if the OS is Open Source or not; 1 is Open Source + * 62:56 - Os Type: FreeBSD is 0x02 + * 55:48 - Distro specific identification + * 47:16 - FreeBSD kernel version number + * 15:0 - Distro specific identification + */ +#define HYPERV_GUESTID_OSS (0x1ULL << 63) +#define HYPERV_GUESTID_FREEBSD (0x02ULL << 56) +#define HYPERV_GUESTID(id) \ + (HYPERV_GUESTID_OSS | HYPERV_GUESTID_FREEBSD | \ + (((uint64_t)(((id) & 0xff0000) >> 16)) << 48) |\ + (((uint64_t)__FreeBSD_version) << 16) | \ + ((uint64_t)((id) & 0x00ffff))) + static u_int hv_get_timecount(struct timecounter *tc); u_int hyperv_features; @@ -143,13 +172,6 @@ hv_vmbus_init(void) goto cleanup; /* - * Write our OS info - */ - uint64_t os_guest_info = HV_FREEBSD_GUEST_ID; - wrmsr(HV_X64_MSR_GUEST_OS_ID, os_guest_info); - hv_vmbus_g_context.guest_id = os_guest_info; - - /* * See if the hypercall page is already set */ hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL); @@ -192,16 +214,13 @@ hv_vmbus_init(void) void hv_vmbus_cleanup(void) { - hv_vmbus_x64_msr_hypercall_contents hypercall_msr; + if (hv_vmbus_g_context.hypercall_page != NULL) { + hv_vmbus_x64_msr_hypercall_contents hypercall_msr; - if (hv_vmbus_g_context.guest_id == HV_FREEBSD_GUEST_ID) { - if (hv_vmbus_g_context.hypercall_page != NULL) { hypercall_msr.as_uint64_t = 0; - wrmsr(HV_X64_MSR_HYPERCALL, - hypercall_msr.as_uint64_t); + wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t); free(hv_vmbus_g_context.hypercall_page, M_DEVBUF); hv_vmbus_g_context.hypercall_page = NULL; - } } } @@ -501,8 +520,15 @@ hyperv_identify(void) static void hyperv_init(void *dummy __unused) { - if (!hyperv_identify()) + if (!hyperv_identify()) { + /* Not Hyper-V; reset guest id to the generic one. */ + if (vm_guest == VM_GUEST_HV) + vm_guest = VM_GUEST_VM; return; + } + + /* Write guest id */ + wrmsr(HV_X64_MSR_GUEST_OS_ID, HYPERV_GUESTID(0)); if (hyperv_features & HV_FEATURE_MSR_TIME_REFCNT) { /* Register virtual timecount */ Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 02:53:24 2016 (r302111) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 03:14:09 2016 (r302112) @@ -346,12 +346,13 @@ hv_vmbus_child_device_unregister(struct } static int -vmbus_probe(device_t dev) { +vmbus_probe(device_t dev) +{ if (ACPI_ID_PROBE(device_get_parent(dev), dev, vmbus_ids) == NULL || device_get_unit(dev) != 0) return (ENXIO); - device_set_desc(dev, "Vmbus Devices"); + device_set_desc(dev, "Hyper-V Vmbus"); return (BUS_PROBE_DEFAULT); } @@ -624,7 +625,7 @@ vmbus_attach(device_t dev) } static void -vmbus_init(void) +vmbus_sysinit(void *arg __unused) { if (vm_guest != VM_GUEST_HV || vmbus_get_softc() == NULL) return; @@ -670,22 +671,23 @@ vmbus_detach(device_t dev) } static device_method_t vmbus_methods[] = { - /** Device interface */ - DEVMETHOD(device_probe, vmbus_probe), - DEVMETHOD(device_attach, vmbus_attach), - DEVMETHOD(device_detach, vmbus_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /** Bus interface */ - DEVMETHOD(bus_add_child, bus_generic_add_child), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, vmbus_read_ivar), - DEVMETHOD(bus_write_ivar, vmbus_write_ivar), - DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), + /* Device interface */ + DEVMETHOD(device_probe, vmbus_probe), + DEVMETHOD(device_attach, vmbus_attach), + DEVMETHOD(device_detach, vmbus_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_read_ivar, vmbus_read_ivar), + DEVMETHOD(bus_write_ivar, vmbus_write_ivar), + DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), - { 0, 0 } }; + DEVMETHOD_END +}; static driver_t vmbus_driver = { "vmbus", @@ -693,12 +695,16 @@ static driver_t vmbus_driver = { sizeof(struct vmbus_softc) }; -devclass_t vmbus_devclass; +static devclass_t vmbus_devclass; DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL); MODULE_DEPEND(vmbus, acpi, 1, 1, 1); MODULE_VERSION(vmbus, 1); -/* We want to be started after SMP is initialized */ -SYSINIT(vmb_init, SI_SUB_SMP + 1, SI_ORDER_FIRST, vmbus_init, NULL); +/* + * NOTE: + * We have to start as the last step of SI_SUB_SMP, i.e. after SMP is + * initialized. + */ +SYSINIT(vmbus_initialize, SI_SUB_SMP, SI_ORDER_ANY, vmbus_sysinit, NULL); Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 02:53:24 2016 (r302111) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 03:14:09 2016 (r302112) @@ -198,7 +198,6 @@ enum { #define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t) typedef struct { - uint64_t guest_id; void* hypercall_page; hv_bool_uint8_t syn_ic_initialized; @@ -763,44 +762,6 @@ void hv_et_intr(struct trapframe*); /* Wait for device creation */ void vmbus_scan(void); -/* - * The guest OS needs to register the guest ID with the hypervisor. - * The guest ID is a 64 bit entity and the structure of this ID is - * specified in the Hyper-V specification: - * - * http://msdn.microsoft.com/en-us/library/windows/ - * hardware/ff542653%28v=vs.85%29.aspx - * - * While the current guideline does not specify how FreeBSD guest ID(s) - * need to be generated, our plan is to publish the guidelines for - * FreeBSD and other guest operating systems that currently are hosted - * on Hyper-V. The implementation here conforms to this yet - * unpublished guidelines. - * - * Bit(s) - * 63 - Indicates if the OS is Open Source or not; 1 is Open Source - * 62:56 - Os Type; Linux is 0x100, FreeBSD is 0x200 - * 55:48 - Distro specific identification - * 47:16 - FreeBSD kernel version number - * 15:0 - Distro specific identification - * - */ - -#define HV_FREEBSD_VENDOR_ID 0x8200 -#define HV_FREEBSD_GUEST_ID hv_generate_guest_id(0,0) - -static inline uint64_t hv_generate_guest_id( - uint8_t distro_id_part1, - uint16_t distro_id_part2) -{ - uint64_t guest_id; - guest_id = (((uint64_t)HV_FREEBSD_VENDOR_ID) << 48); - guest_id |= (((uint64_t)(distro_id_part1)) << 48); - guest_id |= (((uint64_t)(__FreeBSD_version)) << 16); /* in param.h */ - guest_id |= ((uint64_t)(distro_id_part2)); - return guest_id; -} - typedef struct { unsigned int vector; void *page_buffers[2 * MAXCPU]; From owner-svn-src-all@freebsd.org Thu Jun 23 03:25:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40FBEAC4082; Thu, 23 Jun 2016 03:25:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A73116E8; Thu, 23 Jun 2016 03:25:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N3PJgo033985; Thu, 23 Jun 2016 03:25:19 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N3PI6T033979; Thu, 23 Jun 2016 03:25:18 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230325.u5N3PI6T033979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 03:25:18 +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: r302113 - in stable/10/sys: conf dev/hyperv/include dev/hyperv/netvsc dev/hyperv/vmbus modules/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 03:25:20 -0000 Author: sephe Date: Thu Jun 23 03:25:18 2016 New Revision: 302113 URL: https://svnweb.freebsd.org/changeset/base/302113 Log: MFC 300478,300479 300478 hyperv: Add helpers for busdma(9) operation MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6443 300479 hyperv/hn: Use hyperv busdma(9) helper. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6444 Added: stable/10/sys/dev/hyperv/include/hyperv_busdma.h - copied unchanged from r300478, head/sys/dev/hyperv/include/hyperv_busdma.h stable/10/sys/dev/hyperv/vmbus/hyperv_busdma.c - copied unchanged from r300478, head/sys/dev/hyperv/vmbus/hyperv_busdma.c Modified: stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/modules/hyperv/vmbus/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Thu Jun 23 03:14:09 2016 (r302112) +++ stable/10/sys/conf/files.amd64 Thu Jun 23 03:25:18 2016 (r302113) @@ -278,6 +278,7 @@ dev/hyperv/vmbus/hv_hv.c optional hyp dev/hyperv/vmbus/hv_et.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv +dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/amd64/hv_vector.S optional hyperv dev/kbd/kbd.c optional atkbd | sc | ukbd | vt dev/lindev/full.c optional lindev Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Thu Jun 23 03:14:09 2016 (r302112) +++ stable/10/sys/conf/files.i386 Thu Jun 23 03:25:18 2016 (r302113) @@ -254,6 +254,7 @@ dev/hyperv/vmbus/hv_hv.c optional hyp dev/hyperv/vmbus/hv_et.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv +dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/i386/hv_vector.S optional hyperv dev/ichwd/ichwd.c optional ichwd dev/if_ndis/if_ndis.c optional ndis Copied: stable/10/sys/dev/hyperv/include/hyperv_busdma.h (from r300478, head/sys/dev/hyperv/include/hyperv_busdma.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/include/hyperv_busdma.h Thu Jun 23 03:25:18 2016 (r302113, copy of r300478, head/sys/dev/hyperv/include/hyperv_busdma.h) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HYPERV_BUSDMA_H_ +#define _HYPERV_BUSDMA_H_ + +struct hyperv_dma { + bus_addr_t hv_paddr; + bus_dma_tag_t hv_dtag; + bus_dmamap_t hv_dmap; +}; + +void hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, + int error); +void *hyperv_dmamem_alloc(bus_dma_tag_t parent_dtag, bus_size_t alignment, + bus_addr_t boundary, bus_size_t size, struct hyperv_dma *dma, + int flags); +void hyperv_dmamem_free(struct hyperv_dma *dma, void *ptr); + +#endif /* !_HYPERV_BUSDMA_H_ */ Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jun 23 03:14:09 2016 (r302112) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jun 23 03:25:18 2016 (r302113) @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "hv_net_vsc.h" #include "hv_rndis.h" #include "hv_rndis_filter.h" @@ -2217,18 +2218,6 @@ hn_check_iplen(const struct mbuf *m, int } static void -hn_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - bus_addr_t *paddr = arg; - - if (error) - return; - - KASSERT(nseg == 1, ("too many segments %d!", nseg)); - *paddr = segs->ds_addr; -} - -static void hn_create_rx_data(struct hn_softc *sc, int ring_cnt) { struct sysctl_oid_list *child; @@ -2528,7 +2517,7 @@ hn_create_tx_ring(struct hn_softc *sc, i error = bus_dmamap_load(txr->hn_tx_rndis_dtag, txd->rndis_msg_dmap, txd->rndis_msg, HN_RNDIS_MSG_LEN, - hn_dma_map_paddr, &txd->rndis_msg_paddr, + hyperv_dma_map_paddr, &txd->rndis_msg_paddr, BUS_DMA_NOWAIT); if (error) { device_printf(sc->hn_dev, Copied: stable/10/sys/dev/hyperv/vmbus/hyperv_busdma.c (from r300478, head/sys/dev/hyperv/vmbus/hyperv_busdma.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/hyperv_busdma.c Thu Jun 23 03:25:18 2016 (r302113, copy of r300478, head/sys/dev/hyperv/vmbus/hyperv_busdma.c) @@ -0,0 +1,98 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#include + +#define HYPERV_DMA_WAITMASK (BUS_DMA_WAITOK | BUS_DMA_NOWAIT) + +void +hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + bus_addr_t *paddr = arg; + + if (error) + return; + + KASSERT(nseg == 1, ("too many segments %d!", nseg)); + *paddr = segs->ds_addr; +} + +void * +hyperv_dmamem_alloc(bus_dma_tag_t parent_dtag, bus_size_t alignment, + bus_addr_t boundary, bus_size_t size, struct hyperv_dma *dma, int flags) +{ + void *ret; + int error; + + error = bus_dma_tag_create(parent_dtag, /* parent */ + alignment, /* alignment */ + boundary, /* boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + size, /* maxsize */ + 1, /* nsegments */ + size, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &dma->hv_dtag); + if (error) + return NULL; + + error = bus_dmamem_alloc(dma->hv_dtag, &ret, + (flags & HYPERV_DMA_WAITMASK) | BUS_DMA_COHERENT, &dma->hv_dmap); + if (error) { + bus_dma_tag_destroy(dma->hv_dtag); + return NULL; + } + + error = bus_dmamap_load(dma->hv_dtag, dma->hv_dmap, ret, size, + hyperv_dma_map_paddr, &dma->hv_paddr, BUS_DMA_NOWAIT); + if (error) { + bus_dmamem_free(dma->hv_dtag, ret, dma->hv_dmap); + bus_dma_tag_destroy(dma->hv_dtag); + return NULL; + } + return ret; +} + +void +hyperv_dmamem_free(struct hyperv_dma *dma, void *ptr) +{ + bus_dmamap_unload(dma->hv_dtag, dma->hv_dmap); + bus_dmamem_free(dma->hv_dtag, ptr, dma->hv_dmap); + bus_dma_tag_destroy(dma->hv_dtag); +} Modified: stable/10/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- stable/10/sys/modules/hyperv/vmbus/Makefile Thu Jun 23 03:14:09 2016 (r302112) +++ stable/10/sys/modules/hyperv/vmbus/Makefile Thu Jun 23 03:25:18 2016 (r302113) @@ -11,7 +11,8 @@ SRCS= hv_channel.c \ hv_hv.c \ hv_ring_buffer.c \ hv_vmbus_drv_freebsd.c \ - hv_vmbus_priv.h + hv_vmbus_priv.h \ + hyperv_busdma.c SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h # XXX: for assym.s From owner-svn-src-all@freebsd.org Thu Jun 23 04:40:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE268AC4DF8; Thu, 23 Jun 2016 04:40:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9E5D11A9; Thu, 23 Jun 2016 04:40:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N4eDMA060538; Thu, 23 Jun 2016 04:40:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N4eDxA060532; Thu, 23 Jun 2016 04:40:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230440.u5N4eDxA060532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 04:40: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: r302114 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 04:40:15 -0000 Author: sephe Date: Thu Jun 23 04:40:13 2016 New Revision: 302114 URL: https://svnweb.freebsd.org/changeset/base/302114 Log: MFC 300480,300481,300486 300480 hyperv: Move Hypercall setup to an early place. It does not belong to the vmbus. While I'm here rework the Hypercall setup, e.g. use busdma(9) and avoid bit fields. Discussed with: Jun Su MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6445 300481 hyperv/vmbus: Declare Synic message and event w/ proper types Avoid ugly casts. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6446 300486 hyperv/vmbus: Get rid of vmbus_devp While I'm here, nuke useless print in vmbus_attach(). MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6447 Added: stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h - copied unchanged from r300480, head/sys/dev/hyperv/vmbus/hyperv_reg.h Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 03:25:18 2016 (r302113) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 04:40:13 2016 (r302114) @@ -336,8 +336,8 @@ vmbus_event_proc(struct vmbus_softc *sc, { hv_vmbus_synic_event_flags *event; - event = ((hv_vmbus_synic_event_flags *) - hv_vmbus_g_context.syn_ic_event_page[cpu]) + HV_VMBUS_MESSAGE_SINT; + event = hv_vmbus_g_context.syn_ic_event_page[cpu] + + HV_VMBUS_MESSAGE_SINT; /* * On Host with Win8 or above, the event page can be checked directly @@ -352,8 +352,8 @@ vmbus_event_proc_compat(struct vmbus_sof { hv_vmbus_synic_event_flags *event; - event = ((hv_vmbus_synic_event_flags *) - hv_vmbus_g_context.syn_ic_event_page[cpu]) + HV_VMBUS_MESSAGE_SINT; + event = hv_vmbus_g_context.syn_ic_event_page[cpu] + + HV_VMBUS_MESSAGE_SINT; if (atomic_testandclear_int(&event->flags32[0], 0)) { vmbus_event_flags_proc( Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 03:25:18 2016 (r302113) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 04:40:13 2016 (r302114) @@ -43,8 +43,9 @@ __FBSDID("$FreeBSD$"); #include #include - -#include "hv_vmbus_priv.h" +#include +#include +#include #define HV_NANOSECONDS_PER_SEC 1000000000L @@ -79,6 +80,13 @@ __FBSDID("$FreeBSD$"); (((uint64_t)__FreeBSD_version) << 16) | \ ((uint64_t)((id) & 0x00ffff))) +struct hypercall_ctx { + void *hc_addr; + struct hyperv_dma hc_dma; +}; + +static struct hypercall_ctx hypercall_context; + static u_int hv_get_timecount(struct timecounter *tc); u_int hyperv_features; @@ -92,7 +100,6 @@ static u_int hyperv_features3; */ hv_vmbus_context hv_vmbus_g_context = { .syn_ic_initialized = FALSE, - .hypercall_page = NULL, }; static struct timecounter hv_timecounter = { @@ -116,7 +123,7 @@ hv_vmbus_do_hypercall(uint64_t control, uint64_t hv_status = 0; uint64_t input_address = (input) ? hv_get_phys_addr(input) : 0; uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0; - volatile void* hypercall_page = hv_vmbus_g_context.hypercall_page; + volatile void *hypercall_page = hypercall_context.hc_addr; __asm__ __volatile__ ("mov %0, %%r8" : : "r" (output_address): "r8"); __asm__ __volatile__ ("call *%3" : "=a"(hv_status): @@ -134,7 +141,7 @@ hv_vmbus_do_hypercall(uint64_t control, uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0; uint32_t output_address_high = output_address >> 32; uint32_t output_address_low = output_address & 0xFFFFFFFF; - volatile void* hypercall_page = hv_vmbus_g_context.hypercall_page; + volatile void *hypercall_page = hypercall_context.hc_addr; __asm__ __volatile__ ("call *%8" : "=d"(hv_status_high), "=a"(hv_status_low) : "d" (control_high), @@ -147,84 +154,6 @@ hv_vmbus_do_hypercall(uint64_t control, } /** - * @brief Main initialization routine. - * - * This routine must be called - * before any other routines in here are called - */ -int -hv_vmbus_init(void) -{ - hv_vmbus_x64_msr_hypercall_contents hypercall_msr; - void* virt_addr = NULL; - - memset( - hv_vmbus_g_context.syn_ic_event_page, - 0, - sizeof(hv_vmbus_handle) * MAXCPU); - - memset( - hv_vmbus_g_context.syn_ic_msg_page, - 0, - sizeof(hv_vmbus_handle) * MAXCPU); - - if (vm_guest != VM_GUEST_HV) - goto cleanup; - - /* - * See if the hypercall page is already set - */ - hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL); - virt_addr = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - - hypercall_msr.u.enable = 1; - hypercall_msr.u.guest_physical_address = - (hv_get_phys_addr(virt_addr) >> PAGE_SHIFT); - wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t); - - /* - * Confirm that hypercall page did get set up - */ - hypercall_msr.as_uint64_t = 0; - hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL); - - if (!hypercall_msr.u.enable) - goto cleanup; - - hv_vmbus_g_context.hypercall_page = virt_addr; - - return (0); - - cleanup: - if (virt_addr != NULL) { - if (hypercall_msr.u.enable) { - hypercall_msr.as_uint64_t = 0; - wrmsr(HV_X64_MSR_HYPERCALL, - hypercall_msr.as_uint64_t); - } - - free(virt_addr, M_DEVBUF); - } - return (ENOTSUP); -} - -/** - * @brief Cleanup routine, called normally during driver unloading or exiting - */ -void -hv_vmbus_cleanup(void) -{ - if (hv_vmbus_g_context.hypercall_page != NULL) { - hv_vmbus_x64_msr_hypercall_contents hypercall_msr; - - hypercall_msr.as_uint64_t = 0; - wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t); - free(hv_vmbus_g_context.hypercall_page, M_DEVBUF); - hv_vmbus_g_context.hypercall_page = NULL; - } -} - -/** * @brief Post a message using the hypervisor message IPC. * (This involves a hypercall.) */ @@ -304,9 +233,6 @@ hv_vmbus_synic_init(void *arg) cpu = PCPU_GET(cpuid); - if (hv_vmbus_g_context.hypercall_page == NULL) - return; - /* * TODO: Check the version */ @@ -537,3 +463,74 @@ hyperv_init(void *dummy __unused) } SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, NULL); + +static void +hypercall_memfree(void) +{ + hyperv_dmamem_free(&hypercall_context.hc_dma, + hypercall_context.hc_addr); + hypercall_context.hc_addr = NULL; +} + +static void +hypercall_create(void *arg __unused) +{ + uint64_t hc, hc_orig; + + if (vm_guest != VM_GUEST_HV) + return; + + hypercall_context.hc_addr = hyperv_dmamem_alloc(NULL, PAGE_SIZE, 0, + PAGE_SIZE, &hypercall_context.hc_dma, BUS_DMA_WAITOK); + if (hypercall_context.hc_addr == NULL) { + printf("hyperv: Hypercall page allocation failed\n"); + /* Can't perform any Hyper-V specific actions */ + vm_guest = VM_GUEST_VM; + return; + } + + /* Get the 'reserved' bits, which requires preservation. */ + hc_orig = rdmsr(MSR_HV_HYPERCALL); + + /* + * Setup the Hypercall page. + * + * NOTE: 'reserved' bits MUST be preserved. + */ + hc = ((hypercall_context.hc_dma.hv_paddr >> PAGE_SHIFT) << + MSR_HV_HYPERCALL_PGSHIFT) | + (hc_orig & MSR_HV_HYPERCALL_RSVD_MASK) | + MSR_HV_HYPERCALL_ENABLE; + wrmsr(MSR_HV_HYPERCALL, hc); + + /* + * Confirm that Hypercall page did get setup. + */ + hc = rdmsr(MSR_HV_HYPERCALL); + if ((hc & MSR_HV_HYPERCALL_ENABLE) == 0) { + printf("hyperv: Hypercall setup failed\n"); + hypercall_memfree(); + /* Can't perform any Hyper-V specific actions */ + vm_guest = VM_GUEST_VM; + return; + } + if (bootverbose) + printf("hyperv: Hypercall created\n"); +} +SYSINIT(hypercall_ctor, SI_SUB_DRIVERS, SI_ORDER_FIRST, hypercall_create, NULL); + +static void +hypercall_destroy(void *arg __unused) +{ + if (hypercall_context.hc_addr == NULL) + return; + + /* Disable Hypercall */ + wrmsr(MSR_HV_HYPERCALL, 0); + hypercall_memfree(); + + if (bootverbose) + printf("hyperv: Hypercall destroyed\n"); +} +SYSUNINIT(hypercall_dtor, SI_SUB_DRIVERS, SI_ORDER_FIRST, hypercall_destroy, + NULL); Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 03:25:18 2016 (r302113) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 04:40:13 2016 (r302114) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); struct vmbus_softc *vmbus_sc; -static device_t vmbus_devp; static int vmbus_inited; static hv_setup_args setup_args; /* only CPU 0 supported at this time */ @@ -79,8 +78,9 @@ vmbus_msg_task(void *arg __unused, int p { hv_vmbus_message *msg; - msg = ((hv_vmbus_message *)hv_vmbus_g_context.syn_ic_msg_page[curcpu]) + + msg = hv_vmbus_g_context.syn_ic_msg_page[curcpu] + HV_VMBUS_MESSAGE_SINT; + for (;;) { const hv_vmbus_channel_msg_table_entry *entry; hv_vmbus_channel_msg_header *hdr; @@ -134,9 +134,8 @@ static inline int hv_vmbus_isr(struct trapframe *frame) { struct vmbus_softc *sc = vmbus_get_softc(); + hv_vmbus_message *msg, *msg_base; int cpu = curcpu; - hv_vmbus_message *msg; - void *page_addr; /* * The Windows team has advised that we check for events @@ -146,8 +145,8 @@ hv_vmbus_isr(struct trapframe *frame) sc->vmbus_event_proc(sc, cpu); /* Check if there are actual msgs to be process */ - page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu]; - msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_TIMER_SINT; + msg_base = hv_vmbus_g_context.syn_ic_msg_page[cpu]; + msg = msg_base + HV_VMBUS_TIMER_SINT; /* we call eventtimer process the message */ if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) { @@ -178,7 +177,7 @@ hv_vmbus_isr(struct trapframe *frame) } } - msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_MESSAGE_SINT; + msg = msg_base + HV_VMBUS_MESSAGE_SINT; if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) { taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu], &hv_vmbus_g_context.hv_msg_task[cpu]); @@ -324,7 +323,7 @@ hv_vmbus_child_device_register(struct hv printf("VMBUS: Class ID: %s\n", name); } - child = device_add_child(vmbus_devp, NULL, -1); + child = device_add_child(vmbus_get_device(), NULL, -1); child_dev->device = child; device_set_ivars(child, child_dev); @@ -340,7 +339,7 @@ hv_vmbus_child_device_unregister(struct * device_add_child() */ mtx_lock(&Giant); - ret = device_delete_child(vmbus_devp, child_dev->device); + ret = device_delete_child(vmbus_get_device(), child_dev->device); mtx_unlock(&Giant); return(ret); } @@ -349,7 +348,7 @@ static int vmbus_probe(device_t dev) { if (ACPI_ID_PROBE(device_get_parent(dev), dev, vmbus_ids) == NULL || - device_get_unit(dev) != 0) + device_get_unit(dev) != 0 || vm_guest != VM_GUEST_HV) return (ENXIO); device_set_desc(dev, "Hyper-V Vmbus"); @@ -455,14 +454,6 @@ vmbus_bus_init(void) vmbus_inited = 1; sc = vmbus_get_softc(); - ret = hv_vmbus_init(); - - if (ret) { - if(bootverbose) - printf("Error VMBUS: Hypervisor Initialization Failed!\n"); - return (ret); - } - /* * Find a free IDT slot for vmbus callback. */ @@ -472,6 +463,7 @@ vmbus_bus_init(void) if(bootverbose) printf("Error VMBUS: Cannot find free IDT slot for " "vmbus callback!\n"); + ret = ENXIO; goto cleanup; } @@ -559,8 +551,8 @@ vmbus_bus_init(void) hv_vmbus_request_channel_offers(); vmbus_scan(); - bus_generic_attach(vmbus_devp); - device_printf(vmbus_devp, "device scan, probe and attach done\n"); + bus_generic_attach(sc->vmbus_dev); + device_printf(sc->vmbus_dev, "device scan, probe and attach done\n"); return (ret); @@ -585,8 +577,6 @@ vmbus_bus_init(void) vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); cleanup: - hv_vmbus_cleanup(); - return (ret); } @@ -598,11 +588,8 @@ vmbus_event_proc_dummy(struct vmbus_soft static int vmbus_attach(device_t dev) { - if(bootverbose) - device_printf(dev, "VMBUS: attach dev: %p\n", dev); - - vmbus_devp = dev; vmbus_sc = device_get_softc(dev); + vmbus_sc->vmbus_dev = dev; /* * Event processing logic will be configured: @@ -655,8 +642,6 @@ vmbus_detach(device_t dev) free(setup_args.page_buffers[i], M_DEVBUF); } - hv_vmbus_cleanup(); - /* remove swi */ CPU_FOREACH(i) { if (hv_vmbus_g_context.hv_event_queue[i] != NULL) { Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 03:25:18 2016 (r302113) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 04:40:13 2016 (r302114) @@ -197,12 +197,14 @@ enum { #define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t) +struct vmbus_message; +union vmbus_event_flags; + typedef struct { - void* hypercall_page; hv_bool_uint8_t syn_ic_initialized; - hv_vmbus_handle syn_ic_msg_page[MAXCPU]; - hv_vmbus_handle syn_ic_event_page[MAXCPU]; + struct vmbus_message *syn_ic_msg_page[MAXCPU]; + union vmbus_event_flags *syn_ic_event_page[MAXCPU]; /* * For FreeBSD cpuid to Hyper-V vcpuid mapping. */ @@ -304,7 +306,7 @@ typedef struct { /* * Define synthetic interrupt controller message format */ -typedef struct { +typedef struct vmbus_message { hv_vmbus_msg_header header; union { uint64_t payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; @@ -579,7 +581,7 @@ typedef struct { /* * Define the synthetic interrupt controller event flags format */ -typedef union { +typedef union vmbus_event_flags { uint8_t flags8[HV_EVENT_FLAGS_BYTE_COUNT]; uint32_t flags32[HV_EVENT_FLAGS_DWORD_COUNT]; unsigned long flagsul[HV_EVENT_FLAGS_ULONG_COUNT]; @@ -722,8 +724,6 @@ hv_vmbus_channel* hv_vmbus_allocate_chan void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); int hv_vmbus_request_channel_offers(void); void hv_vmbus_release_unattached_channels(void); -int hv_vmbus_init(void); -void hv_vmbus_cleanup(void); uint16_t hv_vmbus_post_msg_via_msg_ipc( hv_vmbus_connection_id connection_id, Copied: stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h (from r300480, head/sys/dev/hyperv/vmbus/hyperv_reg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h Thu Jun 23 04:40:13 2016 (r302114, copy of r300480, head/sys/dev/hyperv/vmbus/hyperv_reg.h) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HYPERV_REG_H_ +#define _HYPERV_REG_H_ + +#define MSR_HV_HYPERCALL 0x40000001 +#define MSR_HV_HYPERCALL_ENABLE 0x0001ULL +#define MSR_HV_HYPERCALL_RSVD_MASK 0x0ffeULL +#define MSR_HV_HYPERCALL_PGSHIFT 12 + +#endif /* !_HYPERV_REG_H_ */ Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 03:25:18 2016 (r302113) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 04:40:13 2016 (r302114) @@ -38,6 +38,7 @@ struct vmbus_pcpu_data { struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; + device_t vmbus_dev; }; extern struct vmbus_softc *vmbus_sc; @@ -48,6 +49,12 @@ vmbus_get_softc(void) return vmbus_sc; } +static __inline device_t +vmbus_get_device(void) +{ + return vmbus_sc->vmbus_dev; +} + #define VMBUS_SC_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field #define VMBUS_SC_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field #define VMBUS_PCPU_GET(field, cpu) \ From owner-svn-src-all@freebsd.org Thu Jun 23 05:08:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C266B72554; Thu, 23 Jun 2016 05:08:19 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D02E22A9; Thu, 23 Jun 2016 05:08:19 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N58IEw071534; Thu, 23 Jun 2016 05:08:18 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N58Il7071530; Thu, 23 Jun 2016 05:08:18 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230508.u5N58Il7071530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 05:08:18 +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: r302115 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 05:08:19 -0000 Author: sephe Date: Thu Jun 23 05:08:17 2016 New Revision: 302115 URL: https://svnweb.freebsd.org/changeset/base/302115 Log: MFC 300487 hyperv/vmbus: Move IDT vector to vmbus_softc Prepare to get rid of the hv_setup_arg. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6449 Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 04:40:13 2016 (r302114) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 05:08:17 2016 (r302115) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define HV_NANOSECONDS_PER_SEC 1000000000L @@ -220,8 +221,8 @@ hv_vmbus_signal_event(void *con_id) */ void hv_vmbus_synic_init(void *arg) - { + struct vmbus_softc *sc = vmbus_get_softc(); int cpu; uint64_t hv_vcpu_index; hv_vmbus_synic_simp simp; @@ -266,7 +267,7 @@ hv_vmbus_synic_init(void *arg) /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ shared_sint.as_uint64_t = 0; - shared_sint.u.vector = setup_args->vector; + shared_sint.u.vector = sc->vmbus_idtvec; shared_sint.u.masked = FALSE; shared_sint.u.auto_eoi = TRUE; Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 04:40:13 2016 (r302114) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 05:08:17 2016 (r302115) @@ -455,26 +455,18 @@ vmbus_bus_init(void) sc = vmbus_get_softc(); /* - * Find a free IDT slot for vmbus callback. + * Find a free IDT vector for vmbus messages/events. */ - hv_vmbus_g_context.hv_cb_vector = vmbus_vector_alloc(); - - if (hv_vmbus_g_context.hv_cb_vector == 0) { - if(bootverbose) - printf("Error VMBUS: Cannot find free IDT slot for " - "vmbus callback!\n"); + sc->vmbus_idtvec = vmbus_vector_alloc(); + if (sc->vmbus_idtvec == 0) { + device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); ret = ENXIO; goto cleanup; } - - if(bootverbose) - printf("VMBUS: vmbus callback vector %d\n", - hv_vmbus_g_context.hv_cb_vector); - - /* - * Notify the hypervisor of our vector. - */ - setup_args.vector = hv_vmbus_g_context.hv_cb_vector; + if(bootverbose) { + device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", + sc->vmbus_idtvec); + } CPU_FOREACH(j) { snprintf(buf, sizeof(buf), "cpu%d:hyperv", j); @@ -574,7 +566,7 @@ vmbus_bus_init(void) } } - vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); + vmbus_vector_free(sc->vmbus_idtvec); cleanup: return (ret); @@ -630,6 +622,7 @@ vmbus_sysinit(void *arg __unused) static int vmbus_detach(device_t dev) { + struct vmbus_softc *sc = device_get_softc(dev); int i; hv_vmbus_release_unattached_channels(); @@ -650,7 +643,7 @@ vmbus_detach(device_t dev) } } - vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); + vmbus_vector_free(sc->vmbus_idtvec); return (0); } Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 04:40:13 2016 (r302114) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 05:08:17 2016 (r302115) @@ -216,11 +216,6 @@ typedef struct { struct taskqueue *hv_event_queue[MAXCPU]; struct taskqueue *hv_msg_tq[MAXCPU]; struct task hv_msg_task[MAXCPU]; - /* - * Host use this vector to intrrupt guest for vmbus channel - * event and msg. - */ - unsigned int hv_cb_vector; } hv_vmbus_context; /* @@ -763,7 +758,6 @@ void hv_et_intr(struct trapframe*); void vmbus_scan(void); typedef struct { - unsigned int vector; void *page_buffers[2 * MAXCPU]; } hv_setup_args; Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 04:40:13 2016 (r302114) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 05:08:17 2016 (r302115) @@ -39,6 +39,7 @@ struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; device_t vmbus_dev; + int vmbus_idtvec; }; extern struct vmbus_softc *vmbus_sc; From owner-svn-src-all@freebsd.org Thu Jun 23 05:35:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39C54B729AD; Thu, 23 Jun 2016 05:35:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F25642FF8; Thu, 23 Jun 2016 05:35:09 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N5Z9MT082715; Thu, 23 Jun 2016 05:35:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N5Z83I082710; Thu, 23 Jun 2016 05:35:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230535.u5N5Z83I082710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 05:35: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: r302116 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 05:35:10 -0000 Author: sephe Date: Thu Jun 23 05:35:08 2016 New Revision: 302116 URL: https://svnweb.freebsd.org/changeset/base/302116 Log: MFC 300565,300567,300568,300570,300571 300565 hyperv/vmbus: Move vmbus interrupt counter into vmbus softc MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6497 300567 hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr() MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6498 300568 hyperv/busdma: Take BUS_DMA_ZERO into account MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6499 300570 hyperv/vmbus: Rename local variable and break long lines No functional changes. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6500 300571 hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file Avoid unnecessary exposure. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6501 Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/hyperv_busdma.c stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 05:08:17 2016 (r302115) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 05:35:08 2016 (r302116) @@ -216,132 +216,6 @@ hv_vmbus_signal_event(void *con_id) return (status); } -/** - * @brief hv_vmbus_synic_init - */ -void -hv_vmbus_synic_init(void *arg) -{ - struct vmbus_softc *sc = vmbus_get_softc(); - int cpu; - uint64_t hv_vcpu_index; - hv_vmbus_synic_simp simp; - hv_vmbus_synic_siefp siefp; - hv_vmbus_synic_scontrol sctrl; - hv_vmbus_synic_sint shared_sint; - uint64_t version; - hv_setup_args* setup_args = (hv_setup_args *)arg; - - cpu = PCPU_GET(cpuid); - - /* - * TODO: Check the version - */ - version = rdmsr(HV_X64_MSR_SVERSION); - - hv_vmbus_g_context.syn_ic_msg_page[cpu] = - setup_args->page_buffers[2 * cpu]; - hv_vmbus_g_context.syn_ic_event_page[cpu] = - setup_args->page_buffers[2 * cpu + 1]; - - /* - * Setup the Synic's message page - */ - - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.u.simp_enabled = 1; - simp.u.base_simp_gpa = ((hv_get_phys_addr( - hv_vmbus_g_context.syn_ic_msg_page[cpu])) >> PAGE_SHIFT); - - wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); - - /* - * Setup the Synic's event page - */ - siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.u.siefp_enabled = 1; - siefp.u.base_siefp_gpa = ((hv_get_phys_addr( - hv_vmbus_g_context.syn_ic_event_page[cpu])) >> PAGE_SHIFT); - - wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); - - /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ - shared_sint.as_uint64_t = 0; - shared_sint.u.vector = sc->vmbus_idtvec; - shared_sint.u.masked = FALSE; - shared_sint.u.auto_eoi = TRUE; - - wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, - shared_sint.as_uint64_t); - - wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, - shared_sint.as_uint64_t); - - /* Enable the global synic bit */ - sctrl.as_uint64_t = rdmsr(HV_X64_MSR_SCONTROL); - sctrl.u.enable = 1; - - wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t); - - hv_vmbus_g_context.syn_ic_initialized = TRUE; - - /* - * Set up the cpuid mapping from Hyper-V to FreeBSD. - * The array is indexed using FreeBSD cpuid. - */ - hv_vcpu_index = rdmsr(HV_X64_MSR_VP_INDEX); - hv_vmbus_g_context.hv_vcpu_index[cpu] = (uint32_t)hv_vcpu_index; - - return; -} - -/** - * @brief Cleanup routine for hv_vmbus_synic_init() - */ -void hv_vmbus_synic_cleanup(void *arg) -{ - hv_vmbus_synic_sint shared_sint; - hv_vmbus_synic_simp simp; - hv_vmbus_synic_siefp siefp; - - if (!hv_vmbus_g_context.syn_ic_initialized) - return; - - shared_sint.as_uint64_t = rdmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT); - - shared_sint.u.masked = 1; - - /* - * Disable the interrupt 0 - */ - wrmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, - shared_sint.as_uint64_t); - - shared_sint.as_uint64_t = rdmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT); - - shared_sint.u.masked = 1; - - /* - * Disable the interrupt 1 - */ - wrmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, - shared_sint.as_uint64_t); - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.u.simp_enabled = 0; - simp.u.base_simp_gpa = 0; - - wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); - - siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.u.siefp_enabled = 0; - siefp.u.base_siefp_gpa = 0; - - wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); -} static bool hyperv_identify(void) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 05:08:17 2016 (r302115) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 05:35:08 2016 (r302116) @@ -131,11 +131,9 @@ handled: * message to process - an event or a channel message. */ static inline int -hv_vmbus_isr(struct trapframe *frame) +hv_vmbus_isr(struct vmbus_softc *sc, struct trapframe *frame, int cpu) { - struct vmbus_softc *sc = vmbus_get_softc(); hv_vmbus_message *msg, *msg_base; - int cpu = curcpu; /* * The Windows team has advised that we check for events @@ -186,12 +184,11 @@ hv_vmbus_isr(struct trapframe *frame) return (FILTER_HANDLED); } -u_long *hv_vmbus_intr_cpu[MAXCPU]; - void hv_vector_handler(struct trapframe *trap_frame) { - int cpu; + struct vmbus_softc *sc = vmbus_get_softc(); + int cpu = curcpu; /* * Disable preemption. @@ -201,10 +198,9 @@ hv_vector_handler(struct trapframe *trap /* * Do a little interrupt counting. */ - cpu = PCPU_GET(cpuid); - (*hv_vmbus_intr_cpu[cpu])++; + (*VMBUS_SC_PCPU_GET(sc, intr_cnt, cpu))++; - hv_vmbus_isr(trap_frame); + hv_vmbus_isr(sc, trap_frame, cpu); /* * Enable preemption. @@ -212,6 +208,126 @@ hv_vector_handler(struct trapframe *trap critical_exit(); } +static void +vmbus_synic_setup(void *arg) +{ + struct vmbus_softc *sc = vmbus_get_softc(); + int cpu; + uint64_t hv_vcpu_index; + hv_vmbus_synic_simp simp; + hv_vmbus_synic_siefp siefp; + hv_vmbus_synic_scontrol sctrl; + hv_vmbus_synic_sint shared_sint; + uint64_t version; + hv_setup_args* setup_args = (hv_setup_args *)arg; + + cpu = PCPU_GET(cpuid); + + /* + * TODO: Check the version + */ + version = rdmsr(HV_X64_MSR_SVERSION); + + hv_vmbus_g_context.syn_ic_msg_page[cpu] = + setup_args->page_buffers[2 * cpu]; + hv_vmbus_g_context.syn_ic_event_page[cpu] = + setup_args->page_buffers[2 * cpu + 1]; + + /* + * Setup the Synic's message page + */ + + simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); + simp.u.simp_enabled = 1; + simp.u.base_simp_gpa = ((hv_get_phys_addr( + hv_vmbus_g_context.syn_ic_msg_page[cpu])) >> PAGE_SHIFT); + + wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); + + /* + * Setup the Synic's event page + */ + siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); + siefp.u.siefp_enabled = 1; + siefp.u.base_siefp_gpa = ((hv_get_phys_addr( + hv_vmbus_g_context.syn_ic_event_page[cpu])) >> PAGE_SHIFT); + + wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); + + /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ + shared_sint.as_uint64_t = 0; + shared_sint.u.vector = sc->vmbus_idtvec; + shared_sint.u.masked = FALSE; + shared_sint.u.auto_eoi = TRUE; + + wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, + shared_sint.as_uint64_t); + + wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, + shared_sint.as_uint64_t); + + /* Enable the global synic bit */ + sctrl.as_uint64_t = rdmsr(HV_X64_MSR_SCONTROL); + sctrl.u.enable = 1; + + wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t); + + hv_vmbus_g_context.syn_ic_initialized = TRUE; + + /* + * Set up the cpuid mapping from Hyper-V to FreeBSD. + * The array is indexed using FreeBSD cpuid. + */ + hv_vcpu_index = rdmsr(HV_X64_MSR_VP_INDEX); + hv_vmbus_g_context.hv_vcpu_index[cpu] = (uint32_t)hv_vcpu_index; +} + +static void +vmbus_synic_teardown(void *arg) +{ + hv_vmbus_synic_sint shared_sint; + hv_vmbus_synic_simp simp; + hv_vmbus_synic_siefp siefp; + + if (!hv_vmbus_g_context.syn_ic_initialized) + return; + + shared_sint.as_uint64_t = rdmsr( + HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT); + + shared_sint.u.masked = 1; + + /* + * Disable the interrupt 0 + */ + wrmsr( + HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, + shared_sint.as_uint64_t); + + shared_sint.as_uint64_t = rdmsr( + HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT); + + shared_sint.u.masked = 1; + + /* + * Disable the interrupt 1 + */ + wrmsr( + HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, + shared_sint.as_uint64_t); + simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); + simp.u.simp_enabled = 0; + simp.u.base_simp_gpa = 0; + + wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); + + siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); + siefp.u.siefp_enabled = 0; + siefp.u.base_siefp_gpa = 0; + + wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); +} + static int vmbus_read_ivar( device_t dev, @@ -444,7 +560,7 @@ static int vmbus_bus_init(void) { struct vmbus_softc *sc; - int i, j, n, ret; + int i, n, ret, cpu; char buf[MAXCOMLEN + 1]; cpuset_t cpu_mask; @@ -468,54 +584,63 @@ vmbus_bus_init(void) sc->vmbus_idtvec); } - CPU_FOREACH(j) { - snprintf(buf, sizeof(buf), "cpu%d:hyperv", j); - intrcnt_add(buf, &hv_vmbus_intr_cpu[j]); + CPU_FOREACH(cpu) { + snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); + intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, cpu)); for (i = 0; i < 2; i++) - setup_args.page_buffers[2 * j + i] = NULL; + setup_args.page_buffers[2 * cpu + i] = NULL; } /* * Per cpu setup. */ - CPU_FOREACH(j) { + CPU_FOREACH(cpu) { struct task cpuset_task; /* * Setup taskqueue to handle events */ - hv_vmbus_g_context.hv_event_queue[j] = taskqueue_create_fast("hyperv event", M_WAITOK, - taskqueue_thread_enqueue, &hv_vmbus_g_context.hv_event_queue[j]); - taskqueue_start_threads(&hv_vmbus_g_context.hv_event_queue[j], 1, PI_NET, - "hvevent%d", j); - - CPU_SETOF(j, &cpu_mask); - TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, &cpu_mask); - taskqueue_enqueue(hv_vmbus_g_context.hv_event_queue[j], &cpuset_task); - taskqueue_drain(hv_vmbus_g_context.hv_event_queue[j], &cpuset_task); + hv_vmbus_g_context.hv_event_queue[cpu] = + taskqueue_create_fast("hyperv event", M_WAITOK, + taskqueue_thread_enqueue, + &hv_vmbus_g_context.hv_event_queue[cpu]); + taskqueue_start_threads(&hv_vmbus_g_context.hv_event_queue[cpu], + 1, PI_NET, "hvevent%d", cpu); + + CPU_SETOF(cpu, &cpu_mask); + TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, + &cpu_mask); + taskqueue_enqueue(hv_vmbus_g_context.hv_event_queue[cpu], + &cpuset_task); + taskqueue_drain(hv_vmbus_g_context.hv_event_queue[cpu], + &cpuset_task); /* * Setup per-cpu tasks and taskqueues to handle msg. */ - hv_vmbus_g_context.hv_msg_tq[j] = taskqueue_create_fast( + hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_msg_tq[j]); - taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[j], 1, PI_NET, - "hvmsg%d", j); - TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0, + &hv_vmbus_g_context.hv_msg_tq[cpu]); + taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[cpu], 1, + PI_NET, "hvmsg%d", cpu); + TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, vmbus_msg_task, NULL); - CPU_SETOF(j, &cpu_mask); - TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, &cpu_mask); - taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[j], &cpuset_task); - taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[j], &cpuset_task); + CPU_SETOF(cpu, &cpu_mask); + TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, + &cpu_mask); + taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu], + &cpuset_task); + taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], + &cpuset_task); /* - * Prepare the per cpu msg and event pages to be called on each cpu. + * Prepare the per cpu msg and event pages to be called on + * each cpu. */ for(i = 0; i < 2; i++) { - setup_args.page_buffers[2 * j + i] = + setup_args.page_buffers[2 * cpu + i] = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); } } @@ -524,7 +649,7 @@ vmbus_bus_init(void) printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n", smp_started); - smp_rendezvous(NULL, hv_vmbus_synic_init, NULL, &setup_args); + smp_rendezvous(NULL, vmbus_synic_setup, NULL, &setup_args); /* * Connect to VMBus in the root partition @@ -559,10 +684,10 @@ vmbus_bus_init(void) /* * remove swi and vmbus callback vector; */ - CPU_FOREACH(j) { - if (hv_vmbus_g_context.hv_event_queue[j] != NULL) { - taskqueue_free(hv_vmbus_g_context.hv_event_queue[j]); - hv_vmbus_g_context.hv_event_queue[j] = NULL; + CPU_FOREACH(cpu) { + if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { + taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); + hv_vmbus_g_context.hv_event_queue[cpu] = NULL; } } @@ -628,7 +753,7 @@ vmbus_detach(device_t dev) hv_vmbus_release_unattached_channels(); hv_vmbus_disconnect(); - smp_rendezvous(NULL, hv_vmbus_synic_cleanup, NULL, NULL); + smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); for(i = 0; i < 2 * MAXCPU; i++) { if (setup_args.page_buffers[i] != NULL) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 05:08:17 2016 (r302115) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 05:35:08 2016 (r302116) @@ -727,8 +727,6 @@ uint16_t hv_vmbus_post_msg_via_msg_ipc( size_t payload_size); uint16_t hv_vmbus_signal_event(void *con_id); -void hv_vmbus_synic_init(void *irq_arg); -void hv_vmbus_synic_cleanup(void *arg); struct hv_device* hv_vmbus_child_device_create( hv_guid device_type, Modified: stable/10/sys/dev/hyperv/vmbus/hyperv_busdma.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hyperv_busdma.c Thu Jun 23 05:08:17 2016 (r302115) +++ stable/10/sys/dev/hyperv/vmbus/hyperv_busdma.c Thu Jun 23 05:35:08 2016 (r302116) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include -#define HYPERV_DMA_WAITMASK (BUS_DMA_WAITOK | BUS_DMA_NOWAIT) +#define HYPERV_DMA_MASK (BUS_DMA_WAITOK | BUS_DMA_NOWAIT | BUS_DMA_ZERO) void hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, int error) @@ -73,7 +73,7 @@ hyperv_dmamem_alloc(bus_dma_tag_t parent return NULL; error = bus_dmamem_alloc(dma->hv_dtag, &ret, - (flags & HYPERV_DMA_WAITMASK) | BUS_DMA_COHERENT, &dma->hv_dmap); + (flags & HYPERV_DMA_MASK) | BUS_DMA_COHERENT, &dma->hv_dmap); if (error) { bus_dma_tag_destroy(dma->hv_dtag); return NULL; Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 05:08:17 2016 (r302115) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 05:35:08 2016 (r302116) @@ -33,6 +33,7 @@ struct vmbus_pcpu_data { int event_flag_cnt; /* # of event flags */ + u_long *intr_cnt; } __aligned(CACHE_LINE_SIZE); struct vmbus_softc { From owner-svn-src-all@freebsd.org Thu Jun 23 05:41:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6969B72B56; Thu, 23 Jun 2016 05:41:47 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76D1816DF; Thu, 23 Jun 2016 05:41:47 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N5fkQa083573; Thu, 23 Jun 2016 05:41:46 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N5fku1083572; Thu, 23 Jun 2016 05:41:46 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606230541.u5N5fku1083572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 23 Jun 2016 05:41:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302117 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 05:41:47 -0000 Author: bz Date: Thu Jun 23 05:41:46 2016 New Revision: 302117 URL: https://svnweb.freebsd.org/changeset/base/302117 Log: Import a fix for and old security issue (CVE-2010-3830) in pf which was not relevant to FreeBSD as only root could open /dev/pf by default. With VIMAGE this is will longer be the case. As pf(4) starts to be supported with VNETs 3rd party users may open /dev/pf inside the virtual jail instance; thus we need to address this issue after all. While OpenBSD largely rewrote code parts for the fix [1], and it's unclear what Apple [3] did, import the minimal fix from NetBSD [2]. [1] http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/net/pf_ioctl.c.diff?r1=1.235&r2=1.236 [2] http://mail-index.netbsd.org/source-changes/2011/01/19/msg017518.html [3] https://support.apple.com/en-gb/HT202154 Obtained from: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dist/pf/net/pf_ioctl.c.diff?r1=1.42&r2=1.43&only_with_tag=MAIN MFC After: 2 weeks Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Security: CVE-2010-3830 Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Thu Jun 23 05:35:08 2016 (r302116) +++ head/sys/netpfil/pf/pf_ioctl.c Thu Jun 23 05:41:46 2016 (r302117) @@ -1254,6 +1254,7 @@ pfioctl(struct cdev *dev, u_long cmd, ca error = ENOMEM; } + rule->overload_tbl = NULL; if (rule->overload_tblname[0]) { if ((rule->overload_tbl = pfr_attach_table(ruleset, rule->overload_tblname)) == NULL) @@ -1511,6 +1512,7 @@ DIOCADDRULE_error: error = ENOMEM; } + newrule->overload_tbl = NULL; if (newrule->overload_tblname[0]) { if ((newrule->overload_tbl = pfr_attach_table( ruleset, newrule->overload_tblname)) == From owner-svn-src-all@freebsd.org Thu Jun 23 05:51:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED7FFB72E8E; Thu, 23 Jun 2016 05:51:58 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9B4E1CF2; Thu, 23 Jun 2016 05:51:58 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N5pw2j089252; Thu, 23 Jun 2016 05:51:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N5pvrx089248; Thu, 23 Jun 2016 05:51:57 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230551.u5N5pvrx089248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 05:51:57 +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: r302118 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 05:51:59 -0000 Author: sephe Date: Thu Jun 23 05:51:57 2016 New Revision: 302118 URL: https://svnweb.freebsd.org/changeset/base/302118 Log: MFC 300572 hyperv/vmbus: Use busdma(9) for messages and event flags And - Move message and event flags to vmbus_softc per-cpu data. - Get rid of hv_setup_arg, which serves no purpose now. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6502 Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 05:41:46 2016 (r302117) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 05:51:57 2016 (r302118) @@ -336,13 +336,11 @@ vmbus_event_proc(struct vmbus_softc *sc, { hv_vmbus_synic_event_flags *event; - event = hv_vmbus_g_context.syn_ic_event_page[cpu] + - HV_VMBUS_MESSAGE_SINT; - /* * On Host with Win8 or above, the event page can be checked directly * to get the id of the channel that has the pending interrupt. */ + event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; vmbus_event_flags_proc(event->flagsul, VMBUS_SC_PCPU_GET(sc, event_flag_cnt, cpu)); } @@ -352,9 +350,7 @@ vmbus_event_proc_compat(struct vmbus_sof { hv_vmbus_synic_event_flags *event; - event = hv_vmbus_g_context.syn_ic_event_page[cpu] + - HV_VMBUS_MESSAGE_SINT; - + event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; if (atomic_testandclear_int(&event->flags32[0], 0)) { vmbus_event_flags_proc( hv_vmbus_g_connection.recv_interrupt_page, Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 05:41:46 2016 (r302117) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 05:51:57 2016 (r302118) @@ -69,18 +69,16 @@ __FBSDID("$FreeBSD$"); struct vmbus_softc *vmbus_sc; static int vmbus_inited; -static hv_setup_args setup_args; /* only CPU 0 supported at this time */ static char *vmbus_ids[] = { "VMBUS", NULL }; static void -vmbus_msg_task(void *arg __unused, int pending __unused) +vmbus_msg_task(void *xsc, int pending __unused) { + struct vmbus_softc *sc = xsc; hv_vmbus_message *msg; - msg = hv_vmbus_g_context.syn_ic_msg_page[curcpu] + - HV_VMBUS_MESSAGE_SINT; - + msg = VMBUS_SC_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT; for (;;) { const hv_vmbus_channel_msg_table_entry *entry; hv_vmbus_channel_msg_header *hdr; @@ -143,7 +141,7 @@ hv_vmbus_isr(struct vmbus_softc *sc, str sc->vmbus_event_proc(sc, cpu); /* Check if there are actual msgs to be process */ - msg_base = hv_vmbus_g_context.syn_ic_msg_page[cpu]; + msg_base = VMBUS_SC_PCPU_GET(sc, message, cpu); msg = msg_base + HV_VMBUS_TIMER_SINT; /* we call eventtimer process the message */ @@ -209,7 +207,7 @@ hv_vector_handler(struct trapframe *trap } static void -vmbus_synic_setup(void *arg) +vmbus_synic_setup(void *arg __unused) { struct vmbus_softc *sc = vmbus_get_softc(); int cpu; @@ -219,7 +217,6 @@ vmbus_synic_setup(void *arg) hv_vmbus_synic_scontrol sctrl; hv_vmbus_synic_sint shared_sint; uint64_t version; - hv_setup_args* setup_args = (hv_setup_args *)arg; cpu = PCPU_GET(cpuid); @@ -228,19 +225,13 @@ vmbus_synic_setup(void *arg) */ version = rdmsr(HV_X64_MSR_SVERSION); - hv_vmbus_g_context.syn_ic_msg_page[cpu] = - setup_args->page_buffers[2 * cpu]; - hv_vmbus_g_context.syn_ic_event_page[cpu] = - setup_args->page_buffers[2 * cpu + 1]; - /* * Setup the Synic's message page */ - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); simp.u.simp_enabled = 1; - simp.u.base_simp_gpa = ((hv_get_phys_addr( - hv_vmbus_g_context.syn_ic_msg_page[cpu])) >> PAGE_SHIFT); + simp.u.base_simp_gpa = + VMBUS_SC_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); @@ -249,8 +240,8 @@ vmbus_synic_setup(void *arg) */ siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); siefp.u.siefp_enabled = 1; - siefp.u.base_siefp_gpa = ((hv_get_phys_addr( - hv_vmbus_g_context.syn_ic_event_page[cpu])) >> PAGE_SHIFT); + siefp.u.base_siefp_gpa = + VMBUS_SC_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); @@ -328,6 +319,47 @@ vmbus_synic_teardown(void *arg) wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); } +static void +vmbus_dma_alloc(struct vmbus_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + /* + * Per-cpu messages and event flags. + */ + VMBUS_SC_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( + bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, + VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), + BUS_DMA_WAITOK | BUS_DMA_ZERO); + VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( + bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, + VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), + BUS_DMA_WAITOK | BUS_DMA_ZERO); + } +} + +static void +vmbus_dma_free(struct vmbus_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + if (VMBUS_SC_PCPU_GET(sc, message, cpu) != NULL) { + hyperv_dmamem_free( + VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), + VMBUS_SC_PCPU_GET(sc, message, cpu)); + VMBUS_SC_PCPU_GET(sc, message, cpu) = NULL; + } + if (VMBUS_SC_PCPU_GET(sc, event_flag, cpu) != NULL) { + hyperv_dmamem_free( + VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), + VMBUS_SC_PCPU_GET(sc, event_flag, cpu)); + VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = NULL; + } + } +} + static int vmbus_read_ivar( device_t dev, @@ -560,7 +592,7 @@ static int vmbus_bus_init(void) { struct vmbus_softc *sc; - int i, n, ret, cpu; + int ret, cpu; char buf[MAXCOMLEN + 1]; cpuset_t cpu_mask; @@ -587,9 +619,6 @@ vmbus_bus_init(void) CPU_FOREACH(cpu) { snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, cpu)); - - for (i = 0; i < 2; i++) - setup_args.page_buffers[2 * cpu + i] = NULL; } /* @@ -623,9 +652,9 @@ vmbus_bus_init(void) "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, &hv_vmbus_g_context.hv_msg_tq[cpu]); taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[cpu], 1, - PI_NET, "hvmsg%d", cpu); + PI_NET, "hvmsg%d", cpu); TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, - vmbus_msg_task, NULL); + vmbus_msg_task, sc); CPU_SETOF(cpu, &cpu_mask); TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, @@ -634,22 +663,17 @@ vmbus_bus_init(void) &cpuset_task); taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], &cpuset_task); - - /* - * Prepare the per cpu msg and event pages to be called on - * each cpu. - */ - for(i = 0; i < 2; i++) { - setup_args.page_buffers[2 * cpu + i] = - malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - } } + /* + * Allocate vmbus DMA stuffs. + */ + vmbus_dma_alloc(sc); + if (bootverbose) printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n", smp_started); - - smp_rendezvous(NULL, vmbus_synic_setup, NULL, &setup_args); + smp_rendezvous(NULL, vmbus_synic_setup, NULL, NULL); /* * Connect to VMBus in the root partition @@ -673,13 +697,8 @@ vmbus_bus_init(void) return (ret); - cleanup1: - /* - * Free pages alloc'ed - */ - for (n = 0; n < 2 * MAXCPU; n++) - if (setup_args.page_buffers[n] != NULL) - free(setup_args.page_buffers[n], M_DEVBUF); +cleanup1: + vmbus_dma_free(sc); /* * remove swi and vmbus callback vector; @@ -755,10 +774,7 @@ vmbus_detach(device_t dev) smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); - for(i = 0; i < 2 * MAXCPU; i++) { - if (setup_args.page_buffers[i] != NULL) - free(setup_args.page_buffers[i], M_DEVBUF); - } + vmbus_dma_free(sc); /* remove swi */ CPU_FOREACH(i) { Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 05:41:46 2016 (r302117) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 05:51:57 2016 (r302118) @@ -203,8 +203,6 @@ union vmbus_event_flags; typedef struct { hv_bool_uint8_t syn_ic_initialized; - struct vmbus_message *syn_ic_msg_page[MAXCPU]; - union vmbus_event_flags *syn_ic_event_page[MAXCPU]; /* * For FreeBSD cpuid to Hyper-V vcpuid mapping. */ @@ -755,8 +753,4 @@ void hv_et_intr(struct trapframe*); /* Wait for device creation */ void vmbus_scan(void); -typedef struct { - void *page_buffers[2 * MAXCPU]; -} hv_setup_args; - #endif /* __HYPERV_PRIV_H__ */ Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 05:41:46 2016 (r302117) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 05:51:57 2016 (r302118) @@ -30,10 +30,18 @@ #define _VMBUS_VAR_H_ #include +#include +#include struct vmbus_pcpu_data { - int event_flag_cnt; /* # of event flags */ - u_long *intr_cnt; + u_long *intr_cnt; /* Hyper-V interrupt counter */ + struct vmbus_message *message; /* shared messages */ + int event_flag_cnt; /* # of event flags */ + union vmbus_event_flags *event_flag; /* shared event flags */ + + /* Rarely used fields */ + struct hyperv_dma message_dma; /* busdma glue */ + struct hyperv_dma event_flag_dma; /* busdma glue */ } __aligned(CACHE_LINE_SIZE); struct vmbus_softc { From owner-svn-src-all@freebsd.org Thu Jun 23 05:56:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 310C0B73044; Thu, 23 Jun 2016 05:56:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D08120FD; Thu, 23 Jun 2016 05:56:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N5u5OD090099; Thu, 23 Jun 2016 05:56:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N5u584090096; Thu, 23 Jun 2016 05:56:05 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230556.u5N5u584090096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 05:56: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: r302119 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 05:56:06 -0000 Author: sephe Date: Thu Jun 23 05:56:04 2016 New Revision: 302119 URL: https://svnweb.freebsd.org/changeset/base/302119 Log: MFC 300573 hyperv/vmbus: Git rid of sc version of pcpu data extraction macro MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6503 Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 05:51:57 2016 (r302118) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 05:56:04 2016 (r302119) @@ -340,9 +340,9 @@ vmbus_event_proc(struct vmbus_softc *sc, * On Host with Win8 or above, the event page can be checked directly * to get the id of the channel that has the pending interrupt. */ - event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; + event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; vmbus_event_flags_proc(event->flagsul, - VMBUS_SC_PCPU_GET(sc, event_flag_cnt, cpu)); + VMBUS_PCPU_GET(sc, event_flag_cnt, cpu)); } void @@ -350,7 +350,7 @@ vmbus_event_proc_compat(struct vmbus_sof { hv_vmbus_synic_event_flags *event; - event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; + event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; if (atomic_testandclear_int(&event->flags32[0], 0)) { vmbus_event_flags_proc( hv_vmbus_g_connection.recv_interrupt_page, @@ -418,7 +418,8 @@ vmbus_on_channel_open(const struct hv_vm int flag_cnt; flag_cnt = (chan->offer_msg.child_rel_id / HV_CHANNEL_ULONG_LEN) + 1; - flag_cnt_ptr = VMBUS_PCPU_PTR(event_flag_cnt, chan->target_cpu); + flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flag_cnt, + chan->target_cpu); for (;;) { int old_flag_cnt; Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 05:51:57 2016 (r302118) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 05:56:04 2016 (r302119) @@ -78,7 +78,7 @@ vmbus_msg_task(void *xsc, int pending __ struct vmbus_softc *sc = xsc; hv_vmbus_message *msg; - msg = VMBUS_SC_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT; + msg = VMBUS_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT; for (;;) { const hv_vmbus_channel_msg_table_entry *entry; hv_vmbus_channel_msg_header *hdr; @@ -141,7 +141,7 @@ hv_vmbus_isr(struct vmbus_softc *sc, str sc->vmbus_event_proc(sc, cpu); /* Check if there are actual msgs to be process */ - msg_base = VMBUS_SC_PCPU_GET(sc, message, cpu); + msg_base = VMBUS_PCPU_GET(sc, message, cpu); msg = msg_base + HV_VMBUS_TIMER_SINT; /* we call eventtimer process the message */ @@ -196,7 +196,7 @@ hv_vector_handler(struct trapframe *trap /* * Do a little interrupt counting. */ - (*VMBUS_SC_PCPU_GET(sc, intr_cnt, cpu))++; + (*VMBUS_PCPU_GET(sc, intr_cnt, cpu))++; hv_vmbus_isr(sc, trap_frame, cpu); @@ -231,7 +231,7 @@ vmbus_synic_setup(void *arg __unused) simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); simp.u.simp_enabled = 1; simp.u.base_simp_gpa = - VMBUS_SC_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; + VMBUS_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); @@ -241,7 +241,7 @@ vmbus_synic_setup(void *arg __unused) siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); siefp.u.siefp_enabled = 1; siefp.u.base_siefp_gpa = - VMBUS_SC_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; + VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); @@ -328,13 +328,13 @@ vmbus_dma_alloc(struct vmbus_softc *sc) /* * Per-cpu messages and event flags. */ - VMBUS_SC_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( + VMBUS_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, - VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), + VMBUS_PCPU_PTR(sc, message_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); - VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( + VMBUS_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, - VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), + VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); } } @@ -345,17 +345,17 @@ vmbus_dma_free(struct vmbus_softc *sc) int cpu; CPU_FOREACH(cpu) { - if (VMBUS_SC_PCPU_GET(sc, message, cpu) != NULL) { + if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) { hyperv_dmamem_free( - VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), - VMBUS_SC_PCPU_GET(sc, message, cpu)); - VMBUS_SC_PCPU_GET(sc, message, cpu) = NULL; + VMBUS_PCPU_PTR(sc, message_dma, cpu), + VMBUS_PCPU_GET(sc, message, cpu)); + VMBUS_PCPU_GET(sc, message, cpu) = NULL; } - if (VMBUS_SC_PCPU_GET(sc, event_flag, cpu) != NULL) { + if (VMBUS_PCPU_GET(sc, event_flag, cpu) != NULL) { hyperv_dmamem_free( - VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), - VMBUS_SC_PCPU_GET(sc, event_flag, cpu)); - VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = NULL; + VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), + VMBUS_PCPU_GET(sc, event_flag, cpu)); + VMBUS_PCPU_GET(sc, event_flag, cpu) = NULL; } } } @@ -618,7 +618,7 @@ vmbus_bus_init(void) CPU_FOREACH(cpu) { snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); - intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, cpu)); + intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu)); } /* Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 05:51:57 2016 (r302118) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 05:56:04 2016 (r302119) @@ -65,12 +65,8 @@ vmbus_get_device(void) return vmbus_sc->vmbus_dev; } -#define VMBUS_SC_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field -#define VMBUS_SC_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field -#define VMBUS_PCPU_GET(field, cpu) \ - VMBUS_SC_PCPU_GET(vmbus_get_softc(), field, (cpu)) -#define VMBUS_PCPU_PTR(field, cpu) \ - VMBUS_SC_PCPU_PTR(vmbus_get_softc(), field, (cpu)) +#define VMBUS_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field +#define VMBUS_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field void vmbus_on_channel_open(const struct hv_vmbus_channel *); void vmbus_event_proc(struct vmbus_softc *, int); From owner-svn-src-all@freebsd.org Thu Jun 23 06:18:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20C8BB734F2; Thu, 23 Jun 2016 06:18:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4EDB2D99; Thu, 23 Jun 2016 06:18:33 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N6IXe9097904; Thu, 23 Jun 2016 06:18:33 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N6IXwH097903; Thu, 23 Jun 2016 06:18:33 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230618.u5N6IXwH097903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 06:18: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: r302120 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 06:18:34 -0000 Author: sephe Date: Thu Jun 23 06:18:32 2016 New Revision: 302120 URL: https://svnweb.freebsd.org/changeset/base/302120 Log: MFC 300574 hyperv/vmbus: Factor out functions for vmbus interrupt set/teardown This paves way for further cleanup and fix. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6505 Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 05:56:04 2016 (r302119) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 06:18:32 2016 (r302120) @@ -72,6 +72,8 @@ static int vmbus_inited; static char *vmbus_ids[] = { "VMBUS", NULL }; +extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback); + static void vmbus_msg_task(void *xsc, int pending __unused) { @@ -360,6 +362,165 @@ vmbus_dma_free(struct vmbus_softc *sc) } } +/** + * @brief Find a free IDT slot and setup the interrupt handler. + */ +static int +vmbus_vector_alloc(void) +{ + int vector; + uintptr_t func; + struct gate_descriptor *ip; + + /* + * Search backwards form the highest IDT vector available for use + * as vmbus channel callback vector. We install 'hv_vmbus_callback' + * handler at that vector and use it to interrupt vcpus. + */ + vector = APIC_SPURIOUS_INT; + while (--vector >= APIC_IPI_INTS) { + ip = &idt[vector]; + func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); + if (func == (uintptr_t)&IDTVEC(rsvd)) { +#ifdef __i386__ + setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYS386IGT, + SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); +#else + setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYSIGT, + SEL_KPL, 0); +#endif + + return (vector); + } + } + return (0); +} + +/** + * @brief Restore the IDT slot to rsvd. + */ +static void +vmbus_vector_free(int vector) +{ + uintptr_t func; + struct gate_descriptor *ip; + + if (vector == 0) + return; + + KASSERT(vector >= APIC_IPI_INTS && vector < APIC_SPURIOUS_INT, + ("invalid vector %d", vector)); + + ip = &idt[vector]; + func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); + KASSERT(func == (uintptr_t)&IDTVEC(hv_vmbus_callback), + ("invalid vector %d", vector)); + + setidt(vector, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0); +} + +static void +vmbus_cpuset_setthread_task(void *xmask, int pending __unused) +{ + cpuset_t *mask = xmask; + int error; + + error = cpuset_setthread(curthread->td_tid, mask); + if (error) { + panic("curthread=%ju: can't pin; error=%d", + (uintmax_t)curthread->td_tid, error); + } +} + +static int +vmbus_intr_setup(struct vmbus_softc *sc) +{ + int cpu; + + /* + * Find a free IDT vector for vmbus messages/events. + */ + sc->vmbus_idtvec = vmbus_vector_alloc(); + if (sc->vmbus_idtvec == 0) { + device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); + return ENXIO; + } + if(bootverbose) { + device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", + sc->vmbus_idtvec); + } + + CPU_FOREACH(cpu) { + char buf[MAXCOMLEN + 1]; + + snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); + intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu)); + } + + /* + * Per cpu setup. + */ + CPU_FOREACH(cpu) { + struct task cpuset_task; + cpuset_t cpu_mask; + + /* + * Setup taskqueue to handle events + */ + hv_vmbus_g_context.hv_event_queue[cpu] = + taskqueue_create_fast("hyperv event", M_WAITOK, + taskqueue_thread_enqueue, + &hv_vmbus_g_context.hv_event_queue[cpu]); + taskqueue_start_threads(&hv_vmbus_g_context.hv_event_queue[cpu], + 1, PI_NET, "hvevent%d", cpu); + + CPU_SETOF(cpu, &cpu_mask); + TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, + &cpu_mask); + taskqueue_enqueue(hv_vmbus_g_context.hv_event_queue[cpu], + &cpuset_task); + taskqueue_drain(hv_vmbus_g_context.hv_event_queue[cpu], + &cpuset_task); + + /* + * Setup per-cpu tasks and taskqueues to handle msg. + */ + hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( + "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, + &hv_vmbus_g_context.hv_msg_tq[cpu]); + taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[cpu], 1, + PI_NET, "hvmsg%d", cpu); + TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, + vmbus_msg_task, sc); + + CPU_SETOF(cpu, &cpu_mask); + TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, + &cpu_mask); + taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu], + &cpuset_task); + taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], + &cpuset_task); + } + return 0; +} + +static void +vmbus_intr_teardown(struct vmbus_softc *sc) +{ + int cpu; + + /* + * remove swi and vmbus callback vector; + */ + CPU_FOREACH(cpu) { + if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { + taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); + hv_vmbus_g_context.hv_event_queue[cpu] = NULL; + } + } + vmbus_vector_free(sc->vmbus_idtvec); +} + static int vmbus_read_ivar( device_t dev, @@ -504,78 +665,6 @@ vmbus_probe(device_t dev) return (BUS_PROBE_DEFAULT); } -extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback); - -/** - * @brief Find a free IDT slot and setup the interrupt handler. - */ -static int -vmbus_vector_alloc(void) -{ - int vector; - uintptr_t func; - struct gate_descriptor *ip; - - /* - * Search backwards form the highest IDT vector available for use - * as vmbus channel callback vector. We install 'hv_vmbus_callback' - * handler at that vector and use it to interrupt vcpus. - */ - vector = APIC_SPURIOUS_INT; - while (--vector >= APIC_IPI_INTS) { - ip = &idt[vector]; - func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); - if (func == (uintptr_t)&IDTVEC(rsvd)) { -#ifdef __i386__ - setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYS386IGT, - SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); -#else - setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYSIGT, - SEL_KPL, 0); -#endif - - return (vector); - } - } - return (0); -} - -/** - * @brief Restore the IDT slot to rsvd. - */ -static void -vmbus_vector_free(int vector) -{ - uintptr_t func; - struct gate_descriptor *ip; - - if (vector == 0) - return; - - KASSERT(vector >= APIC_IPI_INTS && vector < APIC_SPURIOUS_INT, - ("invalid vector %d", vector)); - - ip = &idt[vector]; - func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); - KASSERT(func == (uintptr_t)&IDTVEC(hv_vmbus_callback), - ("invalid vector %d", vector)); - - setidt(vector, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0); -} - -static void -vmbus_cpuset_setthread_task(void *xmask, int pending __unused) -{ - cpuset_t *mask = xmask; - int error; - - error = cpuset_setthread(curthread->td_tid, mask); - if (error) { - panic("curthread=%ju: can't pin; error=%d", - (uintmax_t)curthread->td_tid, error); - } -} - /** * @brief Main vmbus driver initialization routine. * @@ -592,9 +681,7 @@ static int vmbus_bus_init(void) { struct vmbus_softc *sc; - int ret, cpu; - char buf[MAXCOMLEN + 1]; - cpuset_t cpu_mask; + int ret; if (vmbus_inited) return (0); @@ -603,70 +690,14 @@ vmbus_bus_init(void) sc = vmbus_get_softc(); /* - * Find a free IDT vector for vmbus messages/events. + * Setup interrupt. */ - sc->vmbus_idtvec = vmbus_vector_alloc(); - if (sc->vmbus_idtvec == 0) { - device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); - ret = ENXIO; + ret = vmbus_intr_setup(sc); + if (ret != 0) goto cleanup; - } - if(bootverbose) { - device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", - sc->vmbus_idtvec); - } - - CPU_FOREACH(cpu) { - snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); - intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu)); - } - - /* - * Per cpu setup. - */ - CPU_FOREACH(cpu) { - struct task cpuset_task; - - /* - * Setup taskqueue to handle events - */ - hv_vmbus_g_context.hv_event_queue[cpu] = - taskqueue_create_fast("hyperv event", M_WAITOK, - taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_event_queue[cpu]); - taskqueue_start_threads(&hv_vmbus_g_context.hv_event_queue[cpu], - 1, PI_NET, "hvevent%d", cpu); - - CPU_SETOF(cpu, &cpu_mask); - TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, - &cpu_mask); - taskqueue_enqueue(hv_vmbus_g_context.hv_event_queue[cpu], - &cpuset_task); - taskqueue_drain(hv_vmbus_g_context.hv_event_queue[cpu], - &cpuset_task); - - /* - * Setup per-cpu tasks and taskqueues to handle msg. - */ - hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( - "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_msg_tq[cpu]); - taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[cpu], 1, - PI_NET, "hvmsg%d", cpu); - TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, - vmbus_msg_task, sc); - - CPU_SETOF(cpu, &cpu_mask); - TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, - &cpu_mask); - taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu], - &cpuset_task); - taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], - &cpuset_task); - } /* - * Allocate vmbus DMA stuffs. + * Allocate DMA stuffs. */ vmbus_dma_alloc(sc); @@ -681,7 +712,7 @@ vmbus_bus_init(void) ret = hv_vmbus_connect(); if (ret != 0) - goto cleanup1; + goto cleanup; if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 || hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) @@ -697,22 +728,10 @@ vmbus_bus_init(void) return (ret); -cleanup1: +cleanup: vmbus_dma_free(sc); + vmbus_intr_teardown(sc); - /* - * remove swi and vmbus callback vector; - */ - CPU_FOREACH(cpu) { - if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { - taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); - hv_vmbus_g_context.hv_event_queue[cpu] = NULL; - } - } - - vmbus_vector_free(sc->vmbus_idtvec); - - cleanup: return (ret); } @@ -767,7 +786,6 @@ static int vmbus_detach(device_t dev) { struct vmbus_softc *sc = device_get_softc(dev); - int i; hv_vmbus_release_unattached_channels(); hv_vmbus_disconnect(); @@ -775,16 +793,7 @@ vmbus_detach(device_t dev) smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); vmbus_dma_free(sc); - - /* remove swi */ - CPU_FOREACH(i) { - if (hv_vmbus_g_context.hv_event_queue[i] != NULL) { - taskqueue_free(hv_vmbus_g_context.hv_event_queue[i]); - hv_vmbus_g_context.hv_event_queue[i] = NULL; - } - } - - vmbus_vector_free(sc->vmbus_idtvec); + vmbus_intr_teardown(sc); return (0); } From owner-svn-src-all@freebsd.org Thu Jun 23 06:27:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB9F2B737B7; Thu, 23 Jun 2016 06:27:42 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ECB716DE; Thu, 23 Jun 2016 06:27:42 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N6RfMx002809; Thu, 23 Jun 2016 06:27:41 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N6RfSw002808; Thu, 23 Jun 2016 06:27:41 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230627.u5N6RfSw002808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 06:27: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: r302122 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 06:27:43 -0000 Author: sephe Date: Thu Jun 23 06:27:41 2016 New Revision: 302122 URL: https://svnweb.freebsd.org/changeset/base/302122 Log: MFC 300576,300644 300576 hyperv/vmbus: Free message taskqueue during interrupt teardown MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6506 300644 hyperv/vmbus: Check hyperv_dmamem_alloc return value Though it is highly unlikely this function would fail w/ BUS_DMA_WAITOK, we had better to check its return value; better safe then sorry here. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6518 Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 06:22:48 2016 (r302121) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 06:27:41 2016 (r302122) @@ -321,24 +321,34 @@ vmbus_synic_teardown(void *arg) wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); } -static void +static int vmbus_dma_alloc(struct vmbus_softc *sc) { int cpu; CPU_FOREACH(cpu) { + void *ptr; + /* * Per-cpu messages and event flags. */ - VMBUS_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( - bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, + ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, PAGE_SIZE, VMBUS_PCPU_PTR(sc, message_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); - VMBUS_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( - bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, + if (ptr == NULL) + return ENOMEM; + VMBUS_PCPU_GET(sc, message, cpu) = ptr; + + ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, PAGE_SIZE, VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (ptr == NULL) + return ENOMEM; + VMBUS_PCPU_GET(sc, event_flag, cpu) = ptr; } + return 0; } static void @@ -517,6 +527,12 @@ vmbus_intr_teardown(struct vmbus_softc * taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); hv_vmbus_g_context.hv_event_queue[cpu] = NULL; } + if (hv_vmbus_g_context.hv_msg_tq[cpu] != NULL) { + taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], + &hv_vmbus_g_context.hv_msg_task[cpu]); + taskqueue_free(hv_vmbus_g_context.hv_msg_tq[cpu]); + hv_vmbus_g_context.hv_msg_tq[cpu] = NULL; + } } vmbus_vector_free(sc->vmbus_idtvec); } @@ -699,7 +715,9 @@ vmbus_bus_init(void) /* * Allocate DMA stuffs. */ - vmbus_dma_alloc(sc); + ret = vmbus_dma_alloc(sc); + if (ret != 0) + goto cleanup; if (bootverbose) printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n", From owner-svn-src-all@freebsd.org Thu Jun 23 06:32:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BADEB73987; Thu, 23 Jun 2016 06:32:28 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F7751B35; Thu, 23 Jun 2016 06:32:27 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=j+Nlrk3HfJqsV6on9LFZDNZHoxNQh0D5b6rCgCk0Lu4=; b=MwVlJbDerYIrXXd3/6awrv9lcnKS2yWOgT3uv2CbkdpFC5h5FN5IZM1XXEgBo72Rog0HSQDNZhzyqJKri6bFc4MDhDpAh7NliwpYtwZcxio/5EN4jAMbkCo937B0L2dhYhTM5f834YIgGNgtwEdNOFQKDpRZ8sE7L2f6+w5jIHc=; Received: from [37.229.193.176] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1bFyBc-000NgT-Nh ; Thu, 23 Jun 2016 09:32:24 +0300 Date: Thu, 23 Jun 2016 09:32:24 +0300 From: Ivan Klymenko To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302092 - in head/lib/libc: aarch64/sys amd64/sys arm/sys i386/sys mips/sys powerpc/sys powerpc64/sys riscv/sys sparc64/sys sys Message-ID: <20160623093224.18d30b89@nonamehost.local> In-Reply-To: <201606222111.u5MLBRHn090827@repo.freebsd.org> References: <201606222111.u5MLBRHn090827@repo.freebsd.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=37.229.193.176; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 06:32:28 -0000 On Wed, 22 Jun 2016 21:11:27 +0000 (UTC) Brooks Davis wrote: > Author: brooks > Date: Wed Jun 22 21:11:27 2016 > New Revision: 302092 > URL: https://svnweb.freebsd.org/changeset/base/302092 > > Log: > Replace use of the pipe(2) system call with pipe2(2) with a zero > flags value. > > This eliminates the need for machine dependant assembly wrappers for > pipe(2). > > It also make passing an invalid address to pipe(2) return EFAULT > rather than triggering a segfault. Document this behavior (which was > already true for pipe2(2), but undocumented). > > Reviewed by: andrew > Approved by: re (gjb) > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D6815 > > Added: > head/lib/libc/sys/pipe.c (contents, props changed) > Deleted: > head/lib/libc/aarch64/sys/pipe.S > head/lib/libc/amd64/sys/pipe.S > head/lib/libc/arm/sys/pipe.S > head/lib/libc/i386/sys/pipe.S > head/lib/libc/mips/sys/pipe.S > head/lib/libc/powerpc/sys/pipe.S > head/lib/libc/powerpc64/sys/pipe.S > head/lib/libc/riscv/sys/pipe.S > head/lib/libc/sparc64/sys/pipe.S > Modified: > head/lib/libc/aarch64/sys/Makefile.inc > head/lib/libc/amd64/sys/Makefile.inc > head/lib/libc/arm/sys/Makefile.inc > head/lib/libc/i386/sys/Makefile.inc > head/lib/libc/mips/sys/Makefile.inc > head/lib/libc/powerpc/sys/Makefile.inc > head/lib/libc/powerpc64/sys/Makefile.inc > head/lib/libc/riscv/sys/Makefile.inc > head/lib/libc/sparc64/sys/Makefile.inc > head/lib/libc/sys/Makefile.inc > head/lib/libc/sys/pipe.2 > ... /usr/local/libexec/ccache/world/cc -target x86_64-unknown-freebsd11.0 --sysroot=/media/da0s1/obj/usr/src/tmp -B/media/da0s1/obj/usr/src/tmp/usr/bin -fpic -DPIC -O2 -pipe -mmmx -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx -maes -mpclmul -march=native -I/usr/src/lib/libc/include -I/usr/src/lib/libc/../../include -I/usr/src/lib/libc/amd64 -DNLS -D__DBINTERFACE_PRIVATE -I/usr/src/lib/libc/../../contrib/gdtoa -I/usr/src/lib/libc/../../contrib/libc-vis -DINET6 -I/media/da0s1/obj/usr/src/lib/libc -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libc/../libmd -I/usr/src/lib/libc/../../contrib/jemalloc/include -DMALLOC_PRODUCTION -I/usr/src/lib/libc/../../contrib/tzcode/stdtime -I/usr/src/lib/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -I/usr/src/lib/libc/rpc -DYP -DNS_CACHING -DSYMBOL_VERSIONING -DNDEBUG -MD -MF.depend.gettimeofday.So -MTgettimeofday.So -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Ofast -fvectorize -fslp-vectorize -fblocks -fcolor-diagnostics -Qunused-arguments -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src -c /usr/src/lib/libc/sys/gettimeofday.c -o gettimeofday.So --- pipe.So --- /usr/local/libexec/ccache/world/cc -target x86_64-unknown-freebsd11.0 --sysroot=/media/da0s1/obj/usr/src/tmp -B/media/da0s1/obj/usr/src/tmp/usr/bin -fpic -DPIC -O2 -pipe -mmmx -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx -maes -mpclmul -march=native -I/usr/src/lib/libc/include -I/usr/src/lib/libc/../../include -I/usr/src/lib/libc/amd64 -DNLS -D__DBINTERFACE_PRIVATE -I/usr/src/lib/libc/../../contrib/gdtoa -I/usr/src/lib/libc/../../contrib/libc-vis -DINET6 -I/media/da0s1/obj/usr/src/lib/libc -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libc/../libmd -I/usr/src/lib/libc/../../contrib/jemalloc/include -DMALLOC_PRODUCTION -I/usr/src/lib/libc/../../contrib/tzcode/stdtime -I/usr/src/lib/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -I/usr/src/lib/libc/rpc -DYP -DNS_CACHING -DSYMBOL_VERSIONING -DNDEBUG -MD -MF.depend.pipe.So -MTpipe.So -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Ofast -fvectorize -fslp-vectorize -fblocks -fcolor-diagnostics -Qunused-arguments -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src -c /usr/src/lib/libc/amd64/sys/pipe.S -o pipe.So cc: error: no such file or directory: '/usr/src/lib/libc/amd64/sys/pipe.S' cc: error: no input files *** [pipe.So] Error code 1 make[4]: stopped in /usr/src/lib/libc 1 error make[4]: stopped in /usr/src/lib/libc *** [lib/libc__L] Error code 2 make[3]: stopped in /usr/src 1 error make[3]: stopped in /usr/src *** [libraries] Error code 2 make[2]: stopped in /usr/src 1 error make[2]: stopped in /usr/src *** [_libraries] Error code 2 make[1]: stopped in /usr/src 1 error make[1]: stopped in /usr/src *** [buildworld] Error code 2 make: stopped in /usr/src 1 error make: stopped in /usr/src root@nonamehost:/usr/src # From owner-svn-src-all@freebsd.org Thu Jun 23 07:01:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89AE6B73EB3; Thu, 23 Jun 2016 07:01:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DF442981; Thu, 23 Jun 2016 07:01:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N71sVw016901; Thu, 23 Jun 2016 07:01:54 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N71sLm016900; Thu, 23 Jun 2016 07:01:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201606230701.u5N71sLm016900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 23 Jun 2016 07:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302123 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 07:01:55 -0000 Author: avg Date: Thu Jun 23 07:01:54 2016 New Revision: 302123 URL: https://svnweb.freebsd.org/changeset/base/302123 Log: fix deadlock-prone code in getzfsvfs() getzfsvfs() called vfs_busy() in the waiting mode while having a hold on a pool (via a call to dmu_objset_hold). In other words, dp_config_rwlock was held in the shared mode while a thread could be sleeping in vfs_busy(). The pool's txg sync thread needs to take dp_config_rwlock in the exclusive mode for some actions, e.g., for executing sync tasks. If the sync thread gets blocked, then any thread waiting for its sync task to get executed is also blocked. Which, in turn, could mean that vfs_busy() will keep waiting indefinitely. The solution is to use vfs_ref() in the locked section and to call vfs_busy() only after dropping other locks. Note that a reference on a struct mount object does not prevent an associated zfsvfs_t object from being destroyed. So, we have to be careful to operate only on the struct mount object until we successfully vfs_busy it. Approved by: re (gjb) MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jun 23 06:27:41 2016 (r302122) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jun 23 07:01:54 2016 (r302123) @@ -1430,6 +1430,7 @@ static int getzfsvfs(const char *dsname, zfsvfs_t **zfvp) { objset_t *os; + vfs_t *vfsp; int error; error = dmu_objset_hold(dsname, FTAG, &os); @@ -1443,19 +1444,21 @@ getzfsvfs(const char *dsname, zfsvfs_t * mutex_enter(&os->os_user_ptr_lock); *zfvp = dmu_objset_get_user(os); if (*zfvp) { -#ifdef illumos - VFS_HOLD((*zfvp)->z_vfs); -#else - if (vfs_busy((*zfvp)->z_vfs, 0) != 0) { - *zfvp = NULL; - error = SET_ERROR(ESRCH); - } -#endif + vfsp = (*zfvp)->z_vfs; + vfs_ref(vfsp); } else { error = SET_ERROR(ESRCH); } mutex_exit(&os->os_user_ptr_lock); dmu_objset_rele(os, FTAG); + if (error == 0) { + error = vfs_busy(vfsp, 0); + vfs_rel(vfsp); + if (error != 0) { + *zfvp = NULL; + error = SET_ERROR(ESRCH); + } + } return (error); } From owner-svn-src-all@freebsd.org Thu Jun 23 07:07:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3739BB73F7E; Thu, 23 Jun 2016 07:07:24 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE7C62D03; Thu, 23 Jun 2016 07:07:23 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=wr7CUcohF/0oSWzV6mha3B0QzIzXlX9rRpBwv+7pWt8=; b=q/NDT3Uu7teHsU9+6kj/A6yf9wpJOaRfgbjIZY2bmHDhadCFvrJVGemY25oxzHhqkwimcVgHR58nPNmkaiqXdv9lYRu4hdVd7EdJYT0rVfViKe4GZBTzcjl/cmb9uDk6vKd2326ijA5wnoS5Re11juFDC03w/PHI7uWXQEaMJ3M=; Received: from [37.229.193.176] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1bFyjR-0007LO-MG ; Thu, 23 Jun 2016 10:07:21 +0300 Date: Thu, 23 Jun 2016 10:07:21 +0300 From: Ivan Klymenko To: Brooks Davis Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302092 - in head/lib/libc: aarch64/sys amd64/sys arm/sys i386/sys mips/sys powerpc/sys powerpc64/sys riscv/sys sparc64/sys sys Message-ID: <20160623100721.690d67e0@nonamehost.local> In-Reply-To: <20160623093224.18d30b89@nonamehost.local> References: <201606222111.u5MLBRHn090827@repo.freebsd.org> <20160623093224.18d30b89@nonamehost.local> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=37.229.193.176; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 07:07:24 -0000 On Thu, 23 Jun 2016 09:32:24 +0300 Ivan Klymenko wrote: > On Wed, 22 Jun 2016 21:11:27 +0000 (UTC) > Brooks Davis wrote: > > > Author: brooks > > Date: Wed Jun 22 21:11:27 2016 > > New Revision: 302092 > > URL: https://svnweb.freebsd.org/changeset/base/302092 > > > > Log: > > Replace use of the pipe(2) system call with pipe2(2) with a zero > > flags value. > > > > This eliminates the need for machine dependant assembly wrappers > > for pipe(2). > > > > It also make passing an invalid address to pipe(2) return EFAULT > > rather than triggering a segfault. Document this behavior (which > > was already true for pipe2(2), but undocumented). > > > > Reviewed by: andrew > > Approved by: re (gjb) > > Sponsored by: DARPA, AFRL > > Differential Revision: https://reviews.freebsd.org/D6815 > > > > Added: > > head/lib/libc/sys/pipe.c (contents, props changed) > > Deleted: > > head/lib/libc/aarch64/sys/pipe.S > > head/lib/libc/amd64/sys/pipe.S > > head/lib/libc/arm/sys/pipe.S > > head/lib/libc/i386/sys/pipe.S > > head/lib/libc/mips/sys/pipe.S > > head/lib/libc/powerpc/sys/pipe.S > > head/lib/libc/powerpc64/sys/pipe.S > > head/lib/libc/riscv/sys/pipe.S > > head/lib/libc/sparc64/sys/pipe.S > > Modified: > > head/lib/libc/aarch64/sys/Makefile.inc > > head/lib/libc/amd64/sys/Makefile.inc > > head/lib/libc/arm/sys/Makefile.inc > > head/lib/libc/i386/sys/Makefile.inc > > head/lib/libc/mips/sys/Makefile.inc > > head/lib/libc/powerpc/sys/Makefile.inc > > head/lib/libc/powerpc64/sys/Makefile.inc > > head/lib/libc/riscv/sys/Makefile.inc > > head/lib/libc/sparc64/sys/Makefile.inc > > head/lib/libc/sys/Makefile.inc > > head/lib/libc/sys/pipe.2 > > > > ... > /usr/local/libexec/ccache/world/cc -target x86_64-unknown-freebsd11.0 > --sysroot=/media/da0s1/obj/usr/src/tmp > -B/media/da0s1/obj/usr/src/tmp/usr/bin -fpic -DPIC -O2 -pipe -mmmx > -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx -maes > -mpclmul -march=native -I/usr/src/lib/libc/include > -I/usr/src/lib/libc/../../include -I/usr/src/lib/libc/amd64 -DNLS > -D__DBINTERFACE_PRIVATE -I/usr/src/lib/libc/../../contrib/gdtoa > -I/usr/src/lib/libc/../../contrib/libc-vis -DINET6 > -I/media/da0s1/obj/usr/src/lib/libc -I/usr/src/lib/libc/resolv > -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libc/../libmd > -I/usr/src/lib/libc/../../contrib/jemalloc/include -DMALLOC_PRODUCTION > -I/usr/src/lib/libc/../../contrib/tzcode/stdtime > -I/usr/src/lib/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES > -DPORTMAP -DDES_BUILTIN -I/usr/src/lib/libc/rpc -DYP -DNS_CACHING > -DSYMBOL_VERSIONING -DNDEBUG -MD -MF.depend.gettimeofday.So > -MTgettimeofday.So -std=gnu99 -fstack-protector-strong > -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized > -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int > -Wno-unused-const-variable -Wno-tautological-compare > -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function > -Wno-enum-conversion -Wno-unused-local-typedef -Wno-switch > -Wno-switch-enum -Wno-knr-promoted-parameter -Ofast -fvectorize > -fslp-vectorize -fblocks -fcolor-diagnostics -Qunused-arguments > -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64 > -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src > -c /usr/src/lib/libc/sys/gettimeofday.c -o gettimeofday.So --- > pipe.So --- /usr/local/libexec/ccache/world/cc -target > x86_64-unknown-freebsd11.0 --sysroot=/media/da0s1/obj/usr/src/tmp > -B/media/da0s1/obj/usr/src/tmp/usr/bin -fpic -DPIC -O2 -pipe -mmmx > -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx -maes > -mpclmul -march=native -I/usr/src/lib/libc/include > -I/usr/src/lib/libc/../../include -I/usr/src/lib/libc/amd64 -DNLS > -D__DBINTERFACE_PRIVATE -I/usr/src/lib/libc/../../contrib/gdtoa > -I/usr/src/lib/libc/../../contrib/libc-vis -DINET6 > -I/media/da0s1/obj/usr/src/lib/libc -I/usr/src/lib/libc/resolv > -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libc/../libmd > -I/usr/src/lib/libc/../../contrib/jemalloc/include > -DMALLOC_PRODUCTION -I/usr/src/lib/libc/../../contrib/tzcode/stdtime > -I/usr/src/lib/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES > -DPORTMAP -DDES_BUILTIN -I/usr/src/lib/libc/rpc -DYP -DNS_CACHING > -DSYMBOL_VERSIONING -DNDEBUG -MD -MF.depend.pipe.So -MTpipe.So > -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall > -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body > -Wno-string-plus-int -Wno-unused-const-variable > -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality > -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef > -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Ofast > -fvectorize -fslp-vectorize -fblocks -fcolor-diagnostics > -Qunused-arguments -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64 > -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src > -c /usr/src/lib/libc/amd64/sys/pipe.S -o pipe.So cc: error: no such > file or directory: '/usr/src/lib/libc/amd64/sys/pipe.S' cc: error: no > input files *** [pipe.So] Error code 1 > > make[4]: stopped in /usr/src/lib/libc > 1 error > > make[4]: stopped in /usr/src/lib/libc > *** [lib/libc__L] Error code 2 > > make[3]: stopped in /usr/src > 1 error > > make[3]: stopped in /usr/src > *** [libraries] Error code 2 > > make[2]: stopped in /usr/src > 1 error > > make[2]: stopped in /usr/src > *** [_libraries] Error code 2 > > make[1]: stopped in /usr/src > 1 error > > make[1]: stopped in /usr/src > *** [buildworld] Error code 2 > > make: stopped in /usr/src > 1 error > > make: stopped in /usr/src > root@nonamehost:/usr/src # Sorry for noise. I build with -DNO_CLEAN From owner-svn-src-all@freebsd.org Thu Jun 23 07:09:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9402FB72062; Thu, 23 Jun 2016 07:09:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BA8F2EC1; Thu, 23 Jun 2016 07:09:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N79iKm017895; Thu, 23 Jun 2016 07:09:44 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N79iwQ017894; Thu, 23 Jun 2016 07:09:44 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230709.u5N79iwQ017894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 07:09:44 +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: r302124 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 07:09:45 -0000 Author: sephe Date: Thu Jun 23 07:09:44 2016 New Revision: 302124 URL: https://svnweb.freebsd.org/changeset/base/302124 Log: MFC 300645 hyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready And release IDT vector before releasing ISR resources on interrupt teardown path. We still have some work to do on the interrupt tearing down path. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6519 Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 07:01:54 2016 (r302123) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 07:09:44 2016 (r302124) @@ -447,35 +447,18 @@ vmbus_intr_setup(struct vmbus_softc *sc) { int cpu; - /* - * Find a free IDT vector for vmbus messages/events. - */ - sc->vmbus_idtvec = vmbus_vector_alloc(); - if (sc->vmbus_idtvec == 0) { - device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); - return ENXIO; - } - if(bootverbose) { - device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", - sc->vmbus_idtvec); - } - CPU_FOREACH(cpu) { + struct task cpuset_task; char buf[MAXCOMLEN + 1]; + cpuset_t cpu_mask; + /* Allocate an interrupt counter for Hyper-V interrupt */ snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu)); - } - - /* - * Per cpu setup. - */ - CPU_FOREACH(cpu) { - struct task cpuset_task; - cpuset_t cpu_mask; /* - * Setup taskqueue to handle events + * Setup taskqueue to handle events. Task will be per- + * channel. */ hv_vmbus_g_context.hv_event_queue[cpu] = taskqueue_create_fast("hyperv event", M_WAITOK, @@ -493,7 +476,7 @@ vmbus_intr_setup(struct vmbus_softc *sc) &cpuset_task); /* - * Setup per-cpu tasks and taskqueues to handle msg. + * Setup tasks and taskqueues to handle messages. */ hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, @@ -511,6 +494,20 @@ vmbus_intr_setup(struct vmbus_softc *sc) taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], &cpuset_task); } + + /* + * All Hyper-V ISR required resources are setup, now let's find a + * free IDT vector for Hyper-V ISR and set it up. + */ + sc->vmbus_idtvec = vmbus_vector_alloc(); + if (sc->vmbus_idtvec == 0) { + device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); + return ENXIO; + } + if(bootverbose) { + device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", + sc->vmbus_idtvec); + } return 0; } @@ -519,9 +516,8 @@ vmbus_intr_teardown(struct vmbus_softc * { int cpu; - /* - * remove swi and vmbus callback vector; - */ + vmbus_vector_free(sc->vmbus_idtvec); + CPU_FOREACH(cpu) { if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); @@ -534,7 +530,6 @@ vmbus_intr_teardown(struct vmbus_softc * hv_vmbus_g_context.hv_msg_tq[cpu] = NULL; } } - vmbus_vector_free(sc->vmbus_idtvec); } static int @@ -706,16 +701,16 @@ vmbus_bus_init(void) sc = vmbus_get_softc(); /* - * Setup interrupt. + * Allocate DMA stuffs. */ - ret = vmbus_intr_setup(sc); + ret = vmbus_dma_alloc(sc); if (ret != 0) goto cleanup; /* - * Allocate DMA stuffs. + * Setup interrupt. */ - ret = vmbus_dma_alloc(sc); + ret = vmbus_intr_setup(sc); if (ret != 0) goto cleanup; @@ -747,8 +742,8 @@ vmbus_bus_init(void) return (ret); cleanup: - vmbus_dma_free(sc); vmbus_intr_teardown(sc); + vmbus_dma_free(sc); return (ret); } @@ -810,8 +805,8 @@ vmbus_detach(device_t dev) smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); - vmbus_dma_free(sc); vmbus_intr_teardown(sc); + vmbus_dma_free(sc); return (0); } From owner-svn-src-all@freebsd.org Thu Jun 23 07:12:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F410CB72328; Thu, 23 Jun 2016 07:12:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9759148A; Thu, 23 Jun 2016 07:12:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N7CNLc021663; Thu, 23 Jun 2016 07:12:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N7CMXj021657; Thu, 23 Jun 2016 07:12:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201606230712.u5N7CMXj021657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 23 Jun 2016 07:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302125 - head/lib/libusb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 07:12:24 -0000 Author: hselasky Date: Thu Jun 23 07:12:22 2016 New Revision: 302125 URL: https://svnweb.freebsd.org/changeset/base/302125 Log: Add support for USB streams to the LibUSB v1.0 API and update the libusb(3) manual page. Approved by: re (gjb) Requested by: swills MFC after: 1 week Modified: head/lib/libusb/Makefile head/lib/libusb/libusb.3 head/lib/libusb/libusb.h head/lib/libusb/libusb10.c head/lib/libusb/libusb10.h head/lib/libusb/libusb10_io.c Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Thu Jun 23 07:09:44 2016 (r302124) +++ head/lib/libusb/Makefile Thu Jun 23 07:12:22 2016 (r302125) @@ -120,8 +120,12 @@ MLINKS += libusb.3 libusb_get_ss_usb_dev MLINKS += libusb.3 libusb_free_ss_usb_device_capability_descriptor.3 MLINKS += libusb.3 libusb_get_container_id_descriptor.3 MLINKS += libusb.3 libusb_free_container_id_descriptor.3 +MLINKS += libusb.3 libusb_alloc_streams.3 +MLINKS += libusb.3 libusb_free_streams.3 MLINKS += libusb.3 libusb_alloc_transfer.3 MLINKS += libusb.3 libusb_free_transfer.3 +MLINKS += libusb.3 libusb_transfer_set_stream_id.3 +MLINKS += libusb.3 libusb_transfer_get_stream_id.3 MLINKS += libusb.3 libusb_submit_transfer.3 MLINKS += libusb.3 libusb_cancel_transfer.3 MLINKS += libusb.3 libusb_control_transfer.3 Modified: head/lib/libusb/libusb.3 ============================================================================== --- head/lib/libusb/libusb.3 Thu Jun 23 07:09:44 2016 (r302124) +++ head/lib/libusb/libusb.3 Thu Jun 23 07:12:22 2016 (r302125) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 22, 2016 +.Dd June 23, 2016 .Dt LIBUSB 3 .Os .Sh NAME @@ -521,6 +521,29 @@ if the transfer timed out, LIBUSB_ERROR_ supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on other failure. +.Sh USB STREAMS SUPPORT +.Ft int +.Fn libusb_alloc_streams "libusb_device_handle *dev" "uint32_t num_streams" "unsigned char *endpoints" "int num_endpoints" +This function verifies that the given number of streams using the +given number of endpoints is allowed and allocates the resources +needed to use so-called USB streams. +Currently only a single stream per endpoint is supported to simplify +the internals of LibUSB. +This function returns 0 on success or a LIBUSB_ERROR code on failure. +.Pp +.Ft int +.Fn libusb_free_streams "libusb_device_handle *dev" "unsigned char *endpoints" "int num_endpoints" +This function release resources needed for streams usage. +Returns 0 on success or a LIBUSB_ERROR code on failure. +.Pp +.Ft void +.Fn libusb_transfer_set_stream_id "struct libusb_transfer *transfer" "uint32_t stream_id" +This function sets the stream ID for the given USB transfer. +.Pp +.Ft uint32_t +.Fn libusb_transfer_get_stream_id "struct libusb_transfer *transfer" +This function returns the stream ID for the given USB transfer. +If no stream ID is used a value of zero is returned. .Sh USB EVENTS .Ft int .Fn libusb_try_lock_events "libusb_context *ctx" Modified: head/lib/libusb/libusb.h ============================================================================== --- head/lib/libusb/libusb.h Thu Jun 23 07:09:44 2016 (r302124) +++ head/lib/libusb/libusb.h Thu Jun 23 07:12:22 2016 (r302125) @@ -561,6 +561,13 @@ typedef int (*libusb_hotplug_callback_fn int libusb_hotplug_register_callback(libusb_context *ctx, libusb_hotplug_event events, libusb_hotplug_flag flags, int vendor_id, int product_id, int dev_class, libusb_hotplug_callback_fn cb_fn, void *user_data, libusb_hotplug_callback_handle *handle); void libusb_hotplug_deregister_callback(libusb_context *ctx, libusb_hotplug_callback_handle handle); +/* Streams support */ + +int libusb_alloc_streams(libusb_device_handle *dev, uint32_t num_streams, unsigned char *endpoints, int num_endpoints); +int libusb_free_streams(libusb_device_handle *dev, unsigned char *endpoints, int num_endpoints); +void libusb_transfer_set_stream_id(struct libusb_transfer *transfer, uint32_t stream_id); +uint32_t libusb_transfer_get_stream_id(struct libusb_transfer *transfer); + #if 0 { /* indent fix */ #endif Modified: head/lib/libusb/libusb10.c ============================================================================== --- head/lib/libusb/libusb10.c Thu Jun 23 07:09:44 2016 (r302124) +++ head/lib/libusb/libusb10.c Thu Jun 23 07:12:22 2016 (r302125) @@ -1403,7 +1403,8 @@ found: maxframe = libusb10_get_maxframe(pdev, uxfer); /* make sure the transfer is opened */ - err = libusb20_tr_open(pxfer0, buffsize, maxframe, endpoint); + err = libusb20_tr_open_stream(pxfer0, buffsize, maxframe, + endpoint, sxfer->stream_id); if (err && (err != LIBUSB20_ERROR_BUSY)) { goto failure; } Modified: head/lib/libusb/libusb10.h ============================================================================== --- head/lib/libusb/libusb10.h Thu Jun 23 07:09:44 2016 (r302124) +++ head/lib/libusb/libusb10.h Thu Jun 23 07:12:22 2016 (r302125) @@ -69,6 +69,7 @@ struct libusb_super_transfer { uint8_t *curr_data; uint32_t rem_len; uint32_t last_len; + uint32_t stream_id; uint8_t state; #define LIBUSB_SUPER_XFER_ST_NONE 0 #define LIBUSB_SUPER_XFER_ST_PEND 1 Modified: head/lib/libusb/libusb10_io.c ============================================================================== --- head/lib/libusb/libusb10_io.c Thu Jun 23 07:09:44 2016 (r302124) +++ head/lib/libusb/libusb10_io.c Thu Jun 23 07:12:22 2016 (r302125) @@ -767,3 +767,48 @@ libusb_fill_iso_transfer(struct libusb_t transfer->callback = callback; } +int +libusb_alloc_streams(libusb_device_handle *dev, uint32_t num_streams, + unsigned char *endpoints, int num_endpoints) +{ + if (num_streams > 1) + return (LIBUSB_ERROR_INVALID_PARAM); + return (0); +} + +int +libusb_free_streams(libusb_device_handle *dev, unsigned char *endpoints, int num_endpoints) +{ + + return (0); +} + +void +libusb_transfer_set_stream_id(struct libusb_transfer *transfer, uint32_t stream_id) +{ + struct libusb_super_transfer *sxfer; + + if (transfer == NULL) + return; + + sxfer = (struct libusb_super_transfer *)( + ((uint8_t *)transfer) - sizeof(*sxfer)); + + /* set stream ID */ + sxfer->stream_id = stream_id; +} + +uint32_t +libusb_transfer_get_stream_id(struct libusb_transfer *transfer) +{ + struct libusb_super_transfer *sxfer; + + if (transfer == NULL) + return (0); + + sxfer = (struct libusb_super_transfer *)( + ((uint8_t *)transfer) - sizeof(*sxfer)); + + /* get stream ID */ + return (sxfer->stream_id); +} From owner-svn-src-all@freebsd.org Thu Jun 23 07:36:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE227B72890; Thu, 23 Jun 2016 07:36:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85FD82111; Thu, 23 Jun 2016 07:36:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N7a3eZ030542; Thu, 23 Jun 2016 07:36:03 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N7a3AU030538; Thu, 23 Jun 2016 07:36:03 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230736.u5N7a3AU030538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 07:36: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: r302126 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 07:36:04 -0000 Author: sephe Date: Thu Jun 23 07:36:03 2016 New Revision: 302126 URL: https://svnweb.freebsd.org/changeset/base/302126 Log: MFC 300646 hyperv/vmbus: Move event/message taskqueue/task to vmbus softc MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6520 Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel.c Thu Jun 23 07:12:22 2016 (r302125) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c Thu Jun 23 07:36:03 2016 (r302126) @@ -202,7 +202,8 @@ hv_vmbus_channel_open( vmbus_on_channel_open(new_channel); - new_channel->rxq = hv_vmbus_g_context.hv_event_queue[new_channel->target_cpu]; + new_channel->rxq = VMBUS_PCPU_GET(vmbus_get_softc(), event_tq, + new_channel->target_cpu); TASK_INIT(&new_channel->channel_task, 0, VmbusProcessChannelEvent, new_channel); /* Allocate the ring buffer */ Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 07:12:22 2016 (r302125) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 07:36:03 2016 (r302126) @@ -177,8 +177,8 @@ hv_vmbus_isr(struct vmbus_softc *sc, str msg = msg_base + HV_VMBUS_MESSAGE_SINT; if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) { - taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu], - &hv_vmbus_g_context.hv_msg_task[cpu]); + taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu), + VMBUS_PCPU_PTR(sc, message_task, cpu)); } return (FILTER_HANDLED); @@ -460,38 +460,37 @@ vmbus_intr_setup(struct vmbus_softc *sc) * Setup taskqueue to handle events. Task will be per- * channel. */ - hv_vmbus_g_context.hv_event_queue[cpu] = - taskqueue_create_fast("hyperv event", M_WAITOK, - taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_event_queue[cpu]); - taskqueue_start_threads(&hv_vmbus_g_context.hv_event_queue[cpu], + VMBUS_PCPU_GET(sc, event_tq, cpu) = taskqueue_create_fast( + "hyperv event", M_WAITOK, taskqueue_thread_enqueue, + VMBUS_PCPU_PTR(sc, event_tq, cpu)); + taskqueue_start_threads(VMBUS_PCPU_PTR(sc, event_tq, cpu), 1, PI_NET, "hvevent%d", cpu); CPU_SETOF(cpu, &cpu_mask); TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, &cpu_mask); - taskqueue_enqueue(hv_vmbus_g_context.hv_event_queue[cpu], + taskqueue_enqueue(VMBUS_PCPU_GET(sc, event_tq, cpu), &cpuset_task); - taskqueue_drain(hv_vmbus_g_context.hv_event_queue[cpu], + taskqueue_drain(VMBUS_PCPU_GET(sc, event_tq, cpu), &cpuset_task); /* * Setup tasks and taskqueues to handle messages. */ - hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast( + VMBUS_PCPU_GET(sc, message_tq, cpu) = taskqueue_create_fast( "hyperv msg", M_WAITOK, taskqueue_thread_enqueue, - &hv_vmbus_g_context.hv_msg_tq[cpu]); - taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[cpu], 1, + VMBUS_PCPU_PTR(sc, message_tq, cpu)); + taskqueue_start_threads(VMBUS_PCPU_PTR(sc, message_tq, cpu), 1, PI_NET, "hvmsg%d", cpu); - TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0, + TASK_INIT(VMBUS_PCPU_PTR(sc, message_task, cpu), 0, vmbus_msg_task, sc); CPU_SETOF(cpu, &cpu_mask); TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, &cpu_mask); - taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu], + taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu), &cpuset_task); - taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], + taskqueue_drain(VMBUS_PCPU_GET(sc, message_tq, cpu), &cpuset_task); } @@ -519,15 +518,15 @@ vmbus_intr_teardown(struct vmbus_softc * vmbus_vector_free(sc->vmbus_idtvec); CPU_FOREACH(cpu) { - if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) { - taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]); - hv_vmbus_g_context.hv_event_queue[cpu] = NULL; + if (VMBUS_PCPU_GET(sc, event_tq, cpu) != NULL) { + taskqueue_free(VMBUS_PCPU_GET(sc, event_tq, cpu)); + VMBUS_PCPU_GET(sc, event_tq, cpu) = NULL; } - if (hv_vmbus_g_context.hv_msg_tq[cpu] != NULL) { - taskqueue_drain(hv_vmbus_g_context.hv_msg_tq[cpu], - &hv_vmbus_g_context.hv_msg_task[cpu]); - taskqueue_free(hv_vmbus_g_context.hv_msg_tq[cpu]); - hv_vmbus_g_context.hv_msg_tq[cpu] = NULL; + if (VMBUS_PCPU_GET(sc, message_tq, cpu) != NULL) { + taskqueue_drain(VMBUS_PCPU_GET(sc, message_tq, cpu), + VMBUS_PCPU_PTR(sc, message_task, cpu)); + taskqueue_free(VMBUS_PCPU_GET(sc, message_tq, cpu)); + VMBUS_PCPU_GET(sc, message_tq, cpu) = NULL; } } } Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 07:12:22 2016 (r302125) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 07:36:03 2016 (r302126) @@ -207,13 +207,6 @@ typedef struct { * For FreeBSD cpuid to Hyper-V vcpuid mapping. */ uint32_t hv_vcpu_index[MAXCPU]; - /* - * Each cpu has its own software interrupt handler for channel - * event and msg handling. - */ - struct taskqueue *hv_event_queue[MAXCPU]; - struct taskqueue *hv_msg_tq[MAXCPU]; - struct task hv_msg_task[MAXCPU]; } hv_vmbus_context; /* Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 07:12:22 2016 (r302125) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 07:36:03 2016 (r302126) @@ -42,11 +42,16 @@ struct vmbus_pcpu_data { /* Rarely used fields */ struct hyperv_dma message_dma; /* busdma glue */ struct hyperv_dma event_flag_dma; /* busdma glue */ + struct taskqueue *event_tq; /* event taskq */ + struct taskqueue *message_tq; /* message taskq */ + struct task message_task; /* message task */ } __aligned(CACHE_LINE_SIZE); struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; + + /* Rarely used fields */ device_t vmbus_dev; int vmbus_idtvec; }; From owner-svn-src-all@freebsd.org Thu Jun 23 07:54:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42707B72D5F; Thu, 23 Jun 2016 07:54:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3C822A18; Thu, 23 Jun 2016 07:53:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N7rxKf038189; Thu, 23 Jun 2016 07:53:59 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N7rwcG038183; Thu, 23 Jun 2016 07:53:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230753.u5N7rwcG038183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 07:53: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: r302127 - in stable/10/sys/dev/hyperv: include vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 07:54:00 -0000 Author: sephe Date: Thu Jun 23 07:53:58 2016 New Revision: 302127 URL: https://svnweb.freebsd.org/changeset/base/302127 Log: MFC 300647,300650,300651,300652,300653 300647 hyperv/vmbus: Move vcpuid into vmbus softc per-cpu data MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6521 300650 hyperv/vmbus: Move two global flags into vmbus softc And pack them into one flag field. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6522 300651 hyperv/vmbus: Minor style and white space cleanup MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6523 300652 hyperv/vmbus: Pass vmbus softc to vmbus_synic_setup MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6527 300653 hyperv/vmbus: Nuke unnecessary MSR read MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6528 Modified: stable/10/sys/dev/hyperv/include/hyperv_busdma.h stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/include/hyperv_busdma.h ============================================================================== --- stable/10/sys/dev/hyperv/include/hyperv_busdma.h Thu Jun 23 07:36:03 2016 (r302126) +++ stable/10/sys/dev/hyperv/include/hyperv_busdma.h Thu Jun 23 07:53:58 2016 (r302127) @@ -29,6 +29,10 @@ #ifndef _HYPERV_BUSDMA_H_ #define _HYPERV_BUSDMA_H_ +#include +#include +#include + struct hyperv_dma { bus_addr_t hv_paddr; bus_dma_tag_t hv_dtag; Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jun 23 07:36:03 2016 (r302126) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jun 23 07:53:58 2016 (r302127) @@ -35,7 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include "hv_vmbus_priv.h" +#include +#include /* * Internal functions @@ -310,7 +311,7 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch } chan->target_cpu = cpu; - chan->target_vcpu = hv_vmbus_g_context.hv_vcpu_index[cpu]; + chan->target_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, cpu); if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", @@ -751,7 +752,7 @@ vmbus_select_outgoing_channel(struct hv_ return outgoing_channel; } - cur_vcpu = hv_vmbus_g_context.hv_vcpu_index[smp_pro_id]; + cur_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, smp_pro_id); TAILQ_FOREACH(new_channel, &primary->sc_list_anchor, sc_list_entry) { if (new_channel->state != HV_CHANNEL_OPENED_STATE){ Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 07:36:03 2016 (r302126) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 07:53:58 2016 (r302127) @@ -96,13 +96,6 @@ u_int hyperv_recommends; static u_int hyperv_pm_features; static u_int hyperv_features3; -/** - * Globals - */ -hv_vmbus_context hv_vmbus_g_context = { - .syn_ic_initialized = FALSE, -}; - static struct timecounter hv_timecounter = { hv_get_timecount, 0, ~0u, HV_NANOSECONDS_PER_SEC/100, "Hyper-V", HV_NANOSECONDS_PER_SEC/100 }; Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 07:36:03 2016 (r302126) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 07:53:58 2016 (r302127) @@ -68,8 +68,6 @@ __FBSDID("$FreeBSD$"); struct vmbus_softc *vmbus_sc; -static int vmbus_inited; - static char *vmbus_ids[] = { "VMBUS", NULL }; extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback); @@ -209,25 +207,18 @@ hv_vector_handler(struct trapframe *trap } static void -vmbus_synic_setup(void *arg __unused) +vmbus_synic_setup(void *xsc) { - struct vmbus_softc *sc = vmbus_get_softc(); + struct vmbus_softc *sc = xsc; int cpu; - uint64_t hv_vcpu_index; hv_vmbus_synic_simp simp; hv_vmbus_synic_siefp siefp; hv_vmbus_synic_scontrol sctrl; hv_vmbus_synic_sint shared_sint; - uint64_t version; cpu = PCPU_GET(cpuid); /* - * TODO: Check the version - */ - version = rdmsr(HV_X64_MSR_SVERSION); - - /* * Setup the Synic's message page */ simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); @@ -265,14 +256,11 @@ vmbus_synic_setup(void *arg __unused) wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t); - hv_vmbus_g_context.syn_ic_initialized = TRUE; - /* * Set up the cpuid mapping from Hyper-V to FreeBSD. * The array is indexed using FreeBSD cpuid. */ - hv_vcpu_index = rdmsr(HV_X64_MSR_VP_INDEX); - hv_vmbus_g_context.hv_vcpu_index[cpu] = (uint32_t)hv_vcpu_index; + VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(HV_X64_MSR_VP_INDEX); } static void @@ -282,9 +270,6 @@ vmbus_synic_teardown(void *arg) hv_vmbus_synic_simp simp; hv_vmbus_synic_siefp siefp; - if (!hv_vmbus_g_context.syn_ic_initialized) - return; - shared_sint.as_uint64_t = rdmsr( HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT); @@ -532,16 +517,11 @@ vmbus_intr_teardown(struct vmbus_softc * } static int -vmbus_read_ivar( - device_t dev, - device_t child, - int index, - uintptr_t* result) +vmbus_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) { struct hv_device *child_dev_ctx = device_get_ivars(child); switch (index) { - case HV_VMBUS_IVAR_TYPE: *result = (uintptr_t) &child_dev_ctx->class_id; return (0); @@ -559,14 +539,9 @@ vmbus_read_ivar( } static int -vmbus_write_ivar( - device_t dev, - device_t child, - int index, - uintptr_t value) +vmbus_write_ivar(device_t dev, device_t child, int index, uintptr_t value) { switch (index) { - case HV_VMBUS_IVAR_TYPE: case HV_VMBUS_IVAR_INSTANCE: case HV_VMBUS_IVAR_DEVCTX: @@ -597,19 +572,16 @@ vmbus_child_pnpinfo_str(device_t dev, de return (0); } -struct hv_device* -hv_vmbus_child_device_create( - hv_guid type, - hv_guid instance, - hv_vmbus_channel* channel) +struct hv_device * +hv_vmbus_child_device_create(hv_guid type, hv_guid instance, + hv_vmbus_channel *channel) { - hv_device* child_dev; + hv_device *child_dev; /* * Allocate the new child device */ - child_dev = malloc(sizeof(hv_device), M_DEVBUF, - M_WAITOK | M_ZERO); + child_dev = malloc(sizeof(hv_device), M_DEVBUF, M_WAITOK | M_ZERO); child_dev->channel = channel; memcpy(&child_dev->class_id, &type, sizeof(hv_guid)); @@ -690,14 +662,12 @@ vmbus_probe(device_t dev) static int vmbus_bus_init(void) { - struct vmbus_softc *sc; + struct vmbus_softc *sc = vmbus_get_softc(); int ret; - if (vmbus_inited) + if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) return (0); - - vmbus_inited = 1; - sc = vmbus_get_softc(); + sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; /* * Allocate DMA stuffs. @@ -713,10 +683,13 @@ vmbus_bus_init(void) if (ret != 0) goto cleanup; + /* + * Setup SynIC. + */ if (bootverbose) - printf("VMBUS: Calling smp_rendezvous, smp_started = %d\n", - smp_started); - smp_rendezvous(NULL, vmbus_synic_setup, NULL, NULL); + device_printf(sc->vmbus_dev, "smp_started = %d\n", smp_started); + smp_rendezvous(NULL, vmbus_synic_setup, NULL, sc); + sc->vmbus_flags |= VMBUS_FLAG_SYNIC; /* * Connect to VMBus in the root partition @@ -802,7 +775,10 @@ vmbus_detach(device_t dev) hv_vmbus_release_unattached_channels(); hv_vmbus_disconnect(); - smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); + if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { + sc->vmbus_flags &= ~VMBUS_FLAG_SYNIC; + smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL); + } vmbus_intr_teardown(sc); vmbus_dma_free(sc); Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 07:36:03 2016 (r302126) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 07:53:58 2016 (r302127) @@ -200,15 +200,6 @@ enum { struct vmbus_message; union vmbus_event_flags; -typedef struct { - hv_bool_uint8_t syn_ic_initialized; - - /* - * For FreeBSD cpuid to Hyper-V vcpuid mapping. - */ - uint32_t hv_vcpu_index[MAXCPU]; -} hv_vmbus_context; - /* * Define hypervisor message types */ @@ -640,7 +631,6 @@ typedef enum { * Global variables */ -extern hv_vmbus_context hv_vmbus_g_context; extern hv_vmbus_connection hv_vmbus_g_connection; extern u_int hyperv_features; Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 07:36:03 2016 (r302126) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 07:53:58 2016 (r302127) @@ -30,12 +30,12 @@ #define _VMBUS_VAR_H_ #include -#include #include struct vmbus_pcpu_data { u_long *intr_cnt; /* Hyper-V interrupt counter */ struct vmbus_message *message; /* shared messages */ + uint32_t vcpuid; /* virtual cpuid */ int event_flag_cnt; /* # of event flags */ union vmbus_event_flags *event_flag; /* shared event flags */ @@ -54,8 +54,12 @@ struct vmbus_softc { /* Rarely used fields */ device_t vmbus_dev; int vmbus_idtvec; + uint32_t vmbus_flags; /* see VMBUS_FLAG_ */ }; +#define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ +#define VMBUS_FLAG_SYNIC 0x0002 /* SynIC was setup */ + extern struct vmbus_softc *vmbus_sc; static __inline struct vmbus_softc * From owner-svn-src-all@freebsd.org Thu Jun 23 08:09:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48E97AC6259; Thu, 23 Jun 2016 08:09:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AEBD11D4; Thu, 23 Jun 2016 08:09:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N89jkC042639; Thu, 23 Jun 2016 08:09:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N89jOX042636; Thu, 23 Jun 2016 08:09:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230809.u5N89jOX042636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 08:09:45 +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: r302128 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 08:09:46 -0000 Author: sephe Date: Thu Jun 23 08:09:44 2016 New Revision: 302128 URL: https://svnweb.freebsd.org/changeset/base/302128 Log: MFC 300654,300655,300708 300654 hyperv/vmbus: Rework SynIC setup and teardown - Avoid bit fields. - Fix SINT setup (preserve required bits). MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6529 300655 hyperv: Preserve required bits when disable Hypercall MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6530 300708 hyperv: Rework guest id settings according to Hyper-V spec MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6553 Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 07:53:58 2016 (r302127) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 08:09:44 2016 (r302128) @@ -52,34 +52,24 @@ __FBSDID("$FreeBSD$"); #define HYPERV_INTERFACE 0x31237648 /* HV#1 */ -/* - * The guest OS needs to register the guest ID with the hypervisor. - * The guest ID is a 64 bit entity and the structure of this ID is - * specified in the Hyper-V specification: - * - * http://msdn.microsoft.com/en-us/library/windows/ - * hardware/ff542653%28v=vs.85%29.aspx - * - * While the current guideline does not specify how FreeBSD guest ID(s) - * need to be generated, our plan is to publish the guidelines for - * FreeBSD and other guest operating systems that currently are hosted - * on Hyper-V. The implementation here conforms to this yet - * unpublished guidelines. - * - * Bit(s) - * 63 - Indicates if the OS is Open Source or not; 1 is Open Source - * 62:56 - Os Type: FreeBSD is 0x02 - * 55:48 - Distro specific identification - * 47:16 - FreeBSD kernel version number - * 15:0 - Distro specific identification - */ -#define HYPERV_GUESTID_OSS (0x1ULL << 63) -#define HYPERV_GUESTID_FREEBSD (0x02ULL << 56) -#define HYPERV_GUESTID(id) \ - (HYPERV_GUESTID_OSS | HYPERV_GUESTID_FREEBSD | \ - (((uint64_t)(((id) & 0xff0000) >> 16)) << 48) |\ - (((uint64_t)__FreeBSD_version) << 16) | \ - ((uint64_t)((id) & 0x00ffff))) +#define HYPERV_FREEBSD_BUILD 0ULL +#define HYPERV_FREEBSD_VERSION ((uint64_t)__FreeBSD_version) +#define HYPERV_FREEBSD_OSID 0ULL + +#define MSR_HV_GUESTID_BUILD_FREEBSD \ + (HYPERV_FREEBSD_BUILD & MSR_HV_GUESTID_BUILD_MASK) +#define MSR_HV_GUESTID_VERSION_FREEBSD \ + ((HYPERV_FREEBSD_VERSION << MSR_HV_GUESTID_VERSION_SHIFT) & \ + MSR_HV_GUESTID_VERSION_MASK) +#define MSR_HV_GUESTID_OSID_FREEBSD \ + ((HYPERV_FREEBSD_OSID << MSR_HV_GUESTID_OSID_SHIFT) & \ + MSR_HV_GUESTID_OSID_MASK) + +#define MSR_HV_GUESTID_FREEBSD \ + (MSR_HV_GUESTID_BUILD_FREEBSD | \ + MSR_HV_GUESTID_VERSION_FREEBSD | \ + MSR_HV_GUESTID_OSID_FREEBSD | \ + MSR_HV_GUESTID_OSTYPE_FREEBSD) struct hypercall_ctx { void *hc_addr; @@ -321,8 +311,8 @@ hyperv_init(void *dummy __unused) return; } - /* Write guest id */ - wrmsr(HV_X64_MSR_GUEST_OS_ID, HYPERV_GUESTID(0)); + /* Set guest id */ + wrmsr(MSR_HV_GUEST_OS_ID, MSR_HV_GUESTID_FREEBSD); if (hyperv_features & HV_FEATURE_MSR_TIME_REFCNT) { /* Register virtual timecount */ @@ -390,11 +380,14 @@ SYSINIT(hypercall_ctor, SI_SUB_DRIVERS, static void hypercall_destroy(void *arg __unused) { + uint64_t hc; + if (hypercall_context.hc_addr == NULL) return; /* Disable Hypercall */ - wrmsr(MSR_HV_HYPERCALL, 0); + hc = rdmsr(MSR_HV_HYPERCALL); + wrmsr(MSR_HV_HYPERCALL, (hc & MSR_HV_HYPERCALL_RSVD_MASK)); hypercall_memfree(); if (bootverbose) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 07:53:58 2016 (r302127) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 08:09:44 2016 (r302128) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -210,100 +211,97 @@ static void vmbus_synic_setup(void *xsc) { struct vmbus_softc *sc = xsc; - int cpu; - hv_vmbus_synic_simp simp; - hv_vmbus_synic_siefp siefp; - hv_vmbus_synic_scontrol sctrl; - hv_vmbus_synic_sint shared_sint; - - cpu = PCPU_GET(cpuid); + int cpu = curcpu; + uint64_t val, orig; + uint32_t sint; /* - * Setup the Synic's message page + * Save virtual processor id. */ - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.u.simp_enabled = 1; - simp.u.base_simp_gpa = - VMBUS_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; - - wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); + VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(MSR_HV_VP_INDEX); /* - * Setup the Synic's event page + * Setup the SynIC message. */ - siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.u.siefp_enabled = 1; - siefp.u.base_siefp_gpa = - VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; + orig = rdmsr(MSR_HV_SIMP); + val = MSR_HV_SIMP_ENABLE | (orig & MSR_HV_SIMP_RSVD_MASK) | + ((VMBUS_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT) << + MSR_HV_SIMP_PGSHIFT); + wrmsr(MSR_HV_SIMP, val); - wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); - - /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ - shared_sint.as_uint64_t = 0; - shared_sint.u.vector = sc->vmbus_idtvec; - shared_sint.u.masked = FALSE; - shared_sint.u.auto_eoi = TRUE; - - wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, - shared_sint.as_uint64_t); + /* + * Setup the SynIC event flags. + */ + orig = rdmsr(MSR_HV_SIEFP); + val = MSR_HV_SIEFP_ENABLE | (orig & MSR_HV_SIEFP_RSVD_MASK) | + ((VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT) << + MSR_HV_SIEFP_PGSHIFT); + wrmsr(MSR_HV_SIEFP, val); - wrmsr(HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, - shared_sint.as_uint64_t); - /* Enable the global synic bit */ - sctrl.as_uint64_t = rdmsr(HV_X64_MSR_SCONTROL); - sctrl.u.enable = 1; + /* + * Configure and unmask SINT for message and event flags. + */ + sint = MSR_HV_SINT0 + HV_VMBUS_MESSAGE_SINT; + orig = rdmsr(sint); + val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI | + (orig & MSR_HV_SINT_RSVD_MASK); + wrmsr(sint, val); - wrmsr(HV_X64_MSR_SCONTROL, sctrl.as_uint64_t); + /* + * Configure and unmask SINT for timer. + */ + sint = MSR_HV_SINT0 + HV_VMBUS_TIMER_SINT; + orig = rdmsr(sint); + val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI | + (orig & MSR_HV_SINT_RSVD_MASK); + wrmsr(sint, val); /* - * Set up the cpuid mapping from Hyper-V to FreeBSD. - * The array is indexed using FreeBSD cpuid. + * All done; enable SynIC. */ - VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(HV_X64_MSR_VP_INDEX); + orig = rdmsr(MSR_HV_SCONTROL); + val = MSR_HV_SCTRL_ENABLE | (orig & MSR_HV_SCTRL_RSVD_MASK); + wrmsr(MSR_HV_SCONTROL, val); } static void vmbus_synic_teardown(void *arg) { - hv_vmbus_synic_sint shared_sint; - hv_vmbus_synic_simp simp; - hv_vmbus_synic_siefp siefp; - - shared_sint.as_uint64_t = rdmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT); - - shared_sint.u.masked = 1; + uint64_t orig; + uint32_t sint; /* - * Disable the interrupt 0 + * Disable SynIC. */ - wrmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_MESSAGE_SINT, - shared_sint.as_uint64_t); - - shared_sint.as_uint64_t = rdmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT); - - shared_sint.u.masked = 1; + orig = rdmsr(MSR_HV_SCONTROL); + wrmsr(MSR_HV_SCONTROL, (orig & MSR_HV_SCTRL_RSVD_MASK)); /* - * Disable the interrupt 1 + * Mask message and event flags SINT. */ - wrmsr( - HV_X64_MSR_SINT0 + HV_VMBUS_TIMER_SINT, - shared_sint.as_uint64_t); - simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); - simp.u.simp_enabled = 0; - simp.u.base_simp_gpa = 0; + sint = MSR_HV_SINT0 + HV_VMBUS_MESSAGE_SINT; + orig = rdmsr(sint); + wrmsr(sint, orig | MSR_HV_SINT_MASKED); - wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); + /* + * Mask timer SINT. + */ + sint = MSR_HV_SINT0 + HV_VMBUS_TIMER_SINT; + orig = rdmsr(sint); + wrmsr(sint, orig | MSR_HV_SINT_MASKED); - siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); - siefp.u.siefp_enabled = 0; - siefp.u.base_siefp_gpa = 0; + /* + * Teardown SynIC message. + */ + orig = rdmsr(MSR_HV_SIMP); + wrmsr(MSR_HV_SIMP, (orig & MSR_HV_SIMP_RSVD_MASK)); - wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); + /* + * Teardown SynIC event flags. + */ + orig = rdmsr(MSR_HV_SIEFP); + wrmsr(MSR_HV_SIEFP, (orig & MSR_HV_SIEFP_RSVD_MASK)); } static int Modified: stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h Thu Jun 23 07:53:58 2016 (r302127) +++ stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h Thu Jun 23 08:09:44 2016 (r302128) @@ -29,9 +29,48 @@ #ifndef _HYPERV_REG_H_ #define _HYPERV_REG_H_ +#define MSR_HV_GUEST_OS_ID 0x40000000 +#define MSR_HV_GUESTID_BUILD_MASK 0xffffULL +#define MSR_HV_GUESTID_VERSION_MASK 0x0000ffffffff0000ULL +#define MSR_HV_GUESTID_VERSION_SHIFT 16 +#define MSR_HV_GUESTID_OSID_MASK 0x00ff000000000000ULL +#define MSR_HV_GUESTID_OSID_SHIFT 48 +#define MSR_HV_GUESTID_OSTYPE_MASK 0x7f00000000000000ULL +#define MSR_HV_GUESTID_OSTYPE_SHIFT 56 +#define MSR_HV_GUESTID_OPENSRC 0x8000000000000000ULL +#define MSR_HV_GUESTID_OSTYPE_LINUX \ + ((0x01ULL << MSR_HV_GUESTID_OSTYPE_SHIFT) | MSR_HV_GUESTID_OPENSRC) +#define MSR_HV_GUESTID_OSTYPE_FREEBSD \ + ((0x02ULL << MSR_HV_GUESTID_OSTYPE_SHIFT) | MSR_HV_GUESTID_OPENSRC) + #define MSR_HV_HYPERCALL 0x40000001 #define MSR_HV_HYPERCALL_ENABLE 0x0001ULL #define MSR_HV_HYPERCALL_RSVD_MASK 0x0ffeULL #define MSR_HV_HYPERCALL_PGSHIFT 12 +#define MSR_HV_VP_INDEX 0x40000002 + +#define MSR_HV_SCONTROL 0x40000080 +#define MSR_HV_SCTRL_ENABLE 0x0001ULL +#define MSR_HV_SCTRL_RSVD_MASK 0xfffffffffffffffeULL + +#define MSR_HV_SIEFP 0x40000082 +#define MSR_HV_SIEFP_ENABLE 0x0001ULL +#define MSR_HV_SIEFP_RSVD_MASK 0x0ffeULL +#define MSR_HV_SIEFP_PGSHIFT 12 + +#define MSR_HV_SIMP 0x40000083 +#define MSR_HV_SIMP_ENABLE 0x0001ULL +#define MSR_HV_SIMP_RSVD_MASK 0x0ffeULL +#define MSR_HV_SIMP_PGSHIFT 12 + +#define MSR_HV_SINT0 0x40000090 +#define MSR_HV_SINT_VECTOR_MASK 0x00ffULL +#define MSR_HV_SINT_RSVD1_MASK 0xff00ULL +#define MSR_HV_SINT_MASKED 0x00010000ULL +#define MSR_HV_SINT_AUTOEOI 0x00020000ULL +#define MSR_HV_SINT_RSVD2_MASK 0xfffffffffffc0000ULL +#define MSR_HV_SINT_RSVD_MASK (MSR_HV_SINT_RSVD1_MASK | \ + MSR_HV_SINT_RSVD2_MASK) + #endif /* !_HYPERV_REG_H_ */ From owner-svn-src-all@freebsd.org Thu Jun 23 08:18:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 113D6AC63F4; Thu, 23 Jun 2016 08:18:07 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.fer.hr", Issuer "TERENA SSL CA 3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6AA52170C; Thu, 23 Jun 2016 08:18:05 +0000 (UTC) (envelope-from zec@fer.hr) Received: from x23 (161.53.63.210) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server (TLS) id 14.3.279.2; Thu, 23 Jun 2016 10:16:52 +0200 Date: Thu, 23 Jun 2016 10:17:57 +0200 From: Marko Zec To: "Bjoern A. Zeeb" CC: , , , , , Subject: Re: svn commit: r302099 - head/sys/netinet Message-ID: <20160623101757.3e8022fe@x23> In-Reply-To: <201606230034.u5N0Y3Ea069103@repo.freebsd.org> References: <201606230034.u5N0Y3Ea069103@repo.freebsd.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd10.1) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [161.53.63.210] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 08:18:07 -0000 On Thu, 23 Jun 2016 00:34:03 +0000 "Bjoern A. Zeeb" wrote: > Author: bz > Date: Thu Jun 23 00:34:03 2016 > New Revision: 302099 > URL: https://svnweb.freebsd.org/changeset/base/302099 > > Log: > Check the V_tcbinfo.ipi_count to hit 0 before doing the full TCP > cleanup. That way timers can finish cleanly and we do not gamble with > a DELAY(). > Reviewed by: gnn, jtl > Approved by: re (gjb) > Obtained from: projects/vnet > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D6923 As much as this change is welcome, it unnecesarily introduces a mandatory 100 ms delay on each vnet teardown, which I already pointed out in a comment to r301601 two weeks ago, which remained unanswered, along with the question why a delay of 100 ms was introduced here, when before r302099 the delay was only a single clock tick? And furthermore the delay computation expresion here is not style(9) compliant... Hence, please rectify the above objections, perhaps by something like: =================================================================== --- tcp_subr.c (revision 302126) +++ tcp_subr.c (working copy) @@ -739,10 +739,11 @@ * Sleep to let all tcpcb timers really disappear and cleanup. */ do { - pause("tcpdes", hz/10); INP_LIST_RLOCK(&V_tcbinfo); n = V_tcbinfo.ipi_count; INP_LIST_RUNLOCK(&V_tcbinfo); + if (n != 0) + pause("tcpdes", hz / 100); } while (n != 0); tcp_hc_destroy(); syncache_destroy(); Thanks, Marko > > Modified: > head/sys/netinet/tcp_subr.c > > Modified: head/sys/netinet/tcp_subr.c > ============================================================================== > --- head/sys/netinet/tcp_subr.c Thu Jun 23 00:32:58 > 2016 (r302098) +++ head/sys/netinet/tcp_subr.c Thu Jun > 23 00:34:03 2016 (r302099) @@ -731,18 +731,19 @@ tcp_init(void) > static void > tcp_destroy(void *unused __unused) > { > - int error; > + int error, n; > > /* > * All our processes are gone, all our sockets should be > cleaned > * up, which means, we should be past the tcp_discardcb() > calls. > - * Sleep to let all tcpcb timers really disappear and then > cleanup. > - * Timewait will cleanup its queue and will be ready to go. > - * XXX-BZ In theory a few ticks should be good enough to > make sure > - * the timers are all really gone. We should see if we > could use a > - * better metric here and, e.g., check a tcbcb count as an > optimization? > + * Sleep to let all tcpcb timers really disappear and > cleanup. */ > - DELAY(1000000 / hz); > + do { > + pause("tcpdes", hz/10); > + INP_LIST_RLOCK(&V_tcbinfo); > + n = V_tcbinfo.ipi_count; > + INP_LIST_RUNLOCK(&V_tcbinfo); > + } while (n != 0); > tcp_hc_destroy(); > syncache_destroy(); > tcp_tw_destroy(); > From owner-svn-src-all@freebsd.org Thu Jun 23 08:26:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C94E8AC6651; Thu, 23 Jun 2016 08:26:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9326C1D65; Thu, 23 Jun 2016 08:26:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N8Q7iw050184; Thu, 23 Jun 2016 08:26:07 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N8Q78O050178; Thu, 23 Jun 2016 08:26:07 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230826.u5N8Q78O050178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 08:26:07 +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: r302129 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 08:26:08 -0000 Author: sephe Date: Thu Jun 23 08:26:07 2016 New Revision: 302129 URL: https://svnweb.freebsd.org/changeset/base/302129 Log: MFC 300825,300827,300830,300831,300832,300834 300825 hyperv: Move CPUID related bits to hyperv_reg.h and give them clean name MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6565 300827 hyperv: Move timer related MSRs into hyperv_reg.h And avoid bit fields for event timer. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6566 300830 hyperv/vmbus: Move MSR EOM to hyperv_reg.h MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6567 300831 hyperv: GC unneeded bits MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6568 300832 hyperv: Clean up Hyper-V timecounter a bit. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6569 300834 hyperv: Test features before enabling optional functionalities MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6571 Added: stable/10/sys/dev/hyperv/vmbus/hyperv_var.h - copied unchanged from r300834, head/sys/dev/hyperv/vmbus/hyperv_var.h Modified: stable/10/sys/dev/hyperv/vmbus/hv_et.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_et.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_et.c Thu Jun 23 08:09:44 2016 (r302128) +++ stable/10/sys/dev/hyperv/vmbus/hv_et.c Thu Jun 23 08:26:07 2016 (r302129) @@ -37,12 +37,28 @@ __FBSDID("$FreeBSD$"); #include #include -#include "hv_vmbus_priv.h" +#include +#include +#include #define HV_TIMER_FREQUENCY (10 * 1000 * 1000LL) /* 100ns period */ #define HV_MAX_DELTA_TICKS 0xffffffffLL #define HV_MIN_DELTA_TICKS 1LL +#define MSR_HV_STIMER0_CFG_SINT \ + ((((uint64_t)HV_VMBUS_TIMER_SINT) << MSR_HV_STIMER_CFG_SINT_SHIFT) & \ + MSR_HV_STIMER_CFG_SINT_MASK) + +/* + * Two additionally required features: + * - SynIC is needed for interrupt generation. + * - Time reference counter is needed to set ABS reference count to + * STIMER0_COUNT. + */ +#define CPUID_HV_ET_MASK (CPUID_HV_MSR_TIME_REFCNT | \ + CPUID_HV_MSR_SYNIC | \ + CPUID_HV_MSR_SYNTIMER) + static struct eventtimer *et; static inline uint64_t @@ -57,18 +73,15 @@ sbintime2tick(sbintime_t time) static int hv_et_start(struct eventtimer *et, sbintime_t firsttime, sbintime_t periodtime) { - union hv_timer_config timer_cfg; - uint64_t current; + uint64_t current, config; - timer_cfg.as_uint64 = 0; - timer_cfg.auto_enable = 1; - timer_cfg.sintx = HV_VMBUS_TIMER_SINT; + config = MSR_HV_STIMER_CFG_AUTOEN | MSR_HV_STIMER0_CFG_SINT; - current = rdmsr(HV_X64_MSR_TIME_REF_COUNT); + current = rdmsr(MSR_HV_TIME_REF_COUNT); current += sbintime2tick(firsttime); - wrmsr(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64); - wrmsr(HV_X64_MSR_STIMER0_COUNT, current); + wrmsr(MSR_HV_STIMER0_CONFIG, config); + wrmsr(MSR_HV_STIMER0_COUNT, current); return (0); } @@ -76,8 +89,8 @@ hv_et_start(struct eventtimer *et, sbint static int hv_et_stop(struct eventtimer *et) { - wrmsr(HV_X64_MSR_STIMER0_CONFIG, 0); - wrmsr(HV_X64_MSR_STIMER0_COUNT, 0); + wrmsr(MSR_HV_STIMER0_CONFIG, 0); + wrmsr(MSR_HV_STIMER0_COUNT, 0); return (0); } @@ -102,7 +115,8 @@ hv_et_intr(struct trapframe *frame) static void hv_et_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "hv_et", -1) != NULL) + if (device_find_child(parent, "hv_et", -1) != NULL || + (hyperv_features & CPUID_HV_ET_MASK) != CPUID_HV_ET_MASK) return; device_add_child(parent, "hv_et", -1); Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 08:09:44 2016 (r302128) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 08:26:07 2016 (r302129) @@ -46,12 +46,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define HV_NANOSECONDS_PER_SEC 1000000000L -#define HYPERV_INTERFACE 0x31237648 /* HV#1 */ - #define HYPERV_FREEBSD_BUILD 0ULL #define HYPERV_FREEBSD_VERSION ((uint64_t)__FreeBSD_version) #define HYPERV_FREEBSD_OSID 0ULL @@ -76,25 +75,31 @@ struct hypercall_ctx { struct hyperv_dma hc_dma; }; -static struct hypercall_ctx hypercall_context; - -static u_int hv_get_timecount(struct timecounter *tc); +static u_int hyperv_get_timecount(struct timecounter *tc); -u_int hyperv_features; -u_int hyperv_recommends; +u_int hyperv_features; +u_int hyperv_recommends; static u_int hyperv_pm_features; static u_int hyperv_features3; -static struct timecounter hv_timecounter = { - hv_get_timecount, 0, ~0u, HV_NANOSECONDS_PER_SEC/100, "Hyper-V", HV_NANOSECONDS_PER_SEC/100 +static struct timecounter hyperv_timecounter = { + .tc_get_timecount = hyperv_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = HV_NANOSECONDS_PER_SEC/100, + .tc_name = "Hyper-V", + .tc_quality = 2000, + .tc_flags = 0, + .tc_priv = NULL }; +static struct hypercall_ctx hypercall_context; + static u_int -hv_get_timecount(struct timecounter *tc) +hyperv_get_timecount(struct timecounter *tc __unused) { - u_int now = rdmsr(HV_X64_MSR_TIME_REF_COUNT); - return (now); + return rdmsr(MSR_HV_TIME_REF_COUNT); } /** @@ -204,26 +209,22 @@ static bool hyperv_identify(void) { u_int regs[4]; - unsigned int maxLeaf; - unsigned int op; + unsigned int maxleaf; if (vm_guest != VM_GUEST_HV) return (false); - op = HV_CPU_ID_FUNCTION_HV_VENDOR_AND_MAX_FUNCTION; - do_cpuid(op, regs); - maxLeaf = regs[0]; - if (maxLeaf < HV_CPU_ID_FUNCTION_MS_HV_IMPLEMENTATION_LIMITS) + do_cpuid(CPUID_LEAF_HV_MAXLEAF, regs); + maxleaf = regs[0]; + if (maxleaf < CPUID_LEAF_HV_LIMITS) return (false); - op = HV_CPU_ID_FUNCTION_HV_INTERFACE; - do_cpuid(op, regs); - if (regs[0] != HYPERV_INTERFACE) + do_cpuid(CPUID_LEAF_HV_INTERFACE, regs); + if (regs[0] != CPUID_HV_IFACE_HYPERV) return (false); - op = HV_CPU_ID_FUNCTION_MS_HV_FEATURES; - do_cpuid(op, regs); - if ((regs[0] & HV_FEATURE_MSR_HYPERCALL) == 0) { + do_cpuid(CPUID_LEAF_HV_FEATURES, regs); + if ((regs[0] & CPUID_HV_MSR_HYPERCALL) == 0) { /* * Hyper-V w/o Hypercall is impossible; someone * is faking Hyper-V. @@ -234,31 +235,30 @@ hyperv_identify(void) hyperv_pm_features = regs[2]; hyperv_features3 = regs[3]; - op = HV_CPU_ID_FUNCTION_MS_HV_VERSION; - do_cpuid(op, regs); + do_cpuid(CPUID_LEAF_HV_IDENTITY, regs); printf("Hyper-V Version: %d.%d.%d [SP%d]\n", regs[1] >> 16, regs[1] & 0xffff, regs[0], regs[2]); printf(" Features=0x%b\n", hyperv_features, "\020" - "\001VPRUNTIME" /* MSR_VP_RUNTIME */ - "\002TMREFCNT" /* MSR_TIME_REF_COUNT */ + "\001VPRUNTIME" /* MSR_HV_VP_RUNTIME */ + "\002TMREFCNT" /* MSR_HV_TIME_REF_COUNT */ "\003SYNIC" /* MSRs for SynIC */ "\004SYNTM" /* MSRs for SynTimer */ - "\005APIC" /* MSR_{EOI,ICR,TPR} */ - "\006HYPERCALL" /* MSR_{GUEST_OS_ID,HYPERCALL} */ - "\007VPINDEX" /* MSR_VP_INDEX */ - "\010RESET" /* MSR_RESET */ - "\011STATS" /* MSR_STATS_ */ - "\012REFTSC" /* MSR_REFERENCE_TSC */ - "\013IDLE" /* MSR_GUEST_IDLE */ - "\014TMFREQ" /* MSR_{TSC,APIC}_FREQUENCY */ - "\015DEBUG"); /* MSR_SYNTH_DEBUG_ */ - printf(" PM Features=max C%u, 0x%b\n", - HV_PM_FEATURE_CSTATE(hyperv_pm_features), - (hyperv_pm_features & ~HV_PM_FEATURE_CSTATE_MASK), + "\005APIC" /* MSR_HV_{EOI,ICR,TPR} */ + "\006HYPERCALL" /* MSR_HV_{GUEST_OS_ID,HYPERCALL} */ + "\007VPINDEX" /* MSR_HV_VP_INDEX */ + "\010RESET" /* MSR_HV_RESET */ + "\011STATS" /* MSR_HV_STATS_ */ + "\012REFTSC" /* MSR_HV_REFERENCE_TSC */ + "\013IDLE" /* MSR_HV_GUEST_IDLE */ + "\014TMFREQ" /* MSR_HV_{TSC,APIC}_FREQUENCY */ + "\015DEBUG"); /* MSR_HV_SYNTH_DEBUG_ */ + printf(" PM Features=0x%b [C%u]\n", + (hyperv_pm_features & ~CPUPM_HV_CSTATE_MASK), "\020" - "\005C3HPET"); /* HPET is required for C3 state */ + "\005C3HPET", /* HPET is required for C3 state */ + CPUPM_HV_CSTATE(hyperv_pm_features)); printf(" Features3=0x%b\n", hyperv_features3, "\020" "\001MWAIT" /* MWAIT */ @@ -276,24 +276,21 @@ hyperv_identify(void) "\015NPIEP" /* NPIEP */ "\016HVDIS"); /* disabling hypervisor */ - op = HV_CPU_ID_FUNCTION_MS_HV_ENLIGHTENMENT_INFORMATION; - do_cpuid(op, regs); + do_cpuid(CPUID_LEAF_HV_RECOMMENDS, regs); hyperv_recommends = regs[0]; if (bootverbose) printf(" Recommends: %08x %08x\n", regs[0], regs[1]); - op = HV_CPU_ID_FUNCTION_MS_HV_IMPLEMENTATION_LIMITS; - do_cpuid(op, regs); + do_cpuid(CPUID_LEAF_HV_LIMITS, regs); if (bootverbose) { printf(" Limits: Vcpu:%d Lcpu:%d Int:%d\n", regs[0], regs[1], regs[2]); } - if (maxLeaf >= HV_CPU_ID_FUNCTION_MS_HV_HARDWARE_FEATURE) { - op = HV_CPU_ID_FUNCTION_MS_HV_HARDWARE_FEATURE; - do_cpuid(op, regs); + if (maxleaf >= CPUID_LEAF_HV_HWFEATURES) { + do_cpuid(CPUID_LEAF_HV_HWFEATURES, regs); if (bootverbose) { - printf(" HW Features: %08x AMD: %08x\n", + printf(" HW Features: %08x, AMD: %08x\n", regs[0], regs[3]); } } @@ -314,9 +311,9 @@ hyperv_init(void *dummy __unused) /* Set guest id */ wrmsr(MSR_HV_GUEST_OS_ID, MSR_HV_GUESTID_FREEBSD); - if (hyperv_features & HV_FEATURE_MSR_TIME_REFCNT) { - /* Register virtual timecount */ - tc_init(&hv_timecounter); + if (hyperv_features & CPUID_HV_MSR_TIME_REFCNT) { + /* Register Hyper-V timecounter */ + tc_init(&hyperv_timecounter); } } SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 08:09:44 2016 (r302128) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 08:26:07 2016 (r302129) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -118,7 +119,7 @@ handled: * This will cause message queue rescan to possibly * deliver another msg from the hypervisor */ - wrmsr(HV_X64_MSR_EOM, 0); + wrmsr(MSR_HV_EOM, 0); } } } @@ -170,7 +171,7 @@ hv_vmbus_isr(struct vmbus_softc *sc, str * This will cause message queue rescan to possibly * deliver another msg from the hypervisor */ - wrmsr(HV_X64_MSR_EOM, 0); + wrmsr(MSR_HV_EOM, 0); } } @@ -215,10 +216,21 @@ vmbus_synic_setup(void *xsc) uint64_t val, orig; uint32_t sint; - /* - * Save virtual processor id. - */ - VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(MSR_HV_VP_INDEX); + if (hyperv_features & CPUID_HV_MSR_VP_INDEX) { + /* + * Save virtual processor id. + */ + VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(MSR_HV_VP_INDEX); + } else { + /* + * XXX + * Virtual processoor id is only used by a pretty broken + * channel selection code from storvsc. It's nothing + * critical even if CPUID_HV_MSR_VP_INDEX is not set; keep + * moving on. + */ + VMBUS_PCPU_GET(sc, vcpuid, cpu) = cpu; + } /* * Setup the SynIC message. @@ -637,7 +649,8 @@ static int vmbus_probe(device_t dev) { if (ACPI_ID_PROBE(device_get_parent(dev), dev, vmbus_ids) == NULL || - device_get_unit(dev) != 0 || vm_guest != VM_GUEST_HV) + device_get_unit(dev) != 0 || vm_guest != VM_GUEST_HV || + (hyperv_features & CPUID_HV_MSR_SYNIC) == 0) return (ENXIO); device_set_desc(dev, "Hyper-V Vmbus"); Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 08:09:44 2016 (r302128) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 08:26:07 2016 (r302129) @@ -356,32 +356,6 @@ typedef struct { } hv_vmbus_connection; typedef union { - uint64_t as_uint64_t; - struct { - uint64_t build_number : 16; - uint64_t service_version : 8; /* Service Pack, etc. */ - uint64_t minor_version : 8; - uint64_t major_version : 8; - /* - * HV_GUEST_OS_MICROSOFT_IDS (If Vendor=MS) - * HV_GUEST_OS_VENDOR - */ - uint64_t os_id : 8; - uint64_t vendor_id : 16; - } u; -} hv_vmbus_x64_msr_guest_os_id_contents; - - -typedef union { - uint64_t as_uint64_t; - struct { - uint64_t enable :1; - uint64_t reserved :11; - uint64_t guest_physical_address :52; - } u; -} hv_vmbus_x64_msr_hypercall_contents; - -typedef union { uint32_t as_uint32_t; struct { uint32_t group_enable :4; @@ -443,108 +417,6 @@ typedef struct { } hv_vmbus_monitor_page; /* - * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent - * is set by CPUID(HV_CPU_ID_FUNCTION_VERSION_AND_FEATURES). - */ -typedef enum { - HV_CPU_ID_FUNCTION_VERSION_AND_FEATURES = 0x00000001, - HV_CPU_ID_FUNCTION_HV_VENDOR_AND_MAX_FUNCTION = 0x40000000, - HV_CPU_ID_FUNCTION_HV_INTERFACE = 0x40000001, - /* - * The remaining functions depend on the value - * of hv_cpu_id_function_interface - */ - HV_CPU_ID_FUNCTION_MS_HV_VERSION = 0x40000002, - HV_CPU_ID_FUNCTION_MS_HV_FEATURES = 0x40000003, - HV_CPU_ID_FUNCTION_MS_HV_ENLIGHTENMENT_INFORMATION = 0x40000004, - HV_CPU_ID_FUNCTION_MS_HV_IMPLEMENTATION_LIMITS = 0x40000005, - HV_CPU_ID_FUNCTION_MS_HV_HARDWARE_FEATURE = 0x40000006 -} hv_vmbus_cpuid_function; - -#define HV_FEATURE_MSR_TIME_REFCNT 0x0002 /* MSR_TIME_REF_COUNT */ -#define HV_FEATURE_MSR_SYNIC 0x0004 /* MSRs for SynIC */ -#define HV_FEATURE_MSR_SYNTIMER 0x0008 /* MSRs for SynTimer */ -#define HV_FEATURE_MSR_APIC 0x0010 /* MSR_{EOI,ICR,TPR} */ -#define HV_FEATURE_MSR_HYPERCALL 0x0020 /* MSR_{GUEST_OS_ID,HYPERCALL} */ -#define HV_FEATURE_MSR_GUEST_IDLE 0x0400 /* MSR_GUEST_IDLE */ - -#define HV_PM_FEATURE_CSTATE_MASK 0x000f -#define HV_PM_FEATURE_C3_HPET 0x0010 /* C3 requires HPET */ -#define HV_PM_FEATURE_CSTATE(f) ((f) & HV_PM_FEATURE_CSTATE_MASK) - -#define HV_FEATURE3_MWAIT 0x0001 /* MWAIT */ -#define HV_FEATURE3_XMM_HYPERCALL 0x0010 /* hypercall input through XMM regs */ -#define HV_FEATURE3_GUEST_IDLE 0x0020 /* guest idle support */ -#define HV_FEATURE3_NUMA 0x0080 /* NUMA distance query support */ -#define HV_FEATURE3_TIME_FREQ 0x0100 /* timer frequency query (TSC, LAPIC) */ -#define HV_FEATURE3_MSR_CRASH 0x0400 /* MSRs for guest crash */ - -/* - * Define the format of the SIMP register - */ -typedef union { - uint64_t as_uint64_t; - struct { - uint64_t simp_enabled : 1; - uint64_t preserved : 11; - uint64_t base_simp_gpa : 52; - } u; -} hv_vmbus_synic_simp; - -/* - * Define the format of the SIEFP register - */ -typedef union { - uint64_t as_uint64_t; - struct { - uint64_t siefp_enabled : 1; - uint64_t preserved : 11; - uint64_t base_siefp_gpa : 52; - } u; -} hv_vmbus_synic_siefp; - -/* - * Define synthetic interrupt source - */ -typedef union { - uint64_t as_uint64_t; - struct { - uint64_t vector : 8; - uint64_t reserved1 : 8; - uint64_t masked : 1; - uint64_t auto_eoi : 1; - uint64_t reserved2 : 46; - } u; -} hv_vmbus_synic_sint; - -/* - * Timer configuration register. - */ -union hv_timer_config { - uint64_t as_uint64; - struct { - uint64_t enable:1; - uint64_t periodic:1; - uint64_t lazy:1; - uint64_t auto_enable:1; - uint64_t reserved_z0:12; - uint64_t sintx:4; - uint64_t reserved_z1:44; - }; -}; - -/* - * Define syn_ic control register - */ -typedef union _hv_vmbus_synic_scontrol { - uint64_t as_uint64_t; - struct { - uint64_t enable : 1; - uint64_t reserved : 63; - } u; -} hv_vmbus_synic_scontrol; - -/* * Define the hv_vmbus_post_message hypercall input structure */ typedef struct { @@ -565,60 +437,6 @@ typedef union vmbus_event_flags { } hv_vmbus_synic_event_flags; CTASSERT(sizeof(hv_vmbus_synic_event_flags) == HV_EVENT_FLAGS_BYTE_COUNT); -#define HV_X64_CPUID_MIN (0x40000005) -#define HV_X64_CPUID_MAX (0x4000ffff) - -/* - * Declare the MSR used to identify the guest OS - */ -#define HV_X64_MSR_GUEST_OS_ID (0x40000000) -/* - * Declare the MSR used to setup pages used to communicate with the hypervisor - */ -#define HV_X64_MSR_HYPERCALL (0x40000001) -/* MSR used to provide vcpu index */ -#define HV_X64_MSR_VP_INDEX (0x40000002) - -#define HV_X64_MSR_TIME_REF_COUNT (0x40000020) - -/* - * Define synthetic interrupt controller model specific registers - */ -#define HV_X64_MSR_SCONTROL (0x40000080) -#define HV_X64_MSR_SVERSION (0x40000081) -#define HV_X64_MSR_SIEFP (0x40000082) -#define HV_X64_MSR_SIMP (0x40000083) -#define HV_X64_MSR_EOM (0x40000084) - -#define HV_X64_MSR_SINT0 (0x40000090) -#define HV_X64_MSR_SINT1 (0x40000091) -#define HV_X64_MSR_SINT2 (0x40000092) -#define HV_X64_MSR_SINT3 (0x40000093) -#define HV_X64_MSR_SINT4 (0x40000094) -#define HV_X64_MSR_SINT5 (0x40000095) -#define HV_X64_MSR_SINT6 (0x40000096) -#define HV_X64_MSR_SINT7 (0x40000097) -#define HV_X64_MSR_SINT8 (0x40000098) -#define HV_X64_MSR_SINT9 (0x40000099) -#define HV_X64_MSR_SINT10 (0x4000009A) -#define HV_X64_MSR_SINT11 (0x4000009B) -#define HV_X64_MSR_SINT12 (0x4000009C) -#define HV_X64_MSR_SINT13 (0x4000009D) -#define HV_X64_MSR_SINT14 (0x4000009E) -#define HV_X64_MSR_SINT15 (0x4000009F) - -/* - * Synthetic Timer MSRs. Four timers per vcpu. - */ -#define HV_X64_MSR_STIMER0_CONFIG 0x400000B0 -#define HV_X64_MSR_STIMER0_COUNT 0x400000B1 -#define HV_X64_MSR_STIMER1_CONFIG 0x400000B2 -#define HV_X64_MSR_STIMER1_COUNT 0x400000B3 -#define HV_X64_MSR_STIMER2_CONFIG 0x400000B4 -#define HV_X64_MSR_STIMER2_COUNT 0x400000B5 -#define HV_X64_MSR_STIMER3_CONFIG 0x400000B6 -#define HV_X64_MSR_STIMER3_COUNT 0x400000B7 - /* * Declare the various hypercall operations */ @@ -633,9 +451,6 @@ typedef enum { extern hv_vmbus_connection hv_vmbus_g_connection; -extern u_int hyperv_features; -extern u_int hyperv_recommends; - typedef void (*vmbus_msg_handler)(hv_vmbus_channel_msg_header *msg); typedef struct hv_vmbus_channel_msg_table_entry { Modified: stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h Thu Jun 23 08:09:44 2016 (r302128) +++ stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h Thu Jun 23 08:26:07 2016 (r302129) @@ -29,6 +29,10 @@ #ifndef _HYPERV_REG_H_ #define _HYPERV_REG_H_ +/* + * Hyper-V Synthetic MSRs + */ + #define MSR_HV_GUEST_OS_ID 0x40000000 #define MSR_HV_GUESTID_BUILD_MASK 0xffffULL #define MSR_HV_GUESTID_VERSION_MASK 0x0000ffffffff0000ULL @@ -50,6 +54,8 @@ #define MSR_HV_VP_INDEX 0x40000002 +#define MSR_HV_TIME_REF_COUNT 0x40000020 + #define MSR_HV_SCONTROL 0x40000080 #define MSR_HV_SCTRL_ENABLE 0x0001ULL #define MSR_HV_SCTRL_RSVD_MASK 0xfffffffffffffffeULL @@ -64,6 +70,8 @@ #define MSR_HV_SIMP_RSVD_MASK 0x0ffeULL #define MSR_HV_SIMP_PGSHIFT 12 +#define MSR_HV_EOM 0x40000084 + #define MSR_HV_SINT0 0x40000090 #define MSR_HV_SINT_VECTOR_MASK 0x00ffULL #define MSR_HV_SINT_RSVD1_MASK 0xff00ULL @@ -73,4 +81,53 @@ #define MSR_HV_SINT_RSVD_MASK (MSR_HV_SINT_RSVD1_MASK | \ MSR_HV_SINT_RSVD2_MASK) +#define MSR_HV_STIMER0_CONFIG 0x400000b0 +#define MSR_HV_STIMER_CFG_ENABLE 0x0001ULL +#define MSR_HV_STIMER_CFG_PERIODIC 0x0002ULL +#define MSR_HV_STIMER_CFG_LAZY 0x0004ULL +#define MSR_HV_STIMER_CFG_AUTOEN 0x0008ULL +#define MSR_HV_STIMER_CFG_SINT_MASK 0x000f0000ULL +#define MSR_HV_STIMER_CFG_SINT_SHIFT 16 + +#define MSR_HV_STIMER0_COUNT 0x400000b1 + +/* + * CPUID leaves + */ + +#define CPUID_LEAF_HV_MAXLEAF 0x40000000 + +#define CPUID_LEAF_HV_INTERFACE 0x40000001 +#define CPUID_HV_IFACE_HYPERV 0x31237648 /* HV#1 */ + +#define CPUID_LEAF_HV_IDENTITY 0x40000002 + +#define CPUID_LEAF_HV_FEATURES 0x40000003 +/* EAX: features */ +#define CPUID_HV_MSR_TIME_REFCNT 0x0002 /* MSR_HV_TIME_REF_COUNT */ +#define CPUID_HV_MSR_SYNIC 0x0004 /* MSRs for SynIC */ +#define CPUID_HV_MSR_SYNTIMER 0x0008 /* MSRs for SynTimer */ +#define CPUID_HV_MSR_APIC 0x0010 /* MSR_HV_{EOI,ICR,TPR} */ +#define CPUID_HV_MSR_HYPERCALL 0x0020 /* MSR_HV_GUEST_OS_ID + * MSR_HV_HYPERCALL */ +#define CPUID_HV_MSR_VP_INDEX 0x0040 /* MSR_HV_VP_INDEX */ +#define CPUID_HV_MSR_GUEST_IDLE 0x0400 /* MSR_HV_GUEST_IDLE */ +/* ECX: power management features */ +#define CPUPM_HV_CSTATE_MASK 0x000f /* deepest C-state */ +#define CPUPM_HV_C3_HPET 0x0010 /* C3 requires HPET */ +#define CPUPM_HV_CSTATE(f) ((f) & CPUPM_HV_CSTATE_MASK) +/* EDX: features3 */ +#define CPUID3_HV_MWAIT 0x0001 /* MWAIT */ +#define CPUID3_HV_XMM_HYPERCALL 0x0010 /* Hypercall input through + * XMM regs */ +#define CPUID3_HV_GUEST_IDLE 0x0020 /* guest idle */ +#define CPUID3_HV_NUMA 0x0080 /* NUMA distance query */ +#define CPUID3_HV_TIME_FREQ 0x0100 /* timer frequency query + * (TSC, LAPIC) */ +#define CPUID3_HV_MSR_CRASH 0x0400 /* MSRs for guest crash */ + +#define CPUID_LEAF_HV_RECOMMENDS 0x40000004 +#define CPUID_LEAF_HV_LIMITS 0x40000005 +#define CPUID_LEAF_HV_HWFEATURES 0x40000006 + #endif /* !_HYPERV_REG_H_ */ Copied: stable/10/sys/dev/hyperv/vmbus/hyperv_var.h (from r300834, head/sys/dev/hyperv/vmbus/hyperv_var.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/hyperv_var.h Thu Jun 23 08:26:07 2016 (r302129, copy of r300834, head/sys/dev/hyperv/vmbus/hyperv_var.h) @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HYPERV_VAR_H_ +#define _HYPERV_VAR_H_ + +extern u_int hyperv_features; +extern u_int hyperv_recommends; + +#endif /* !_HYPERV_VAR_H_ */ From owner-svn-src-all@freebsd.org Thu Jun 23 08:27:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B97C6AC66D1; Thu, 23 Jun 2016 08:27:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89AA61EDF; Thu, 23 Jun 2016 08:27:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N8Rcxe050311; Thu, 23 Jun 2016 08:27:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N8Rc2B050310; Thu, 23 Jun 2016 08:27:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606230827.u5N8Rc2B050310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 Jun 2016 08:27:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302130 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 08:27:39 -0000 Author: kib Date: Thu Jun 23 08:27:38 2016 New Revision: 302130 URL: https://svnweb.freebsd.org/changeset/base/302130 Log: Add a comment noting locking regime for vm_page_xunbusy(). Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Approved by: re (gjb) Modified: head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Thu Jun 23 08:26:07 2016 (r302129) +++ head/sys/vm/vm_page.h Thu Jun 23 08:27:38 2016 (r302130) @@ -552,6 +552,7 @@ void vm_page_lock_assert_KBI(vm_page_t m (m)); \ } while (0) +/* Note: page m's lock must not be owned by the caller. */ #define vm_page_xunbusy(m) do { \ if (!atomic_cmpset_rel_int(&(m)->busy_lock, \ VPB_SINGLE_EXCLUSIVER, VPB_UNBUSIED)) \ From owner-svn-src-all@freebsd.org Thu Jun 23 08:28:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5403FAC6715; Thu, 23 Jun 2016 08:28:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AE04209F; Thu, 23 Jun 2016 08:28:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N8SDAJ050388; Thu, 23 Jun 2016 08:28:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N8SDaT050387; Thu, 23 Jun 2016 08:28:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606230828.u5N8SDaT050387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 Jun 2016 08:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302131 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 08:28:14 -0000 Author: kib Date: Thu Jun 23 08:28:13 2016 New Revision: 302131 URL: https://svnweb.freebsd.org/changeset/base/302131 Log: In vm_page_xunbusy_maybelocked(), add fast path for unbusy when no waiters exist, same as for vm_page_xunbusy(). If previous value of busy_lock was VPB_SINGLE_EXCLUSIVER, no waiters existed and wakeup is not needed. Move common code from vm_page_xunbusy_maybelocked() and vm_page_xunbusy_hard() to vm_page_xunbusy_locked(). Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Approved by: re (gjb) Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Jun 23 08:27:38 2016 (r302130) +++ head/sys/vm/vm_page.c Thu Jun 23 08:28:13 2016 (r302131) @@ -760,17 +760,36 @@ vm_page_trysbusy(vm_page_t m) } static void +vm_page_xunbusy_locked(vm_page_t m) +{ + + vm_page_assert_xbusied(m); + vm_page_assert_locked(m); + + atomic_store_rel_int(&m->busy_lock, VPB_UNBUSIED); + /* There is a waiter, do wakeup() instead of vm_page_flash(). */ + wakeup(m); +} + +static void vm_page_xunbusy_maybelocked(vm_page_t m) { bool lockacq; vm_page_assert_xbusied(m); + /* + * Fast path for unbusy. If it succeeds, we know that there + * are no waiters, so we do not need a wakeup. + */ + if (atomic_cmpset_rel_int(&m->busy_lock, VPB_SINGLE_EXCLUSIVER, + VPB_UNBUSIED)) + return; + lockacq = !mtx_owned(vm_page_lockptr(m)); if (lockacq) vm_page_lock(m); - vm_page_flash(m); - atomic_store_rel_int(&m->busy_lock, VPB_UNBUSIED); + vm_page_xunbusy_locked(m); if (lockacq) vm_page_unlock(m); } @@ -788,8 +807,7 @@ vm_page_xunbusy_hard(vm_page_t m) vm_page_assert_xbusied(m); vm_page_lock(m); - atomic_store_rel_int(&m->busy_lock, VPB_UNBUSIED); - wakeup(m); + vm_page_xunbusy_locked(m); vm_page_unlock(m); } From owner-svn-src-all@freebsd.org Thu Jun 23 08:38:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD6DCAC692D; Thu, 23 Jun 2016 08:38:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FB2B2687; Thu, 23 Jun 2016 08:38:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N8c1uM054459; Thu, 23 Jun 2016 08:38:01 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N8c1w8054458; Thu, 23 Jun 2016 08:38:01 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230838.u5N8c1w8054458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 08: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: r302132 - stable/10/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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 08:38:02 -0000 Author: sephe Date: Thu Jun 23 08:38:01 2016 New Revision: 302132 URL: https://svnweb.freebsd.org/changeset/base/302132 Log: MFC 300981 tcp: Don't prematurely drop receiving-only connections If the connection was persistent and receiving-only, several (12) sporadic device insufficient buffers would cause the connection be dropped prematurely: Upon ENOBUFS in tcp_output() for an ACK, retransmission timer is started. No one will stop this retransmission timer for receiving- only connection, so the retransmission timer promises to expire and t_rxtshift is promised to be increased. And t_rxtshift will not be reset to 0, since no RTT measurement will be done for receiving-only connection. If this receiving-only connection lived long enough (e.g. >350sec, given the RTO starts from 200ms), and it suffered 12 sporadic device insufficient buffers, i.e. t_rxtshift >= 12, this receiving-only connection would be dropped prematurely by the retransmission timer. We now assert that for data segments, SYNs or FINs either rexmit or persist timer was wired upon ENOBUFS. And don't set rexmit timer for other cases, i.e. ENOBUFS upon ACKs. Discussed with: lstewart, hiren, jtl, Mike Karels MFC after: 3 weeks Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5872 Modified: stable/10/sys/netinet/tcp_output.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_output.c ============================================================================== --- stable/10/sys/netinet/tcp_output.c Thu Jun 23 08:28:13 2016 (r302131) +++ stable/10/sys/netinet/tcp_output.c Thu Jun 23 08:38:01 2016 (r302132) @@ -127,6 +127,16 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, &VNET_NAME(tcp_autosndbuf_max), 0, "Max size of automatic send buffer"); +/* + * Make sure that either retransmit or persist timer is set for SYN, FIN and + * non-ACK. + */ +#define TCP_XMIT_TIMER_ASSERT(tp, len, th_flags) \ + KASSERT(((len) == 0 && ((th_flags) & (TH_SYN | TH_FIN)) == 0) ||\ + tcp_timer_active((tp), TT_REXMT) || \ + tcp_timer_active((tp), TT_PERSIST), \ + ("neither rexmt nor persist timer is set")) + static void inline hhook_run_tcp_est_out(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to, long len, int tso); @@ -1531,9 +1541,7 @@ timer: tp->t_softerror = error; return (error); case ENOBUFS: - if (!tcp_timer_active(tp, TT_REXMT) && - !tcp_timer_active(tp, TT_PERSIST)) - tcp_timer_activate(tp, TT_REXMT, tp->t_rxtcur); + TCP_XMIT_TIMER_ASSERT(tp, len, flags); tp->snd_cwnd = tp->t_maxseg; return (0); case EMSGSIZE: From owner-svn-src-all@freebsd.org Thu Jun 23 08:49:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BE53AC6C7D; Thu, 23 Jun 2016 08:49:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx2.freebsd.org", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73F792C22; Thu, 23 Jun 2016 08:49:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from butcher-nb.yandex.net (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx2.freebsd.org (Postfix) with ESMTP id D95756565A; Thu, 23 Jun 2016 08:49:12 +0000 (UTC) (envelope-from ae@FreeBSD.org) Subject: Re: svn commit: r302081 - head/sys/netinet6 To: hiren panchasara References: <201606221129.u5MBTMun071427@repo.freebsd.org> <20160622154613.GR60812@strugglingcoder.info> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: "Andrey V. Elsukov" Message-ID: <576BA265.2060104@FreeBSD.org> Date: Thu, 23 Jun 2016 11:48:37 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <20160622154613.GR60812@strugglingcoder.info> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VX0Jd7o79FJWhI9dKEwXqau6IFD0kAUGi" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 08:49:14 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VX0Jd7o79FJWhI9dKEwXqau6IFD0kAUGi Content-Type: multipart/mixed; boundary="mDIUVbicci99ngUtcJa3nTnODAlBjmgTV" From: "Andrey V. Elsukov" To: hiren panchasara Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <576BA265.2060104@FreeBSD.org> Subject: Re: svn commit: r302081 - head/sys/netinet6 References: <201606221129.u5MBTMun071427@repo.freebsd.org> <20160622154613.GR60812@strugglingcoder.info> In-Reply-To: <20160622154613.GR60812@strugglingcoder.info> --mDIUVbicci99ngUtcJa3nTnODAlBjmgTV Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 22.06.16 18:46, hiren panchasara wrote: >> Fix the NULL pointer dereference for unresolved link layer entries i= n >> the netinet6 code. Copy link layer address only when corresponding e= ntry >> has LLE_VALID flag. >> =20 >> PR: 210379 >> Approved by: re (kib) >> >> Modified: >> head/sys/netinet6/in6.c >=20 > Cursory look tells me that this bug is also present in 10. Is that true= ? > If so, is it possible for you to mfc this? The patch is applicable, but due to the difference in the LLE code stable/10 has not affected with this bug. --=20 WBR, Andrey V. Elsukov --mDIUVbicci99ngUtcJa3nTnODAlBjmgTV-- --VX0Jd7o79FJWhI9dKEwXqau6IFD0kAUGi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXa6JpAAoJEAHF6gQQyKF6nXEH/0d5sSm0HZWnSCqL/mA82EjP ZXOeKvA+AMPPjDeeUD2vol9tKFAixbTuFHhR9FR0cRuaj3TsiX9o20qImRoqwEbp 5Rl9yZ+drwuzOkgAnvqE9lA9CSwFjoVJSHB4DmKG7qX2Gks0VxdG+tE75gRmhMfu mFLnrKiaQDYRunFnfbINEA4GFLGVGvImeoL9EVa5vQe1ixxz3wmoKzxaFnTXXEWF wXL06A5UsI/mBJjxrdhmnRt2ceJI3aZ6WwK7Rto6cd6+ZZOOD/nWzAN07PeU/i8I xuL+hB0d/L4ePDU4vLZdQPC7+VwWPSGPq2u1RYKi5cCJieESy9pkzBlHKjooMVU= =K0lL -----END PGP SIGNATURE----- --VX0Jd7o79FJWhI9dKEwXqau6IFD0kAUGi-- From owner-svn-src-all@freebsd.org Thu Jun 23 09:00:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEED0B733D3; Thu, 23 Jun 2016 09:00:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9EF1D168C; Thu, 23 Jun 2016 09:00:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N90wKJ063685; Thu, 23 Jun 2016 09:00:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N90wQd063684; Thu, 23 Jun 2016 09:00:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606230900.u5N90wQd063684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 Jun 2016 09:00: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: r302133 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 09:00:59 -0000 Author: kib Date: Thu Jun 23 09:00:58 2016 New Revision: 302133 URL: https://svnweb.freebsd.org/changeset/base/302133 Log: MFC r301959: Remove code duplication. Modified: stable/10/sys/kern/kern_thread.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_thread.c ============================================================================== --- stable/10/sys/kern/kern_thread.c Thu Jun 23 08:38:01 2016 (r302132) +++ stable/10/sys/kern/kern_thread.c Thu Jun 23 09:00:58 2016 (r302133) @@ -613,11 +613,6 @@ weed_inhib(int mode, struct thread *td2, wakeup_swapper |= sleepq_abort(td2, EINTR); break; case SINGLE_BOUNDARY: - if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) - wakeup_swapper |= thread_unsuspend_one(td2, p, false); - if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) - wakeup_swapper |= sleepq_abort(td2, ERESTART); - break; case SINGLE_NO_EXIT: if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) wakeup_swapper |= thread_unsuspend_one(td2, p, false); From owner-svn-src-all@freebsd.org Thu Jun 23 09:02:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21340B7344A; Thu, 23 Jun 2016 09:02:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5E4E1A2B; Thu, 23 Jun 2016 09:02:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N92pTW065785; Thu, 23 Jun 2016 09:02:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N92pMF065784; Thu, 23 Jun 2016 09:02:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606230902.u5N92pMF065784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 Jun 2016 09:02:51 +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: r302134 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 09:02:52 -0000 Author: kib Date: Thu Jun 23 09:02:50 2016 New Revision: 302134 URL: https://svnweb.freebsd.org/changeset/base/302134 Log: MFC r301960: Remove XXX comments from kern_thread.c. Modified: stable/10/sys/kern/kern_thread.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_thread.c ============================================================================== --- stable/10/sys/kern/kern_thread.c Thu Jun 23 09:00:58 2016 (r302133) +++ stable/10/sys/kern/kern_thread.c Thu Jun 23 09:02:50 2016 (r302134) @@ -424,7 +424,7 @@ thread_exit(void) * architecture specific resources that * would not be on a new untouched process. */ - cpu_thread_exit(td); /* XXXSMP */ + cpu_thread_exit(td); /* * The last thread is left attached to the process @@ -851,8 +851,8 @@ thread_suspend_check(int return_instead) /* * The only suspension in action is a * single-threading. Single threader need not stop. - * XXX Should be safe to access unlocked - * as it can only be set to be true by us. + * It is safe to access p->p_singlethread unlocked + * because it can only be set to our address by us. */ if (p->p_singlethread == td) return (0); /* Exempt from stopping. */ From owner-svn-src-all@freebsd.org Thu Jun 23 09:03:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52F1AB73500; Thu, 23 Jun 2016 09:03:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23E5F1BD3; Thu, 23 Jun 2016 09:03:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N93rqH065884; Thu, 23 Jun 2016 09:03:53 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N93qjj065877; Thu, 23 Jun 2016 09:03:52 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606230903.u5N93qjj065877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 23 Jun 2016 09:03: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: r302135 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 09:03:54 -0000 Author: sephe Date: Thu Jun 23 09:03:52 2016 New Revision: 302135 URL: https://svnweb.freebsd.org/changeset/base/302135 Log: MFC 300987,300988,300989,300992,300993,300994,301009 300987 hyperv/et: Fix STIMER0 operations. - Make sure that STIMER0 is disabled before writting to it, since writing to an enabled STIMER will result in undefined behaviour. - It is unnecessary to reconfigure STIMER0 upon each et_start(). - Make sure that MSR_HV_REF_TIME_COUNT will not return 0, since writing 0 to STIMER_COUNT will disable the target STIMER. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6573 300988 hyperv/vmbus: Move SINT settings to vmbus_var.h While I'm here remove the event timer's dependency on hv_vmbus_priv.h MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6574 300989 hyperv/et: Make sure only one event timer will be registered This nullifies the need to use softc. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6591 300992 hyperv: Move timer frequency definition to common place. And cleanup event timer period settings. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6597 300993 hyperv/et: Device renaming; consistent w/ other Hyper-V utils While I'm here, prefix function names w/ vmbus, since unlike Hyper-V timecounter, Hyper-V event timer will not work w/o vmbus. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6598 300994 hyperv/et: Allow Hyper-V event timer be disabled MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6599 301009 hyperv/vmbus: Process event timer before checking events And update comment. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6600 Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_et.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/hyperv_var.h stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 09:02:50 2016 (r302134) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Thu Jun 23 09:03:52 2016 (r302135) @@ -340,7 +340,7 @@ vmbus_event_proc(struct vmbus_softc *sc, * On Host with Win8 or above, the event page can be checked directly * to get the id of the channel that has the pending interrupt. */ - event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; + event = VMBUS_PCPU_GET(sc, event_flag, cpu) + VMBUS_SINT_MESSAGE; vmbus_event_flags_proc(event->flagsul, VMBUS_PCPU_GET(sc, event_flag_cnt, cpu)); } @@ -350,7 +350,7 @@ vmbus_event_proc_compat(struct vmbus_sof { hv_vmbus_synic_event_flags *event; - event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; + event = VMBUS_PCPU_GET(sc, event_flag, cpu) + VMBUS_SINT_MESSAGE; if (atomic_testandclear_int(&event->flags32[0], 0)) { vmbus_event_flags_proc( hv_vmbus_g_connection.recv_interrupt_page, Modified: stable/10/sys/dev/hyperv/vmbus/hv_et.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_et.c Thu Jun 23 09:02:50 2016 (r302134) +++ stable/10/sys/dev/hyperv/vmbus/hv_et.c Thu Jun 23 09:03:52 2016 (r302135) @@ -37,16 +37,16 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include + #include #include +#include -#define HV_TIMER_FREQUENCY (10 * 1000 * 1000LL) /* 100ns period */ -#define HV_MAX_DELTA_TICKS 0xffffffffLL -#define HV_MIN_DELTA_TICKS 1LL +#define VMBUS_ET_NAME "hvet" #define MSR_HV_STIMER0_CFG_SINT \ - ((((uint64_t)HV_VMBUS_TIMER_SINT) << MSR_HV_STIMER_CFG_SINT_SHIFT) & \ + ((((uint64_t)VMBUS_SINT_TIMER) << MSR_HV_STIMER_CFG_SINT_SHIFT) & \ MSR_HV_STIMER_CFG_SINT_MASK) /* @@ -59,117 +59,140 @@ __FBSDID("$FreeBSD$"); CPUID_HV_MSR_SYNIC | \ CPUID_HV_MSR_SYNTIMER) -static struct eventtimer *et; +static struct eventtimer vmbus_et; -static inline uint64_t -sbintime2tick(sbintime_t time) +static __inline uint64_t +hyperv_sbintime2count(sbintime_t time) { struct timespec val; val = sbttots(time); - return val.tv_sec * HV_TIMER_FREQUENCY + val.tv_nsec / 100; + return (val.tv_sec * HYPERV_TIMER_FREQ) + + (val.tv_nsec / HYPERV_TIMER_NS_FACTOR); } static int -hv_et_start(struct eventtimer *et, sbintime_t firsttime, sbintime_t periodtime) +vmbus_et_start(struct eventtimer *et __unused, sbintime_t first, + sbintime_t period __unused) { - uint64_t current, config; - - config = MSR_HV_STIMER_CFG_AUTOEN | MSR_HV_STIMER0_CFG_SINT; + uint64_t current; current = rdmsr(MSR_HV_TIME_REF_COUNT); - current += sbintime2tick(firsttime); - - wrmsr(MSR_HV_STIMER0_CONFIG, config); + current += hyperv_sbintime2count(first); wrmsr(MSR_HV_STIMER0_COUNT, current); return (0); } -static int -hv_et_stop(struct eventtimer *et) -{ - wrmsr(MSR_HV_STIMER0_CONFIG, 0); - wrmsr(MSR_HV_STIMER0_COUNT, 0); - - return (0); -} - void -hv_et_intr(struct trapframe *frame) +vmbus_et_intr(struct trapframe *frame) { struct trapframe *oldframe; struct thread *td; - if (et->et_active) { + if (vmbus_et.et_active) { td = curthread; td->td_intr_nesting_level++; oldframe = td->td_intr_frame; td->td_intr_frame = frame; - et->et_event_cb(et, et->et_arg); + vmbus_et.et_event_cb(&vmbus_et, vmbus_et.et_arg); td->td_intr_frame = oldframe; td->td_intr_nesting_level--; } } static void -hv_et_identify(driver_t *driver, device_t parent) +vmbus_et_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "hv_et", -1) != NULL || + if (device_get_unit(parent) != 0 || + device_find_child(parent, VMBUS_ET_NAME, -1) != NULL || (hyperv_features & CPUID_HV_ET_MASK) != CPUID_HV_ET_MASK) return; - device_add_child(parent, "hv_et", -1); + device_add_child(parent, VMBUS_ET_NAME, -1); } static int -hv_et_probe(device_t dev) +vmbus_et_probe(device_t dev) { + if (resource_disabled(VMBUS_ET_NAME, 0)) + return (ENXIO); + device_set_desc(dev, "Hyper-V event timer"); return (BUS_PROBE_NOWILDCARD); } +static void +vmbus_et_config(void *arg __unused) +{ + /* + * Make sure that STIMER0 is really disabled before writing + * to STIMER0_CONFIG. + * + * "Writing to the configuration register of a timer that + * is already enabled may result in undefined behaviour." + */ + for (;;) { + uint64_t val; + + /* Stop counting, and this also implies disabling STIMER0 */ + wrmsr(MSR_HV_STIMER0_COUNT, 0); + + val = rdmsr(MSR_HV_STIMER0_CONFIG); + if ((val & MSR_HV_STIMER_CFG_ENABLE) == 0) + break; + cpu_spinwait(); + } + wrmsr(MSR_HV_STIMER0_CONFIG, + MSR_HV_STIMER_CFG_AUTOEN | MSR_HV_STIMER0_CFG_SINT); +} + static int -hv_et_attach(device_t dev) +vmbus_et_attach(device_t dev) { - /* XXX: need allocate SINT and remove global et */ - et = device_get_softc(dev); + /* TODO: use independent IDT vector */ - et->et_name = "Hyper-V"; - et->et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; - et->et_quality = 1000; - et->et_frequency = HV_TIMER_FREQUENCY; - et->et_min_period = HV_MIN_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY); - et->et_max_period = HV_MAX_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY); - et->et_start = hv_et_start; - et->et_stop = hv_et_stop; - et->et_priv = dev; + vmbus_et.et_name = "Hyper-V"; + vmbus_et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; + vmbus_et.et_quality = 1000; + vmbus_et.et_frequency = HYPERV_TIMER_FREQ; + vmbus_et.et_min_period = (0x00000001ULL << 32) / HYPERV_TIMER_FREQ; + vmbus_et.et_max_period = (0xfffffffeULL << 32) / HYPERV_TIMER_FREQ; + vmbus_et.et_start = vmbus_et_start; + + /* + * Delay a bit to make sure that MSR_HV_TIME_REF_COUNT will + * not return 0, since writing 0 to STIMER0_COUNT will disable + * STIMER0. + */ + DELAY(100); + smp_rendezvous(NULL, vmbus_et_config, NULL, NULL); - return (et_register(et)); + return (et_register(&vmbus_et)); } static int -hv_et_detach(device_t dev) +vmbus_et_detach(device_t dev) { - return (et_deregister(et)); + return (et_deregister(&vmbus_et)); } -static device_method_t hv_et_methods[] = { - DEVMETHOD(device_identify, hv_et_identify), - DEVMETHOD(device_probe, hv_et_probe), - DEVMETHOD(device_attach, hv_et_attach), - DEVMETHOD(device_detach, hv_et_detach), +static device_method_t vmbus_et_methods[] = { + DEVMETHOD(device_identify, vmbus_et_identify), + DEVMETHOD(device_probe, vmbus_et_probe), + DEVMETHOD(device_attach, vmbus_et_attach), + DEVMETHOD(device_detach, vmbus_et_detach), DEVMETHOD_END }; -static driver_t hv_et_driver = { - "hv_et", - hv_et_methods, - sizeof(struct eventtimer) +static driver_t vmbus_et_driver = { + VMBUS_ET_NAME, + vmbus_et_methods, + 0 }; -static devclass_t hv_et_devclass; -DRIVER_MODULE(hv_et, vmbus, hv_et_driver, hv_et_devclass, NULL, 0); +static devclass_t vmbus_et_devclass; +DRIVER_MODULE(hv_et, vmbus, vmbus_et_driver, vmbus_et_devclass, NULL, NULL); MODULE_VERSION(hv_et, 1); Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 09:02:50 2016 (r302134) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Thu Jun 23 09:03:52 2016 (r302135) @@ -49,8 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define HV_NANOSECONDS_PER_SEC 1000000000L - #define HYPERV_FREEBSD_BUILD 0ULL #define HYPERV_FREEBSD_VERSION ((uint64_t)__FreeBSD_version) #define HYPERV_FREEBSD_OSID 0ULL @@ -87,7 +85,7 @@ static struct timecounter hyperv_timecou .tc_get_timecount = hyperv_get_timecount, .tc_poll_pps = NULL, .tc_counter_mask = 0xffffffff, - .tc_frequency = HV_NANOSECONDS_PER_SEC/100, + .tc_frequency = HYPERV_TIMER_FREQ, .tc_name = "Hyper-V", .tc_quality = 2000, .tc_flags = 0, Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 09:02:50 2016 (r302134) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 09:03:52 2016 (r302135) @@ -80,7 +80,7 @@ vmbus_msg_task(void *xsc, int pending __ struct vmbus_softc *sc = xsc; hv_vmbus_message *msg; - msg = VMBUS_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT; + msg = VMBUS_PCPU_GET(sc, message, curcpu) + VMBUS_SINT_MESSAGE; for (;;) { const hv_vmbus_channel_msg_table_entry *entry; hv_vmbus_channel_msg_header *hdr; @@ -124,34 +124,23 @@ handled: } } -/** - * @brief Interrupt filter routine for VMBUS. - * - * The purpose of this routine is to determine the type of VMBUS protocol - * message to process - an event or a channel message. - */ static inline int hv_vmbus_isr(struct vmbus_softc *sc, struct trapframe *frame, int cpu) { hv_vmbus_message *msg, *msg_base; - /* - * The Windows team has advised that we check for events - * before checking for messages. This is the way they do it - * in Windows when running as a guest in Hyper-V - */ - sc->vmbus_event_proc(sc, cpu); - - /* Check if there are actual msgs to be process */ msg_base = VMBUS_PCPU_GET(sc, message, cpu); - msg = msg_base + HV_VMBUS_TIMER_SINT; - /* we call eventtimer process the message */ + /* + * Check event timer. + * + * TODO: move this to independent IDT vector. + */ + msg = msg_base + VMBUS_SINT_TIMER; if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) { msg->header.message_type = HV_MESSAGE_TYPE_NONE; - /* call intrrupt handler of event timer */ - hv_et_intr(frame); + vmbus_et_intr(frame); /* * Make sure the write to message_type (ie set to @@ -175,8 +164,20 @@ hv_vmbus_isr(struct vmbus_softc *sc, str } } - msg = msg_base + HV_VMBUS_MESSAGE_SINT; - if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) { + /* + * Check events. Hot path for network and storage I/O data; high rate. + * + * NOTE: + * As recommended by the Windows guest fellows, we check events before + * checking messages. + */ + sc->vmbus_event_proc(sc, cpu); + + /* + * Check messages. Mainly management stuffs; ultra low rate. + */ + msg = msg_base + VMBUS_SINT_MESSAGE; + if (__predict_false(msg->header.message_type != HV_MESSAGE_TYPE_NONE)) { taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu), VMBUS_PCPU_PTR(sc, message_task, cpu)); } @@ -254,7 +255,7 @@ vmbus_synic_setup(void *xsc) /* * Configure and unmask SINT for message and event flags. */ - sint = MSR_HV_SINT0 + HV_VMBUS_MESSAGE_SINT; + sint = MSR_HV_SINT0 + VMBUS_SINT_MESSAGE; orig = rdmsr(sint); val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI | (orig & MSR_HV_SINT_RSVD_MASK); @@ -263,7 +264,7 @@ vmbus_synic_setup(void *xsc) /* * Configure and unmask SINT for timer. */ - sint = MSR_HV_SINT0 + HV_VMBUS_TIMER_SINT; + sint = MSR_HV_SINT0 + VMBUS_SINT_TIMER; orig = rdmsr(sint); val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI | (orig & MSR_HV_SINT_RSVD_MASK); @@ -292,14 +293,14 @@ vmbus_synic_teardown(void *arg) /* * Mask message and event flags SINT. */ - sint = MSR_HV_SINT0 + HV_VMBUS_MESSAGE_SINT; + sint = MSR_HV_SINT0 + VMBUS_SINT_MESSAGE; orig = rdmsr(sint); wrmsr(sint, orig | MSR_HV_SINT_MASKED); /* * Mask timer SINT. */ - sint = MSR_HV_SINT0 + HV_VMBUS_TIMER_SINT; + sint = MSR_HV_SINT0 + VMBUS_SINT_TIMER; orig = rdmsr(sint); wrmsr(sint, orig | MSR_HV_SINT_MASKED); Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 09:02:50 2016 (r302134) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jun 23 09:03:52 2016 (r302135) @@ -189,8 +189,6 @@ enum { HV_VMBUS_EVENT_PORT_ID = 2, HV_VMBUS_MONITOR_CONNECTION_ID = 3, HV_VMBUS_MONITOR_PORT_ID = 3, - HV_VMBUS_MESSAGE_SINT = 2, - HV_VMBUS_TIMER_SINT = 4, }; #define HV_PRESENT_BIT 0x80000000 @@ -542,12 +540,6 @@ int hv_vmbus_disconnect(void); int hv_vmbus_post_message(void *buffer, size_t buf_size); int hv_vmbus_set_event(hv_vmbus_channel *channel); -/** - * Event Timer interfaces - */ -void hv_et_init(void); -void hv_et_intr(struct trapframe*); - /* Wait for device creation */ void vmbus_scan(void); Modified: stable/10/sys/dev/hyperv/vmbus/hyperv_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hyperv_var.h Thu Jun 23 09:02:50 2016 (r302134) +++ stable/10/sys/dev/hyperv/vmbus/hyperv_var.h Thu Jun 23 09:03:52 2016 (r302135) @@ -29,6 +29,12 @@ #ifndef _HYPERV_VAR_H_ #define _HYPERV_VAR_H_ +#ifndef NANOSEC +#define NANOSEC 1000000000ULL +#endif +#define HYPERV_TIMER_NS_FACTOR 100ULL +#define HYPERV_TIMER_FREQ (NANOSEC / HYPERV_TIMER_NS_FACTOR) + extern u_int hyperv_features; extern u_int hyperv_recommends; Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 09:02:50 2016 (r302134) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jun 23 09:03:52 2016 (r302135) @@ -30,8 +30,21 @@ #define _VMBUS_VAR_H_ #include +#include + #include +/* + * NOTE: DO NOT CHANGE THIS. + */ +#define VMBUS_SINT_MESSAGE 2 +/* + * NOTE: + * - DO NOT set it to the same value as VMBUS_SINT_MESSAGE. + * - DO NOT set it to 0. + */ +#define VMBUS_SINT_TIMER 4 + struct vmbus_pcpu_data { u_long *intr_cnt; /* Hyper-V interrupt counter */ struct vmbus_message *message; /* shared messages */ @@ -77,8 +90,13 @@ vmbus_get_device(void) #define VMBUS_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field #define VMBUS_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field +struct hv_vmbus_channel; +struct trapframe; + void vmbus_on_channel_open(const struct hv_vmbus_channel *); void vmbus_event_proc(struct vmbus_softc *, int); void vmbus_event_proc_compat(struct vmbus_softc *, int); +void vmbus_et_intr(struct trapframe *); + #endif /* !_VMBUS_VAR_H_ */ From owner-svn-src-all@freebsd.org Thu Jun 23 09:04:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8223DB7360A; Thu, 23 Jun 2016 09:04:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59F8F1D46; Thu, 23 Jun 2016 09:04:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N94oGL065974; Thu, 23 Jun 2016 09:04:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N94ovK065973; Thu, 23 Jun 2016 09:04:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606230904.u5N94ovK065973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 Jun 2016 09:04: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: r302136 - stable/10/sys/dev/cpuctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 09:04:51 -0000 Author: kib Date: Thu Jun 23 09:04:50 2016 New Revision: 302136 URL: https://svnweb.freebsd.org/changeset/base/302136 Log: MFC r301962: Always allow loading of cpuctl(4). Modified: stable/10/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/10/sys/dev/cpuctl/cpuctl.c Thu Jun 23 09:03:52 2016 (r302135) +++ stable/10/sys/dev/cpuctl/cpuctl.c Thu Jun 23 09:04:50 2016 (r302136) @@ -67,9 +67,9 @@ static d_ioctl_t cpuctl_ioctl; static int cpuctl_do_msr(int cpu, cpuctl_msr_args_t *data, u_long cmd, struct thread *td); -static void cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data, +static int cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data, struct thread *td); -static void cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data, +static int cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data, struct thread *td); static int cpuctl_do_update(int cpu, cpuctl_update_args_t *data, struct thread *td); @@ -171,8 +171,7 @@ cpuctl_ioctl(struct cdev *dev, u_long cm ret = cpuctl_do_msr(cpu, (cpuctl_msr_args_t *)data, cmd, td); break; case CPUCTL_CPUID: - cpuctl_do_cpuid(cpu, (cpuctl_cpuid_args_t *)data, td); - ret = 0; + ret = cpuctl_do_cpuid(cpu, (cpuctl_cpuid_args_t *)data, td); break; case CPUCTL_UPDATE: ret = priv_check(td, PRIV_CPUCTL_UPDATE); @@ -181,9 +180,8 @@ cpuctl_ioctl(struct cdev *dev, u_long cm ret = cpuctl_do_update(cpu, (cpuctl_update_args_t *)data, td); break; case CPUCTL_CPUID_COUNT: - cpuctl_do_cpuid_count(cpu, (cpuctl_cpuid_count_args_t *)data, - td); - ret = 0; + ret = cpuctl_do_cpuid_count(cpu, + (cpuctl_cpuid_count_args_t *)data, td); break; default: ret = EINVAL; @@ -196,7 +194,7 @@ fail: /* * Actually perform cpuid operation. */ -static void +static int cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data, struct thread *td) { @@ -210,23 +208,30 @@ cpuctl_do_cpuid_count(int cpu, cpuctl_cp bzero(data->data, sizeof(data->data)); DPRINTF("[cpuctl,%d]: retrieving cpuid lev %#0x type %#0x for %d cpu\n", __LINE__, data->level, data->level_type, cpu); +#ifdef __i386__ + if (cpu_id == 0) + return (ENODEV); +#endif oldcpu = td->td_oncpu; is_bound = cpu_sched_is_bound(td); set_cpu(cpu, td); cpuid_count(data->level, data->level_type, data->data); restore_cpu(oldcpu, is_bound, td); + return (0); } -static void +static int cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data, struct thread *td) { cpuctl_cpuid_count_args_t cdata; + int error; cdata.level = data->level; /* Override the level type. */ cdata.level_type = 0; - cpuctl_do_cpuid_count(cpu, &cdata, td); + error = cpuctl_do_cpuid_count(cpu, &cdata, td); bcopy(cdata.data, data->data, sizeof(data->data)); /* Ignore error */ + return (error); } /* @@ -249,6 +254,10 @@ cpuctl_do_msr(int cpu, cpuctl_msr_args_t */ DPRINTF("[cpuctl,%d]: operating on MSR %#0x for %d cpu\n", __LINE__, data->msr, cpu); +#ifdef __i386__ + if ((cpu_feature & CPUID_MSR) == 0) + return (ENODEV); +#endif oldcpu = td->td_oncpu; is_bound = cpu_sched_is_bound(td); set_cpu(cpu, td); @@ -291,7 +300,9 @@ cpuctl_do_update(int cpu, cpuctl_update_ ("[cpuctl,%d]: bad cpu number %d", __LINE__, cpu)); DPRINTF("[cpuctl,%d]: XXX %d", __LINE__, cpu); - cpuctl_do_cpuid(cpu, &args, td); + ret = cpuctl_do_cpuid(cpu, &args, td); + if (ret != 0) + return (ret); ((uint32_t *)vendor)[0] = args.data[1]; ((uint32_t *)vendor)[1] = args.data[3]; ((uint32_t *)vendor)[2] = args.data[2]; @@ -518,11 +529,6 @@ cpuctl_modevent(module_t mod __unused, i switch(type) { case MOD_LOAD: - if ((cpu_feature & CPUID_MSR) == 0) { - if (bootverbose) - printf("cpuctl: not available.\n"); - return (ENODEV); - } if (bootverbose) printf("cpuctl: access to MSR registers/cpuid info.\n"); cpuctl_devs = malloc(sizeof(*cpuctl_devs) * mp_ncpus, M_CPUCTL, From owner-svn-src-all@freebsd.org Thu Jun 23 09:06:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A3BAB736CC; Thu, 23 Jun 2016 09:06:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D03151FB0; Thu, 23 Jun 2016 09:06:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N96CLn066182; Thu, 23 Jun 2016 09:06:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N96CFl066181; Thu, 23 Jun 2016 09:06:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606230906.u5N96CFl066181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 Jun 2016 09:06:12 +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: r302137 - stable/10/usr.sbin/cpucontrol X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 09:06:13 -0000 Author: kib Date: Thu Jun 23 09:06:11 2016 New Revision: 302137 URL: https://svnweb.freebsd.org/changeset/base/302137 Log: MFC r301963: Return usual error indicator to shell. Modified: stable/10/usr.sbin/cpucontrol/cpucontrol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/cpucontrol/cpucontrol.c ============================================================================== --- stable/10/usr.sbin/cpucontrol/cpucontrol.c Thu Jun 23 09:04:50 2016 (r302136) +++ stable/10/usr.sbin/cpucontrol/cpucontrol.c Thu Jun 23 09:06:11 2016 (r302137) @@ -481,5 +481,5 @@ main(int argc, char *argv[]) usage(); /* Only one command can be selected. */ } SLIST_FREE(&datadirs, next, free); - return (error); + return (error == 0 ? 0 : 1); } From owner-svn-src-all@freebsd.org Thu Jun 23 09:13:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F891B73B70; Thu, 23 Jun 2016 09:13:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2782C2846; Thu, 23 Jun 2016 09:13:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N9DGSI069959; Thu, 23 Jun 2016 09:13:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N9DGq2069956; Thu, 23 Jun 2016 09:13:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201606230913.u5N9DGq2069956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 23 Jun 2016 09:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302138 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 09:13:17 -0000 Author: tuexen Date: Thu Jun 23 09:13:15 2016 New Revision: 302138 URL: https://svnweb.freebsd.org/changeset/base/302138 Log: Don't consider the socket when processing an incoming ICMP/ICMP6 packet, which was triggered by an SCTP packet. Whether a socket exists, is just not relevant. Approved by: re (kib) MFC after: 1 week Modified: head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Thu Jun 23 09:06:11 2016 (r302137) +++ head/sys/netinet/sctp_usrreq.c Thu Jun 23 09:13:15 2016 (r302138) @@ -291,8 +291,7 @@ sctp_ctlinput(int cmd, struct sockaddr * SCTP_DEFAULT_VRFID); if ((stcb != NULL) && (net != NULL) && - (inp != NULL) && - (inp->sctp_socket != NULL)) { + (inp != NULL)) { /* Check the verification tag */ if (ntohl(sh->v_tag) != 0) { /* Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Thu Jun 23 09:06:11 2016 (r302137) +++ head/sys/netinet/sctputil.c Thu Jun 23 09:13:15 2016 (r302138) @@ -6965,8 +6965,7 @@ sctp_recv_icmp_tunneled_packet(int cmd, SCTP_DEFAULT_VRFID); if ((stcb != NULL) && (net != NULL) && - (inp != NULL) && - (inp->sctp_socket != NULL)) { + (inp != NULL)) { /* Check the UDP port numbers */ if ((udp->uh_dport != net->port) || (udp->uh_sport != htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)))) { @@ -7092,8 +7091,7 @@ sctp_recv_icmp6_tunneled_packet(int cmd, &inp, &net, 1, SCTP_DEFAULT_VRFID); if ((stcb != NULL) && (net != NULL) && - (inp != NULL) && - (inp->sctp_socket != NULL)) { + (inp != NULL)) { /* Check the UDP port numbers */ if ((udp.uh_dport != net->port) || (udp.uh_sport != htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)))) { Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Thu Jun 23 09:06:11 2016 (r302137) +++ head/sys/netinet6/sctp6_usrreq.c Thu Jun 23 09:13:15 2016 (r302138) @@ -341,8 +341,7 @@ sctp6_ctlinput(int cmd, struct sockaddr &inp, &net, 1, SCTP_DEFAULT_VRFID); if ((stcb != NULL) && (net != NULL) && - (inp != NULL) && - (inp->sctp_socket != NULL)) { + (inp != NULL)) { /* Check the verification tag */ if (ntohl(sh.v_tag) != 0) { /* From owner-svn-src-all@freebsd.org Thu Jun 23 09:23:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C67BCA7903D; Thu, 23 Jun 2016 09:23:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 972B82E11; Thu, 23 Jun 2016 09:23:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5N9Nbxn073681; Thu, 23 Jun 2016 09:23:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5N9Nb6g073680; Thu, 23 Jun 2016 09:23:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201606230923.u5N9Nb6g073680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 23 Jun 2016 09:23:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302139 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 09:23:38 -0000 Author: hselasky Date: Thu Jun 23 09:23:37 2016 New Revision: 302139 URL: https://svnweb.freebsd.org/changeset/base/302139 Log: Use correct Q-counter output array. Sponsored by: Mellanox Technologies Approved by: re (kib) MFC after: 3 days Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Thu Jun 23 09:13:15 2016 (r302138) +++ head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Thu Jun 23 09:23:37 2016 (r302139) @@ -71,7 +71,7 @@ static int mlx5_query_nic_vport_context( int mlx5_vport_alloc_q_counter(struct mlx5_core_dev *mdev, int *counter_set_id) { u32 in[MLX5_ST_SZ_DW(alloc_q_counter_in)]; - u32 out[MLX5_ST_SZ_DW(alloc_q_counter_in)]; + u32 out[MLX5_ST_SZ_DW(alloc_q_counter_out)]; int err; memset(in, 0, sizeof(in)); From owner-svn-src-all@freebsd.org Thu Jun 23 11:55:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9C20B73D53; Thu, 23 Jun 2016 11:55:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB4E4265D; Thu, 23 Jun 2016 11:55:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NBtFRb031975; Thu, 23 Jun 2016 11:55:15 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NBtFor031974; Thu, 23 Jun 2016 11:55:15 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606231155.u5NBtFor031974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 23 Jun 2016 11:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302140 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 11:55:17 -0000 Author: bz Date: Thu Jun 23 11:55:15 2016 New Revision: 302140 URL: https://svnweb.freebsd.org/changeset/base/302140 Log: In VNET TCP teardown Do not sleep unconditionally but only if we have any TCP connections left. Submitted by: zec Approved by: re (hrs) MFC after: 13 days Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu Jun 23 09:23:37 2016 (r302139) +++ head/sys/netinet/tcp_subr.c Thu Jun 23 11:55:15 2016 (r302140) @@ -739,10 +739,11 @@ tcp_destroy(void *unused __unused) * Sleep to let all tcpcb timers really disappear and cleanup. */ do { - pause("tcpdes", hz/10); INP_LIST_RLOCK(&V_tcbinfo); n = V_tcbinfo.ipi_count; INP_LIST_RUNLOCK(&V_tcbinfo); + if (n != 0) + pause("tcpdes", hz / 10); } while (n != 0); tcp_hc_destroy(); syncache_destroy(); From owner-svn-src-all@freebsd.org Thu Jun 23 12:01:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B5DFB73624; Thu, 23 Jun 2016 12:01:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DCA52FDF; Thu, 23 Jun 2016 12:01:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id D1E6F25D37C2; Thu, 23 Jun 2016 12:01:30 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id BD775D1F827; Thu, 23 Jun 2016 12:01:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id q0pnQXFj4MLF; Thu, 23 Jun 2016 12:01:27 +0000 (UTC) Received: from [192.168.124.1] (unknown [IPv6:fde9:577b:c1a9:4410:21bf:e4ab:2432:b9]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 0908AD1F825; Thu, 23 Jun 2016 11:59:26 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Marko Zec" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302099 - head/sys/netinet Date: Thu, 23 Jun 2016 11:59:24 +0000 Message-ID: <1875471F-E650-4A29-89A5-D60DAD926C9F@FreeBSD.org> In-Reply-To: <20160623101757.3e8022fe@x23> References: <201606230034.u5N0Y3Ea069103@repo.freebsd.org> <20160623101757.3e8022fe@x23> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Mailer: MailMate Trial (2.0BETAr6032) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 12:01:40 -0000 On 23 Jun 2016, at 8:17, Marko Zec wrote: > On Thu, 23 Jun 2016 00:34:03 +0000 > "Bjoern A. Zeeb" wrote: > >> Author: bz >> Date: Thu Jun 23 00:34:03 2016 >> New Revision: 302099 >> URL: https://svnweb.freebsd.org/changeset/base/302099 >> >> Log: >> Check the V_tcbinfo.ipi_count to hit 0 before doing the full TCP >> cleanup. That way timers can finish cleanly and we do not gamble with >> a DELAY(). >> Reviewed by: gnn, jtl >> Approved by: re (gjb) >> Obtained from: projects/vnet >> MFC after: 2 weeks >> Sponsored by: The FreeBSD Foundation >> Differential Revision: https://reviews.freebsd.org/D6923 > > As much as this change is welcome, it unnecesarily introduces a > mandatory 100 ms delay on each vnet teardown, which I already pointed > out in a comment to r301601 two weeks ago, which remained unanswered, sorry about that. While VNET teardown is a non-criticial slow path and the pause doesn’t really matter a lot (unless you need the resources to be freed) you actually made me go an “benchmark” this in terms of how often my test cases do run into the pause after your change. It was indeed very rare. > along with the question why a delay of 100 ms was introduced here, when > before r302099 the delay was only a single clock tick? And furthermore > the delay computation expresion here is not style(9) compliant... > > Hence, please rectify the above objections, perhaps by something like: Done. Thanks a lot! /bz From owner-svn-src-all@freebsd.org Thu Jun 23 15:02:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FD1BB72740; Thu, 23 Jun 2016 15:02:59 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3A6E1A28; Thu, 23 Jun 2016 15:02:58 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NF2wXb003208; Thu, 23 Jun 2016 15:02:58 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NF2v1g003203; Thu, 23 Jun 2016 15:02:57 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201606231502.u5NF2v1g003203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 23 Jun 2016 15:02:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302141 - in head/cddl/lib: libavl libctf libnvpair libumem libuutil X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 15:02:59 -0000 Author: asomers Date: Thu Jun 23 15:02:57 2016 New Revision: 302141 URL: https://svnweb.freebsd.org/changeset/base/302141 Log: Raise the WARNS level in cddl/lib cddl/lib/libavl/Makefile cddl/lib/libctf/Makefile cddl/lib/libnvpair/Makefile cddl/lib/libumem/Makefile cddl/lib/libuutil/Makefile Increase WARNS to the highest working level for each of these libraries Approved by: re (gjb, hrs) MFC after: 4 weeks Sponsored by: Spectra Logic Corp Modified: head/cddl/lib/libavl/Makefile head/cddl/lib/libctf/Makefile head/cddl/lib/libnvpair/Makefile head/cddl/lib/libumem/Makefile head/cddl/lib/libuutil/Makefile Modified: head/cddl/lib/libavl/Makefile ============================================================================== --- head/cddl/lib/libavl/Makefile Thu Jun 23 11:55:15 2016 (r302140) +++ head/cddl/lib/libavl/Makefile Thu Jun 23 15:02:57 2016 (r302141) @@ -4,7 +4,7 @@ LIB= avl SRCS= avl.c -WARNS?= 0 +WARNS?= 3 CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common Modified: head/cddl/lib/libctf/Makefile ============================================================================== --- head/cddl/lib/libctf/Makefile Thu Jun 23 11:55:15 2016 (r302140) +++ head/cddl/lib/libctf/Makefile Thu Jun 23 15:02:57 2016 (r302141) @@ -18,7 +18,7 @@ SRCS= ctf_create.c \ ctf_util.c MAN= ctf.5 -WARNS?= 0 +WARNS?= 2 CFLAGS+= -DCTF_OLD_VERSIONS CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \ Modified: head/cddl/lib/libnvpair/Makefile ============================================================================== --- head/cddl/lib/libnvpair/Makefile Thu Jun 23 11:55:15 2016 (r302140) +++ head/cddl/lib/libnvpair/Makefile Thu Jun 23 15:02:57 2016 (r302141) @@ -12,7 +12,7 @@ SRCS= libnvpair.c \ opensolaris_nvpair.c \ opensolaris_nvpair_alloc_fixed.c -WARNS?= 0 +WARNS?= 1 CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris Modified: head/cddl/lib/libumem/Makefile ============================================================================== --- head/cddl/lib/libumem/Makefile Thu Jun 23 11:55:15 2016 (r302140) +++ head/cddl/lib/libumem/Makefile Thu Jun 23 15:02:57 2016 (r302141) @@ -4,7 +4,7 @@ LIB= umem SRCS= umem.c -WARNS?= 0 +WARNS?= 3 CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem .include Modified: head/cddl/lib/libuutil/Makefile ============================================================================== --- head/cddl/lib/libuutil/Makefile Thu Jun 23 11:55:15 2016 (r302140) +++ head/cddl/lib/libuutil/Makefile Thu Jun 23 15:02:57 2016 (r302141) @@ -15,7 +15,7 @@ SRCS= avl.c \ uu_pname.c \ uu_strtoint.c -WARNS?= 0 +WARNS?= 1 CFLAGS+= -DNATIVE_BUILD CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris From owner-svn-src-all@freebsd.org Thu Jun 23 15:57:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1690AC59FA; Thu, 23 Jun 2016 15:57:58 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id A349B1B96; Thu, 23 Jun 2016 15:57:58 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id 58170174F8; Thu, 23 Jun 2016 08:57:52 -0700 (PDT) Date: Thu, 23 Jun 2016 08:57:52 -0700 From: hiren panchasara To: "Andrey V. Elsukov" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302081 - head/sys/netinet6 Message-ID: <20160623155752.GC60812@strugglingcoder.info> References: <201606221129.u5MBTMun071427@repo.freebsd.org> <20160622154613.GR60812@strugglingcoder.info> <576BA265.2060104@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="z3ND3gJe4e1E4uwh" Content-Disposition: inline In-Reply-To: <576BA265.2060104@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 15:57:58 -0000 --z3ND3gJe4e1E4uwh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 06/23/16 at 11:48P, Andrey V. Elsukov wrote: > On 22.06.16 18:46, hiren panchasara wrote: > >> Fix the NULL pointer dereference for unresolved link layer entries in > >> the netinet6 code. Copy link layer address only when corresponding e= ntry > >> has LLE_VALID flag. > >> =20 > >> PR: 210379 > >> Approved by: re (kib) > >> > >> Modified: > >> head/sys/netinet6/in6.c > >=20 > > Cursory look tells me that this bug is also present in 10. Is that true? > > If so, is it possible for you to mfc this? >=20 > The patch is applicable, but due to the difference in the LLE code > stable/10 has not affected with this bug. Ah, okay. Thanks a lot for checking. Cheers, Hiren --z3ND3gJe4e1E4uwh Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJXbAb9XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/lAU8H/0yn9lAe4Va0/jRMkFV6pquM fxwfY9Dc32m3TUDQ766Kn3cbosXCGJHYEQVWNT1TUMtfXEpNLgOVd0k+Olk1bLwV pvVBjxzyV/lkRJw1j1PlW4EwMvi82qv+OJf/+NnEgxCsE6JjTkRTyA1Yl05rd3Bx fp4M/bGuBe7Ke3a+0ho1Wqwa9OUk73j0I+QqMXI/YZ21z87Td5Y4O3A9keaPBHTW 9ZTD6/9amyG9fU7PeXfjQ447pxizLiSJGHLsqa74yBEDz2pEHiythGLjcHoW8U9K zWguV67/6AulkXZk+9gks35p8uMX/aeZj5XNczVW0dtZgKegowtRmnqahicobk0= =o0Si -----END PGP SIGNATURE----- --z3ND3gJe4e1E4uwh-- From owner-svn-src-all@freebsd.org Thu Jun 23 16:55:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BBE0B73CA9; Thu, 23 Jun 2016 16:55:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37BBA2D60; Thu, 23 Jun 2016 16:55:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 069E9B923; Thu, 23 Jun 2016 12:55:05 -0400 (EDT) From: John Baldwin To: Marko Zec Cc: "Bjoern A. Zeeb" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, gnn@freebsd.org, jtl@freebsd.org, gjb@freebsd.org Subject: Re: svn commit: r302099 - head/sys/netinet Date: Thu, 23 Jun 2016 09:54:35 -0700 Message-ID: <2792317.yMOeJVR7no@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20160623101757.3e8022fe@x23> References: <201606230034.u5N0Y3Ea069103@repo.freebsd.org> <20160623101757.3e8022fe@x23> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 23 Jun 2016 12:55:05 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 16:55:06 -0000 On Thursday, June 23, 2016 10:17:57 AM Marko Zec wrote: > On Thu, 23 Jun 2016 00:34:03 +0000 > "Bjoern A. Zeeb" wrote: > > > Author: bz > > Date: Thu Jun 23 00:34:03 2016 > > New Revision: 302099 > > URL: https://svnweb.freebsd.org/changeset/base/302099 > > > > Log: > > Check the V_tcbinfo.ipi_count to hit 0 before doing the full TCP > > cleanup. That way timers can finish cleanly and we do not gamble with > > a DELAY(). > > Reviewed by: gnn, jtl > > Approved by: re (gjb) > > Obtained from: projects/vnet > > MFC after: 2 weeks > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D6923 > > As much as this change is welcome, it unnecesarily introduces a > mandatory 100 ms delay on each vnet teardown, which I already pointed > out in a comment to r301601 two weeks ago, which remained unanswered, > along with the question why a delay of 100 ms was introduced here, when > before r302099 the delay was only a single clock tick? And furthermore > the delay computation expresion here is not style(9) compliant... > > Hence, please rectify the above objections, perhaps by something like: > > =================================================================== > --- tcp_subr.c (revision 302126) > +++ tcp_subr.c (working copy) > @@ -739,10 +739,11 @@ > * Sleep to let all tcpcb timers really disappear and cleanup. > */ > do { > - pause("tcpdes", hz/10); > INP_LIST_RLOCK(&V_tcbinfo); > n = V_tcbinfo.ipi_count; > INP_LIST_RUNLOCK(&V_tcbinfo); > + if (n != 0) > + pause("tcpdes", hz / 100); > } while (n != 0); > tcp_hc_destroy(); > syncache_destroy(); I would suggest avoiding the duplicate test by using a break: for (;;) { /* fetch 'n' */ if (n == 0) break; pause(...); } -- John Baldwin From owner-svn-src-all@freebsd.org Thu Jun 23 16:55:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C08FFB73CAE; Thu, 23 Jun 2016 16:55:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0F052D70; Thu, 23 Jun 2016 16:55:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B8DD2B945; Thu, 23 Jun 2016 12:55:06 -0400 (EDT) From: John Baldwin To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302094 - in head/sys: compat/freebsd32 kern Date: Thu, 23 Jun 2016 09:52:58 -0700 Message-ID: <1867573.VqAxCqRXft@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20160623003948.GB41630@spindle.one-eyed-alien.net> References: <201606222115.u5MLFxBD093628@repo.freebsd.org> <5096414.4TN0ypqLNM@ralph.baldwin.cx> <20160623003948.GB41630@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 23 Jun 2016 12:55:06 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 16:55:07 -0000 On Thursday, June 23, 2016 12:39:48 AM Brooks Davis wrote: > On Wed, Jun 22, 2016 at 05:09:34PM -0700, John Baldwin wrote: > > On Wednesday, June 22, 2016 09:15:59 PM Brooks Davis wrote: > > > Author: brooks > > > Date: Wed Jun 22 21:15:59 2016 > > > New Revision: 302094 > > > URL: https://svnweb.freebsd.org/changeset/base/302094 > > > > > > Log: > > > Mark the pipe() system call as COMPAT10. > > > > > > As of r302092 libc uses pipe2() with a zero flags value instead of pipe(). > > > > > > Commit with regenerated files and implementation to follow. > > > > This breaks the build on at least i386 because other ABIs depend on being > > able to call sys_pipe directly. You should at least add COMPAT_FREEBSD10 > > to GENERIC on architectures that shipped a 10.x release. That will fix the > > build breakage on i386, but it's also the policy we follow for all the other > > compat knobs. > > It was actually that sys_pipe() was renamed by the COMPAT10 tag. I've > copied the implementation to a svr4_pipe(). Thanks, my bad for jumping the gun on assuming FREEBSD10 was missing from GENERIC. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Jun 23 18:04:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2929B73EED; Thu, 23 Jun 2016 18:04:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8068F1236; Thu, 23 Jun 2016 18:04:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NI4mmm072084; Thu, 23 Jun 2016 18:04:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NI4mEb072083; Thu, 23 Jun 2016 18:04:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201606231804.u5NI4mEb072083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 23 Jun 2016 18:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302145 - head/usr.sbin/bsdinstall/partedit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 18:04:49 -0000 Author: emaste Date: Thu Jun 23 18:04:48 2016 New Revision: 302145 URL: https://svnweb.freebsd.org/changeset/base/302145 Log: bsdinstall: increase EFI partition size to 200MB A larger EFI file system size will facilitate multi-boot configurations and the installation other EFI applications like firmware update tools. 200MB matches OS X. Note that this changes only the partition size, not the file system that bsdinstall places there. We need to do both, but as the partition size is difficult to adjust later make this change for now so that at least systems installed with FreeBSD 11.0 have a partition layout with room to grow. Reviewed by: allanjude, imp Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6935 Modified: head/usr.sbin/bsdinstall/partedit/partedit_x86.c Modified: head/usr.sbin/bsdinstall/partedit/partedit_x86.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/partedit_x86.c Thu Jun 23 16:37:43 2016 (r302144) +++ head/usr.sbin/bsdinstall/partedit/partedit_x86.c Thu Jun 23 18:04:48 2016 (r302145) @@ -99,7 +99,7 @@ bootpart_size(const char *scheme) if (strcmp(x86_bootmethod(), "BIOS") == 0) return (512*1024); else - return (800*1024); + return (200*1024*1024); return (0); } From owner-svn-src-all@freebsd.org Thu Jun 23 19:19:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80903B73E16; Thu, 23 Jun 2016 19:19:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4711F2293; Thu, 23 Jun 2016 19:19:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NJJiLR097934; Thu, 23 Jun 2016 19:19:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NJJidh097933; Thu, 23 Jun 2016 19:19:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201606231919.u5NJJidh097933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 23 Jun 2016 19:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302146 - head/tools/tools/makeroot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 19:19:45 -0000 Author: emaste Date: Thu Jun 23 19:19:44 2016 New Revision: 302146 URL: https://svnweb.freebsd.org/changeset/base/302146 Log: makeroot: zero out subsecond component of time= keywords They are currently not supported by makefs(1). PR: 194703 Reviewed by: brooks Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6925 Modified: head/tools/tools/makeroot/makeroot.sh Modified: head/tools/tools/makeroot/makeroot.sh ============================================================================== --- head/tools/tools/makeroot/makeroot.sh Thu Jun 23 18:04:48 2016 (r302145) +++ head/tools/tools/makeroot/makeroot.sh Thu Jun 23 19:19:44 2016 (r302146) @@ -238,5 +238,9 @@ if [ -n "${SIZE}" ]; then SIZEFLAG="-s ${SIZE}" fi +# Zero out subsecond component of time= keywords as they are currently not +# supported by makefs +sed -i '' -E 's/(time=[0-9]*)\.[0-9]*/\1.0/' ${manifest} + cd ${BSDROOT}; makefs ${DUPFLAG} -N ${DBDIR} ${SIZEFLAG} ${BFLAG} \ -t ffs ${LABELFLAG} -f 256 ${IMGFILE} ${manifest} From owner-svn-src-all@freebsd.org Thu Jun 23 19:24:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72546B73225; Thu, 23 Jun 2016 19:24:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FB75194F; Thu, 23 Jun 2016 19:24:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NJOcS9001901; Thu, 23 Jun 2016 19:24:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NJOc9J001900; Thu, 23 Jun 2016 19:24:38 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201606231924.u5NJOc9J001900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 23 Jun 2016 19:24:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302147 - head/sys/x86/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 19:24:39 -0000 Author: markj Date: Thu Jun 23 19:24:38 2016 New Revision: 302147 URL: https://svnweb.freebsd.org/changeset/base/302147 Log: Use M_NOWAIT when allocating memory for the ACPI wakeup handler. If the allocation attempt fails, we may otherwise VM_WAIT after a failed attempt to reclaim contiguous memory in the requested range. After r297466, this results in the thread going to sleep, causing a hang during boot. Reviewed by: jkim, kib Approved by: re (gjb) Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6945 Modified: head/sys/x86/acpica/acpi_wakeup.c Modified: head/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- head/sys/x86/acpica/acpi_wakeup.c Thu Jun 23 19:19:44 2016 (r302146) +++ head/sys/x86/acpica/acpi_wakeup.c Thu Jun 23 19:24:38 2016 (r302147) @@ -322,7 +322,7 @@ acpi_alloc_wakeup_handler(void) * page-aligned. */ wakeaddr = contigmalloc((ACPI_PAGETABLES + 1) * PAGE_SIZE, M_DEVBUF, - M_WAITOK, 0x500, 0xa0000, PAGE_SIZE, 0ul); + M_NOWAIT, 0x500, 0xa0000, PAGE_SIZE, 0ul); if (wakeaddr == NULL) { printf("%s: can't alloc wake memory\n", __func__); return (NULL); From owner-svn-src-all@freebsd.org Thu Jun 23 19:27:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34332B73317; Thu, 23 Jun 2016 19:27:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D859224A1; Thu, 23 Jun 2016 19:27:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NJRTbY002037; Thu, 23 Jun 2016 19:27:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NJRTpk002036; Thu, 23 Jun 2016 19:27:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201606231927.u5NJRTpk002036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 23 Jun 2016 19:27:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302148 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 19:27:31 -0000 Author: tuexen Date: Thu Jun 23 19:27:29 2016 New Revision: 302148 URL: https://svnweb.freebsd.org/changeset/base/302148 Log: Fix a bug in the handling of non-blocking SCTP 1-to-1 sockets. When using this code in the userland stack, it could result in a loop. This happened on iOS. However, I was not able to reproduce this when using the code in the kernel. Thanks to Eugen-Andrei Gavriloaie for reporting the issue and proving detailed information to find the root of the problem. Approved by: re (gjb) MFC after: 1 week Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Thu Jun 23 19:24:38 2016 (r302147) +++ head/sys/netinet/sctputil.c Thu Jun 23 19:27:29 2016 (r302148) @@ -5274,8 +5274,14 @@ restart_nosblocks: } } } - if ((so->so_rcv.sb_cc <= held_length) && block_allowed) { - /* we need to wait for data */ + if (so->so_rcv.sb_cc <= held_length) { + if (so->so_error) { + error = so->so_error; + if ((in_flags & MSG_PEEK) == 0) { + so->so_error = 0; + } + goto out; + } if ((so->so_rcv.sb_cc == 0) && ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { @@ -5306,51 +5312,18 @@ restart_nosblocks: goto out; } } - error = sbwait(&so->so_rcv); - if (error) { - goto out; - } - held_length = 0; - goto restart_nosblocks; - } else if (so->so_rcv.sb_cc == 0) { - if (so->so_error) { - error = so->so_error; - if ((in_flags & MSG_PEEK) == 0) - so->so_error = 0; - } else { - if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || - (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { - if ((inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) == 0) { - /* - * For active open side clear flags - * for re-use passive open is - * blocked by connect. - */ - if (inp->sctp_flags & SCTP_PCB_FLAGS_WAS_ABORTED) { - /* - * You were aborted, passive - * side always hits here - */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, ECONNRESET); - error = ECONNRESET; - } - so->so_state &= ~(SS_ISCONNECTING | - SS_ISDISCONNECTING | - SS_ISCONFIRMING | - SS_ISCONNECTED); - if (error == 0) { - if ((inp->sctp_flags & SCTP_PCB_FLAGS_WAS_CONNECTED) == 0) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, ENOTCONN); - error = ENOTCONN; - } - } - goto out; - } + if (block_allowed) { + error = sbwait(&so->so_rcv); + if (error) { + goto out; } + held_length = 0; + goto restart_nosblocks; + } else { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EWOULDBLOCK); error = EWOULDBLOCK; + goto out; } - goto out; } if (hold_sblock == 1) { SOCKBUF_UNLOCK(&so->so_rcv); From owner-svn-src-all@freebsd.org Thu Jun 23 19:37:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D23EBB73548; Thu, 23 Jun 2016 19:37:01 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 914942A02; Thu, 23 Jun 2016 19:37:01 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NJb0eD005773; Thu, 23 Jun 2016 19:37:00 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NJb03I005772; Thu, 23 Jun 2016 19:37:00 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201606231937.u5NJb03I005772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Thu, 23 Jun 2016 19:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302149 - head/etc/defaults X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 19:37:01 -0000 Author: lidl Date: Thu Jun 23 19:37:00 2016 New Revision: 302149 URL: https://svnweb.freebsd.org/changeset/base/302149 Log: Add support for a /etc/defaults/vendor.conf override file Reviewed by: stas, imp Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D6895 Modified: head/etc/defaults/rc.conf Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Thu Jun 23 19:27:29 2016 (r302148) +++ head/etc/defaults/rc.conf Thu Jun 23 19:37:00 2016 (r302149) @@ -741,3 +741,9 @@ if [ -z "${source_rc_confs_defined}" ]; done } fi + +# Allow vendors to override FreeBSD defaults in /etc/default/rc.conf +# without the need to carefully manage /etc/rc.conf. +if [ -r /etc/defaults/vendor.conf ]; then + . /etc/defaults/vendor.conf +fi From owner-svn-src-all@freebsd.org Thu Jun 23 20:06:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93F45B73A3A; Thu, 23 Jun 2016 20:06:00 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F48D1DCD; Thu, 23 Jun 2016 20:06:00 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NK5xGm017066; Thu, 23 Jun 2016 20:05:59 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NK5xTc017063; Thu, 23 Jun 2016 20:05:59 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201606232005.u5NK5xTc017063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 23 Jun 2016 20:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302150 - in head/sys: geom sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 20:06:00 -0000 Author: ken Date: Thu Jun 23 20:05:59 2016 New Revision: 302150 URL: https://svnweb.freebsd.org/changeset/base/302150 Log: Switch geom_disk over to using a pool mutex. The GEOM disk d_mtx is only acquired on disk creation and destruction. It is a good candidate for replacement with a pool mutex. This eliminates the mutex initialization and teardown and the mutex and name variables themselves from struct disk. sys/geom/geom_disk.h: Take d_mtx and d_mtx_name out of struct disk. sys/geom/geom_disk.c: Use mtx_pool_lock() and mtx_pool_unlock() to guard the disk initialization state instead of a dedicated mutex. This allows removing the initialization and destruction of d_mtx. sys/sys/param.h: Bump __FreeBSD_version to 1100119 for the change to struct disk. Suggested by: jhb Sponsored by: Spectra Logic Approved by: re (gjb) Modified: head/sys/geom/geom_disk.c head/sys/geom/geom_disk.h head/sys/sys/param.h Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Thu Jun 23 19:37:00 2016 (r302149) +++ head/sys/geom/geom_disk.c Thu Jun 23 20:05:59 2016 (r302150) @@ -670,7 +670,7 @@ g_disk_create(void *arg, int flag) g_topology_assert(); dp = arg; - mtx_lock(&dp->d_mtx); + mtx_pool_lock(mtxpool_sleep, dp); dp->d_init_level = DISK_INIT_START; /* @@ -678,12 +678,12 @@ g_disk_create(void *arg, int flag) * call the user's callback to tell him we've cleaned things up. */ if (dp->d_goneflag != 0) { - mtx_unlock(&dp->d_mtx); + mtx_pool_unlock(mtxpool_sleep, dp); if (dp->d_gone != NULL) dp->d_gone(dp); return; } - mtx_unlock(&dp->d_mtx); + mtx_pool_unlock(mtxpool_sleep, dp); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); mtx_init(&sc->start_mtx, "g_disk_start", NULL, MTX_DEF); @@ -721,7 +721,7 @@ g_disk_create(void *arg, int flag) dp->d_geom = gp; g_error_provider(pp, 0); - mtx_lock(&dp->d_mtx); + mtx_pool_lock(mtxpool_sleep, dp); dp->d_init_level = DISK_INIT_DONE; /* @@ -729,11 +729,11 @@ g_disk_create(void *arg, int flag) * process for it. */ if (dp->d_goneflag != 0) { - mtx_unlock(&dp->d_mtx); + mtx_pool_unlock(mtxpool_sleep, dp); g_wither_provider(pp, ENXIO); return; } - mtx_unlock(&dp->d_mtx); + mtx_pool_unlock(mtxpool_sleep, dp); } @@ -786,8 +786,6 @@ g_disk_destroy(void *ptr, int flag) g_wither_geom(gp, ENXIO); } - mtx_destroy(&dp->d_mtx); - g_free(dp); } @@ -852,9 +850,6 @@ disk_create(struct disk *dp, int version DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); dp->d_geom = NULL; - snprintf(dp->d_mtx_name, sizeof(dp->d_mtx_name), "%s%ddlk", - dp->d_name, dp->d_unit); - mtx_init(&dp->d_mtx, dp->d_mtx_name, NULL, MTX_DEF); dp->d_init_level = DISK_INIT_NONE; g_disk_ident_adjust(dp->d_ident, sizeof(dp->d_ident)); @@ -878,7 +873,7 @@ disk_gone(struct disk *dp) struct g_geom *gp; struct g_provider *pp; - mtx_lock(&dp->d_mtx); + mtx_pool_lock(mtxpool_sleep, dp); dp->d_goneflag = 1; /* @@ -897,10 +892,10 @@ disk_gone(struct disk *dp) * has not been fully setup in any case. */ if (dp->d_init_level < DISK_INIT_DONE) { - mtx_unlock(&dp->d_mtx); + mtx_pool_unlock(mtxpool_sleep, dp); return; } - mtx_unlock(&dp->d_mtx); + mtx_pool_unlock(mtxpool_sleep, dp); gp = dp->d_geom; if (gp != NULL) { Modified: head/sys/geom/geom_disk.h ============================================================================== --- head/sys/geom/geom_disk.h Thu Jun 23 19:37:00 2016 (r302149) +++ head/sys/geom/geom_disk.h Thu Jun 23 20:05:59 2016 (r302150) @@ -72,8 +72,6 @@ struct disk { struct devstat *d_devstat; int d_goneflag; int d_destroyed; - struct mtx d_mtx; - char d_mtx_name[24]; disk_init_level d_init_level; /* Shared fields */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Jun 23 19:37:00 2016 (r302149) +++ head/sys/sys/param.h Thu Jun 23 20:05:59 2016 (r302150) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100118 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100119 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Thu Jun 23 20:59:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B176CB73574; Thu, 23 Jun 2016 20:59:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7EA111730; Thu, 23 Jun 2016 20:59:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NKxDMJ040642; Thu, 23 Jun 2016 20:59:13 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NKxDOO040641; Thu, 23 Jun 2016 20:59:13 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201606232059.u5NKxDOO040641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Thu, 23 Jun 2016 20:59:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302151 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 20:59:14 -0000 Author: jilles Date: Thu Jun 23 20:59:13 2016 New Revision: 302151 URL: https://svnweb.freebsd.org/changeset/base/302151 Log: posixshm: Fix lock leak when mac_posixshm_check_read rejects read. While reading the code, I noticed that shm_read() returns without unlocking foffset and rangelock if mac_posixshm_check_read() rejects the read. Reviewed by: kib, jhb, rwatson Approved by: re (gjb) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6927 Modified: head/sys/kern/uipc_shm.c Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Thu Jun 23 20:05:59 2016 (r302150) +++ head/sys/kern/uipc_shm.c Thu Jun 23 20:59:13 2016 (r302151) @@ -295,14 +295,14 @@ shm_read(struct file *fp, struct uio *ui int error; shmfd = fp->f_data; - foffset_lock_uio(fp, uio, flags); - rl_cookie = rangelock_rlock(&shmfd->shm_rl, uio->uio_offset, - uio->uio_offset + uio->uio_resid, &shmfd->shm_mtx); #ifdef MAC error = mac_posixshm_check_read(active_cred, fp->f_cred, shmfd); if (error) return (error); #endif + foffset_lock_uio(fp, uio, flags); + rl_cookie = rangelock_rlock(&shmfd->shm_rl, uio->uio_offset, + uio->uio_offset + uio->uio_resid, &shmfd->shm_mtx); error = uiomove_object(shmfd->shm_object, shmfd->shm_size, uio); rangelock_unlock(&shmfd->shm_rl, rl_cookie, &shmfd->shm_mtx); foffset_unlock_uio(fp, uio, flags); From owner-svn-src-all@freebsd.org Thu Jun 23 21:02:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93666B73706; Thu, 23 Jun 2016 21:02:06 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 658A02530; Thu, 23 Jun 2016 21:02:06 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NL25Er044146; Thu, 23 Jun 2016 21:02:05 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NL259V044145; Thu, 23 Jun 2016 21:02:05 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201606232102.u5NL259V044145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 23 Jun 2016 21:02:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302152 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 21:02:06 -0000 Author: brooks Date: Thu Jun 23 21:02:05 2016 New Revision: 302152 URL: https://svnweb.freebsd.org/changeset/base/302152 Log: Add an UPDATING entry for the pipe() -> pipe2() transition. Approved by: re (gjb) Sponsored by: DARPA, AFRL Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Jun 23 20:59:13 2016 (r302151) +++ head/UPDATING Thu Jun 23 21:02:05 2016 (r302152) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160622: + The the libc stub for the pipe(2) system call has been replaced with + a wrapper which calls the pipe2(2) system call and the pipe(2) is now + only implemented by the kernels which include "options + FREEBSD10_COMPAT" in their config file (this is the default). + Users should ensure that this option is enabled in their kernel + or upgrade userspace to r302092 before upgrading their kernel. + 20160527: CAM will now strip leading spaces from SCSI disks' serial numbers. This will effect users who create UFS filesystems on SCSI disks using From owner-svn-src-all@freebsd.org Thu Jun 23 21:05:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07B2DB737D9 for ; Thu, 23 Jun 2016 21:05:36 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk0-x229.google.com (mail-qk0-x229.google.com [IPv6:2607:f8b0:400d:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B044D220E for ; Thu, 23 Jun 2016 21:05:35 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk0-x229.google.com with SMTP id a186so122882666qkf.0 for ; Thu, 23 Jun 2016 14:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=vL8KRIC2er//avjaTtH/ULMI4w7dIJnpNX6iL9vkRFM=; b=04jmC0tZdwvySMhzsGTQzf+fAezkYvrV/60bGnE010u2Q0DFnFvovEhHAJIsx15Sal a6lp0++/zKjFejUMJ/JqnaVNUMnWA5Tj/cnM/ED/oMsgQRjQUOVMobaGloKKjxvP1nrj Gdosl3Y1epA8kiOjqcQmhI5Nlj8BF7Hs78+VmxqteyKBLAnGrBEIJ1KQxGxYcF0Da6vZ cr7Bddu0PjgoyPWB7KRx1wIFct8SDsrxGDdkC2uyqLC1REKRAo89ebROUttnWqkvnkIe FHTqi5ACCTrOK35zNjT89rpKqq8QMTxW9H/p+IguQjg1Nz2mLXhV52FVyqanCF4uBXRZ EXwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=vL8KRIC2er//avjaTtH/ULMI4w7dIJnpNX6iL9vkRFM=; b=MRK+c7sKlXr/POE/phq4MF38FzpkNIeOXHGF452FRlS+kyoXAo25ti+6rMVrEupaNr fZbJ6/lIoWohi1fH2W3OsLNmV9XmlYtjh/+d9Q1X8MzZUgzFsEb04PhTnkzwrD2SSZo0 3s1+BM8SGhXEyRuGI5xITGmAiOdugRrEminTuZDVjIbHf4As3bxKNMZiP7WTnwrar/2w DU0/OGWnohby4HfWh/MiVK4As08n9i6M1e+b4wn5vREWgISLPpQ1zGx7zq+Xj/PNo2W3 /KZt1xfol5DwXqh44/OjFZgV70ad4eGYpf3p+U8iON0WVR3GyTN6iT5nIBKoRhEVXgKZ 4Vvw== X-Gm-Message-State: ALyK8tKgyRMiBao9yITRRLBqKK2UcsCGIDKeZOJcrTRedhJQcksCH5LgvhDNbExuMIcGDUDB X-Received: by 10.55.59.196 with SMTP id i187mr638540qka.167.1466715934622; Thu, 23 Jun 2016 14:05:34 -0700 (PDT) Received: from ?IPv6:2001:470:e290:1:39a5:20df:41d9:eebb? ([2001:470:e290:1:39a5:20df:41d9:eebb]) by smtp.gmail.com with ESMTPSA id x136sm773064qkb.32.2016.06.23.14.05.33 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Jun 2016 14:05:33 -0700 (PDT) Subject: Re: svn commit: r302152 - head Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_505E6EE3-C4D0-4B98-83B1-B8FBC77ACDC0"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.6b2 From: Shawn Webb In-Reply-To: <201606232102.u5NL259V044145@repo.freebsd.org> Date: Thu, 23 Jun 2016 17:05:28 -0400 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <32BAEECA-9CDB-4199-89AF-4BDB31E39343@hardenedbsd.org> References: <201606232102.u5NL259V044145@repo.freebsd.org> To: Brooks Davis X-Mailer: Apple Mail (2.3124) X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 21:05:36 -0000 --Apple-Mail=_505E6EE3-C4D0-4B98-83B1-B8FBC77ACDC0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hey Brooks, > On Jun 23, 2016, at 5:02 PM, Brooks Davis wrote: >=20 > Author: brooks > Date: Thu Jun 23 21:02:05 2016 > New Revision: 302152 > URL: https://svnweb.freebsd.org/changeset/base/302152 >=20 > Log: > Add an UPDATING entry for the pipe() -> pipe2() transition. >=20 > Approved by: re (gjb) > Sponsored by: DARPA, AFRL >=20 > Modified: > head/UPDATING >=20 > Modified: head/UPDATING > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/UPDATING Thu Jun 23 20:59:13 2016 (r302151) > +++ head/UPDATING Thu Jun 23 21:02:05 2016 (r302152) > @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) >=20 > +20160622: > + The the libc stub for the pipe(2) system call has been replaced = with > + a wrapper which calls the pipe2(2) system call and the pipe(2) = is now > + only implemented by the kernels which include "options > + FREEBSD10_COMPAT" in their config file (this is the default). The option is COMPAT_FREEBSD10, not FREEBSD10_COMPAT. Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --Apple-Mail=_505E6EE3-C4D0-4B98-83B1-B8FBC77ACDC0 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----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXbE8bAAoJEGqEZY9SRW7uOYUP/1KCcF0SYaT0Jv3mHbD55lnU Iez3uyD2z4339B0nCqk50TE6Wkvro9Vlq10gbwmHm6JMNb+eyM9e0OGdmwTlIgST MBTSJvB5gFogS+q3jK3QN4jyNsgNMQYwoeuLnXyxo/thPEMD77Y+nMxmqTRAoKZL BZt17GvcdmKW6v8lFDFQ7Wvhdd4grDrzJ/aPAnXLgRWEn0BW5sE3aR7Sue1PheEy 39S/yRURk3aYJ3KoMiWH/mPTjr/WIdNYQpANAkllFdrykI7156eJz9otb7zrjkJK Kho75hFufGaQEBeAvJn3ARW2LVQglGQDWvnOQTDAg/aGX/MJ24rGSRdPWx7sJSii 0kxS7H2HYPK1wlCV9ToQdixU6IwxnncccQMsCXto4fC+36QzzDc7uw0YWmkMuNLi Cjx1s2uoS7/VXnyUzIWPnNviczkdfZWYjxWDva/h8lI8/id6JfiOG54mtwvv0mrL CzR60f9tek92CO/qwRrYPLTX4NDV1jBlqrYjB+a0soi8n2sCav2i441D1/E+2kPd Z7ORinndWhxdxFddNU+cZloxfm00u6tyfayaGFXpaMwM8fERkA9mezDjGZeyN9Ko rPHEOpGHSBU/d6uGzWCZZeo0ALgcDQziZnaSr1xMezf16ngDEYDnDwKJGKX8oz4y ABh9qijrnaO5zEAme4mY =wLNC -----END PGP SIGNATURE----- --Apple-Mail=_505E6EE3-C4D0-4B98-83B1-B8FBC77ACDC0-- From owner-svn-src-all@freebsd.org Thu Jun 23 21:07:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3EC7B73845; Thu, 23 Jun 2016 21:07:16 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7538C298A; Thu, 23 Jun 2016 21:07:16 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NL7FBP044388; Thu, 23 Jun 2016 21:07:15 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NL7F3b044384; Thu, 23 Jun 2016 21:07:15 GMT (envelope-from np@FreeBSD.org) Message-Id: <201606232107.u5NL7F3b044384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 23 Jun 2016 21:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302153 - in head/sys: net netinet sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 21:07:16 -0000 Author: np Date: Thu Jun 23 21:07:15 2016 New Revision: 302153 URL: https://svnweb.freebsd.org/changeset/base/302153 Log: Add spares to struct ifnet and socket for packet pacing and/or general use. Update comments regarding the spare fields in struct inpcb. Bump __FreeBSD_version for the changes to the size of the structures. Reviewed by: gnn@ Approved by: re@ (gjb@) Sponsored by: Chelsio Communications Modified: head/sys/net/if_var.h head/sys/netinet/in_pcb.h head/sys/sys/param.h head/sys/sys/socketvar.h Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Jun 23 21:02:05 2016 (r302152) +++ head/sys/net/if_var.h Thu Jun 23 21:07:15 2016 (r302153) @@ -311,6 +311,8 @@ struct ifnet { * that structure can be enhanced without changing the kernel * binary interface. */ + void *if_pspare[4]; /* packet pacing / general use */ + int if_ispare[4]; /* packet pacing / general use */ }; /* for compatibility with other BSDs */ Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Thu Jun 23 21:02:05 2016 (r302152) +++ head/sys/netinet/in_pcb.h Thu Jun 23 21:07:15 2016 (r302153) @@ -202,10 +202,10 @@ struct inpcb { u_char inp_ip_minttl; /* (i) minimum TTL or drop */ uint32_t inp_flowid; /* (x) flow id / queue id */ u_int inp_refcount; /* (i) refcount */ - void *inp_pspare[5]; /* (x) route caching / general use */ + void *inp_pspare[5]; /* (x) packet pacing / general use */ uint32_t inp_flowtype; /* (x) M_HASHTYPE value */ uint32_t inp_rss_listen_bucket; /* (x) overridden RSS listen bucket */ - u_int inp_ispare[4]; /* (x) route caching / user cookie / + u_int inp_ispare[4]; /* (x) packet pacing / user cookie / * general use */ /* Local and foreign ports, local and foreign addr. */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Jun 23 21:02:05 2016 (r302152) +++ head/sys/sys/param.h Thu Jun 23 21:07:15 2016 (r302153) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100119 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100120 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/sys/sys/socketvar.h ============================================================================== --- head/sys/sys/socketvar.h Thu Jun 23 21:02:05 2016 (r302152) +++ head/sys/sys/socketvar.h Thu Jun 23 21:07:15 2016 (r302153) @@ -126,6 +126,9 @@ struct socket { */ int so_fibnum; /* routing domain for this socket */ uint32_t so_user_cookie; + + void *so_pspare[2]; /* packet pacing / general use */ + int so_ispare[2]; /* packet pacing / general use */ }; /* From owner-svn-src-all@freebsd.org Thu Jun 23 21:09:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74D4BB7395D; Thu, 23 Jun 2016 21:09:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 427FE220B; Thu, 23 Jun 2016 21:09:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NL97Bu044534; Thu, 23 Jun 2016 21:09:07 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NL97JJ044533; Thu, 23 Jun 2016 21:09:07 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201606232109.u5NL97JJ044533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 23 Jun 2016 21:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302154 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 21:09:08 -0000 Author: brooks Date: Thu Jun 23 21:09:07 2016 New Revision: 302154 URL: https://svnweb.freebsd.org/changeset/base/302154 Log: Fix two typos in r302152. Approved by: re (implicit) Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Jun 23 21:07:15 2016 (r302153) +++ head/UPDATING Thu Jun 23 21:09:07 2016 (r302154) @@ -32,10 +32,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 "ln -s 'abort:false,junk:false' /etc/malloc.conf".) 20160622: - The the libc stub for the pipe(2) system call has been replaced with + The libc stub for the pipe(2) system call has been replaced with a wrapper which calls the pipe2(2) system call and the pipe(2) is now only implemented by the kernels which include "options - FREEBSD10_COMPAT" in their config file (this is the default). + COMPAT_FREEBSD10" in their config file (this is the default). Users should ensure that this option is enabled in their kernel or upgrade userspace to r302092 before upgrading their kernel. From owner-svn-src-all@freebsd.org Thu Jun 23 21:32:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEC86B73F4D; Thu, 23 Jun 2016 21:32:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B6231634; Thu, 23 Jun 2016 21:32:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NLWq4L055900; Thu, 23 Jun 2016 21:32:52 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NLWqdj055899; Thu, 23 Jun 2016 21:32:52 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606232132.u5NLWqdj055899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 23 Jun 2016 21:32:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302155 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 21:32:53 -0000 Author: bz Date: Thu Jun 23 21:32:52 2016 New Revision: 302155 URL: https://svnweb.freebsd.org/changeset/base/302155 Log: Try to avoid a 2nd conditional by re-writing the loop, pause, and escape clause another time. Submitted by: jhb Approved by: re (gjb) MFC after: 12 days Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu Jun 23 21:09:07 2016 (r302154) +++ head/sys/netinet/tcp_subr.c Thu Jun 23 21:32:52 2016 (r302155) @@ -738,13 +738,14 @@ tcp_destroy(void *unused __unused) * up, which means, we should be past the tcp_discardcb() calls. * Sleep to let all tcpcb timers really disappear and cleanup. */ - do { + for (;;) { INP_LIST_RLOCK(&V_tcbinfo); n = V_tcbinfo.ipi_count; INP_LIST_RUNLOCK(&V_tcbinfo); - if (n != 0) - pause("tcpdes", hz / 10); - } while (n != 0); + if (n == 0) + break; + pause("tcpdes", hz / 10); + } tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); From owner-svn-src-all@freebsd.org Thu Jun 23 21:34:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35075B73FD1; Thu, 23 Jun 2016 21:34:13 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id F39E11C29; Thu, 23 Jun 2016 21:34:12 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 9BA86B80DB; Thu, 23 Jun 2016 23:34:10 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 6D24828494; Thu, 23 Jun 2016 23:34:11 +0200 (CEST) Date: Thu, 23 Jun 2016 23:34:11 +0200 From: Jilles Tjoelker To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302092 - in head/lib/libc: aarch64/sys amd64/sys arm/sys i386/sys mips/sys powerpc/sys powerpc64/sys riscv/sys sparc64/sys sys Message-ID: <20160623213411.GB5381@stack.nl> References: <201606222111.u5MLBRHn090827@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201606222111.u5MLBRHn090827@repo.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 21:34:13 -0000 On Wed, Jun 22, 2016 at 09:11:27PM +0000, Brooks Davis wrote: > Author: brooks > Date: Wed Jun 22 21:11:27 2016 > New Revision: 302092 > URL: https://svnweb.freebsd.org/changeset/base/302092 > Log: > Replace use of the pipe(2) system call with pipe2(2) with a zero flags > value. > This eliminates the need for machine dependant assembly wrappers for > pipe(2). I like it. > It also make passing an invalid address to pipe(2) return EFAULT rather > than triggering a segfault. Document this behavior (which was already > true for pipe2(2), but undocumented). It is valid to promise [EFAULT] in this specific case since the kernel undoes the call's effects when the copyout fails (by closing the descriptors) and it seems unlikely that we will need a userland wrapper around pipe() or pipe2() that needs to access the created file descriptors. However, POSIX does not require it: passing invalid pointers to functions specified by the standard is undefined behaviour. See r241001 for some man pages where I removed the [EFAULT] condition because it is wrong for both reasons mentioned above (something changes even after copyout failure and userland wrappers dereference pointers). -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Thu Jun 23 21:34:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2A3EB74019; Thu, 23 Jun 2016 21:34:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6FEA1EC4; Thu, 23 Jun 2016 21:34:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NLYcOO056021; Thu, 23 Jun 2016 21:34:38 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NLYcCP056016; Thu, 23 Jun 2016 21:34:38 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606232134.u5NLYcCP056016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 23 Jun 2016 21:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302156 - in head/sys: net netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 21:34:40 -0000 Author: bz Date: Thu Jun 23 21:34:38 2016 New Revision: 302156 URL: https://svnweb.freebsd.org/changeset/base/302156 Log: Update pf(4) and pflog(4) to survive basic VNET testing, which includes proper virtualisation, teardown, avoiding use-after-free, race conditions, no longer creating a thread per VNET (which could easily be a couple of thousand threads), gracefully ignoring global events (e.g., eventhandlers) on teardown, clearing various globally cached pointers and checking them before use. Reviewed by: kp Approved by: re (gjb) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D6924 Modified: head/sys/net/pfvar.h head/sys/netpfil/pf/if_pflog.c head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf_if.c head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/net/pfvar.h ============================================================================== --- head/sys/net/pfvar.h Thu Jun 23 21:32:52 2016 (r302155) +++ head/sys/net/pfvar.h Thu Jun 23 21:34:38 2016 (r302156) @@ -835,7 +835,6 @@ typedef int pflog_packet_t(struct pfi_ki struct pf_ruleset *, struct pf_pdesc *, int); extern pflog_packet_t *pflog_packet_ptr; -#define V_pf_end_threads VNET(pf_end_threads) #endif /* _KERNEL */ #define PFSYNC_FLAG_SRCNODE 0x04 @@ -1520,6 +1519,7 @@ VNET_DECLARE(uma_zone_t, pf_state_scrub #define V_pf_state_scrub_z VNET(pf_state_scrub_z) extern void pf_purge_thread(void *); +extern void pf_unload_vnet_purge(void); extern void pf_intr(void *); extern void pf_purge_expired_src_nodes(void); @@ -1661,7 +1661,9 @@ VNET_DECLARE(struct pfi_kif *, pfi_all #define V_pfi_all VNET(pfi_all) void pfi_initialize(void); +void pfi_initialize_vnet(void); void pfi_cleanup(void); +void pfi_cleanup_vnet(void); void pfi_kif_ref(struct pfi_kif *); void pfi_kif_unref(struct pfi_kif *); struct pfi_kif *pfi_kif_find(const char *); Modified: head/sys/netpfil/pf/if_pflog.c ============================================================================== --- head/sys/netpfil/pf/if_pflog.c Thu Jun 23 21:32:52 2016 (r302155) +++ head/sys/netpfil/pf/if_pflog.c Thu Jun 23 21:34:38 2016 (r302156) @@ -91,19 +91,22 @@ static int pflogioctl(struct ifnet *, u_ static void pflogstart(struct ifnet *); static int pflog_clone_create(struct if_clone *, int, caddr_t); static void pflog_clone_destroy(struct ifnet *); -static struct if_clone *pflog_cloner; static const char pflogname[] = "pflog"; -struct ifnet *pflogifs[PFLOGIFS_MAX]; /* for fast access */ +static VNET_DEFINE(struct if_clone *, pflog_cloner); +#define V_pflog_cloner VNET(pflog_cloner) + +VNET_DEFINE(struct ifnet *, pflogifs[PFLOGIFS_MAX]); /* for fast access */ +#define V_pflogifs VNET(pflogifs) static void -pflogattach(int npflog) +pflogattach(int npflog __unused) { int i; for (i = 0; i < PFLOGIFS_MAX; i++) - pflogifs[i] = NULL; - pflog_cloner = if_clone_simple(pflogname, pflog_clone_create, + V_pflogifs[i] = NULL; + V_pflog_cloner = if_clone_simple(pflogname, pflog_clone_create, pflog_clone_destroy, 1); } @@ -130,7 +133,7 @@ pflog_clone_create(struct if_clone *ifc, bpfattach(ifp, DLT_PFLOG, PFLOG_HDRLEN); - pflogifs[unit] = ifp; + V_pflogifs[unit] = ifp; return (0); } @@ -141,8 +144,8 @@ pflog_clone_destroy(struct ifnet *ifp) int i; for (i = 0; i < PFLOGIFS_MAX; i++) - if (pflogifs[i] == ifp) - pflogifs[i] = NULL; + if (V_pflogifs[i] == ifp) + V_pflogifs[i] = NULL; bpfdetach(ifp); if_detach(ifp); @@ -206,7 +209,7 @@ pflog_packet(struct pfi_kif *kif, struct if (kif == NULL || m == NULL || rm == NULL || pd == NULL) return ( 1); - if ((ifn = pflogifs[rm->logif]) == NULL || !ifn->if_bpf) + if ((ifn = V_pflogifs[rm->logif]) == NULL || !ifn->if_bpf) return (0); bzero(&hdr, sizeof(hdr)); @@ -259,6 +262,24 @@ pflog_packet(struct pfi_kif *kif, struct return (0); } +static void +vnet_pflog_init(const void *unused __unused) +{ + + pflogattach(1); +} +VNET_SYSINIT(vnet_pflog_init, SI_SUB_PSEUDO, SI_ORDER_ANY, + vnet_pflog_init, NULL); + +static void +vnet_pflog_uninit(const void *unused __unused) +{ + + if_clone_detach(V_pflog_cloner); +} +VNET_SYSUNINIT(vnet_pflog_uninit, SI_SUB_INIT_IF, SI_ORDER_SECOND, + vnet_pflog_uninit, NULL); + static int pflog_modevent(module_t mod, int type, void *data) { @@ -266,7 +287,6 @@ pflog_modevent(module_t mod, int type, v switch (type) { case MOD_LOAD: - pflogattach(1); PF_RULES_WLOCK(); pflog_packet_ptr = pflog_packet; PF_RULES_WUNLOCK(); @@ -275,10 +295,9 @@ pflog_modevent(module_t mod, int type, v PF_RULES_WLOCK(); pflog_packet_ptr = NULL; PF_RULES_WUNLOCK(); - if_clone_detach(pflog_cloner); break; default: - error = EINVAL; + error = EOPNOTSUPP; break; } Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Thu Jun 23 21:32:52 2016 (r302155) +++ head/sys/netpfil/pf/pf.c Thu Jun 23 21:34:38 2016 (r302156) @@ -299,7 +299,7 @@ static void pf_route6(struct mbuf **, int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); -VNET_DECLARE(int, pf_end_threads); +extern int pf_end_threads; VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); @@ -1421,51 +1421,25 @@ pf_intr(void *v) } void -pf_purge_thread(void *v) +pf_purge_thread(void *unused __unused) { + VNET_ITERATOR_DECL(vnet_iter); u_int idx = 0; - CURVNET_SET((struct vnet *)v); - for (;;) { PF_RULES_RLOCK(); rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftm", hz / 10); + PF_RULES_RUNLOCK(); - if (V_pf_end_threads) { - /* - * To cleanse up all kifs and rules we need - * two runs: first one clears reference flags, - * then pf_purge_expired_states() doesn't - * raise them, and then second run frees. - */ - PF_RULES_RUNLOCK(); - pf_purge_unlinked_rules(); - pfi_kif_purge(); - - /* - * Now purge everything. - */ - pf_purge_expired_states(0, pf_hashmask); - pf_purge_expired_fragments(); - pf_purge_expired_src_nodes(); - - /* - * Now all kifs & rules should be unreferenced, - * thus should be successfully freed. - */ - pf_purge_unlinked_rules(); - pfi_kif_purge(); + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); - /* - * Announce success and exit. - */ - PF_RULES_RLOCK(); - V_pf_end_threads++; - PF_RULES_RUNLOCK(); + if (pf_end_threads) { + pf_end_threads++; wakeup(pf_purge_thread); kproc_exit(0); } - PF_RULES_RUNLOCK(); /* Process 1/interval fraction of the state table every run. */ idx = pf_purge_expired_states(idx, pf_hashmask / @@ -1483,11 +1457,42 @@ pf_purge_thread(void *v) pf_purge_unlinked_rules(); pfi_kif_purge(); } + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK(); } /* not reached */ - CURVNET_RESTORE(); } +void +pf_unload_vnet_purge(void) +{ + + /* + * To cleanse up all kifs and rules we need + * two runs: first one clears reference flags, + * then pf_purge_expired_states() doesn't + * raise them, and then second run frees. + */ + pf_purge_unlinked_rules(); + pfi_kif_purge(); + + /* + * Now purge everything. + */ + pf_purge_expired_states(0, pf_hashmask); + pf_purge_expired_fragments(); + pf_purge_expired_src_nodes(); + + /* + * Now all kifs & rules should be unreferenced, + * thus should be successfully freed. + */ + pf_purge_unlinked_rules(); + pfi_kif_purge(); +} + + u_int32_t pf_state_expires(const struct pf_state *state) { Modified: head/sys/netpfil/pf/pf_if.c ============================================================================== --- head/sys/netpfil/pf/pf_if.c Thu Jun 23 21:32:52 2016 (r302155) +++ head/sys/netpfil/pf/pf_if.c Thu Jun 23 21:34:38 2016 (r302156) @@ -58,6 +58,9 @@ static VNET_DEFINE(long, pfi_update); #define V_pfi_update VNET(pfi_update) #define PFI_BUFFER_MAX 0x10000 +VNET_DECLARE(int, pf_vnet_active); +#define V_pf_vnet_active VNET(pf_vnet_active) + static VNET_DEFINE(struct pfr_addr *, pfi_buffer); static VNET_DEFINE(int, pfi_buffer_cnt); static VNET_DEFINE(int, pfi_buffer_max); @@ -108,7 +111,7 @@ MTX_SYSINIT(pfi_unlnkdkifs_mtx, &pfi_unl MTX_DEF); void -pfi_initialize(void) +pfi_initialize_vnet(void) { struct ifg_group *ifg; struct ifnet *ifp; @@ -129,6 +132,11 @@ pfi_initialize(void) TAILQ_FOREACH(ifp, &V_ifnet, if_link) pfi_attach_ifnet(ifp); IFNET_RUNLOCK(); +} + +void +pfi_initialize(void) +{ pfi_attach_cookie = EVENTHANDLER_REGISTER(ifnet_arrival_event, pfi_attach_ifnet_event, NULL, EVENTHANDLER_PRI_ANY); @@ -145,31 +153,44 @@ pfi_initialize(void) } void -pfi_cleanup(void) +pfi_cleanup_vnet(void) { - struct pfi_kif *p; + struct pfi_kif *kif; - EVENTHANDLER_DEREGISTER(ifnet_arrival_event, pfi_attach_cookie); - EVENTHANDLER_DEREGISTER(ifnet_departure_event, pfi_detach_cookie); - EVENTHANDLER_DEREGISTER(group_attach_event, pfi_attach_group_cookie); - EVENTHANDLER_DEREGISTER(group_change_event, pfi_change_group_cookie); - EVENTHANDLER_DEREGISTER(group_detach_event, pfi_detach_group_cookie); - EVENTHANDLER_DEREGISTER(ifaddr_event, pfi_ifaddr_event_cookie); + PF_RULES_WASSERT(); V_pfi_all = NULL; - while ((p = RB_MIN(pfi_ifhead, &V_pfi_ifs))) { - RB_REMOVE(pfi_ifhead, &V_pfi_ifs, p); - free(p, PFI_MTYPE); + while ((kif = RB_MIN(pfi_ifhead, &V_pfi_ifs))) { + RB_REMOVE(pfi_ifhead, &V_pfi_ifs, kif); + if (kif->pfik_group) + kif->pfik_group->ifg_pf_kif = NULL; + if (kif->pfik_ifp) + kif->pfik_ifp->if_pf_kif = NULL; + free(kif, PFI_MTYPE); } - while ((p = LIST_FIRST(&V_pfi_unlinked_kifs))) { - LIST_REMOVE(p, pfik_list); - free(p, PFI_MTYPE); + mtx_lock(&pfi_unlnkdkifs_mtx); + while ((kif = LIST_FIRST(&V_pfi_unlinked_kifs))) { + LIST_REMOVE(kif, pfik_list); + free(kif, PFI_MTYPE); } + mtx_unlock(&pfi_unlnkdkifs_mtx); free(V_pfi_buffer, PFI_MTYPE); } +void +pfi_cleanup(void) +{ + + EVENTHANDLER_DEREGISTER(ifnet_arrival_event, pfi_attach_cookie); + EVENTHANDLER_DEREGISTER(ifnet_departure_event, pfi_detach_cookie); + EVENTHANDLER_DEREGISTER(group_attach_event, pfi_attach_group_cookie); + EVENTHANDLER_DEREGISTER(group_change_event, pfi_change_group_cookie); + EVENTHANDLER_DEREGISTER(group_detach_event, pfi_detach_group_cookie); + EVENTHANDLER_DEREGISTER(ifaddr_event, pfi_ifaddr_event_cookie); +} + struct pfi_kif * pfi_kif_find(const char *kif_name) { @@ -668,7 +689,7 @@ pfi_update_status(const char *name, stru bzero(pfs->bcounters, sizeof(pfs->bcounters)); } TAILQ_FOREACH(ifgm, &ifg_members, ifgm_next) { - if (ifgm->ifgm_ifp == NULL) + if (ifgm->ifgm_ifp == NULL || ifgm->ifgm_ifp->if_pf_kif == NULL) continue; p = (struct pfi_kif *)ifgm->ifgm_ifp->if_pf_kif; @@ -780,6 +801,11 @@ pfi_attach_ifnet_event(void *arg __unuse { CURVNET_SET(ifp->if_vnet); + if (V_pf_vnet_active == 0) { + /* Avoid teardown race in the least expensive way. */ + CURVNET_RESTORE(); + return; + } pfi_attach_ifnet(ifp); #ifdef ALTQ PF_RULES_WLOCK(); @@ -794,7 +820,15 @@ pfi_detach_ifnet_event(void *arg __unuse { struct pfi_kif *kif = (struct pfi_kif *)ifp->if_pf_kif; + if (kif == NULL) + return; + CURVNET_SET(ifp->if_vnet); + if (V_pf_vnet_active == 0) { + /* Avoid teardown race in the least expensive way. */ + CURVNET_RESTORE(); + return; + } PF_RULES_WLOCK(); V_pfi_update++; pfi_kif_update(kif); @@ -813,6 +847,11 @@ pfi_attach_group_event(void *arg , struc { CURVNET_SET((struct vnet *)arg); + if (V_pf_vnet_active == 0) { + /* Avoid teardown race in the least expensive way. */ + CURVNET_RESTORE(); + return; + } pfi_attach_ifgroup(ifg); CURVNET_RESTORE(); } @@ -822,9 +861,14 @@ pfi_change_group_event(void *arg, char * { struct pfi_kif *kif; - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); - CURVNET_SET((struct vnet *)arg); + if (V_pf_vnet_active == 0) { + /* Avoid teardown race in the least expensive way. */ + CURVNET_RESTORE(); + return; + } + + kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); PF_RULES_WLOCK(); V_pfi_update++; kif = pfi_kif_attach(kif, gname); @@ -838,7 +882,15 @@ pfi_detach_group_event(void *arg, struct { struct pfi_kif *kif = (struct pfi_kif *)ifg->ifg_pf_kif; + if (kif == NULL) + return; + CURVNET_SET((struct vnet *)arg); + if (V_pf_vnet_active == 0) { + /* Avoid teardown race in the least expensive way. */ + CURVNET_RESTORE(); + return; + } PF_RULES_WLOCK(); V_pfi_update++; @@ -851,8 +903,15 @@ pfi_detach_group_event(void *arg, struct static void pfi_ifaddr_event(void *arg __unused, struct ifnet *ifp) { + if (ifp->if_pf_kif == NULL) + return; CURVNET_SET(ifp->if_vnet); + if (V_pf_vnet_active == 0) { + /* Avoid teardown race in the least expensive way. */ + CURVNET_RESTORE(); + return; + } PF_RULES_WLOCK(); if (ifp && ifp->if_pf_kif) { V_pfi_update++; Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Thu Jun 23 21:32:52 2016 (r302155) +++ head/sys/netpfil/pf/pf_ioctl.c Thu Jun 23 21:34:38 2016 (r302156) @@ -87,7 +87,6 @@ __FBSDID("$FreeBSD$"); #include #endif -static int pfattach(void); static struct pf_pool *pf_get_pool(char *, u_int32_t, u_int8_t, u_int32_t, u_int8_t, u_int8_t, u_int8_t); @@ -189,7 +188,16 @@ static struct cdevsw pf_cdevsw = { static volatile VNET_DEFINE(int, pf_pfil_hooked); #define V_pf_pfil_hooked VNET(pf_pfil_hooked) -VNET_DEFINE(int, pf_end_threads); + +/* + * We need a flag that is neither hooked nor running to know when + * the VNET is "valid". We primarily need this to control (global) + * external event, e.g., eventhandlers. + */ +VNET_DEFINE(int, pf_vnet_active); +#define V_pf_vnet_active VNET(pf_vnet_active) + +int pf_end_threads; struct rwlock pf_rules_lock; struct sx pf_ioctl_lock; @@ -204,17 +212,14 @@ pfsync_defer_t *pfsync_defer_ptr = NUL /* pflog */ pflog_packet_t *pflog_packet_ptr = NULL; -static int -pfattach(void) +static void +pfattach_vnet(void) { u_int32_t *my_timeout = V_pf_default_rule.timeout; - int error; - if (IS_DEFAULT_VNET(curvnet)) - pf_mtag_initialize(); pf_initialize(); pfr_initialize(); - pfi_initialize(); + pfi_initialize_vnet(); pf_normalize_init(); V_pf_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT; @@ -276,18 +281,13 @@ pfattach(void) for (int i = 0; i < SCNT_MAX; i++) V_pf_status.scounters[i] = counter_u64_alloc(M_WAITOK); - if ((error = kproc_create(pf_purge_thread, curvnet, NULL, 0, 0, - "pf purge")) != 0) - /* XXXGL: leaked all above. */ - return (error); - if ((error = swi_add(NULL, "pf send", pf_intr, curvnet, SWI_NET, - INTR_MPSAFE, &V_pf_swi_cookie)) != 0) + if (swi_add(NULL, "pf send", pf_intr, curvnet, SWI_NET, + INTR_MPSAFE, &V_pf_swi_cookie) != 0) /* XXXGL: leaked all above. */ - return (error); - - return (0); + return; } + static struct pf_pool * pf_get_pool(char *anchor, u_int32_t ticket, u_int8_t rule_action, u_int32_t rule_number, u_int8_t r_last, u_int8_t active, @@ -3480,21 +3480,6 @@ shutdown_pf(void) u_int32_t t[5]; char nn = '\0'; - V_pf_status.running = 0; - - counter_u64_free(V_pf_default_rule.states_cur); - counter_u64_free(V_pf_default_rule.states_tot); - counter_u64_free(V_pf_default_rule.src_nodes); - - for (int i = 0; i < PFRES_MAX; i++) - counter_u64_free(V_pf_status.counters[i]); - for (int i = 0; i < LCNT_MAX; i++) - counter_u64_free(V_pf_status.lcounters[i]); - for (int i = 0; i < FCNT_MAX; i++) - counter_u64_free(V_pf_status.fcounters[i]); - for (int i = 0; i < SCNT_MAX; i++) - counter_u64_free(V_pf_status.scounters[i]); - do { if ((error = pf_begin_rules(&t[0], PF_RULESET_SCRUB, &nn)) != 0) { @@ -3546,6 +3531,20 @@ shutdown_pf(void) /* status does not use malloced mem so no need to cleanup */ /* fingerprints and interfaces have their own cleanup code */ + + /* Free counters last as we updated them during shutdown. */ + counter_u64_free(V_pf_default_rule.states_cur); + counter_u64_free(V_pf_default_rule.states_tot); + counter_u64_free(V_pf_default_rule.src_nodes); + + for (int i = 0; i < PFRES_MAX; i++) + counter_u64_free(V_pf_status.counters[i]); + for (int i = 0; i < LCNT_MAX; i++) + counter_u64_free(V_pf_status.lcounters[i]); + for (int i = 0; i < FCNT_MAX; i++) + counter_u64_free(V_pf_status.fcounters[i]); + for (int i = 0; i < SCNT_MAX; i++) + counter_u64_free(V_pf_status.scounters[i]); } while(0); return (error); @@ -3697,39 +3696,55 @@ dehook_pf(void) return (0); } -static int -pf_load(void) +static void +pf_load_vnet(void) { - int error; - VNET_ITERATOR_DECL(vnet_iter); VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); V_pf_pfil_hooked = 0; - V_pf_end_threads = 0; TAILQ_INIT(&V_pf_tags); TAILQ_INIT(&V_pf_qids); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK(); + pfattach_vnet(); + V_pf_vnet_active = 1; +} + +static int +pf_load(void) +{ + int error; + rw_init(&pf_rules_lock, "pf rulesets"); sx_init(&pf_ioctl_lock, "pf ioctl"); + pf_mtag_initialize(); + pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); - if ((error = pfattach()) != 0) + if (pf_dev == NULL) + return (ENOMEM); + + pf_end_threads = 0; + error = kproc_create(pf_purge_thread, NULL, NULL, 0, 0, "pf purge"); + if (error != 0) return (error); + pfi_initialize(); + return (0); } -static int -pf_unload(void) +static void +pf_unload_vnet() { - int error = 0; + int error; + V_pf_vnet_active = 0; V_pf_status.running = 0; swi_remove(V_pf_swi_cookie); error = dehook_pf(); @@ -3740,30 +3755,67 @@ pf_unload(void) * a message like 'No such process'. */ printf("%s : pfil unregisteration fail\n", __FUNCTION__); - return error; + return; } + + pf_unload_vnet_purge(); + PF_RULES_WLOCK(); shutdown_pf(); - V_pf_end_threads = 1; - while (V_pf_end_threads < 2) { - wakeup_one(pf_purge_thread); - rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftmo", 0); - } PF_RULES_WUNLOCK(); + pf_normalize_cleanup(); - pfi_cleanup(); + PF_RULES_WLOCK(); + pfi_cleanup_vnet(); + PF_RULES_WUNLOCK(); pfr_cleanup(); pf_osfp_flush(); pf_cleanup(); if (IS_DEFAULT_VNET(curvnet)) pf_mtag_cleanup(); - destroy_dev(pf_dev); +} + +static int +pf_unload(void) +{ + int error = 0; + + pf_end_threads = 1; + while (pf_end_threads < 2) { + wakeup_one(pf_purge_thread); + rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftmo", 0); + } + + if (pf_dev != NULL) + destroy_dev(pf_dev); + + pfi_cleanup(); + rw_destroy(&pf_rules_lock); sx_destroy(&pf_ioctl_lock); return (error); } +static void +vnet_pf_init(void *unused __unused) +{ + + pf_load_vnet(); +} +VNET_SYSINIT(vnet_pf_init, SI_SUB_PROTO_FIREWALL, SI_ORDER_THIRD, + vnet_pf_init, NULL); + +static void +vnet_pf_uninit(const void *unused __unused) +{ + + pf_unload_vnet(); +} +VNET_SYSUNINIT(vnet_pf_uninit, SI_SUB_PROTO_FIREWALL, SI_ORDER_THIRD, + vnet_pf_uninit, NULL); + + static int pf_modevent(module_t mod, int type, void *data) { @@ -3796,5 +3848,5 @@ static moduledata_t pf_mod = { 0 }; -DECLARE_MODULE(pf, pf_mod, SI_SUB_PROTO_FIREWALL, SI_ORDER_FIRST); +DECLARE_MODULE(pf, pf_mod, SI_SUB_PROTO_FIREWALL, SI_ORDER_SECOND); MODULE_VERSION(pf, PF_MODVER); From owner-svn-src-all@freebsd.org Thu Jun 23 21:42:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63ABAB7441D; Thu, 23 Jun 2016 21:42:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30F3521C9; Thu, 23 Jun 2016 21:42:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NLgh4c059648; Thu, 23 Jun 2016 21:42:43 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NLghX2059647; Thu, 23 Jun 2016 21:42:43 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606232142.u5NLghX2059647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 23 Jun 2016 21:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302157 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 21:42:44 -0000 Author: bz Date: Thu Jun 23 21:42:43 2016 New Revision: 302157 URL: https://svnweb.freebsd.org/changeset/base/302157 Log: PFSTATE_NOSYNC goes onto state_flags, not sync_state; this prevents: panic: pfsync_delete_state: unexpected sync state 8 Reviewed by: kp Approved by: re (gjb) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6942 Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Thu Jun 23 21:34:38 2016 (r302156) +++ head/sys/netpfil/pf/pf_ioctl.c Thu Jun 23 21:42:43 2016 (r302157) @@ -3362,7 +3362,7 @@ relock: LIST_FOREACH(s, &ih->states, entry) { s->timeout = PFTM_PURGE; /* Don't send out individual delete messages. */ - s->sync_state = PFSTATE_NOSYNC; + s->state_flags |= PFSTATE_NOSYNC; pf_unlink_state(s, PF_ENTER_LOCKED); goto relock; } From owner-svn-src-all@freebsd.org Thu Jun 23 22:31:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1522FB74C36; Thu, 23 Jun 2016 22:31:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB0A929C5; Thu, 23 Jun 2016 22:31:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NMVBJU075889; Thu, 23 Jun 2016 22:31:11 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NMVBTj075888; Thu, 23 Jun 2016 22:31:11 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606232231.u5NMVBTj075888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 23 Jun 2016 22:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302159 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 22:31:12 -0000 Author: bz Date: Thu Jun 23 22:31:10 2016 New Revision: 302159 URL: https://svnweb.freebsd.org/changeset/base/302159 Log: Make sure pflog is attached after pf is initializaed so we can borrow pf's lock, and also make sure pflog goes after pf is gone in order to avoid callouts in VNETs to an already freed instance. Reported by: Ivan Klymenko, Johan Hendriks on current@ today Obtained from: projects/vnet Sponsored by: The FreeBSD Foundation MFC after: 13 days Approved by: re (gjb) Modified: head/sys/netpfil/pf/if_pflog.c Modified: head/sys/netpfil/pf/if_pflog.c ============================================================================== --- head/sys/netpfil/pf/if_pflog.c Thu Jun 23 21:50:52 2016 (r302158) +++ head/sys/netpfil/pf/if_pflog.c Thu Jun 23 22:31:10 2016 (r302159) @@ -268,7 +268,7 @@ vnet_pflog_init(const void *unused __unu pflogattach(1); } -VNET_SYSINIT(vnet_pflog_init, SI_SUB_PSEUDO, SI_ORDER_ANY, +VNET_SYSINIT(vnet_pflog_init, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY, vnet_pflog_init, NULL); static void @@ -277,6 +277,10 @@ vnet_pflog_uninit(const void *unused __u if_clone_detach(V_pflog_cloner); } +/* + * Detach after pf is gone; otherwise we might touch pflog memory + * from within pf after freeing pflog. + */ VNET_SYSUNINIT(vnet_pflog_uninit, SI_SUB_INIT_IF, SI_ORDER_SECOND, vnet_pflog_uninit, NULL); @@ -308,6 +312,7 @@ static moduledata_t pflog_mod = { pflogn #define PFLOG_MODVER 1 -DECLARE_MODULE(pflog, pflog_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +/* Do not run before pf is initialized as we depend on its locks. */ +DECLARE_MODULE(pflog, pflog_mod, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY); MODULE_VERSION(pflog, PFLOG_MODVER); MODULE_DEPEND(pflog, pf, PF_MODVER, PF_MODVER, PF_MODVER); From owner-svn-src-all@freebsd.org Thu Jun 23 22:31:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6154DB74D32; Thu, 23 Jun 2016 22:31:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DE542BAB; Thu, 23 Jun 2016 22:31:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NMVikm075949; Thu, 23 Jun 2016 22:31:44 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NMViLv075948; Thu, 23 Jun 2016 22:31:44 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606232231.u5NMViLv075948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 23 Jun 2016 22:31:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302160 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 22:31:45 -0000 Author: bz Date: Thu Jun 23 22:31:44 2016 New Revision: 302160 URL: https://svnweb.freebsd.org/changeset/base/302160 Log: Proerply virtualize pfsync for bringup after pf is initialized and teardown of VNETs once pf(4) has been shut down. Properly split resources into VNET_SYS(UN)INITs and one time module loading. While here cover the INET parts in the uninit callpath with proper #ifdefs. Approved by: re (gjb) Obtained from: projects/vnet MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/netpfil/pf/if_pfsync.c Modified: head/sys/netpfil/pf/if_pfsync.c ============================================================================== --- head/sys/netpfil/pf/if_pfsync.c Thu Jun 23 22:31:10 2016 (r302159) +++ head/sys/netpfil/pf/if_pfsync.c Thu Jun 23 22:31:44 2016 (r302160) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -2315,71 +2316,67 @@ pfsync_pointers_uninit() PF_RULES_WUNLOCK(); } -static int -pfsync_init() +static void +vnet_pfsync_init(const void *unused __unused) { - VNET_ITERATOR_DECL(vnet_iter); - int error = 0; + int error; - VNET_LIST_RLOCK(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); - V_pfsync_cloner = if_clone_simple(pfsyncname, - pfsync_clone_create, pfsync_clone_destroy, 1); - error = swi_add(NULL, pfsyncname, pfsyncintr, V_pfsyncif, - SWI_NET, INTR_MPSAFE, &V_pfsync_swi_cookie); - CURVNET_RESTORE(); - if (error) - goto fail_locked; + V_pfsync_cloner = if_clone_simple(pfsyncname, + pfsync_clone_create, pfsync_clone_destroy, 1); + error = swi_add(NULL, pfsyncname, pfsyncintr, V_pfsyncif, + SWI_NET, INTR_MPSAFE, &V_pfsync_swi_cookie); + if (error) { + if_clone_detach(V_pfsync_cloner); + log(LOG_INFO, "swi_add() failed in %s\n", __func__); } - VNET_LIST_RUNLOCK(); +} +VNET_SYSINIT(vnet_pfsync_init, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY, + vnet_pfsync_init, NULL); + +static void +vnet_pfsync_uninit(const void *unused __unused) +{ + + if_clone_detach(V_pfsync_cloner); + swi_remove(V_pfsync_swi_cookie); +} +/* + * Detach after pf is gone; otherwise we might touch pfsync memory + * from within pf after freeing pfsync. + */ +VNET_SYSUNINIT(vnet_pfsync_uninit, SI_SUB_INIT_IF, SI_ORDER_SECOND, + vnet_pfsync_uninit, NULL); + +static int +pfsync_init() +{ #ifdef INET + int error; + error = pf_proto_register(PF_INET, &in_pfsync_protosw); if (error) - goto fail; + return (error); error = ipproto_register(IPPROTO_PFSYNC); if (error) { pf_proto_unregister(PF_INET, IPPROTO_PFSYNC, SOCK_RAW); - goto fail; + return (error); } #endif pfsync_pointers_init(); return (0); - -fail: - VNET_LIST_RLOCK(); -fail_locked: - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); - if (V_pfsync_swi_cookie) { - swi_remove(V_pfsync_swi_cookie); - if_clone_detach(V_pfsync_cloner); - } - CURVNET_RESTORE(); - } - VNET_LIST_RUNLOCK(); - - return (error); } static void pfsync_uninit() { - VNET_ITERATOR_DECL(vnet_iter); pfsync_pointers_uninit(); +#ifdef INET ipproto_unregister(IPPROTO_PFSYNC); pf_proto_unregister(PF_INET, IPPROTO_PFSYNC, SOCK_RAW); - VNET_LIST_RLOCK(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); - if_clone_detach(V_pfsync_cloner); - swi_remove(V_pfsync_swi_cookie); - CURVNET_RESTORE(); - } - VNET_LIST_RUNLOCK(); +#endif } static int @@ -2416,6 +2413,7 @@ static moduledata_t pfsync_mod = { #define PFSYNC_MODVER 1 -DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); +/* Stay on FIREWALL as we depend on pf being initialized and on inetdomain. */ +DECLARE_MODULE(pfsync, pfsync_mod, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY); MODULE_VERSION(pfsync, PFSYNC_MODVER); MODULE_DEPEND(pfsync, pf, PF_MODVER, PF_MODVER, PF_MODVER); From owner-svn-src-all@freebsd.org Thu Jun 23 23:13:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8F83B73D26; Thu, 23 Jun 2016 23:13:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D66228EE; Thu, 23 Jun 2016 23:13:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NNDEA5093675; Thu, 23 Jun 2016 23:13:14 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NNDEu3093674; Thu, 23 Jun 2016 23:13:14 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201606232313.u5NNDEu3093674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 23 Jun 2016 23:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302162 - head/usr.sbin/gstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 23:13:15 -0000 Author: asomers Date: Thu Jun 23 23:13:14 2016 New Revision: 302162 URL: https://svnweb.freebsd.org/changeset/base/302162 Log: Fix gstat's interactive f and q commands curses and libedit don't play well together. After last year's libedit upgrade in head, they play even less well together. This change resets some curses settings after they get screwed up by libedit calls. Without it, gstat's interactive commands require an extra "enter", screw up the terminal on exit, and screw up the display if the user enters an invalid filter string. PR: 204852 Submitted by: Keith White Reviewed by: pfg Approved by: re (gjb) MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6934 Modified: head/usr.sbin/gstat/gstat.c Modified: head/usr.sbin/gstat/gstat.c ============================================================================== --- head/usr.sbin/gstat/gstat.c Thu Jun 23 22:42:03 2016 (r302161) +++ head/usr.sbin/gstat/gstat.c Thu Jun 23 23:13:14 2016 (r302162) @@ -167,20 +167,6 @@ main(int argc, char **argv) if (sq == NULL) err(1, "geom_stats_snapshot()"); if (!flag_b) { - /* Setup curses */ - initscr(); - start_color(); - use_default_colors(); - pair_content(0, &cf, &cb); - init_pair(1, COLOR_GREEN, cb); - init_pair(2, COLOR_MAGENTA, cb); - init_pair(3, COLOR_RED, cb); - cbreak(); - noecho(); - nonl(); - nodelay(stdscr, 1); - intrflush(stdscr, FALSE); - keypad(stdscr, TRUE); /* Setup libedit */ hist = history_init(); if (hist == NULL) @@ -195,6 +181,20 @@ main(int argc, char **argv) el_set(el, EL_PROMPT, el_prompt); if (f_s[0] != '\0') history(hist, &hist_ev, H_ENTER, f_s); + /* Setup curses */ + initscr(); + start_color(); + use_default_colors(); + pair_content(0, &cf, &cb); + init_pair(1, COLOR_GREEN, cb); + init_pair(2, COLOR_MAGENTA, cb); + init_pair(3, COLOR_RED, cb); + cbreak(); + noecho(); + nonl(); + nodelay(stdscr, 1); + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); } geom_stats_snapshot_timestamp(sq, &tq); for (quit = 0; !quit;) { @@ -410,12 +410,15 @@ main(int argc, char **argv) if ((p = strchr(tmp_f_s, '\n')) != NULL) *p = '\0'; /* - * We have to clear since we messed up + * Fix the terminal. We messed up * curses idea of the screen by using * libedit. */ clear(); refresh(); + cbreak(); + noecho(); + nonl(); if (regcomp(&tmp_f_re, tmp_f_s, REG_EXTENDED) != 0) { move(0, 0); @@ -440,8 +443,8 @@ main(int argc, char **argv) } if (!flag_b) { - endwin(); el_end(el); + endwin(); } exit(EX_OK); } From owner-svn-src-all@freebsd.org Thu Jun 23 23:16:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28640B73E60 for ; Thu, 23 Jun 2016 23:16:47 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi0-x244.google.com (mail-oi0-x244.google.com [IPv6:2607:f8b0:4003:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E280F2BB5 for ; Thu, 23 Jun 2016 23:16:46 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi0-x244.google.com with SMTP id x6so15120906oif.3 for ; Thu, 23 Jun 2016 16:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:cc; bh=8BFysJjX3BaCntKSUYSC6tEe/32YcNW5kb1qDVh0/DY=; b=HDYwpU32G6p+PqFx5UPnKj5MkG4MZ/cl++o4juJtz2rhXRlyumjOU2LtJmvGQtJS9d AdusesZaU9pVqhz0TlijGsWq1yNaQbK2ZK/BOKwkmV16QM10RqHpd06Cc0tpOXuz+v1v hfXvtjY4C8q9QIUd8OC/L1LBpOU4t4vkt3/QY4hu1b0Pi2ldjHSXRWJFf0tkPTd7I+uf DygOt5p34x3dZ+Y7055sx4FCWyiLpSA+qIo3H0iZeFhPHXtRhxa8W6EMIBfTekdxPQwG VQjGEjW7grdoErr0L9bo61v+k637UMKz/FtOtX88fb0ZNAVkh2Q1oh1NatlkUtTx+lKg gYNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:cc; bh=8BFysJjX3BaCntKSUYSC6tEe/32YcNW5kb1qDVh0/DY=; b=hSj6J7p8koafBjl1Z1vE1zL5L2DWsfnEIme85DvaqOyZ6gY/ZBNoKtAMIwRhCVqSGF akz3LEDDU7LFNRV56zW5DKSxIanercot6So/Xb08Qm4wXiueMACd1IkUElWm5urlFNkx flG5ppgi3M0t4FGssQd7QCPB9MfptjPjvjNrwyAT6j/zG3HRkUJ2bvwKv8jgoU1VRriL C6DeVU5e9D8HjKwrh+ezDUgd9yl70urSS7ZokVlNtuFC2oE7ppRfE10GQZlrpGzVDqvc 04dw9C9tM2rN606HHLISGyTUL+UTimUdDzKJTfO8bMZcmOm/CThFZSCPDjRL0eQNn3Mj 5XUQ== X-Gm-Message-State: ALyK8tLCeUmiRcWEfpixjBd7SBMHqVbfkuhHeyB72aFHQwpElwBnHXW83DCFOjJibZSf7gJ1wt4m9LwJgUIEFA== X-Received: by 10.157.0.74 with SMTP id 68mt931552ota.55.1466723806063; Thu, 23 Jun 2016 16:16:46 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.202.168.149 with HTTP; Thu, 23 Jun 2016 16:16:45 -0700 (PDT) In-Reply-To: <201606232313.u5NNDEu3093674@repo.freebsd.org> References: <201606232313.u5NNDEu3093674@repo.freebsd.org> From: Alan Somers Date: Thu, 23 Jun 2016 17:16:45 -0600 X-Google-Sender-Auth: W5xb1xwuHZK900xxLyBU35wT8RM Message-ID: Subject: Re: svn commit: r302162 - head/usr.sbin/gstat Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 23:16:47 -0000 On Thu, Jun 23, 2016 at 5:13 PM, Alan Somers wrote: > Author: asomers > Date: Thu Jun 23 23:13:14 2016 > New Revision: 302162 > URL: https://svnweb.freebsd.org/changeset/base/302162 > > Log: > Fix gstat's interactive f and q commands > > curses and libedit don't play well together. After last year's libedit > upgrade in head, they play even less well together. This change resets some > curses settings after they get screwed up by libedit calls. Without it, > gstat's interactive commands require an extra "enter", screw up the terminal > on exit, and screw up the display if the user enters an invalid filter > string. > > PR: 204852 > Submitted by: Keith White > Reviewed by: pfg > Approved by: re (gjb) > MFC after: 4 weeks > Sponsored by: Spectra Logic Corp > Differential Revision: https://reviews.freebsd.org/D6934 > > Modified: > head/usr.sbin/gstat/gstat.c > For the record, the MFC field is a mistake. This bug does not affect stable/9 or stable/10. From owner-svn-src-all@freebsd.org Thu Jun 23 23:21:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A01CB73F5F; Thu, 23 Jun 2016 23:21:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED3F52F5F; Thu, 23 Jun 2016 23:20:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5NNKxFp094248; Thu, 23 Jun 2016 23:20:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5NNKwR9094246; Thu, 23 Jun 2016 23:20:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201606232320.u5NNKwR9094246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 23 Jun 2016 23:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302163 - in head/sys: cam conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 23:21:00 -0000 Author: imp Date: Thu Jun 23 23:20:58 2016 New Revision: 302163 URL: https://svnweb.freebsd.org/changeset/base/302163 Log: Rename CAM_NETFLIX_IOSCHED to CAM_IOSCHED_DYNAMIC to better reflect its nature. Approved by: re Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D6811 Modified: head/sys/cam/cam_iosched.c head/sys/conf/options Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Jun 23 23:13:14 2016 (r302162) +++ head/sys/cam/cam_iosched.c Thu Jun 23 23:20:58 2016 (r302163) @@ -61,7 +61,7 @@ static MALLOC_DEFINE(M_CAMSCHED, "CAM I/ * for trims. */ -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC static int do_netflix_iosched = 1; TUNABLE_INT("kern.cam.do_netflix_iosched", &do_netflix_iosched); @@ -250,7 +250,7 @@ struct cam_iosched_softc /* scheduler flags < 16, user flags >= 16 */ uint32_t flags; int sort_io_queue; -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC int read_bias; /* Read bias setting */ int current_read_bias; /* Current read bias state */ int total_ticks; @@ -269,7 +269,7 @@ struct cam_iosched_softc #endif }; -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC /* * helper functions to call the limsw functions. */ @@ -624,7 +624,7 @@ cam_iosched_cl_maybe_steer(struct contro /* Periph drivers set these flags to indicate work */ #define CAM_IOSCHED_FLAG_WORK_FLAGS ((0xffffu) << 16) -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC static void cam_iosched_io_metric_update(struct cam_iosched_softc *isc, sbintime_t sim_latency, int cmd, size_t size); @@ -639,7 +639,7 @@ cam_iosched_has_flagged_work(struct cam_ static inline int cam_iosched_has_io(struct cam_iosched_softc *isc) { -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC if (do_netflix_iosched) { struct bio *rbp = bioq_first(&isc->bio_queue); struct bio *wbp = bioq_first(&isc->write_queue); @@ -672,7 +672,7 @@ cam_iosched_has_more_trim(struct cam_ios static inline int cam_iosched_has_work(struct cam_iosched_softc *isc) { -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC if (iosched_debug > 2) printf("has work: %d %d %d\n", cam_iosched_has_io(isc), cam_iosched_has_more_trim(isc), @@ -684,7 +684,7 @@ cam_iosched_has_work(struct cam_iosched_ cam_iosched_has_flagged_work(isc); } -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC static void cam_iosched_iop_stats_init(struct cam_iosched_softc *isc, struct iop_stats *ios) { @@ -946,14 +946,14 @@ cam_iosched_init(struct cam_iosched_soft *iscp = malloc(sizeof(**iscp), M_CAMSCHED, M_NOWAIT | M_ZERO); if (*iscp == NULL) return ENOMEM; -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC if (iosched_debug) printf("CAM IOSCHEDULER Allocating entry at %p\n", *iscp); #endif (*iscp)->sort_io_queue = -1; bioq_init(&(*iscp)->bio_queue); bioq_init(&(*iscp)->trim_queue); -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC if (do_netflix_iosched) { bioq_init(&(*iscp)->write_queue); (*iscp)->read_bias = 100; @@ -984,7 +984,7 @@ cam_iosched_fini(struct cam_iosched_soft { if (isc) { cam_iosched_flush(isc, NULL, ENXIO); -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC cam_iosched_iop_stats_fini(&isc->read_stats); cam_iosched_iop_stats_fini(&isc->write_stats); cam_iosched_iop_stats_fini(&isc->trim_stats); @@ -1009,7 +1009,7 @@ cam_iosched_fini(struct cam_iosched_soft void cam_iosched_sysctl_init(struct cam_iosched_softc *isc, struct sysctl_ctx_list *ctx, struct sysctl_oid *node) { -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC struct sysctl_oid_list *n; #endif @@ -1018,7 +1018,7 @@ void cam_iosched_sysctl_init(struct cam_ &isc->sort_io_queue, 0, "Sort IO queue to try and optimise disk access patterns"); -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC if (!do_netflix_iosched) return; @@ -1060,13 +1060,13 @@ cam_iosched_flush(struct cam_iosched_sof { bioq_flush(&isc->bio_queue, stp, err); bioq_flush(&isc->trim_queue, stp, err); -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC if (do_netflix_iosched) bioq_flush(&isc->write_queue, stp, err); #endif } -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC static struct bio * cam_iosched_get_write(struct cam_iosched_softc *isc) { @@ -1132,7 +1132,7 @@ void cam_iosched_put_back_trim(struct cam_iosched_softc *isc, struct bio *bp) { bioq_insert_head(&isc->trim_queue, bp); -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC isc->trim_stats.queued++; isc->trim_stats.total--; /* since we put it back, don't double count */ isc->trim_stats.pending--; @@ -1155,7 +1155,7 @@ cam_iosched_next_trim(struct cam_iosched if (bp == NULL) return NULL; bioq_remove(&isc->trim_queue, bp); -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC isc->trim_stats.queued--; isc->trim_stats.total++; isc->trim_stats.pending++; @@ -1201,7 +1201,7 @@ cam_iosched_next_bio(struct cam_iosched_ if ((bp = cam_iosched_get_trim(isc)) != NULL) return bp; -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC /* * See if we have any pending writes, and room in the queue for them, * and if so, those are next. @@ -1218,7 +1218,7 @@ cam_iosched_next_bio(struct cam_iosched_ if ((bp = bioq_first(&isc->bio_queue)) == NULL) return NULL; -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC /* * For the netflix scheduler, bio_queue is only for reads, so enforce * the limits here. Enforce only for reads. @@ -1230,7 +1230,7 @@ cam_iosched_next_bio(struct cam_iosched_ } #endif bioq_remove(&isc->bio_queue, bp); -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC if (do_netflix_iosched) { if (bp->bio_cmd == BIO_READ) { isc->read_stats.queued--; @@ -1262,12 +1262,12 @@ cam_iosched_queue_work(struct cam_iosche */ if (bp->bio_cmd == BIO_DELETE) { bioq_disksort(&isc->trim_queue, bp); -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC isc->trim_stats.in++; isc->trim_stats.queued++; #endif } -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC else if (do_netflix_iosched && (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH)) { if (cam_iosched_sort_queue(isc)) @@ -1287,7 +1287,7 @@ cam_iosched_queue_work(struct cam_iosche bioq_disksort(&isc->bio_queue, bp); else bioq_insert_tail(&isc->bio_queue, bp); -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC if (iosched_debug > 9) printf("Qr : %p %#x\n", bp, bp->bio_cmd); if (bp->bio_cmd == BIO_READ) { @@ -1331,7 +1331,7 @@ cam_iosched_bio_complete(struct cam_iosc union ccb *done_ccb) { int retval = 0; -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC if (!do_netflix_iosched) return retval; @@ -1399,7 +1399,7 @@ cam_iosched_clr_work_flags(struct cam_io isc->flags &= ~flags; } -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC /* * After the method presented in Jack Crenshaw's 1998 article "Integer * Suqare Roots," reprinted at @@ -1523,7 +1523,7 @@ cam_iosched_update(struct iop_stats *iop iop->sd = (int64_t)var < 0 ? 0 : isqrt64(var); } -#ifdef CAM_NETFLIX_IOSCHED +#ifdef CAM_IOSCHED_DYNAMIC static void cam_iosched_io_metric_update(struct cam_iosched_softc *isc, sbintime_t sim_latency, int cmd, size_t size) Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Jun 23 23:13:14 2016 (r302162) +++ head/sys/conf/options Thu Jun 23 23:20:58 2016 (r302163) @@ -330,7 +330,7 @@ CAM_DEBUG_TARGET opt_cam.h CAM_DEBUG_LUN opt_cam.h CAM_DEBUG_FLAGS opt_cam.h CAM_BOOT_DELAY opt_cam.h -CAM_NETFLIX_IOSCHED opt_cam.h +CAM_IOSCHED_DYNAMIC opt_cam.h SCSI_DELAY opt_scsi.h SCSI_NO_SENSE_STRINGS opt_scsi.h SCSI_NO_OP_STRINGS opt_scsi.h From owner-svn-src-all@freebsd.org Fri Jun 24 00:05:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FB03AC6A85; Fri, 24 Jun 2016 00:05:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FCF02616; Fri, 24 Jun 2016 00:05:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5O05jWG012822; Fri, 24 Jun 2016 00:05:45 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5O05jVe012821; Fri, 24 Jun 2016 00:05:45 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201606240005.u5O05jVe012821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 24 Jun 2016 00:05:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302164 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 00:05:46 -0000 Author: gjb Date: Fri Jun 24 00:05:45 2016 New Revision: 302164 URL: https://svnweb.freebsd.org/changeset/base/302164 Log: Update head to ALPHA5 in preparation of new snapshot builds. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Thu Jun 23 23:20:58 2016 (r302163) +++ head/sys/conf/newvers.sh Fri Jun 24 00:05:45 2016 (r302164) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="11.0" -BRANCH="ALPHA4" +BRANCH="ALPHA5" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Fri Jun 24 01:20:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC4F2B72AF1; Fri, 24 Jun 2016 01:20:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80EA024F6; Fri, 24 Jun 2016 01:20:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5O1KYPe039084; Fri, 24 Jun 2016 01:20:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5O1KYTB039078; Fri, 24 Jun 2016 01:20:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606240120.u5O1KYTB039078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 24 Jun 2016 01:20:34 +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: r302165 - in stable/10/sys: amd64/include dev/hyperv/vmbus dev/hyperv/vmbus/amd64 dev/hyperv/vmbus/i386 i386/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 01:20:35 -0000 Author: sephe Date: Fri Jun 24 01:20:33 2016 New Revision: 302165 URL: https://svnweb.freebsd.org/changeset/base/302165 Log: MFC 301015 hyperv/vmbus: Rename ISR functions MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6601 Modified: stable/10/sys/amd64/include/apicvar.h stable/10/sys/dev/hyperv/vmbus/amd64/hv_vector.S stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S stable/10/sys/dev/hyperv/vmbus/vmbus_var.h stable/10/sys/i386/include/apicvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/include/apicvar.h ============================================================================== --- stable/10/sys/amd64/include/apicvar.h Fri Jun 24 00:05:45 2016 (r302164) +++ stable/10/sys/amd64/include/apicvar.h Fri Jun 24 01:20:33 2016 (r302165) @@ -216,7 +216,6 @@ int lapic_set_lvt_triggermode(u_int apic void lapic_set_tpr(u_int vector); void lapic_setup(int boot); void xen_intr_handle_upcall(struct trapframe *frame); -void hv_vector_handler(struct trapframe *frame); #endif /* !LOCORE */ #endif /* _MACHINE_APICVAR_H_ */ Modified: stable/10/sys/dev/hyperv/vmbus/amd64/hv_vector.S ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/amd64/hv_vector.S Fri Jun 24 00:05:45 2016 (r302164) +++ stable/10/sys/dev/hyperv/vmbus/amd64/hv_vector.S Fri Jun 24 01:20:33 2016 (r302165) @@ -37,10 +37,10 @@ */ .text SUPERALIGN_TEXT -IDTVEC(hv_vmbus_callback) +IDTVEC(vmbus_isr) PUSH_FRAME FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rdi - call hv_vector_handler + call vmbus_handle_intr MEXITCOUNT jmp doreti Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Fri Jun 24 00:05:45 2016 (r302164) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Fri Jun 24 01:20:33 2016 (r302165) @@ -72,7 +72,7 @@ struct vmbus_softc *vmbus_sc; static char *vmbus_ids[] = { "VMBUS", NULL }; -extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback); +extern inthand_t IDTVEC(rsvd), IDTVEC(vmbus_isr); static void vmbus_msg_task(void *xsc, int pending __unused) @@ -124,8 +124,8 @@ handled: } } -static inline int -hv_vmbus_isr(struct vmbus_softc *sc, struct trapframe *frame, int cpu) +static __inline int +vmbus_handle_intr1(struct vmbus_softc *sc, struct trapframe *frame, int cpu) { hv_vmbus_message *msg, *msg_base; @@ -186,7 +186,7 @@ hv_vmbus_isr(struct vmbus_softc *sc, str } void -hv_vector_handler(struct trapframe *trap_frame) +vmbus_handle_intr(struct trapframe *trap_frame) { struct vmbus_softc *sc = vmbus_get_softc(); int cpu = curcpu; @@ -201,7 +201,7 @@ hv_vector_handler(struct trapframe *trap */ (*VMBUS_PCPU_GET(sc, intr_cnt, cpu))++; - hv_vmbus_isr(sc, trap_frame, cpu); + vmbus_handle_intr1(sc, trap_frame, cpu); /* * Enable preemption. @@ -389,10 +389,10 @@ vmbus_vector_alloc(void) func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); if (func == (uintptr_t)&IDTVEC(rsvd)) { #ifdef __i386__ - setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYS386IGT, + setidt(vector , IDTVEC(vmbus_isr), SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); #else - setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYSIGT, + setidt(vector , IDTVEC(vmbus_isr), SDT_SYSIGT, SEL_KPL, 0); #endif Modified: stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S Fri Jun 24 00:05:45 2016 (r302164) +++ stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S Fri Jun 24 01:20:33 2016 (r302165) @@ -37,13 +37,13 @@ */ .text SUPERALIGN_TEXT -IDTVEC(hv_vmbus_callback) +IDTVEC(vmbus_isr) PUSH_FRAME SET_KERNEL_SREGS cld FAKE_MCOUNT(TF_EIP(%esp)) pushl %esp - call hv_vector_handler + call vmbus_handle_intr add $4, %esp MEXITCOUNT jmp doreti Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jun 24 00:05:45 2016 (r302164) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jun 24 01:20:33 2016 (r302165) @@ -96,6 +96,7 @@ struct trapframe; void vmbus_on_channel_open(const struct hv_vmbus_channel *); void vmbus_event_proc(struct vmbus_softc *, int); void vmbus_event_proc_compat(struct vmbus_softc *, int); +void vmbus_handle_intr(struct trapframe *); void vmbus_et_intr(struct trapframe *); Modified: stable/10/sys/i386/include/apicvar.h ============================================================================== --- stable/10/sys/i386/include/apicvar.h Fri Jun 24 00:05:45 2016 (r302164) +++ stable/10/sys/i386/include/apicvar.h Fri Jun 24 01:20:33 2016 (r302165) @@ -215,7 +215,6 @@ int lapic_set_lvt_triggermode(u_int apic void lapic_set_tpr(u_int vector); void lapic_setup(int boot); void xen_intr_handle_upcall(struct trapframe *frame); -void hv_vector_handler(struct trapframe *frame); #endif /* !LOCORE */ #endif /* _MACHINE_APICVAR_H_ */ From owner-svn-src-all@freebsd.org Fri Jun 24 01:50:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB79AB73262; Fri, 24 Jun 2016 01:50:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFE5F1244; Fri, 24 Jun 2016 01:50:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5O1o0Uc050036; Fri, 24 Jun 2016 01:50:00 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5O1nxAR050000; Fri, 24 Jun 2016 01:49:59 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606240149.u5O1nxAR050000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 24 Jun 2016 01:49: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: r302166 - in stable/10/sys/dev/hyperv: include utilities vmbus vmbus/i386 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 01:50:02 -0000 Author: sephe Date: Fri Jun 24 01:49:59 2016 New Revision: 302166 URL: https://svnweb.freebsd.org/changeset/base/302166 Log: MFC 301017,301018,301019,301020,301021,301022,301106 301017 hyperv/vmbus: Indentation cleanup No functional changes. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6602 301018 hyperv/vmbus: Move global vmbus id array to stack. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6603 301019 hyperv/vmbus: Redefine SynIC message. - Avoid unnecessary indirection. - Avoid bit fields. - Use __packed. Reviewed by: Jun Su MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6636 301020 hyperv/vmbus: White space cleanup No functional changes MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6637 301021 hyperv: Move guid2str from vmbus file to hyperv file - Use uint8_t for GUID byte array. - Define GUID string length. - Break long lines. - Nuke unnecessary stack variable. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6640 301022 hyperv/kvp: Use if_xname. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6641 301106 hyperv/vmbus: Redefine event flags. - Nuke unnecessary union. - Avoid convoluted macro indirection. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6671 Added: stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h - copied, changed from r301019, head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: stable/10/sys/dev/hyperv/include/hyperv.h stable/10/sys/dev/hyperv/utilities/hv_kvp.c stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/10/sys/dev/hyperv/include/hyperv.h Fri Jun 24 01:20:33 2016 (r302165) +++ stable/10/sys/dev/hyperv/include/hyperv.h Fri Jun 24 01:49:59 2016 (r302166) @@ -121,10 +121,12 @@ typedef uint8_t hv_bool_uint8_t; HV_ALIGN_DOWN(addr, PAGE_SIZE)) >> PAGE_SHIFT ) typedef struct hv_guid { - unsigned char data[16]; + uint8_t data[16]; } __packed hv_guid; -int snprintf_hv_guid(char *, size_t, const hv_guid *); +#define HYPERV_GUID_STRLEN 40 + +int hyperv_guid2str(const struct hv_guid *, char *, size_t); #define HV_NIC_GUID \ .data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, \ Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_kvp.c Fri Jun 24 01:20:33 2016 (r302165) +++ stable/10/sys/dev/hyperv/utilities/hv_kvp.c Fri Jun 24 01:49:59 2016 (r302166) @@ -58,7 +58,10 @@ __FBSDID("$FreeBSD$"); #include #include #include + +#include #include +#include #include #include @@ -306,8 +309,7 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru int UNUSED_FLAG = 1; struct hv_device *hv_dev; /* GUID Data Structure */ hn_softc_t *sc; /* hn softc structure */ - char if_name[4]; - char buf[39]; + char buf[HYPERV_GUID_STRLEN]; device_t *devs; int devcnt; @@ -335,11 +337,12 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru /* Trying to find GUID of Network Device */ hv_dev = sc->hn_dev_obj; - snprintf_hv_guid(buf, sizeof(buf), &hv_dev->device_id); - sprintf(if_name, "%s%d", "hn", device_get_unit(devs[devcnt])); + hyperv_guid2str(&hv_dev->device_id, buf, sizeof(buf)); - if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id, 39) == 0) { - strcpy((char *)umsg->body.kvp_ip_val.adapter_id, if_name); + if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id, + HYPERV_GUID_STRLEN - 1) == 0) { + strlcpy((char *)umsg->body.kvp_ip_val.adapter_id, + sc->hn_ifp->if_xname, MAX_ADAPTER_ID_SIZE); break; } } Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Jun 24 01:20:33 2016 (r302165) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Jun 24 01:49:59 2016 (r302166) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include /* @@ -720,8 +721,8 @@ hv_vmbus_release_unattached_channels(voi } hv_vmbus_free_vmbus_channel(channel); } - bzero(hv_vmbus_g_connection.channels, - sizeof(hv_vmbus_channel*) * HV_CHANNEL_MAX_COUNT); + bzero(hv_vmbus_g_connection.channels, + sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX); mtx_unlock(&hv_vmbus_g_connection.channel_lock); } Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Fri Jun 24 01:20:33 2016 (r302165) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Fri Jun 24 01:49:59 2016 (r302166) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include /* @@ -212,8 +213,7 @@ hv_vmbus_connect(void) M_DEVBUF, M_WAITOK | M_ZERO); hv_vmbus_g_connection.channels = malloc(sizeof(hv_vmbus_channel*) * - HV_CHANNEL_MAX_COUNT, - M_DEVBUF, M_WAITOK | M_ZERO); + VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); /* * Find the highest vmbus version number we can support. */ @@ -295,20 +295,20 @@ hv_vmbus_disconnect(void) } static __inline void -vmbus_event_flags_proc(unsigned long *event_flags, int flag_cnt) +vmbus_event_flags_proc(volatile u_long *event_flags, int flag_cnt) { int f; for (f = 0; f < flag_cnt; ++f) { uint32_t rel_id_base; - unsigned long flags; + u_long flags; int bit; if (event_flags[f] == 0) continue; flags = atomic_swap_long(&event_flags[f], 0); - rel_id_base = f << HV_CHANNEL_ULONG_SHIFT; + rel_id_base = f << VMBUS_EVTFLAG_SHIFT; while ((bit = ffsl(flags)) != 0) { struct hv_vmbus_channel *channel; @@ -334,27 +334,27 @@ vmbus_event_flags_proc(unsigned long *ev void vmbus_event_proc(struct vmbus_softc *sc, int cpu) { - hv_vmbus_synic_event_flags *event; + struct vmbus_evtflags *eventf; /* * On Host with Win8 or above, the event page can be checked directly * to get the id of the channel that has the pending interrupt. */ - event = VMBUS_PCPU_GET(sc, event_flag, cpu) + VMBUS_SINT_MESSAGE; - vmbus_event_flags_proc(event->flagsul, - VMBUS_PCPU_GET(sc, event_flag_cnt, cpu)); + eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; + vmbus_event_flags_proc(eventf->evt_flags, + VMBUS_PCPU_GET(sc, event_flags_cnt, cpu)); } void vmbus_event_proc_compat(struct vmbus_softc *sc __unused, int cpu) { - hv_vmbus_synic_event_flags *event; + struct vmbus_evtflags *eventf; - event = VMBUS_PCPU_GET(sc, event_flag, cpu) + VMBUS_SINT_MESSAGE; - if (atomic_testandclear_int(&event->flags32[0], 0)) { + eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; + if (atomic_testandclear_long(&eventf->evt_flags[0], 0)) { vmbus_event_flags_proc( hv_vmbus_g_connection.recv_interrupt_page, - HV_MAX_NUM_CHANNELS_SUPPORTED >> HV_CHANNEL_ULONG_SHIFT); + VMBUS_CHAN_MAX_COMPAT >> VMBUS_EVTFLAG_SHIFT); } } @@ -417,8 +417,8 @@ vmbus_on_channel_open(const struct hv_vm volatile int *flag_cnt_ptr; int flag_cnt; - flag_cnt = (chan->offer_msg.child_rel_id / HV_CHANNEL_ULONG_LEN) + 1; - flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flag_cnt, + flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1; + flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flags_cnt, chan->target_cpu); for (;;) { Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_hv.c Fri Jun 24 01:20:33 2016 (r302165) +++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c Fri Jun 24 01:49:59 2016 (r302166) @@ -202,6 +202,18 @@ hv_vmbus_signal_event(void *con_id) return (status); } +int +hyperv_guid2str(const struct hv_guid *guid, char *buf, size_t sz) +{ + const uint8_t *d = guid->data; + + return snprintf(buf, sz, "%02x%02x%02x%02x-" + "%02x%02x-%02x%02x-%02x%02x-" + "%02x%02x%02x%02x%02x%02x", + d[3], d[2], d[1], d[0], + d[5], d[4], d[7], d[6], d[8], d[9], + d[10], d[11], d[12], d[13], d[14], d[15]); +} static bool hyperv_identify(void) Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Fri Jun 24 01:20:33 2016 (r302165) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Fri Jun 24 01:49:59 2016 (r302166) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -70,15 +71,13 @@ __FBSDID("$FreeBSD$"); struct vmbus_softc *vmbus_sc; -static char *vmbus_ids[] = { "VMBUS", NULL }; - extern inthand_t IDTVEC(rsvd), IDTVEC(vmbus_isr); static void vmbus_msg_task(void *xsc, int pending __unused) { struct vmbus_softc *sc = xsc; - hv_vmbus_message *msg; + volatile struct vmbus_message *msg; msg = VMBUS_PCPU_GET(sc, message, curcpu) + VMBUS_SINT_MESSAGE; for (;;) { @@ -86,10 +85,12 @@ vmbus_msg_task(void *xsc, int pending __ hv_vmbus_channel_msg_header *hdr; hv_vmbus_channel_msg_type msg_type; - if (msg->header.message_type == HV_MESSAGE_TYPE_NONE) + if (msg->msg_type == VMBUS_MSGTYPE_NONE) break; /* no message */ - hdr = (hv_vmbus_channel_msg_header *)msg->u.payload; + /* XXX: update messageHandler interface */ + hdr = __DEVOLATILE(hv_vmbus_channel_msg_header *, + msg->msg_data); msg_type = hdr->message_type; if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) { @@ -101,20 +102,20 @@ vmbus_msg_task(void *xsc, int pending __ if (entry->messageHandler) entry->messageHandler(hdr); handled: - msg->header.message_type = HV_MESSAGE_TYPE_NONE; + msg->msg_type = VMBUS_MSGTYPE_NONE; /* - * Make sure the write to message_type (ie set to - * HV_MESSAGE_TYPE_NONE) happens before we read the - * message_pending and EOMing. Otherwise, the EOMing will - * not deliver any more messages - * since there is no empty slot + * Make sure the write to msg_type (i.e. set to + * VMBUS_MSGTYPE_NONE) happens before we read the + * msg_flags and EOMing. Otherwise, the EOMing will + * not deliver any more messages since there is no + * empty slot * * NOTE: * mb() is used here, since atomic_thread_fence_seq_cst() * will become compiler fence on UP kernel. */ mb(); - if (msg->header.message_flags.u.message_pending) { + if (msg->msg_flags & VMBUS_MSGFLAG_PENDING) { /* * This will cause message queue rescan to possibly * deliver another msg from the hypervisor @@ -127,7 +128,8 @@ handled: static __inline int vmbus_handle_intr1(struct vmbus_softc *sc, struct trapframe *frame, int cpu) { - hv_vmbus_message *msg, *msg_base; + volatile struct vmbus_message *msg; + struct vmbus_message *msg_base; msg_base = VMBUS_PCPU_GET(sc, message, cpu); @@ -137,25 +139,24 @@ vmbus_handle_intr1(struct vmbus_softc *s * TODO: move this to independent IDT vector. */ msg = msg_base + VMBUS_SINT_TIMER; - if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) { - msg->header.message_type = HV_MESSAGE_TYPE_NONE; + if (msg->msg_type == VMBUS_MSGTYPE_TIMER_EXPIRED) { + msg->msg_type = VMBUS_MSGTYPE_NONE; vmbus_et_intr(frame); /* - * Make sure the write to message_type (ie set to - * HV_MESSAGE_TYPE_NONE) happens before we read the - * message_pending and EOMing. Otherwise, the EOMing will - * not deliver any more messages - * since there is no empty slot + * Make sure the write to msg_type (i.e. set to + * VMBUS_MSGTYPE_NONE) happens before we read the + * msg_flags and EOMing. Otherwise, the EOMing will + * not deliver any more messages since there is no + * empty slot * * NOTE: * mb() is used here, since atomic_thread_fence_seq_cst() * will become compiler fence on UP kernel. */ mb(); - - if (msg->header.message_flags.u.message_pending) { + if (msg->msg_flags & VMBUS_MSGFLAG_PENDING) { /* * This will cause message queue rescan to possibly * deliver another msg from the hypervisor @@ -177,7 +178,7 @@ vmbus_handle_intr1(struct vmbus_softc *s * Check messages. Mainly management stuffs; ultra low rate. */ msg = msg_base + VMBUS_SINT_MESSAGE; - if (__predict_false(msg->header.message_type != HV_MESSAGE_TYPE_NONE)) { + if (__predict_false(msg->msg_type != VMBUS_MSGTYPE_NONE)) { taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu), VMBUS_PCPU_PTR(sc, message_task, cpu)); } @@ -247,8 +248,8 @@ vmbus_synic_setup(void *xsc) */ orig = rdmsr(MSR_HV_SIEFP); val = MSR_HV_SIEFP_ENABLE | (orig & MSR_HV_SIEFP_RSVD_MASK) | - ((VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT) << - MSR_HV_SIEFP_PGSHIFT); + ((VMBUS_PCPU_GET(sc, event_flags_dma.hv_paddr, cpu) + >> PAGE_SHIFT) << MSR_HV_SIEFP_PGSHIFT); wrmsr(MSR_HV_SIEFP, val); @@ -338,11 +339,11 @@ vmbus_dma_alloc(struct vmbus_softc *sc) ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, - VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), + VMBUS_PCPU_PTR(sc, event_flags_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); if (ptr == NULL) return ENOMEM; - VMBUS_PCPU_GET(sc, event_flag, cpu) = ptr; + VMBUS_PCPU_GET(sc, event_flags, cpu) = ptr; } return 0; } @@ -359,11 +360,11 @@ vmbus_dma_free(struct vmbus_softc *sc) VMBUS_PCPU_GET(sc, message, cpu)); VMBUS_PCPU_GET(sc, message, cpu) = NULL; } - if (VMBUS_PCPU_GET(sc, event_flag, cpu) != NULL) { + if (VMBUS_PCPU_GET(sc, event_flags, cpu) != NULL) { hyperv_dmamem_free( - VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), - VMBUS_PCPU_GET(sc, event_flag, cpu)); - VMBUS_PCPU_GET(sc, event_flag, cpu) = NULL; + VMBUS_PCPU_PTR(sc, event_flags_dma, cpu), + VMBUS_PCPU_GET(sc, event_flags, cpu)); + VMBUS_PCPU_GET(sc, event_flags, cpu) = NULL; } } } @@ -534,16 +535,19 @@ vmbus_read_ivar(device_t dev, device_t c switch (index) { case HV_VMBUS_IVAR_TYPE: - *result = (uintptr_t) &child_dev_ctx->class_id; + *result = (uintptr_t)&child_dev_ctx->class_id; return (0); + case HV_VMBUS_IVAR_INSTANCE: - *result = (uintptr_t) &child_dev_ctx->device_id; + *result = (uintptr_t)&child_dev_ctx->device_id; return (0); + case HV_VMBUS_IVAR_DEVCTX: - *result = (uintptr_t) child_dev_ctx; + *result = (uintptr_t)child_dev_ctx; return (0); + case HV_VMBUS_IVAR_NODE: - *result = (uintptr_t) child_dev_ctx->device; + *result = (uintptr_t)child_dev_ctx->device; return (0); } return (ENOENT); @@ -566,18 +570,18 @@ vmbus_write_ivar(device_t dev, device_t static int vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen) { - char guidbuf[40]; struct hv_device *dev_ctx = device_get_ivars(child); + char guidbuf[HYPERV_GUID_STRLEN]; if (dev_ctx == NULL) return (0); strlcat(buf, "classid=", buflen); - snprintf_hv_guid(guidbuf, sizeof(guidbuf), &dev_ctx->class_id); + hyperv_guid2str(&dev_ctx->class_id, guidbuf, sizeof(guidbuf)); strlcat(buf, guidbuf, buflen); strlcat(buf, " deviceid=", buflen); - snprintf_hv_guid(guidbuf, sizeof(guidbuf), &dev_ctx->device_id); + hyperv_guid2str(&dev_ctx->device_id, guidbuf, sizeof(guidbuf)); strlcat(buf, guidbuf, buflen); return (0); @@ -602,30 +606,19 @@ hv_vmbus_child_device_create(hv_guid typ } int -snprintf_hv_guid(char *buf, size_t sz, const hv_guid *guid) -{ - int cnt; - const unsigned char *d = guid->data; - - cnt = snprintf(buf, sz, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - d[3], d[2], d[1], d[0], d[5], d[4], d[7], d[6], - d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); - return (cnt); -} - -int hv_vmbus_child_device_register(struct hv_device *child_dev) { - device_t child; + device_t child, parent; + parent = vmbus_get_device(); if (bootverbose) { - char name[40]; - snprintf_hv_guid(name, sizeof(name), &child_dev->class_id); - printf("VMBUS: Class ID: %s\n", name); + char name[HYPERV_GUID_STRLEN]; + + hyperv_guid2str(&child_dev->class_id, name, sizeof(name)); + device_printf(parent, "add device, classid: %s\n", name); } - child = device_add_child(vmbus_get_device(), NULL, -1); + child = device_add_child(parent, NULL, -1); child_dev->device = child; device_set_ivars(child, child_dev); @@ -649,7 +642,9 @@ hv_vmbus_child_device_unregister(struct static int vmbus_probe(device_t dev) { - if (ACPI_ID_PROBE(device_get_parent(dev), dev, vmbus_ids) == NULL || + char *id[] = { "VMBUS", NULL }; + + if (ACPI_ID_PROBE(device_get_parent(dev), dev, id) == NULL || device_get_unit(dev) != 0 || vm_guest != VM_GUEST_HV || (hyperv_features & CPUID_HV_MSR_SYNIC) == 0) return (ENXIO); Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jun 24 01:20:33 2016 (r302165) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jun 24 01:49:59 2016 (r302166) @@ -51,28 +51,6 @@ typedef uint16_t hv_vmbus_status; #define HV_ANY_VP (0xFFFFFFFF) /* - * Synthetic interrupt controller flag constants. - */ - -#define HV_EVENT_FLAGS_COUNT (256 * 8) -#define HV_EVENT_FLAGS_BYTE_COUNT (256) -#define HV_EVENT_FLAGS_DWORD_COUNT (256 / sizeof(uint32_t)) -#define HV_EVENT_FLAGS_ULONG_COUNT (256 / sizeof(unsigned long)) - -/** - * max channel count <== event_flags_dword_count * bit_of_dword - */ -#ifdef __LP64__ -#define HV_CHANNEL_ULONG_LEN (64) -#define HV_CHANNEL_ULONG_SHIFT (6) -#else -#define HV_CHANNEL_ULONG_LEN (32) -#define HV_CHANNEL_ULONG_SHIFT (5) -#endif -#define HV_CHANNEL_DWORD_LEN (32) -#define HV_CHANNEL_MAX_COUNT \ - ((HV_EVENT_FLAGS_DWORD_COUNT) * HV_CHANNEL_DWORD_LEN) -/* * MessageId: HV_STATUS_INSUFFICIENT_BUFFERS * MessageText: * You did not supply enough message buffers to send a message. @@ -195,9 +173,6 @@ enum { #define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t) -struct vmbus_message; -union vmbus_event_flags; - /* * Define hypervisor message types */ @@ -251,59 +226,9 @@ typedef union _hv_vmbus_port_id { } u ; } hv_vmbus_port_id; -/* - * Define synthetic interrupt controller message flag - */ -typedef union { - uint8_t as_uint8_t; - struct { - uint8_t message_pending:1; - uint8_t reserved:7; - } u; -} hv_vmbus_msg_flags; - typedef uint64_t hv_vmbus_partition_id; /* - * Define synthetic interrupt controller message header - */ -typedef struct { - hv_vmbus_msg_type message_type; - uint8_t payload_size; - hv_vmbus_msg_flags message_flags; - uint8_t reserved[2]; - union { - hv_vmbus_partition_id sender; - hv_vmbus_port_id port; - } u; -} hv_vmbus_msg_header; - -/* - * Define synthetic interrupt controller message format - */ -typedef struct vmbus_message { - hv_vmbus_msg_header header; - union { - uint64_t payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; - } u ; -} hv_vmbus_message; - -/* - * Maximum channels is determined by the size of the interrupt - * page which is PAGE_SIZE. 1/2 of PAGE_SIZE is for - * send endpoint interrupt and the other is receive - * endpoint interrupt. - * - * Note: (PAGE_SIZE >> 1) << 3 allocates 16348 channels - */ -#define HV_MAX_NUM_CHANNELS (PAGE_SIZE >> 1) << 3 - -/* - * (The value here must be in multiple of 32) - */ -#define HV_MAX_NUM_CHANNELS_SUPPORTED 256 - -/* * VM Bus connection states */ typedef enum { @@ -426,16 +351,6 @@ typedef struct { } hv_vmbus_input_post_message; /* - * Define the synthetic interrupt controller event flags format - */ -typedef union vmbus_event_flags { - uint8_t flags8[HV_EVENT_FLAGS_BYTE_COUNT]; - uint32_t flags32[HV_EVENT_FLAGS_DWORD_COUNT]; - unsigned long flagsul[HV_EVENT_FLAGS_ULONG_COUNT]; -} hv_vmbus_synic_event_flags; -CTASSERT(sizeof(hv_vmbus_synic_event_flags) == HV_EVENT_FLAGS_BYTE_COUNT); - -/* * Declare the various hypercall operations */ typedef enum { Modified: stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S Fri Jun 24 01:20:33 2016 (r302165) +++ stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S Fri Jun 24 01:49:59 2016 (r302166) @@ -35,15 +35,15 @@ * This is the Hyper-V vmbus channel direct callback interrupt. * Only used when it is running on Hyper-V. */ - .text - SUPERALIGN_TEXT + .text + SUPERALIGN_TEXT IDTVEC(vmbus_isr) - PUSH_FRAME - SET_KERNEL_SREGS - cld - FAKE_MCOUNT(TF_EIP(%esp)) - pushl %esp - call vmbus_handle_intr - add $4, %esp - MEXITCOUNT - jmp doreti + PUSH_FRAME + SET_KERNEL_SREGS + cld + FAKE_MCOUNT(TF_EIP(%esp)) + pushl %esp + call vmbus_handle_intr + add $4, %esp + MEXITCOUNT + jmp doreti Copied and modified: stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h (from r301019, head/sys/dev/hyperv/vmbus/vmbus_reg.h) ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue May 31 05:18:55 2016 (r301019, copy source) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jun 24 01:49:59 2016 (r302166) @@ -53,4 +53,30 @@ CTASSERT(sizeof(struct vmbus_message) == #define VMBUS_MSGFLAG_PENDING 0x01 +/* + * Hyper-V SynIC event flags + */ + +#ifdef __LP64__ +#define VMBUS_EVTFLAGS_MAX 32 +#define VMBUS_EVTFLAG_SHIFT 6 +#else +#define VMBUS_EVTFLAGS_MAX 64 +#define VMBUS_EVTFLAG_SHIFT 5 +#endif +#define VMBUS_EVTFLAG_LEN (1 << VMBUS_EVTFLAG_SHIFT) +#define VMBUS_EVTFLAGS_SIZE 256 + +struct vmbus_evtflags { + u_long evt_flags[VMBUS_EVTFLAGS_MAX]; +} __packed; +CTASSERT(sizeof(struct vmbus_evtflags) == VMBUS_EVTFLAGS_SIZE); + +/* + * Channel + */ + +#define VMBUS_CHAN_MAX_COMPAT 256 +#define VMBUS_CHAN_MAX (VMBUS_EVTFLAG_LEN * VMBUS_EVTFLAGS_MAX) + #endif /* !_VMBUS_REG_H_ */ Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jun 24 01:20:33 2016 (r302165) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jun 24 01:49:59 2016 (r302166) @@ -49,12 +49,12 @@ struct vmbus_pcpu_data { u_long *intr_cnt; /* Hyper-V interrupt counter */ struct vmbus_message *message; /* shared messages */ uint32_t vcpuid; /* virtual cpuid */ - int event_flag_cnt; /* # of event flags */ - union vmbus_event_flags *event_flag; /* shared event flags */ + int event_flags_cnt;/* # of event flags */ + struct vmbus_evtflags *event_flags; /* shared event flags */ /* Rarely used fields */ struct hyperv_dma message_dma; /* busdma glue */ - struct hyperv_dma event_flag_dma; /* busdma glue */ + struct hyperv_dma event_flags_dma;/* busdma glue */ struct taskqueue *event_tq; /* event taskq */ struct taskqueue *message_tq; /* message taskq */ struct task message_task; /* message task */ From owner-svn-src-all@freebsd.org Fri Jun 24 02:06:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B151B73515; Fri, 24 Jun 2016 02:06:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA7811A86; Fri, 24 Jun 2016 02:06:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5O26Eg8057313; Fri, 24 Jun 2016 02:06:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5O26Dxh057306; Fri, 24 Jun 2016 02:06:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606240206.u5O26Dxh057306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 24 Jun 2016 02:06: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: r302167 - in stable/10/sys: conf dev/hyperv/vmbus dev/hyperv/vmbus/amd64 dev/hyperv/vmbus/i386 modules/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 02:06:15 -0000 Author: sephe Date: Fri Jun 24 02:06:13 2016 New Revision: 302167 URL: https://svnweb.freebsd.org/changeset/base/302167 Log: MFC 301113 hyperv: Rename some cleaned up/almost cleaned up files MFC after: 1 week Sponsored by: Microsoft OSTC Added: stable/10/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S - copied unchanged from r302166, stable/10/sys/dev/hyperv/vmbus/amd64/hv_vector.S stable/10/sys/dev/hyperv/vmbus/hyperv.c - copied unchanged from r302166, stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/i386/vmbus_vector.S - copied unchanged from r302166, stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S stable/10/sys/dev/hyperv/vmbus/vmbus.c - copied unchanged from r302166, stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/vmbus_et.c - copied unchanged from r302166, stable/10/sys/dev/hyperv/vmbus/hv_et.c Deleted: stable/10/sys/dev/hyperv/vmbus/amd64/hv_vector.S stable/10/sys/dev/hyperv/vmbus/hv_et.c stable/10/sys/dev/hyperv/vmbus/hv_hv.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S Modified: stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/modules/hyperv/vmbus/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Fri Jun 24 01:49:59 2016 (r302166) +++ stable/10/sys/conf/files.amd64 Fri Jun 24 02:06:13 2016 (r302167) @@ -274,12 +274,12 @@ dev/hyperv/utilities/hv_util.c option dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv dev/hyperv/vmbus/hv_connection.c optional hyperv -dev/hyperv/vmbus/hv_hv.c optional hyperv -dev/hyperv/vmbus/hv_et.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv -dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv +dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv -dev/hyperv/vmbus/amd64/hv_vector.S optional hyperv +dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus_et.c optional hyperv +dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv dev/kbd/kbd.c optional atkbd | sc | ukbd | vt dev/lindev/full.c optional lindev dev/lindev/lindev.c optional lindev Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Fri Jun 24 01:49:59 2016 (r302166) +++ stable/10/sys/conf/files.i386 Fri Jun 24 02:06:13 2016 (r302167) @@ -250,12 +250,12 @@ dev/hyperv/utilities/hv_util.c option dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv dev/hyperv/vmbus/hv_connection.c optional hyperv -dev/hyperv/vmbus/hv_hv.c optional hyperv -dev/hyperv/vmbus/hv_et.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv -dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv +dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv -dev/hyperv/vmbus/i386/hv_vector.S optional hyperv +dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus_et.c optional hyperv +dev/hyperv/vmbus/i386/vmbus_vector.S optional hyperv dev/ichwd/ichwd.c optional ichwd dev/if_ndis/if_ndis.c optional ndis dev/if_ndis/if_ndis_pccard.c optional ndis pccard Copied: stable/10/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S (from r302166, stable/10/sys/dev/hyperv/vmbus/amd64/hv_vector.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S Fri Jun 24 02:06:13 2016 (r302167, copy of r302166, stable/10/sys/dev/hyperv/vmbus/amd64/hv_vector.S) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include "assym.s" + +/* + * This is the Hyper-V vmbus channel direct callback interrupt. + * Only used when it is running on Hyper-V. + */ + .text + SUPERALIGN_TEXT +IDTVEC(vmbus_isr) + PUSH_FRAME + FAKE_MCOUNT(TF_RIP(%rsp)) + movq %rsp, %rdi + call vmbus_handle_intr + MEXITCOUNT + jmp doreti Copied: stable/10/sys/dev/hyperv/vmbus/hyperv.c (from r302166, stable/10/sys/dev/hyperv/vmbus/hv_hv.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/hyperv.c Fri Jun 24 02:06:13 2016 (r302167, copy of r302166, stable/10/sys/dev/hyperv/vmbus/hv_hv.c) @@ -0,0 +1,404 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * Implements low-level interactions with Hypver-V/Azure + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define HYPERV_FREEBSD_BUILD 0ULL +#define HYPERV_FREEBSD_VERSION ((uint64_t)__FreeBSD_version) +#define HYPERV_FREEBSD_OSID 0ULL + +#define MSR_HV_GUESTID_BUILD_FREEBSD \ + (HYPERV_FREEBSD_BUILD & MSR_HV_GUESTID_BUILD_MASK) +#define MSR_HV_GUESTID_VERSION_FREEBSD \ + ((HYPERV_FREEBSD_VERSION << MSR_HV_GUESTID_VERSION_SHIFT) & \ + MSR_HV_GUESTID_VERSION_MASK) +#define MSR_HV_GUESTID_OSID_FREEBSD \ + ((HYPERV_FREEBSD_OSID << MSR_HV_GUESTID_OSID_SHIFT) & \ + MSR_HV_GUESTID_OSID_MASK) + +#define MSR_HV_GUESTID_FREEBSD \ + (MSR_HV_GUESTID_BUILD_FREEBSD | \ + MSR_HV_GUESTID_VERSION_FREEBSD | \ + MSR_HV_GUESTID_OSID_FREEBSD | \ + MSR_HV_GUESTID_OSTYPE_FREEBSD) + +struct hypercall_ctx { + void *hc_addr; + struct hyperv_dma hc_dma; +}; + +static u_int hyperv_get_timecount(struct timecounter *tc); + +u_int hyperv_features; +u_int hyperv_recommends; + +static u_int hyperv_pm_features; +static u_int hyperv_features3; + +static struct timecounter hyperv_timecounter = { + .tc_get_timecount = hyperv_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = 0xffffffff, + .tc_frequency = HYPERV_TIMER_FREQ, + .tc_name = "Hyper-V", + .tc_quality = 2000, + .tc_flags = 0, + .tc_priv = NULL +}; + +static struct hypercall_ctx hypercall_context; + +static u_int +hyperv_get_timecount(struct timecounter *tc __unused) +{ + return rdmsr(MSR_HV_TIME_REF_COUNT); +} + +/** + * @brief Invoke the specified hypercall + */ +static uint64_t +hv_vmbus_do_hypercall(uint64_t control, void* input, void* output) +{ +#ifdef __x86_64__ + uint64_t hv_status = 0; + uint64_t input_address = (input) ? hv_get_phys_addr(input) : 0; + uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0; + volatile void *hypercall_page = hypercall_context.hc_addr; + + __asm__ __volatile__ ("mov %0, %%r8" : : "r" (output_address): "r8"); + __asm__ __volatile__ ("call *%3" : "=a"(hv_status): + "c" (control), "d" (input_address), + "m" (hypercall_page)); + return (hv_status); +#else + uint32_t control_high = control >> 32; + uint32_t control_low = control & 0xFFFFFFFF; + uint32_t hv_status_high = 1; + uint32_t hv_status_low = 1; + uint64_t input_address = (input) ? hv_get_phys_addr(input) : 0; + uint32_t input_address_high = input_address >> 32; + uint32_t input_address_low = input_address & 0xFFFFFFFF; + uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0; + uint32_t output_address_high = output_address >> 32; + uint32_t output_address_low = output_address & 0xFFFFFFFF; + volatile void *hypercall_page = hypercall_context.hc_addr; + + __asm__ __volatile__ ("call *%8" : "=d"(hv_status_high), + "=a"(hv_status_low) : "d" (control_high), + "a" (control_low), "b" (input_address_high), + "c" (input_address_low), + "D"(output_address_high), + "S"(output_address_low), "m" (hypercall_page)); + return (hv_status_low | ((uint64_t)hv_status_high << 32)); +#endif /* __x86_64__ */ +} + +/** + * @brief Post a message using the hypervisor message IPC. + * (This involves a hypercall.) + */ +hv_vmbus_status +hv_vmbus_post_msg_via_msg_ipc( + hv_vmbus_connection_id connection_id, + hv_vmbus_msg_type message_type, + void* payload, + size_t payload_size) +{ + struct alignedinput { + uint64_t alignment8; + hv_vmbus_input_post_message msg; + }; + + hv_vmbus_input_post_message* aligned_msg; + hv_vmbus_status status; + size_t addr; + + if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT) + return (EMSGSIZE); + + addr = (size_t) malloc(sizeof(struct alignedinput), M_DEVBUF, + M_ZERO | M_NOWAIT); + KASSERT(addr != 0, + ("Error VMBUS: malloc failed to allocate message buffer!")); + if (addr == 0) + return (ENOMEM); + + aligned_msg = (hv_vmbus_input_post_message*) + (HV_ALIGN_UP(addr, HV_HYPERCALL_PARAM_ALIGN)); + + aligned_msg->connection_id = connection_id; + aligned_msg->message_type = message_type; + aligned_msg->payload_size = payload_size; + memcpy((void*) aligned_msg->payload, payload, payload_size); + + status = hv_vmbus_do_hypercall( + HV_CALL_POST_MESSAGE, aligned_msg, 0) & 0xFFFF; + + free((void *) addr, M_DEVBUF); + return (status); +} + +/** + * @brief Signal an event on the specified connection using the hypervisor + * event IPC. (This involves a hypercall.) + */ +hv_vmbus_status +hv_vmbus_signal_event(void *con_id) +{ + hv_vmbus_status status; + + status = hv_vmbus_do_hypercall( + HV_CALL_SIGNAL_EVENT, + con_id, + 0) & 0xFFFF; + + return (status); +} + +int +hyperv_guid2str(const struct hv_guid *guid, char *buf, size_t sz) +{ + const uint8_t *d = guid->data; + + return snprintf(buf, sz, "%02x%02x%02x%02x-" + "%02x%02x-%02x%02x-%02x%02x-" + "%02x%02x%02x%02x%02x%02x", + d[3], d[2], d[1], d[0], + d[5], d[4], d[7], d[6], d[8], d[9], + d[10], d[11], d[12], d[13], d[14], d[15]); +} + +static bool +hyperv_identify(void) +{ + u_int regs[4]; + unsigned int maxleaf; + + if (vm_guest != VM_GUEST_HV) + return (false); + + do_cpuid(CPUID_LEAF_HV_MAXLEAF, regs); + maxleaf = regs[0]; + if (maxleaf < CPUID_LEAF_HV_LIMITS) + return (false); + + do_cpuid(CPUID_LEAF_HV_INTERFACE, regs); + if (regs[0] != CPUID_HV_IFACE_HYPERV) + return (false); + + do_cpuid(CPUID_LEAF_HV_FEATURES, regs); + if ((regs[0] & CPUID_HV_MSR_HYPERCALL) == 0) { + /* + * Hyper-V w/o Hypercall is impossible; someone + * is faking Hyper-V. + */ + return (false); + } + hyperv_features = regs[0]; + hyperv_pm_features = regs[2]; + hyperv_features3 = regs[3]; + + do_cpuid(CPUID_LEAF_HV_IDENTITY, regs); + printf("Hyper-V Version: %d.%d.%d [SP%d]\n", + regs[1] >> 16, regs[1] & 0xffff, regs[0], regs[2]); + + printf(" Features=0x%b\n", hyperv_features, + "\020" + "\001VPRUNTIME" /* MSR_HV_VP_RUNTIME */ + "\002TMREFCNT" /* MSR_HV_TIME_REF_COUNT */ + "\003SYNIC" /* MSRs for SynIC */ + "\004SYNTM" /* MSRs for SynTimer */ + "\005APIC" /* MSR_HV_{EOI,ICR,TPR} */ + "\006HYPERCALL" /* MSR_HV_{GUEST_OS_ID,HYPERCALL} */ + "\007VPINDEX" /* MSR_HV_VP_INDEX */ + "\010RESET" /* MSR_HV_RESET */ + "\011STATS" /* MSR_HV_STATS_ */ + "\012REFTSC" /* MSR_HV_REFERENCE_TSC */ + "\013IDLE" /* MSR_HV_GUEST_IDLE */ + "\014TMFREQ" /* MSR_HV_{TSC,APIC}_FREQUENCY */ + "\015DEBUG"); /* MSR_HV_SYNTH_DEBUG_ */ + printf(" PM Features=0x%b [C%u]\n", + (hyperv_pm_features & ~CPUPM_HV_CSTATE_MASK), + "\020" + "\005C3HPET", /* HPET is required for C3 state */ + CPUPM_HV_CSTATE(hyperv_pm_features)); + printf(" Features3=0x%b\n", hyperv_features3, + "\020" + "\001MWAIT" /* MWAIT */ + "\002DEBUG" /* guest debug support */ + "\003PERFMON" /* performance monitor */ + "\004PCPUDPE" /* physical CPU dynamic partition event */ + "\005XMMHC" /* hypercall input through XMM regs */ + "\006IDLE" /* guest idle support */ + "\007SLEEP" /* hypervisor sleep support */ + "\010NUMA" /* NUMA distance query support */ + "\011TMFREQ" /* timer frequency query (TSC, LAPIC) */ + "\012SYNCMC" /* inject synthetic machine checks */ + "\013CRASH" /* MSRs for guest crash */ + "\014DEBUGMSR" /* MSRs for guest debug */ + "\015NPIEP" /* NPIEP */ + "\016HVDIS"); /* disabling hypervisor */ + + do_cpuid(CPUID_LEAF_HV_RECOMMENDS, regs); + hyperv_recommends = regs[0]; + if (bootverbose) + printf(" Recommends: %08x %08x\n", regs[0], regs[1]); + + do_cpuid(CPUID_LEAF_HV_LIMITS, regs); + if (bootverbose) { + printf(" Limits: Vcpu:%d Lcpu:%d Int:%d\n", + regs[0], regs[1], regs[2]); + } + + if (maxleaf >= CPUID_LEAF_HV_HWFEATURES) { + do_cpuid(CPUID_LEAF_HV_HWFEATURES, regs); + if (bootverbose) { + printf(" HW Features: %08x, AMD: %08x\n", + regs[0], regs[3]); + } + } + + return (true); +} + +static void +hyperv_init(void *dummy __unused) +{ + if (!hyperv_identify()) { + /* Not Hyper-V; reset guest id to the generic one. */ + if (vm_guest == VM_GUEST_HV) + vm_guest = VM_GUEST_VM; + return; + } + + /* Set guest id */ + wrmsr(MSR_HV_GUEST_OS_ID, MSR_HV_GUESTID_FREEBSD); + + if (hyperv_features & CPUID_HV_MSR_TIME_REFCNT) { + /* Register Hyper-V timecounter */ + tc_init(&hyperv_timecounter); + } +} +SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, + NULL); + +static void +hypercall_memfree(void) +{ + hyperv_dmamem_free(&hypercall_context.hc_dma, + hypercall_context.hc_addr); + hypercall_context.hc_addr = NULL; +} + +static void +hypercall_create(void *arg __unused) +{ + uint64_t hc, hc_orig; + + if (vm_guest != VM_GUEST_HV) + return; + + hypercall_context.hc_addr = hyperv_dmamem_alloc(NULL, PAGE_SIZE, 0, + PAGE_SIZE, &hypercall_context.hc_dma, BUS_DMA_WAITOK); + if (hypercall_context.hc_addr == NULL) { + printf("hyperv: Hypercall page allocation failed\n"); + /* Can't perform any Hyper-V specific actions */ + vm_guest = VM_GUEST_VM; + return; + } + + /* Get the 'reserved' bits, which requires preservation. */ + hc_orig = rdmsr(MSR_HV_HYPERCALL); + + /* + * Setup the Hypercall page. + * + * NOTE: 'reserved' bits MUST be preserved. + */ + hc = ((hypercall_context.hc_dma.hv_paddr >> PAGE_SHIFT) << + MSR_HV_HYPERCALL_PGSHIFT) | + (hc_orig & MSR_HV_HYPERCALL_RSVD_MASK) | + MSR_HV_HYPERCALL_ENABLE; + wrmsr(MSR_HV_HYPERCALL, hc); + + /* + * Confirm that Hypercall page did get setup. + */ + hc = rdmsr(MSR_HV_HYPERCALL); + if ((hc & MSR_HV_HYPERCALL_ENABLE) == 0) { + printf("hyperv: Hypercall setup failed\n"); + hypercall_memfree(); + /* Can't perform any Hyper-V specific actions */ + vm_guest = VM_GUEST_VM; + return; + } + if (bootverbose) + printf("hyperv: Hypercall created\n"); +} +SYSINIT(hypercall_ctor, SI_SUB_DRIVERS, SI_ORDER_FIRST, hypercall_create, NULL); + +static void +hypercall_destroy(void *arg __unused) +{ + uint64_t hc; + + if (hypercall_context.hc_addr == NULL) + return; + + /* Disable Hypercall */ + hc = rdmsr(MSR_HV_HYPERCALL); + wrmsr(MSR_HV_HYPERCALL, (hc & MSR_HV_HYPERCALL_RSVD_MASK)); + hypercall_memfree(); + + if (bootverbose) + printf("hyperv: Hypercall destroyed\n"); +} +SYSUNINIT(hypercall_dtor, SI_SUB_DRIVERS, SI_ORDER_FIRST, hypercall_destroy, + NULL); Copied: stable/10/sys/dev/hyperv/vmbus/i386/vmbus_vector.S (from r302166, stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/i386/vmbus_vector.S Fri Jun 24 02:06:13 2016 (r302167, copy of r302166, stable/10/sys/dev/hyperv/vmbus/i386/hv_vector.S) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include "assym.s" + +/* + * This is the Hyper-V vmbus channel direct callback interrupt. + * Only used when it is running on Hyper-V. + */ + .text + SUPERALIGN_TEXT +IDTVEC(vmbus_isr) + PUSH_FRAME + SET_KERNEL_SREGS + cld + FAKE_MCOUNT(TF_EIP(%esp)) + pushl %esp + call vmbus_handle_intr + add $4, %esp + MEXITCOUNT + jmp doreti Copied: stable/10/sys/dev/hyperv/vmbus/vmbus.c (from r302166, stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/vmbus.c Fri Jun 24 02:06:13 2016 (r302167, copy of r302166, stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c) @@ -0,0 +1,833 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * VM Bus Driver Implementation + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include "acpi_if.h" + +struct vmbus_softc *vmbus_sc; + +extern inthand_t IDTVEC(rsvd), IDTVEC(vmbus_isr); + +static void +vmbus_msg_task(void *xsc, int pending __unused) +{ + struct vmbus_softc *sc = xsc; + volatile struct vmbus_message *msg; + + msg = VMBUS_PCPU_GET(sc, message, curcpu) + VMBUS_SINT_MESSAGE; + for (;;) { + const hv_vmbus_channel_msg_table_entry *entry; + hv_vmbus_channel_msg_header *hdr; + hv_vmbus_channel_msg_type msg_type; + + if (msg->msg_type == VMBUS_MSGTYPE_NONE) + break; /* no message */ + + /* XXX: update messageHandler interface */ + hdr = __DEVOLATILE(hv_vmbus_channel_msg_header *, + msg->msg_data); + msg_type = hdr->message_type; + + if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) { + printf("VMBUS: unknown message type = %d\n", msg_type); + goto handled; + } + + entry = &g_channel_message_table[msg_type]; + if (entry->messageHandler) + entry->messageHandler(hdr); +handled: + msg->msg_type = VMBUS_MSGTYPE_NONE; + /* + * Make sure the write to msg_type (i.e. set to + * VMBUS_MSGTYPE_NONE) happens before we read the + * msg_flags and EOMing. Otherwise, the EOMing will + * not deliver any more messages since there is no + * empty slot + * + * NOTE: + * mb() is used here, since atomic_thread_fence_seq_cst() + * will become compiler fence on UP kernel. + */ + mb(); + if (msg->msg_flags & VMBUS_MSGFLAG_PENDING) { + /* + * This will cause message queue rescan to possibly + * deliver another msg from the hypervisor + */ + wrmsr(MSR_HV_EOM, 0); + } + } +} + +static __inline int +vmbus_handle_intr1(struct vmbus_softc *sc, struct trapframe *frame, int cpu) +{ + volatile struct vmbus_message *msg; + struct vmbus_message *msg_base; + + msg_base = VMBUS_PCPU_GET(sc, message, cpu); + + /* + * Check event timer. + * + * TODO: move this to independent IDT vector. + */ + msg = msg_base + VMBUS_SINT_TIMER; + if (msg->msg_type == VMBUS_MSGTYPE_TIMER_EXPIRED) { + msg->msg_type = VMBUS_MSGTYPE_NONE; + + vmbus_et_intr(frame); + + /* + * Make sure the write to msg_type (i.e. set to + * VMBUS_MSGTYPE_NONE) happens before we read the + * msg_flags and EOMing. Otherwise, the EOMing will + * not deliver any more messages since there is no + * empty slot + * + * NOTE: + * mb() is used here, since atomic_thread_fence_seq_cst() + * will become compiler fence on UP kernel. + */ + mb(); + if (msg->msg_flags & VMBUS_MSGFLAG_PENDING) { + /* + * This will cause message queue rescan to possibly + * deliver another msg from the hypervisor + */ + wrmsr(MSR_HV_EOM, 0); + } + } + + /* + * Check events. Hot path for network and storage I/O data; high rate. + * + * NOTE: + * As recommended by the Windows guest fellows, we check events before + * checking messages. + */ + sc->vmbus_event_proc(sc, cpu); + + /* + * Check messages. Mainly management stuffs; ultra low rate. + */ + msg = msg_base + VMBUS_SINT_MESSAGE; + if (__predict_false(msg->msg_type != VMBUS_MSGTYPE_NONE)) { + taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu), + VMBUS_PCPU_PTR(sc, message_task, cpu)); + } + + return (FILTER_HANDLED); +} + +void +vmbus_handle_intr(struct trapframe *trap_frame) +{ + struct vmbus_softc *sc = vmbus_get_softc(); + int cpu = curcpu; + + /* + * Disable preemption. + */ + critical_enter(); + + /* + * Do a little interrupt counting. + */ + (*VMBUS_PCPU_GET(sc, intr_cnt, cpu))++; + + vmbus_handle_intr1(sc, trap_frame, cpu); + + /* + * Enable preemption. + */ + critical_exit(); +} + +static void +vmbus_synic_setup(void *xsc) +{ + struct vmbus_softc *sc = xsc; + int cpu = curcpu; + uint64_t val, orig; + uint32_t sint; + + if (hyperv_features & CPUID_HV_MSR_VP_INDEX) { + /* + * Save virtual processor id. + */ + VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(MSR_HV_VP_INDEX); + } else { + /* + * XXX + * Virtual processoor id is only used by a pretty broken + * channel selection code from storvsc. It's nothing + * critical even if CPUID_HV_MSR_VP_INDEX is not set; keep + * moving on. + */ + VMBUS_PCPU_GET(sc, vcpuid, cpu) = cpu; + } + + /* + * Setup the SynIC message. + */ + orig = rdmsr(MSR_HV_SIMP); + val = MSR_HV_SIMP_ENABLE | (orig & MSR_HV_SIMP_RSVD_MASK) | + ((VMBUS_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT) << + MSR_HV_SIMP_PGSHIFT); + wrmsr(MSR_HV_SIMP, val); + + /* + * Setup the SynIC event flags. + */ + orig = rdmsr(MSR_HV_SIEFP); + val = MSR_HV_SIEFP_ENABLE | (orig & MSR_HV_SIEFP_RSVD_MASK) | + ((VMBUS_PCPU_GET(sc, event_flags_dma.hv_paddr, cpu) + >> PAGE_SHIFT) << MSR_HV_SIEFP_PGSHIFT); + wrmsr(MSR_HV_SIEFP, val); + + + /* + * Configure and unmask SINT for message and event flags. + */ + sint = MSR_HV_SINT0 + VMBUS_SINT_MESSAGE; + orig = rdmsr(sint); + val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI | + (orig & MSR_HV_SINT_RSVD_MASK); + wrmsr(sint, val); + + /* + * Configure and unmask SINT for timer. + */ + sint = MSR_HV_SINT0 + VMBUS_SINT_TIMER; + orig = rdmsr(sint); + val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI | + (orig & MSR_HV_SINT_RSVD_MASK); + wrmsr(sint, val); + + /* + * All done; enable SynIC. + */ + orig = rdmsr(MSR_HV_SCONTROL); + val = MSR_HV_SCTRL_ENABLE | (orig & MSR_HV_SCTRL_RSVD_MASK); + wrmsr(MSR_HV_SCONTROL, val); +} + +static void +vmbus_synic_teardown(void *arg) +{ + uint64_t orig; + uint32_t sint; + + /* + * Disable SynIC. + */ + orig = rdmsr(MSR_HV_SCONTROL); + wrmsr(MSR_HV_SCONTROL, (orig & MSR_HV_SCTRL_RSVD_MASK)); + + /* + * Mask message and event flags SINT. + */ + sint = MSR_HV_SINT0 + VMBUS_SINT_MESSAGE; + orig = rdmsr(sint); + wrmsr(sint, orig | MSR_HV_SINT_MASKED); + + /* + * Mask timer SINT. + */ + sint = MSR_HV_SINT0 + VMBUS_SINT_TIMER; + orig = rdmsr(sint); + wrmsr(sint, orig | MSR_HV_SINT_MASKED); + + /* + * Teardown SynIC message. + */ + orig = rdmsr(MSR_HV_SIMP); + wrmsr(MSR_HV_SIMP, (orig & MSR_HV_SIMP_RSVD_MASK)); + + /* + * Teardown SynIC event flags. + */ + orig = rdmsr(MSR_HV_SIEFP); + wrmsr(MSR_HV_SIEFP, (orig & MSR_HV_SIEFP_RSVD_MASK)); +} + +static int +vmbus_dma_alloc(struct vmbus_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + void *ptr; + + /* + * Per-cpu messages and event flags. + */ + ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, PAGE_SIZE, + VMBUS_PCPU_PTR(sc, message_dma, cpu), + BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (ptr == NULL) + return ENOMEM; + VMBUS_PCPU_GET(sc, message, cpu) = ptr; + + ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, PAGE_SIZE, + VMBUS_PCPU_PTR(sc, event_flags_dma, cpu), + BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (ptr == NULL) + return ENOMEM; + VMBUS_PCPU_GET(sc, event_flags, cpu) = ptr; + } + return 0; +} + +static void +vmbus_dma_free(struct vmbus_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) { + hyperv_dmamem_free( + VMBUS_PCPU_PTR(sc, message_dma, cpu), + VMBUS_PCPU_GET(sc, message, cpu)); + VMBUS_PCPU_GET(sc, message, cpu) = NULL; + } + if (VMBUS_PCPU_GET(sc, event_flags, cpu) != NULL) { + hyperv_dmamem_free( + VMBUS_PCPU_PTR(sc, event_flags_dma, cpu), + VMBUS_PCPU_GET(sc, event_flags, cpu)); + VMBUS_PCPU_GET(sc, event_flags, cpu) = NULL; + } + } +} + +/** + * @brief Find a free IDT slot and setup the interrupt handler. + */ +static int +vmbus_vector_alloc(void) +{ + int vector; + uintptr_t func; + struct gate_descriptor *ip; + + /* + * Search backwards form the highest IDT vector available for use + * as vmbus channel callback vector. We install 'hv_vmbus_callback' + * handler at that vector and use it to interrupt vcpus. + */ + vector = APIC_SPURIOUS_INT; + while (--vector >= APIC_IPI_INTS) { + ip = &idt[vector]; + func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); + if (func == (uintptr_t)&IDTVEC(rsvd)) { +#ifdef __i386__ + setidt(vector , IDTVEC(vmbus_isr), SDT_SYS386IGT, + SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); +#else + setidt(vector , IDTVEC(vmbus_isr), SDT_SYSIGT, + SEL_KPL, 0); +#endif + + return (vector); + } + } + return (0); +} + +/** + * @brief Restore the IDT slot to rsvd. + */ +static void +vmbus_vector_free(int vector) +{ + uintptr_t func; + struct gate_descriptor *ip; + + if (vector == 0) + return; + + KASSERT(vector >= APIC_IPI_INTS && vector < APIC_SPURIOUS_INT, + ("invalid vector %d", vector)); + + ip = &idt[vector]; + func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); + KASSERT(func == (uintptr_t)&IDTVEC(hv_vmbus_callback), + ("invalid vector %d", vector)); + + setidt(vector, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0); +} + +static void +vmbus_cpuset_setthread_task(void *xmask, int pending __unused) +{ + cpuset_t *mask = xmask; + int error; + + error = cpuset_setthread(curthread->td_tid, mask); + if (error) { + panic("curthread=%ju: can't pin; error=%d", + (uintmax_t)curthread->td_tid, error); + } +} + +static int +vmbus_intr_setup(struct vmbus_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + struct task cpuset_task; + char buf[MAXCOMLEN + 1]; + cpuset_t cpu_mask; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Jun 24 02:24:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F5BAB73FCB; Fri, 24 Jun 2016 02:24:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67A1027FB; Fri, 24 Jun 2016 02:24:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5O2OYhq064512; Fri, 24 Jun 2016 02:24:34 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5O2OYXc064510; Fri, 24 Jun 2016 02:24:34 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201606240224.u5O2OYXc064510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 24 Jun 2016 02:24:34 +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: r302168 - stable/10/lib/libc/regex X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 02:24:35 -0000 Author: pfg Date: Fri Jun 24 02:24:34 2016 New Revision: 302168 URL: https://svnweb.freebsd.org/changeset/base/302168 Log: MFC r300683: libc: regexec(3) adjustment. Change the behavior of when REG_STARTEND is combined with REG_NOTBOL. From the original posting[1]: "Enable the assumption that pmatch[0].rm_so is a continuation offset to a string and allows us to do a proper assessment of the character in regards to it's word position ('^' or '\<'), without risking going into unallocated memory." This change makes us similar to how glibc handles REG_STARTEND | REG_NOTBOL, and is closely related to a soon-to-land fix to sed. Special thanks to Martijn van Duren and Ingo Schwarze for working out some consistent behaviour. Differential Revision: https://reviews.freebsd.org/D6257 Taken from: openbsd-tech 2016-05-24 [1] (Martijn van Duren) Modified: stable/10/lib/libc/regex/engine.c stable/10/lib/libc/regex/regex.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/regex/engine.c ============================================================================== --- stable/10/lib/libc/regex/engine.c Fri Jun 24 02:06:13 2016 (r302167) +++ stable/10/lib/libc/regex/engine.c Fri Jun 24 02:24:34 2016 (r302168) @@ -786,7 +786,7 @@ fast( struct match *m, ASSIGN(fresh, st); SP("start", st, *p); coldp = NULL; - if (start == m->beginp) + if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; else { /* @@ -891,7 +891,7 @@ slow( struct match *m, SP("sstart", st, *p); st = step(m->g, startst, stopst, st, NOTHING, st); matchp = NULL; - if (start == m->beginp) + if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; else { /* Modified: stable/10/lib/libc/regex/regex.3 ============================================================================== --- stable/10/lib/libc/regex/regex.3 Fri Jun 24 02:06:13 2016 (r302167) +++ stable/10/lib/libc/regex/regex.3 Fri Jun 24 02:24:34 2016 (r302168) @@ -32,7 +32,7 @@ .\" @(#)regex.3 8.4 (Berkeley) 3/20/94 .\" $FreeBSD$ .\" -.Dd August 17, 2005 +.Dd May 25, 2016 .Dt REGEX 3 .Os .Sh NAME @@ -235,11 +235,16 @@ The argument is the bitwise OR of zero or more of the following flags: .Bl -tag -width REG_STARTEND .It Dv REG_NOTBOL -The first character of -the string -is not the beginning of a line, so the -.Ql ^\& -anchor should not match before it. +The first character of the string is treated as the continuation +of a line. +This means that the anchors +.Ql ^\& , +.Ql [[:<:]] , +and +.Ql \e< +do not match before it; but see +.Dv REG_STARTEND +below. This does not affect the behavior of newlines under .Dv REG_NEWLINE . .It Dv REG_NOTEOL @@ -247,19 +252,16 @@ The NUL terminating the string does not end a line, so the .Ql $\& -anchor should not match before it. +anchor does not match before it. This does not affect the behavior of newlines under .Dv REG_NEWLINE . .It Dv REG_STARTEND The string is considered to start at -.Fa string -+ -.Fa pmatch Ns [0]. Ns Va rm_so -and to have a terminating NUL located at -.Fa string -+ -.Fa pmatch Ns [0]. Ns Va rm_eo -(there need not actually be a NUL at that location), +.Fa string No + +.Fa pmatch Ns [0]. Ns Fa rm_so +and to end before the byte located at +.Fa string No + +.Fa pmatch Ns [0]. Ns Fa rm_eo , regardless of the value of .Fa nmatch . See below for the definition of @@ -271,13 +273,37 @@ compatible with but not specified by .St -p1003.2 , and should be used with caution in software intended to be portable to other systems. -Note that a non-zero -.Va rm_so -does not imply -.Dv REG_NOTBOL ; -.Dv REG_STARTEND -affects only the location of the string, -not how it is matched. +.Pp +Without +.Dv REG_NOTBOL , +the position +.Fa rm_so +is considered the beginning of a line, such that +.Ql ^ +matches before it, and the beginning of a word if there is a word +character at this position, such that +.Ql [[:<:]] +and +.Ql \e< +match before it. +.Pp +With +.Dv REG_NOTBOL , +the character at position +.Fa rm_so +is treated as the continuation of a line, and if +.Fa rm_so +is greater than 0, the preceding character is taken into consideration. +If the preceding character is a newline and the regular expression was compiled +with +.Dv REG_NEWLINE , +.Ql ^ +matches before the string; if the preceding character is not a word character +but the string starts with a word character, +.Ql [[:<:]] +and +.Ql \e< +match before the string. .El .Pp See From owner-svn-src-all@freebsd.org Fri Jun 24 02:28:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DBA3B7306A; Fri, 24 Jun 2016 02:28:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECD0A2994; Fri, 24 Jun 2016 02:28:25 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5O2SPWB064700; Fri, 24 Jun 2016 02:28:25 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5O2SPeu064698; Fri, 24 Jun 2016 02:28:25 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201606240228.u5O2SPeu064698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 24 Jun 2016 02:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r302169 - stable/9/lib/libc/regex X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 02:28:26 -0000 Author: pfg Date: Fri Jun 24 02:28:24 2016 New Revision: 302169 URL: https://svnweb.freebsd.org/changeset/base/302169 Log: MFC r300683: libc: regexec(3) adjustment. Change the behavior of when REG_STARTEND is combined with REG_NOTBOL. From the original posting[1]: "Enable the assumption that pmatch[0].rm_so is a continuation offset to a string and allows us to do a proper assessment of the character in regards to it's word position ('^' or '\<'), without risking going into unallocated memory." This change makes us similar to how glibc handles REG_STARTEND | REG_NOTBOL, and is closely related to a soon-to-land fix to sed. Special thanks to Martijn van Duren and Ingo Schwarze for working out some consistent behaviour. Differential Revision: https://reviews.freebsd.org/D6257 Taken from: openbsd-tech 2016-05-24 [1] (Martijn van Duren) Modified: stable/9/lib/libc/regex/engine.c stable/9/lib/libc/regex/regex.3 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/regex/engine.c ============================================================================== --- stable/9/lib/libc/regex/engine.c Fri Jun 24 02:24:34 2016 (r302168) +++ stable/9/lib/libc/regex/engine.c Fri Jun 24 02:28:24 2016 (r302169) @@ -786,7 +786,7 @@ fast( struct match *m, ASSIGN(fresh, st); SP("start", st, *p); coldp = NULL; - if (start == m->beginp) + if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; else { /* @@ -891,7 +891,7 @@ slow( struct match *m, SP("sstart", st, *p); st = step(m->g, startst, stopst, st, NOTHING, st); matchp = NULL; - if (start == m->beginp) + if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; else { /* Modified: stable/9/lib/libc/regex/regex.3 ============================================================================== --- stable/9/lib/libc/regex/regex.3 Fri Jun 24 02:24:34 2016 (r302168) +++ stable/9/lib/libc/regex/regex.3 Fri Jun 24 02:28:24 2016 (r302169) @@ -32,7 +32,7 @@ .\" @(#)regex.3 8.4 (Berkeley) 3/20/94 .\" $FreeBSD$ .\" -.Dd August 17, 2005 +.Dd May 25, 2016 .Dt REGEX 3 .Os .Sh NAME @@ -235,11 +235,16 @@ The argument is the bitwise OR of zero or more of the following flags: .Bl -tag -width REG_STARTEND .It Dv REG_NOTBOL -The first character of -the string -is not the beginning of a line, so the -.Ql ^\& -anchor should not match before it. +The first character of the string is treated as the continuation +of a line. +This means that the anchors +.Ql ^\& , +.Ql [[:<:]] , +and +.Ql \e< +do not match before it; but see +.Dv REG_STARTEND +below. This does not affect the behavior of newlines under .Dv REG_NEWLINE . .It Dv REG_NOTEOL @@ -247,19 +252,16 @@ The NUL terminating the string does not end a line, so the .Ql $\& -anchor should not match before it. +anchor does not match before it. This does not affect the behavior of newlines under .Dv REG_NEWLINE . .It Dv REG_STARTEND The string is considered to start at -.Fa string -+ -.Fa pmatch Ns [0]. Ns Va rm_so -and to have a terminating NUL located at -.Fa string -+ -.Fa pmatch Ns [0]. Ns Va rm_eo -(there need not actually be a NUL at that location), +.Fa string No + +.Fa pmatch Ns [0]. Ns Fa rm_so +and to end before the byte located at +.Fa string No + +.Fa pmatch Ns [0]. Ns Fa rm_eo , regardless of the value of .Fa nmatch . See below for the definition of @@ -271,13 +273,37 @@ compatible with but not specified by .St -p1003.2 , and should be used with caution in software intended to be portable to other systems. -Note that a non-zero -.Va rm_so -does not imply -.Dv REG_NOTBOL ; -.Dv REG_STARTEND -affects only the location of the string, -not how it is matched. +.Pp +Without +.Dv REG_NOTBOL , +the position +.Fa rm_so +is considered the beginning of a line, such that +.Ql ^ +matches before it, and the beginning of a word if there is a word +character at this position, such that +.Ql [[:<:]] +and +.Ql \e< +match before it. +.Pp +With +.Dv REG_NOTBOL , +the character at position +.Fa rm_so +is treated as the continuation of a line, and if +.Fa rm_so +is greater than 0, the preceding character is taken into consideration. +If the preceding character is a newline and the regular expression was compiled +with +.Dv REG_NEWLINE , +.Ql ^ +matches before the string; if the preceding character is not a word character +but the string starts with a word character, +.Ql [[:<:]] +and +.Ql \e< +match before the string. .El .Pp See From owner-svn-src-all@freebsd.org Fri Jun 24 02:30:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18834B7311A; Fri, 24 Jun 2016 02:30:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A35AA2B36; Fri, 24 Jun 2016 02:30:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5O2UFKh064836; Fri, 24 Jun 2016 02:30:15 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5O2UE3Z064822; Fri, 24 Jun 2016 02:30:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201606240230.u5O2UE3Z064822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 24 Jun 2016 02:30:14 +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: r302170 - in stable/10/sys: conf dev/hyperv/vmbus dev/hyperv/vmbus/amd64 dev/hyperv/vmbus/i386 modules/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 02:30:17 -0000 Author: sephe Date: Fri Jun 24 02:30:14 2016 New Revision: 302170 URL: https://svnweb.freebsd.org/changeset/base/302170 Log: MFC 301483,301484,301487,301488,301583,301588 301483 hyperv: Move machine dependent bits into machine dependent files. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6701 301484 hyperv/vmbus: Define type for channel messages. And fix message processing; only channel messages are supported. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6706 301487 hyperv/vmbus: Factor out channel message processing This paves the way for further cleanup. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6707 301488 hyperv/vmbus: Constify channel message MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6708 301583 hyperv/vmbus: Busdma-fy MNF and event flags. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6744 301588 hyperv/vmbus: Change tx_evtflags type to u_long to match vmbus_evtflags MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6745 Added: stable/10/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c - copied unchanged from r301483, head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c stable/10/sys/dev/hyperv/vmbus/hyperv_machdep.h - copied unchanged from r301483, head/sys/dev/hyperv/vmbus/hyperv_machdep.h stable/10/sys/dev/hyperv/vmbus/i386/hyperv_machdep.c - copied unchanged from r301483, head/sys/dev/hyperv/vmbus/i386/hyperv_machdep.c Modified: stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/10/sys/dev/hyperv/vmbus/hyperv.c stable/10/sys/dev/hyperv/vmbus/vmbus.c stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h stable/10/sys/dev/hyperv/vmbus/vmbus_var.h stable/10/sys/modules/hyperv/vmbus/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/conf/files.amd64 Fri Jun 24 02:30:14 2016 (r302170) @@ -279,6 +279,7 @@ dev/hyperv/vmbus/hyperv.c optional hy dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv +dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv dev/kbd/kbd.c optional atkbd | sc | ukbd | vt dev/lindev/full.c optional lindev Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/conf/files.i386 Fri Jun 24 02:30:14 2016 (r302170) @@ -255,6 +255,7 @@ dev/hyperv/vmbus/hyperv.c optional hy dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv +dev/hyperv/vmbus/i386/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/i386/vmbus_vector.S optional hyperv dev/ichwd/ichwd.c optional ichwd dev/if_ndis/if_ndis.c optional ndis Copied: stable/10/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c (from r301483, head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c Fri Jun 24 02:30:14 2016 (r302170, copy of r301483, head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c) @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +uint64_t +hypercall_md(volatile void *hc_addr, uint64_t in_val, + uint64_t in_paddr, uint64_t out_paddr) +{ + uint64_t status; + + __asm__ __volatile__ ("mov %0, %%r8" : : "r" (out_paddr): "r8"); + __asm__ __volatile__ ("call *%3" : "=a" (status) : + "c" (in_val), "d" (in_paddr), "m" (hc_addr)); + return (status); +} Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel.c Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c Fri Jun 24 02:30:14 2016 (r302170) @@ -37,12 +37,16 @@ __FBSDID("$FreeBSD$"); #include #include #include + +#include #include + #include #include #include #include +#include #include static int vmbus_channel_create_gpadl_header( @@ -62,17 +66,16 @@ static void VmbusProcessChannelEvent(voi static void vmbus_channel_set_event(hv_vmbus_channel *channel) { - hv_vmbus_monitor_page *monitor_page; - if (channel->offer_msg.monitor_allocated) { - /* Each uint32_t represents 32 channels */ - synch_set_bit((channel->offer_msg.child_rel_id & 31), - ((uint32_t *)hv_vmbus_g_connection.send_interrupt_page - + ((channel->offer_msg.child_rel_id >> 5)))); - - monitor_page = (hv_vmbus_monitor_page *) - hv_vmbus_g_connection.monitor_page_2; + struct vmbus_softc *sc = vmbus_get_softc(); + hv_vmbus_monitor_page *monitor_page; + uint32_t chanid = channel->offer_msg.child_rel_id; + + atomic_set_long( + &sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], + 1UL << (chanid & VMBUS_EVTFLAG_MASK)); + monitor_page = sc->vmbus_mnf2; synch_set_bit(channel->monitor_bit, (uint32_t *)&monitor_page-> trigger_group[channel->monitor_group].u.pending); Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Fri Jun 24 02:30:14 2016 (r302170) @@ -43,20 +43,34 @@ __FBSDID("$FreeBSD$"); * Internal functions */ -static void vmbus_channel_on_offer(hv_vmbus_channel_msg_header* hdr); -static void vmbus_channel_on_offer_internal(void* context); -static void vmbus_channel_on_open_result(hv_vmbus_channel_msg_header* hdr); -static void vmbus_channel_on_offer_rescind(hv_vmbus_channel_msg_header* hdr); -static void vmbus_channel_on_offer_rescind_internal(void* context); -static void vmbus_channel_on_gpadl_created(hv_vmbus_channel_msg_header* hdr); -static void vmbus_channel_on_gpadl_torndown(hv_vmbus_channel_msg_header* hdr); -static void vmbus_channel_on_offers_delivered(hv_vmbus_channel_msg_header* hdr); -static void vmbus_channel_on_version_response(hv_vmbus_channel_msg_header* hdr); +typedef void (*vmbus_msg_handler)(const hv_vmbus_channel_msg_header *msg); + +typedef struct hv_vmbus_channel_msg_table_entry { + hv_vmbus_channel_msg_type messageType; + vmbus_msg_handler messageHandler; +} hv_vmbus_channel_msg_table_entry; + +static void vmbus_channel_on_offer_internal(void *context); +static void vmbus_channel_on_offer_rescind_internal(void *context); + +static void vmbus_channel_on_offer(const hv_vmbus_channel_msg_header *hdr); +static void vmbus_channel_on_open_result( + const hv_vmbus_channel_msg_header *hdr); +static void vmbus_channel_on_offer_rescind( + const hv_vmbus_channel_msg_header *hdr); +static void vmbus_channel_on_gpadl_created( + const hv_vmbus_channel_msg_header *hdr); +static void vmbus_channel_on_gpadl_torndown( + const hv_vmbus_channel_msg_header *hdr); +static void vmbus_channel_on_offers_delivered( + const hv_vmbus_channel_msg_header *hdr); +static void vmbus_channel_on_version_response( + const hv_vmbus_channel_msg_header *hdr); /** * Channel message dispatch table */ -hv_vmbus_channel_msg_table_entry +static const hv_vmbus_channel_msg_table_entry g_channel_message_table[HV_CHANNEL_MESSAGE_COUNT] = { { HV_CHANNEL_MESSAGE_INVALID, NULL }, @@ -387,12 +401,12 @@ vmbus_channel_select_defcpu(struct hv_vm * object to process the offer synchronously */ static void -vmbus_channel_on_offer(hv_vmbus_channel_msg_header* hdr) +vmbus_channel_on_offer(const hv_vmbus_channel_msg_header *hdr) { - hv_vmbus_channel_offer_channel* offer; - hv_vmbus_channel_offer_channel* copied; + const hv_vmbus_channel_offer_channel *offer; + hv_vmbus_channel_offer_channel *copied; - offer = (hv_vmbus_channel_offer_channel*) hdr; + offer = (const hv_vmbus_channel_offer_channel *)hdr; // copy offer data copied = malloc(sizeof(*copied), M_DEVBUF, M_NOWAIT); @@ -465,12 +479,12 @@ vmbus_channel_on_offer_internal(void* co * synchronously */ static void -vmbus_channel_on_offer_rescind(hv_vmbus_channel_msg_header* hdr) +vmbus_channel_on_offer_rescind(const hv_vmbus_channel_msg_header *hdr) { - hv_vmbus_channel_rescind_offer* rescind; + const hv_vmbus_channel_rescind_offer *rescind; hv_vmbus_channel* channel; - rescind = (hv_vmbus_channel_rescind_offer*) hdr; + rescind = (const hv_vmbus_channel_rescind_offer *)hdr; channel = hv_vmbus_g_connection.channels[rescind->child_rel_id]; if (channel == NULL) @@ -497,7 +511,8 @@ vmbus_channel_on_offer_rescind_internal( * @brief Invoked when all offers have been delivered. */ static void -vmbus_channel_on_offers_delivered(hv_vmbus_channel_msg_header* hdr) +vmbus_channel_on_offers_delivered( + const hv_vmbus_channel_msg_header *hdr __unused) { mtx_lock(&vmbus_chwait_lock); @@ -514,14 +529,14 @@ vmbus_channel_on_offers_delivered(hv_vmb * response and signal the requesting thread. */ static void -vmbus_channel_on_open_result(hv_vmbus_channel_msg_header* hdr) +vmbus_channel_on_open_result(const hv_vmbus_channel_msg_header *hdr) { - hv_vmbus_channel_open_result* result; + const hv_vmbus_channel_open_result *result; hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* requestHeader; hv_vmbus_channel_open_channel* openMsg; - result = (hv_vmbus_channel_open_result*) hdr; + result = (const hv_vmbus_channel_open_result *)hdr; /* * Find the open msg, copy the result and signal/unblock the wait event @@ -556,14 +571,14 @@ vmbus_channel_on_open_result(hv_vmbus_ch * response and signal the requesting thread. */ static void -vmbus_channel_on_gpadl_created(hv_vmbus_channel_msg_header* hdr) +vmbus_channel_on_gpadl_created(const hv_vmbus_channel_msg_header *hdr) { - hv_vmbus_channel_gpadl_created* gpadl_created; + const hv_vmbus_channel_gpadl_created *gpadl_created; hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* request_header; hv_vmbus_channel_gpadl_header* gpadl_header; - gpadl_created = (hv_vmbus_channel_gpadl_created*) hdr; + gpadl_created = (const hv_vmbus_channel_gpadl_created *)hdr; /* Find the establish msg, copy the result and signal/unblock * the wait event @@ -598,14 +613,14 @@ vmbus_channel_on_gpadl_created(hv_vmbus_ * response and signal the requesting thread */ static void -vmbus_channel_on_gpadl_torndown(hv_vmbus_channel_msg_header* hdr) +vmbus_channel_on_gpadl_torndown(const hv_vmbus_channel_msg_header *hdr) { - hv_vmbus_channel_gpadl_torndown* gpadl_torndown; + const hv_vmbus_channel_gpadl_torndown *gpadl_torndown; hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* requestHeader; hv_vmbus_channel_gpadl_teardown* gpadlTeardown; - gpadl_torndown = (hv_vmbus_channel_gpadl_torndown*)hdr; + gpadl_torndown = (const hv_vmbus_channel_gpadl_torndown *)hdr; /* * Find the open msg, copy the result and signal/unblock the @@ -643,14 +658,14 @@ vmbus_channel_on_gpadl_torndown(hv_vmbus * response and signal the requesting thread. */ static void -vmbus_channel_on_version_response(hv_vmbus_channel_msg_header* hdr) +vmbus_channel_on_version_response(const hv_vmbus_channel_msg_header *hdr) { hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* requestHeader; hv_vmbus_channel_initiate_contact* initiate; - hv_vmbus_channel_version_response* versionResponse; + const hv_vmbus_channel_version_response *versionResponse; - versionResponse = (hv_vmbus_channel_version_response*)hdr; + versionResponse = (const hv_vmbus_channel_version_response *)hdr; mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, @@ -834,3 +849,24 @@ vmbus_rel_subchan(struct hv_vmbus_channe free(subchan, M_TEMP); } + +void +vmbus_chan_msgproc(struct vmbus_softc *sc, const struct vmbus_message *msg) +{ + const hv_vmbus_channel_msg_table_entry *entry; + const hv_vmbus_channel_msg_header *hdr; + hv_vmbus_channel_msg_type msg_type; + + hdr = (const hv_vmbus_channel_msg_header *)msg->msg_data; + msg_type = hdr->message_type; + + if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) { + device_printf(sc->vmbus_dev, "unknown message type 0x%x\n", + msg_type); + return; + } + + entry = &g_channel_message_table[msg_type]; + if (entry->messageHandler) + entry->messageHandler(hdr); +} Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_connection.c Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c Fri Jun 24 02:30:14 2016 (r302170) @@ -77,8 +77,8 @@ hv_vmbus_get_next_version(uint32_t curre * Negotiate the highest supported hypervisor version. */ static int -hv_vmbus_negotiate_version(hv_vmbus_channel_msg_info *msg_info, - uint32_t version) +hv_vmbus_negotiate_version(struct vmbus_softc *sc, + hv_vmbus_channel_msg_info *msg_info, uint32_t version) { int ret = 0; hv_vmbus_channel_initiate_contact *msg; @@ -89,14 +89,9 @@ hv_vmbus_negotiate_version(hv_vmbus_chan msg->header.message_type = HV_CHANNEL_MESSAGE_INITIATED_CONTACT; msg->vmbus_version_requested = version; - msg->interrupt_page = hv_get_phys_addr( - hv_vmbus_g_connection.interrupt_page); - - msg->monitor_page_1 = hv_get_phys_addr( - hv_vmbus_g_connection.monitor_page_1); - - msg->monitor_page_2 = hv_get_phys_addr( - hv_vmbus_g_connection.monitor_page_2); + msg->interrupt_page = sc->vmbus_evtflags_dma.hv_paddr; + msg->monitor_page_1 = sc->vmbus_mnf1_dma.hv_paddr; + msg->monitor_page_2 = sc->vmbus_mnf2_dma.hv_paddr; /** * Add to list before we send the request since we may receive the @@ -153,7 +148,7 @@ hv_vmbus_negotiate_version(hv_vmbus_chan * Send a connect request on the partition service connection */ int -hv_vmbus_connect(void) +hv_vmbus_connect(struct vmbus_softc *sc) { int ret = 0; uint32_t version; @@ -179,34 +174,6 @@ hv_vmbus_connect(void) mtx_init(&hv_vmbus_g_connection.channel_lock, "vmbus channel", NULL, MTX_DEF); - /** - * Setup the vmbus event connection for channel interrupt abstraction - * stuff - */ - hv_vmbus_g_connection.interrupt_page = malloc( - PAGE_SIZE, M_DEVBUF, - M_WAITOK | M_ZERO); - - hv_vmbus_g_connection.recv_interrupt_page = - hv_vmbus_g_connection.interrupt_page; - - hv_vmbus_g_connection.send_interrupt_page = - ((uint8_t *) hv_vmbus_g_connection.interrupt_page + - (PAGE_SIZE >> 1)); - - /** - * Set up the monitor notification facility. The 1st page for - * parent->child and the 2nd page for child->parent - */ - hv_vmbus_g_connection.monitor_page_1 = malloc( - PAGE_SIZE, - M_DEVBUF, - M_WAITOK | M_ZERO); - hv_vmbus_g_connection.monitor_page_2 = malloc( - PAGE_SIZE, - M_DEVBUF, - M_WAITOK | M_ZERO); - msg_info = (hv_vmbus_channel_msg_info*) malloc(sizeof(hv_vmbus_channel_msg_info) + sizeof(hv_vmbus_channel_initiate_contact), @@ -220,7 +187,7 @@ hv_vmbus_connect(void) version = HV_VMBUS_VERSION_CURRENT; do { - ret = hv_vmbus_negotiate_version(msg_info, version); + ret = hv_vmbus_negotiate_version(sc, msg_info, version); if (ret == EWOULDBLOCK) { /* * We timed out. @@ -254,14 +221,6 @@ hv_vmbus_connect(void) mtx_destroy(&hv_vmbus_g_connection.channel_lock); mtx_destroy(&hv_vmbus_g_connection.channel_msg_lock); - if (hv_vmbus_g_connection.interrupt_page != NULL) { - free(hv_vmbus_g_connection.interrupt_page, M_DEVBUF); - hv_vmbus_g_connection.interrupt_page = NULL; - } - - free(hv_vmbus_g_connection.monitor_page_1, M_DEVBUF); - free(hv_vmbus_g_connection.monitor_page_2, M_DEVBUF); - if (msg_info) { sema_destroy(&msg_info->wait_sema); free(msg_info, M_DEVBUF); @@ -284,8 +243,6 @@ hv_vmbus_disconnect(void) ret = hv_vmbus_post_message(&msg, sizeof(hv_vmbus_channel_unload)); - free(hv_vmbus_g_connection.interrupt_page, M_DEVBUF); - mtx_destroy(&hv_vmbus_g_connection.channel_msg_lock); free(hv_vmbus_g_connection.channels, M_DEVBUF); @@ -346,14 +303,13 @@ vmbus_event_proc(struct vmbus_softc *sc, } void -vmbus_event_proc_compat(struct vmbus_softc *sc __unused, int cpu) +vmbus_event_proc_compat(struct vmbus_softc *sc, int cpu) { struct vmbus_evtflags *eventf; eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; if (atomic_testandclear_long(&eventf->evt_flags[0], 0)) { - vmbus_event_flags_proc( - hv_vmbus_g_connection.recv_interrupt_page, + vmbus_event_flags_proc(sc->vmbus_rx_evtflags, VMBUS_CHAN_MAX_COMPAT >> VMBUS_EVTFLAG_SHIFT); } } @@ -376,8 +332,8 @@ int hv_vmbus_post_message(void *buffer, * insufficient resources. 20 times should suffice in practice. */ for (retries = 0; retries < 20; retries++) { - ret = hv_vmbus_post_msg_via_msg_ipc(connId, 1, buffer, - bufferLen); + ret = hv_vmbus_post_msg_via_msg_ipc(connId, + VMBUS_MSGTYPE_CHANNEL, buffer, bufferLen); if (ret == HV_STATUS_SUCCESS) return (0); @@ -398,14 +354,12 @@ int hv_vmbus_post_message(void *buffer, int hv_vmbus_set_event(hv_vmbus_channel *channel) { + struct vmbus_softc *sc = vmbus_get_softc(); int ret = 0; - uint32_t child_rel_id = channel->offer_msg.child_rel_id; - - /* Each uint32_t represents 32 channels */ + uint32_t chanid = channel->offer_msg.child_rel_id; - synch_set_bit(child_rel_id & 31, - (((uint32_t *)hv_vmbus_g_connection.send_interrupt_page - + (child_rel_id >> 5)))); + atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], + 1UL << (chanid & VMBUS_EVTFLAG_MASK)); ret = hv_vmbus_signal_event(channel->signal_event_param); return (ret); Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jun 24 02:30:14 2016 (r302170) @@ -244,25 +244,7 @@ typedef enum { typedef struct { hv_vmbus_connect_state connect_state; uint32_t next_gpadl_handle; - /** - * Represents channel interrupts. Each bit position - * represents a channel. - * When a channel sends an interrupt via VMBUS, it - * finds its bit in the send_interrupt_page, set it and - * calls Hv to generate a port event. The other end - * receives the port event and parse the - * recv_interrupt_page to see which bit is set - */ - void *interrupt_page; - void *send_interrupt_page; - void *recv_interrupt_page; - /* - * 2 pages - 1st page for parent->child - * notification and 2nd is child->parent - * notification - */ - void *monitor_page_1; - void *monitor_page_2; + TAILQ_HEAD(, hv_vmbus_channel_msg_info) channel_msg_anchor; struct mtx channel_msg_lock; /** @@ -364,16 +346,6 @@ typedef enum { extern hv_vmbus_connection hv_vmbus_g_connection; -typedef void (*vmbus_msg_handler)(hv_vmbus_channel_msg_header *msg); - -typedef struct hv_vmbus_channel_msg_table_entry { - hv_vmbus_channel_msg_type messageType; - - vmbus_msg_handler messageHandler; -} hv_vmbus_channel_msg_table_entry; - -extern hv_vmbus_channel_msg_table_entry g_channel_message_table[]; - /* * Private, VM Bus functions */ @@ -450,7 +422,8 @@ int hv_vmbus_child_device_unregister( /** * Connection interfaces */ -int hv_vmbus_connect(void); +struct vmbus_softc; +int hv_vmbus_connect(struct vmbus_softc *); int hv_vmbus_disconnect(void); int hv_vmbus_post_message(void *buffer, size_t buf_size); int hv_vmbus_set_event(hv_vmbus_channel *channel); Modified: stable/10/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hyperv.c Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/dev/hyperv/vmbus/hyperv.c Fri Jun 24 02:30:14 2016 (r302170) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -104,40 +105,17 @@ hyperv_get_timecount(struct timecounter * @brief Invoke the specified hypercall */ static uint64_t -hv_vmbus_do_hypercall(uint64_t control, void* input, void* output) +hv_vmbus_do_hypercall(uint64_t value, void *input, void *output) { -#ifdef __x86_64__ - uint64_t hv_status = 0; - uint64_t input_address = (input) ? hv_get_phys_addr(input) : 0; - uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0; - volatile void *hypercall_page = hypercall_context.hc_addr; - - __asm__ __volatile__ ("mov %0, %%r8" : : "r" (output_address): "r8"); - __asm__ __volatile__ ("call *%3" : "=a"(hv_status): - "c" (control), "d" (input_address), - "m" (hypercall_page)); - return (hv_status); -#else - uint32_t control_high = control >> 32; - uint32_t control_low = control & 0xFFFFFFFF; - uint32_t hv_status_high = 1; - uint32_t hv_status_low = 1; - uint64_t input_address = (input) ? hv_get_phys_addr(input) : 0; - uint32_t input_address_high = input_address >> 32; - uint32_t input_address_low = input_address & 0xFFFFFFFF; - uint64_t output_address = (output) ? hv_get_phys_addr(output) : 0; - uint32_t output_address_high = output_address >> 32; - uint32_t output_address_low = output_address & 0xFFFFFFFF; - volatile void *hypercall_page = hypercall_context.hc_addr; - - __asm__ __volatile__ ("call *%8" : "=d"(hv_status_high), - "=a"(hv_status_low) : "d" (control_high), - "a" (control_low), "b" (input_address_high), - "c" (input_address_low), - "D"(output_address_high), - "S"(output_address_low), "m" (hypercall_page)); - return (hv_status_low | ((uint64_t)hv_status_high << 32)); -#endif /* __x86_64__ */ + uint64_t in_paddr = 0, out_paddr = 0; + + if (input != NULL) + in_paddr = hv_get_phys_addr(input); + if (output != NULL) + out_paddr = hv_get_phys_addr(output); + + return hypercall_md(hypercall_context.hc_addr, value, + in_paddr, out_paddr); } /** Copied: stable/10/sys/dev/hyperv/vmbus/hyperv_machdep.h (from r301483, head/sys/dev/hyperv/vmbus/hyperv_machdep.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/hyperv_machdep.h Fri Jun 24 02:30:14 2016 (r302170, copy of r301483, head/sys/dev/hyperv/vmbus/hyperv_machdep.h) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HYPERV_MACHDEP_H_ +#define _HYPERV_MACHDEP_H_ + +#include + +uint64_t hypercall_md(volatile void *hc_addr, uint64_t in_val, + uint64_t in_paddr, uint64_t out_paddr); + +#endif /* !_HYPERV_MACHDEP_H_ */ Copied: stable/10/sys/dev/hyperv/vmbus/i386/hyperv_machdep.c (from r301483, head/sys/dev/hyperv/vmbus/i386/hyperv_machdep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/hyperv/vmbus/i386/hyperv_machdep.c Fri Jun 24 02:30:14 2016 (r302170, copy of r301483, head/sys/dev/hyperv/vmbus/i386/hyperv_machdep.c) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +uint64_t +hypercall_md(volatile void *hc_addr, uint64_t in_val, + uint64_t in_paddr, uint64_t out_paddr) +{ + uint32_t in_val_hi = in_val >> 32; + uint32_t in_val_lo = in_val & 0xFFFFFFFF; + uint32_t status_hi, status_lo; + uint32_t in_paddr_hi = in_paddr >> 32; + uint32_t in_paddr_lo = in_paddr & 0xFFFFFFFF; + uint32_t out_paddr_hi = out_paddr >> 32; + uint32_t out_paddr_lo = out_paddr & 0xFFFFFFFF; + + __asm__ __volatile__ ("call *%8" : "=d"(status_hi), "=a"(status_lo) : + "d" (in_val_hi), "a" (in_val_lo), + "b" (in_paddr_hi), "c" (in_paddr_lo), + "D"(out_paddr_hi), "S"(out_paddr_lo), + "m" (hc_addr)); + return (status_lo | ((uint64_t)status_hi << 32)); +} Modified: stable/10/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus.c Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/dev/hyperv/vmbus/vmbus.c Fri Jun 24 02:30:14 2016 (r302170) @@ -81,27 +81,15 @@ vmbus_msg_task(void *xsc, int pending __ msg = VMBUS_PCPU_GET(sc, message, curcpu) + VMBUS_SINT_MESSAGE; for (;;) { - const hv_vmbus_channel_msg_table_entry *entry; - hv_vmbus_channel_msg_header *hdr; - hv_vmbus_channel_msg_type msg_type; - - if (msg->msg_type == VMBUS_MSGTYPE_NONE) - break; /* no message */ - - /* XXX: update messageHandler interface */ - hdr = __DEVOLATILE(hv_vmbus_channel_msg_header *, - msg->msg_data); - msg_type = hdr->message_type; - - if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) { - printf("VMBUS: unknown message type = %d\n", msg_type); - goto handled; + if (msg->msg_type == VMBUS_MSGTYPE_NONE) { + /* No message */ + break; + } else if (msg->msg_type == VMBUS_MSGTYPE_CHANNEL) { + /* Channel message */ + vmbus_chan_msgproc(sc, + __DEVOLATILE(const struct vmbus_message *, msg)); } - entry = &g_channel_message_table[msg_type]; - if (entry->messageHandler) - entry->messageHandler(hdr); -handled: msg->msg_type = VMBUS_MSGTYPE_NONE; /* * Make sure the write to msg_type (i.e. set to @@ -321,30 +309,50 @@ vmbus_synic_teardown(void *arg) static int vmbus_dma_alloc(struct vmbus_softc *sc) { + bus_dma_tag_t parent_dtag; + uint8_t *evtflags; int cpu; + parent_dtag = bus_get_dma_tag(sc->vmbus_dev); CPU_FOREACH(cpu) { void *ptr; /* * Per-cpu messages and event flags. */ - ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), - PAGE_SIZE, 0, PAGE_SIZE, - VMBUS_PCPU_PTR(sc, message_dma, cpu), + ptr = hyperv_dmamem_alloc(parent_dtag, PAGE_SIZE, 0, + PAGE_SIZE, VMBUS_PCPU_PTR(sc, message_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); if (ptr == NULL) return ENOMEM; VMBUS_PCPU_GET(sc, message, cpu) = ptr; - ptr = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), - PAGE_SIZE, 0, PAGE_SIZE, - VMBUS_PCPU_PTR(sc, event_flags_dma, cpu), + ptr = hyperv_dmamem_alloc(parent_dtag, PAGE_SIZE, 0, + PAGE_SIZE, VMBUS_PCPU_PTR(sc, event_flags_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); if (ptr == NULL) return ENOMEM; VMBUS_PCPU_GET(sc, event_flags, cpu) = ptr; } + + evtflags = hyperv_dmamem_alloc(parent_dtag, PAGE_SIZE, 0, + PAGE_SIZE, &sc->vmbus_evtflags_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (evtflags == NULL) + return ENOMEM; + sc->vmbus_rx_evtflags = (u_long *)evtflags; + sc->vmbus_tx_evtflags = (u_long *)(evtflags + (PAGE_SIZE / 2)); + sc->vmbus_evtflags = evtflags; + + sc->vmbus_mnf1 = hyperv_dmamem_alloc(parent_dtag, PAGE_SIZE, 0, + PAGE_SIZE, &sc->vmbus_mnf1_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (sc->vmbus_mnf1 == NULL) + return ENOMEM; + + sc->vmbus_mnf2 = hyperv_dmamem_alloc(parent_dtag, PAGE_SIZE, 0, + PAGE_SIZE, &sc->vmbus_mnf2_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (sc->vmbus_mnf2 == NULL) + return ENOMEM; + return 0; } @@ -353,6 +361,21 @@ vmbus_dma_free(struct vmbus_softc *sc) { int cpu; + if (sc->vmbus_evtflags != NULL) { + hyperv_dmamem_free(&sc->vmbus_evtflags_dma, sc->vmbus_evtflags); + sc->vmbus_evtflags = NULL; + sc->vmbus_rx_evtflags = NULL; + sc->vmbus_tx_evtflags = NULL; + } + if (sc->vmbus_mnf1 != NULL) { + hyperv_dmamem_free(&sc->vmbus_mnf1_dma, sc->vmbus_mnf1); + sc->vmbus_mnf1 = NULL; + } + if (sc->vmbus_mnf2 != NULL) { + hyperv_dmamem_free(&sc->vmbus_mnf2_dma, sc->vmbus_mnf2); + sc->vmbus_mnf2 = NULL; + } + CPU_FOREACH(cpu) { if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) { hyperv_dmamem_free( @@ -701,8 +724,7 @@ vmbus_bus_init(void) /* * Connect to VMBus in the root partition */ - ret = hv_vmbus_connect(); - + ret = hv_vmbus_connect(sc); if (ret != 0) goto cleanup; Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jun 24 02:30:14 2016 (r302170) @@ -49,6 +49,7 @@ struct vmbus_message { CTASSERT(sizeof(struct vmbus_message) == VMBUS_MSG_SIZE); #define VMBUS_MSGTYPE_NONE 0 +#define VMBUS_MSGTYPE_CHANNEL 1 #define VMBUS_MSGTYPE_TIMER_EXPIRED 0x80000010 #define VMBUS_MSGFLAG_PENDING 0x01 @@ -65,6 +66,7 @@ CTASSERT(sizeof(struct vmbus_message) == #define VMBUS_EVTFLAG_SHIFT 5 #endif #define VMBUS_EVTFLAG_LEN (1 << VMBUS_EVTFLAG_SHIFT) +#define VMBUS_EVTFLAG_MASK (VMBUS_EVTFLAG_LEN - 1) #define VMBUS_EVTFLAGS_SIZE 256 struct vmbus_evtflags { Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jun 24 02:30:14 2016 (r302170) @@ -50,7 +50,7 @@ struct vmbus_pcpu_data { struct vmbus_message *message; /* shared messages */ uint32_t vcpuid; /* virtual cpuid */ int event_flags_cnt;/* # of event flags */ - struct vmbus_evtflags *event_flags; /* shared event flags */ + struct vmbus_evtflags *event_flags; /* event flags from host */ /* Rarely used fields */ struct hyperv_dma message_dma; /* busdma glue */ @@ -62,12 +62,26 @@ struct vmbus_pcpu_data { struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); + u_long *vmbus_tx_evtflags; + /* event flags to host */ + void *vmbus_mnf2; /* monitored by host */ + + u_long *vmbus_rx_evtflags; + /* compat evtflgs from host */ struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; /* Rarely used fields */ device_t vmbus_dev; int vmbus_idtvec; uint32_t vmbus_flags; /* see VMBUS_FLAG_ */ + + /* Shared memory for vmbus_{rx,tx}_evtflags */ + void *vmbus_evtflags; + struct hyperv_dma vmbus_evtflags_dma; + + void *vmbus_mnf1; /* monitored by VM, unused */ + struct hyperv_dma vmbus_mnf1_dma; + struct hyperv_dma vmbus_mnf2_dma; }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ @@ -92,6 +106,7 @@ vmbus_get_device(void) struct hv_vmbus_channel; struct trapframe; +struct vmbus_message; void vmbus_on_channel_open(const struct hv_vmbus_channel *); void vmbus_event_proc(struct vmbus_softc *, int); @@ -100,4 +115,6 @@ void vmbus_handle_intr(struct trapframe void vmbus_et_intr(struct trapframe *); +void vmbus_chan_msgproc(struct vmbus_softc *, const struct vmbus_message *); + #endif /* !_VMBUS_VAR_H_ */ Modified: stable/10/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- stable/10/sys/modules/hyperv/vmbus/Makefile Fri Jun 24 02:28:24 2016 (r302169) +++ stable/10/sys/modules/hyperv/vmbus/Makefile Fri Jun 24 02:30:14 2016 (r302170) @@ -10,6 +10,7 @@ SRCS= hv_channel.c \ hv_ring_buffer.c \ hyperv.c \ hyperv_busdma.c \ + hyperv_machdep.c \ vmbus.c \ vmbus_et.c SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h From owner-svn-src-all@freebsd.org Fri Jun 24 10:55:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F48BB7343D; Fri, 24 Jun 2016 10:55:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5B5726CB; Fri, 24 Jun 2016 10:55:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OAtFBb052932; Fri, 24 Jun 2016 10:55:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OAtEZm052930; Fri, 24 Jun 2016 10:55:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201606241055.u5OAtEZm052930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 24 Jun 2016 10:55:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302171 - head/lib/libusb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 10:55:16 -0000 Author: hselasky Date: Fri Jun 24 10:55:14 2016 New Revision: 302171 URL: https://svnweb.freebsd.org/changeset/base/302171 Log: Resolve issue with libusb C++ header file inclusion. Approved by: re (marius) PR: 210509 MFC after: 1 week Modified: head/lib/libusb/libusb.h head/lib/libusb/libusb10.h Modified: head/lib/libusb/libusb.h ============================================================================== --- head/lib/libusb/libusb.h Fri Jun 24 02:30:14 2016 (r302170) +++ head/lib/libusb/libusb.h Fri Jun 24 10:55:14 2016 (r302171) @@ -254,7 +254,7 @@ struct libusb_context; struct libusb_device; struct libusb_transfer; struct libusb_device_handle; -struct libusb_hotplug_callback_handle; +struct libusb_hotplug_callback_handle_struct; struct libusb_pollfd { int fd; @@ -276,7 +276,7 @@ typedef struct libusb_device_handle libu typedef struct libusb_pollfd libusb_pollfd; typedef void (*libusb_pollfd_added_cb) (int fd, short events, void *user_data); typedef void (*libusb_pollfd_removed_cb) (int fd, void *user_data); -typedef struct libusb_hotplug_callback_handle *libusb_hotplug_callback_handle; +typedef struct libusb_hotplug_callback_handle_struct *libusb_hotplug_callback_handle; typedef struct libusb_device_descriptor { uint8_t bLength; Modified: head/lib/libusb/libusb10.h ============================================================================== --- head/lib/libusb/libusb10.h Fri Jun 24 02:30:14 2016 (r302170) +++ head/lib/libusb/libusb10.h Fri Jun 24 10:55:14 2016 (r302171) @@ -75,8 +75,8 @@ struct libusb_super_transfer { #define LIBUSB_SUPER_XFER_ST_PEND 1 }; -struct libusb_hotplug_callback_handle { - TAILQ_ENTRY(libusb_hotplug_callback_handle) entry; +struct libusb_hotplug_callback_handle_struct { + TAILQ_ENTRY(libusb_hotplug_callback_handle_struct) entry; int events; int vendor; int product; @@ -101,7 +101,7 @@ struct libusb_context { TAILQ_HEAD(, libusb_super_pollfd) pollfds; TAILQ_HEAD(, libusb_super_transfer) tr_done; - TAILQ_HEAD(, libusb_hotplug_callback_handle) hotplug_cbh; + TAILQ_HEAD(, libusb_hotplug_callback_handle_struct) hotplug_cbh; TAILQ_HEAD(, libusb_device) hotplug_devs; struct libusb_super_pollfd ctx_poll; From owner-svn-src-all@freebsd.org Fri Jun 24 11:26:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B79E8B73CEF; Fri, 24 Jun 2016 11:26:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 4320B1720; Fri, 24 Jun 2016 11:26:48 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 390901044DF1; Fri, 24 Jun 2016 21:26:39 +1000 (AEST) Date: Fri, 24 Jun 2016 21:26:39 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r301932 - head/sys/dev/cxgbe/tom In-Reply-To: <10550858.Wqzuf5sXBE@ralph.baldwin.cx> Message-ID: <20160624210041.J1013@besplex.bde.org> References: <201606152108.u5FL8pcO012174@repo.freebsd.org> <10550858.Wqzuf5sXBE@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=OtmysHLt c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=WQYTAzPHRSsGqI3LFlkA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 11:26:49 -0000 On Wed, 15 Jun 2016, John Baldwin wrote: > On Wednesday, June 15, 2016 09:08:51 PM John Baldwin wrote: >> Author: jhb >> Date: Wed Jun 15 21:08:51 2016 >> New Revision: 301932 >> URL: https://svnweb.freebsd.org/changeset/base/301932 >> >> Log: >> Use sbused() instead of sbspace() to avoid signed issues. This description is sort of backwards. sbused() is unsigned (u_int), so using it gives (un)sign extension bugs. sbspace() has complications to return signed (long) to avoid (un)sign extension bugs. It has to be careful to avoid (un)sign extension bugs internally (intermediate versions of it were broken by removing this care when converting it from a macro to an inline function). The changed code also mostly uses signed types, but ... >> Inserting a full mbuf with an external cluster into the socket buffer >> resulted in sbspace() returning -MLEN. However, since sb_hiwat is >> unsigned, the -MLEN value was converted to unsigned in comparisons. As a >> result, the socket buffer was never autosized. Note that sb_lowat is signed >> to permit direct comparisons with sbspace(), but sb_hiwat is unsigned. >> Follow suit with what tcp_output() does and compare the value of sbused() >> with sb_hiwat instead. ... direct comparisons with sb_hiwat gives the (un)sign extension bugs since its foor-shooting type is exposed. > Amusingly (or not), sb_lowat used to be signed as well. Mike Karels > changed it to signed in this commit to BSD: > > https://svnweb.freebsd.org/csrg/sys/sys/socketvar.h?revision=43896 > > The log reads: > > add SB_ASYNC in sockbuf, add SB_NOTIFY, SB_NOINTR; > make lowat signed for comparison with sbspace (should probably give up > and make all fields signed They shoyld all have been signed to begin with. X Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c X ============================================================================== X --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Jun 15 21:01:53 2016 (r301931) X +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Jun 15 21:08:51 2016 (r301932) X @@ -577,7 +577,7 @@ t4_push_frames(struct adapter *sc, struc X struct tcpcb *tp = intotcpcb(inp); X struct socket *so = inp->inp_socket; X struct sockbuf *sb = &so->so_snd; X - int tx_credits, shove, compl, space, sowwakeup; X + int tx_credits, shove, compl, sowwakeup; X struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; X X INP_WLOCK_ASSERT(inp); X @@ -652,9 +652,7 @@ t4_push_frames(struct adapter *sc, struc X } X } X X - space = sbspace(sb); Here 'space' was signed (int) to hold sbspace(), but this was still a type mismatch since sbspace() returns signed long. X - X - if (space <= sb->sb_hiwat * 3 / 8 && Then this broke because the unsigned sb_hiwat is too hard to use. X + if (sbused(sb) > sb->sb_hiwat * 5 / 8 && Is this conversion really correct? sbspace(sb) is only sb->sb_hiwat - sbused(sb) in the usual case. For a direct translation, convert sb_hiwat * 3 / 8 to int (it is sure to fit). Bruce From owner-svn-src-all@freebsd.org Fri Jun 24 11:53:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EFC5B80269; Fri, 24 Jun 2016 11:53:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F3EE25FB; Fri, 24 Jun 2016 11:53:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OBrC6l075182; Fri, 24 Jun 2016 11:53:12 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OBrCkC075181; Fri, 24 Jun 2016 11:53:12 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606241153.u5OBrCkC075181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 24 Jun 2016 11:53:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302173 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 11:53:13 -0000 Author: bz Date: Fri Jun 24 11:53:12 2016 New Revision: 302173 URL: https://svnweb.freebsd.org/changeset/base/302173 Log: The void isn't void. Unbreak sparc64 and powerpc builds. Approved by: re (gjb) Sponsored by: The FreeBSD Foundation MFC after: 12 days Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Fri Jun 24 11:45:56 2016 (r302172) +++ head/sys/netpfil/pf/pf_ioctl.c Fri Jun 24 11:53:12 2016 (r302173) @@ -3740,7 +3740,7 @@ pf_load(void) } static void -pf_unload_vnet() +pf_unload_vnet(void) { int error; From owner-svn-src-all@freebsd.org Fri Jun 24 14:58:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 357DDB80190; Fri, 24 Jun 2016 14:58:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC9D62871; Fri, 24 Jun 2016 14:58:38 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OEwcJr043168; Fri, 24 Jun 2016 14:58:38 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OEwcuq043167; Fri, 24 Jun 2016 14:58:38 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201606241458.u5OEwcuq043167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 24 Jun 2016 14:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302174 - head/sbin/sysctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 14:58:39 -0000 Author: asomers Date: Fri Jun 24 14:58:37 2016 New Revision: 302174 URL: https://svnweb.freebsd.org/changeset/base/302174 Log: Fix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory sbin/sysctl/sysctl.c Fix integer overflows in printf format strings PR: 199673 Submitted by: Vitaly Magerya Reviewed by: cem Approved by: re (marius) MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6941 Modified: head/sbin/sysctl/sysctl.c Modified: head/sbin/sysctl/sysctl.c ============================================================================== --- head/sbin/sysctl/sysctl.c Fri Jun 24 11:53:12 2016 (r302173) +++ head/sbin/sysctl/sysctl.c Fri Jun 24 14:58:37 2016 (r302174) @@ -623,15 +623,15 @@ S_vmtotal(size_t l2, void *p) "%hd Sleep: %hd)\n", v->t_rq, v->t_dw, v->t_pw, v->t_sl); printf( - "Virtual Memory:\t\t(Total: %dK Active: %dK)\n", - v->t_vm * pageKilo, v->t_avm * pageKilo); - printf("Real Memory:\t\t(Total: %dK Active: %dK)\n", - v->t_rm * pageKilo, v->t_arm * pageKilo); - printf("Shared Virtual Memory:\t(Total: %dK Active: %dK)\n", - v->t_vmshr * pageKilo, v->t_avmshr * pageKilo); - printf("Shared Real Memory:\t(Total: %dK Active: %dK)\n", - v->t_rmshr * pageKilo, v->t_armshr * pageKilo); - printf("Free Memory:\t%dK", v->t_free * pageKilo); + "Virtual Memory:\t\t(Total: %jdK Active: %jdK)\n", + (intmax_t)v->t_vm * pageKilo, (intmax_t)v->t_avm * pageKilo); + printf("Real Memory:\t\t(Total: %jdK Active: %jdK)\n", + (intmax_t)v->t_rm * pageKilo, (intmax_t)v->t_arm * pageKilo); + printf("Shared Virtual Memory:\t(Total: %jdK Active: %jdK)\n", + (intmax_t)v->t_vmshr * pageKilo, (intmax_t)v->t_avmshr * pageKilo); + printf("Shared Real Memory:\t(Total: %jdK Active: %jdK)\n", + (intmax_t)v->t_rmshr * pageKilo, (intmax_t)v->t_armshr * pageKilo); + printf("Free Memory:\t%jdK", (intmax_t)v->t_free * pageKilo); return (0); } From owner-svn-src-all@freebsd.org Fri Jun 24 17:26:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E012EB80F6B; Fri, 24 Jun 2016 17:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A28FC164D; Fri, 24 Jun 2016 17:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OHQguN099445; Fri, 24 Jun 2016 17:26:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OHQgQ0099442; Fri, 24 Jun 2016 17:26:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201606241726.u5OHQgQ0099442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 24 Jun 2016 17:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302175 - in head: share/man/man9 sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 17:26:44 -0000 Author: jhb Date: Fri Jun 24 17:26:42 2016 New Revision: 302175 URL: https://svnweb.freebsd.org/changeset/base/302175 Log: Add pci_get_max_payload() to fetch the PCI-express maximum payload size. Approved by: re (gjb) MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D6951 Modified: head/share/man/man9/pci.9 head/sys/dev/pci/pci.c head/sys/dev/pci/pcivar.h Modified: head/share/man/man9/pci.9 ============================================================================== --- head/share/man/man9/pci.9 Fri Jun 24 14:58:37 2016 (r302174) +++ head/share/man/man9/pci.9 Fri Jun 24 17:26:42 2016 (r302175) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2016 +.Dd June 24, 2016 .Dt PCI 9 .Os .Sh NAME @@ -44,6 +44,7 @@ .Nm pci_find_htcap , .Nm pci_find_pcie_root_port , .Nm pci_get_id , +.Nm pci_get_max_payload , .Nm pci_get_max_read_req , .Nm pci_get_powerstate , .Nm pci_get_vpd_ident , @@ -100,6 +101,8 @@ .Ft int .Fn pci_get_id "device_t dev" "enum pci_id_type type" "uintptr_t *id" .Ft int +.Fn pci_get_max_payload "device_t dev" +.Ft int .Fn pci_get_max_read_req "device_t dev" .Ft int .Fn pci_get_powerstate "device_t dev" @@ -461,6 +464,16 @@ or .Xr bus_activate_resource 9 . .Pp The +.Fn pci_get_max_payload +function returns the current maximum TLP payload size in bytes for a +PCI-express device. +If the +.Fa dev +device is not a PCI-express device, +.Fn pci_get_max_payload +returns zero. +.Pp +The .Fn pci_get_max_read_req function returns the current maximum read request size in bytes for a PCI-express device. Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Fri Jun 24 14:58:37 2016 (r302174) +++ head/sys/dev/pci/pci.c Fri Jun 24 17:26:42 2016 (r302175) @@ -1993,6 +1993,22 @@ pci_ht_map_msi(device_t dev, uint64_t ad } int +pci_get_max_payload(device_t dev) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + int cap; + uint16_t val; + + cap = dinfo->cfg.pcie.pcie_location; + if (cap == 0) + return (0); + val = pci_read_config(dev, cap + PCIER_DEVICE_CTL, 2); + val &= PCIEM_CTL_MAX_PAYLOAD; + val >>= 5; + return (1 << (val + 7)); +} + +int pci_get_max_read_req(device_t dev) { struct pci_devinfo *dinfo = device_get_ivars(dev); Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Fri Jun 24 14:58:37 2016 (r302174) +++ head/sys/dev/pci/pcivar.h Fri Jun 24 17:26:42 2016 (r302175) @@ -585,6 +585,7 @@ int pci_msix_device_blacklisted(device_t void pci_ht_map_msi(device_t dev, uint64_t addr); device_t pci_find_pcie_root_port(device_t dev); +int pci_get_max_payload(device_t dev); int pci_get_max_read_req(device_t dev); void pci_restore_state(device_t dev); void pci_save_state(device_t dev); From owner-svn-src-all@freebsd.org Fri Jun 24 18:45:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B328B73FB9; Fri, 24 Jun 2016 18:45:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A8D41EEF; Fri, 24 Jun 2016 18:45:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OIjG9C029422; Fri, 24 Jun 2016 18:45:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OIjGL5029421; Fri, 24 Jun 2016 18:45:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201606241845.u5OIjGL5029421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 24 Jun 2016 18:45:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302176 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 18:45:17 -0000 Author: emaste Date: Fri Jun 24 18:45:16 2016 New Revision: 302176 URL: https://svnweb.freebsd.org/changeset/base/302176 Log: bsd.prog.mk: add "/usr/lib" to list of base system directories kgzldr.o is installed into /usr/lib but using bsd.prog.mk. Add /usr/lib to the base system directory list so that debug files are installed into /usr/lib/debug/usr/lib, not /usr/lib/.debug . Approved by: re (gjb) MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/share/mk/bsd.prog.mk Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Fri Jun 24 17:26:42 2016 (r302175) +++ head/share/mk/bsd.prog.mk Fri Jun 24 18:45:16 2016 (r302176) @@ -66,7 +66,8 @@ PROG_FULL=${PROG}.full ${BINDIR} == "/bin" ||\ ${BINDIR:C%/libexec(/.*)?%/libexec%} == "/libexec" ||\ ${BINDIR} == "/sbin" ||\ - ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin|tests)(/.*)?%/usr/bin%} == "/usr/bin"\ + ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin|tests)(/.*)?%/usr/bin%} == "/usr/bin" ||\ + ${BINDIR} == "/usr/lib" \ ) DEBUGFILEDIR= ${DEBUGDIR}${BINDIR} .else From owner-svn-src-all@freebsd.org Fri Jun 24 19:56:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6523B8030F; Fri, 24 Jun 2016 19:56:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72D64249E; Fri, 24 Jun 2016 19:56:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OJtxO5055259; Fri, 24 Jun 2016 19:55:59 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OJtxQ8055258; Fri, 24 Jun 2016 19:55:59 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606241955.u5OJtxQ8055258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 24 Jun 2016 19:55:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302177 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 19:56:00 -0000 Author: bdrewery Date: Fri Jun 24 19:55:59 2016 New Revision: 302177 URL: https://svnweb.freebsd.org/changeset/base/302177 Log: WITH_SYSTEM_COMPILER: Enable by default This improves buildworld, toolchain, kernel-toolchain, and universe targets. See r300354 or src.conf(5) for more details. Approved by: re (gjb) Relnotes: yes (r300354) Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Jun 24 18:45:16 2016 (r302176) +++ head/share/mk/src.opts.mk Fri Jun 24 19:55:59 2016 (r302177) @@ -158,6 +158,7 @@ __DEFAULT_YES_OPTIONS = \ SOURCELESS_UCODE \ SVNLITE \ SYSCONS \ + SYSTEM_COMPILER \ TALK \ TCP_WRAPPERS \ TCSH \ @@ -189,7 +190,6 @@ __DEFAULT_NO_OPTIONS = \ SHARED_TOOLCHAIN \ SORT_THREADS \ SVN \ - SYSTEM_COMPILER \ # From owner-svn-src-all@freebsd.org Fri Jun 24 20:00:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B89B2B8057F; Fri, 24 Jun 2016 20:00:40 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CC512791; Fri, 24 Jun 2016 20:00:40 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OK0d3j055515; Fri, 24 Jun 2016 20:00:39 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OK0dcD055514; Fri, 24 Jun 2016 20:00:39 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201606242000.u5OK0dcD055514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 24 Jun 2016 20:00:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302178 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 20:00:40 -0000 Author: bdrewery Date: Fri Jun 24 20:00:39 2016 New Revision: 302178 URL: https://svnweb.freebsd.org/changeset/base/302178 Log: Regenerate Approved by: re (implicit, r302177) Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Fri Jun 24 19:55:59 2016 (r302177) +++ head/share/man/man5/src.conf.5 Fri Jun 24 20:00:39 2016 (r302178) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 292283 2015-12-15 18:42:30Z bdrewery .\" $FreeBSD$ -.Dd June 14, 2016 +.Dd June 24, 2016 .Dt SRC.CONF 5 .Os .Sh NAME @@ -536,6 +536,10 @@ When set, it also enforces the following When set, the following options are also in effect: .Pp .Bl -inset -compact +.It Va WITHOUT_SYSTEM_COMPILER +(unless +.Va WITH_SYSTEM_COMPILER +is set explicitly) .It Va WITH_AUTO_OBJ (unless .Va WITHOUT_AUTO_OBJ @@ -1134,6 +1138,14 @@ to .Pp Currently this also enforces .Va WITHOUT_SYSTEM_COMPILER . +When set, the following options are also in effect: +.Pp +.Bl -inset -compact +.It Va WITHOUT_SYSTEM_COMPILER +(unless +.Va WITH_SYSTEM_COMPILER +is set explicitly) +.El .Pp This must be set in the environment, make command line, or .Pa /etc/src-env.conf , @@ -1434,12 +1446,12 @@ This must be set in the environment, mak .Pa /etc/src-env.conf , not .Pa /etc/src.conf . -.It Va WITH_SYSTEM_COMPILER -.\" from FreeBSD: head/tools/build/options/WITH_SYSTEM_COMPILER 300354 2016-05-21 01:32:23Z bdrewery -Set to opportunistically skip building a cross-compiler during the +.It Va WITHOUT_SYSTEM_COMPILER +.\" from FreeBSD: head/tools/build/options/WITHOUT_SYSTEM_COMPILER 300354 2016-05-21 01:32:23Z bdrewery +Set to not opportunistically skip building a cross-compiler during the bootstrap phase of the build. -If the currently installed compiler matches the planned bootstrap compiler -type and revision, then it will not be built. +Normally, if the currently installed compiler matches the planned bootstrap +compiler type and revision, then it will not be built. This does not prevent a compiler from being built for installation though, only for building one for the build itself. The From owner-svn-src-all@freebsd.org Fri Jun 24 20:21:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6279BB809B8; Fri, 24 Jun 2016 20:21:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 327D912F6; Fri, 24 Jun 2016 20:21:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OKLWhp064114; Fri, 24 Jun 2016 20:21:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OKLWRG064113; Fri, 24 Jun 2016 20:21:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201606242021.u5OKLWRG064113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 24 Jun 2016 20:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302179 - head/usr.bin/gcore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 20:21:33 -0000 Author: markj Date: Fri Jun 24 20:21:32 2016 New Revision: 302179 URL: https://svnweb.freebsd.org/changeset/base/302179 Log: gcore: Forward pending signals when detaching from the target. Otherwise gcore's ptrace attach operation can race with delivery of a signal and cause it to be lost. In collaboration with: Suraj Raju Reviewed by: bdrewery Approved by: re (gjb, kib) MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/gcore/elfcore.c Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Fri Jun 24 20:00:39 2016 (r302178) +++ head/usr.bin/gcore/elfcore.c Fri Jun 24 20:21:32 2016 (r302179) @@ -126,6 +126,7 @@ static vm_map_entry_t readmap(pid_t); static void *procstat_sysctl(void *, int, size_t, size_t *sizep); static pid_t g_pid; /* Pid being dumped, global for elf_detach */ +static int g_status; /* proc status after ptrace attach */ static int elf_ident(int efd, pid_t pid __unused, char *binfile __unused) @@ -159,9 +160,18 @@ elf_ident(int efd, pid_t pid __unused, c static void elf_detach(void) { + int sig; - if (g_pid != 0) - ptrace(PT_DETACH, g_pid, (caddr_t)1, 0); + if (g_pid != 0) { + /* + * Forward any pending signals. SIGSTOP is generated by ptrace + * itself, so ignore it. + */ + sig = WIFSTOPPED(g_status) ? WSTOPSIG(g_status) : 0; + if (sig == SIGSTOP) + sig = 0; + ptrace(PT_DETACH, g_pid, (caddr_t)1, sig); + } } /* @@ -187,7 +197,7 @@ elf_coredump(int efd __unused, int fd, p ptrace(PT_ATTACH, pid, NULL, 0); if (errno) err(1, "PT_ATTACH"); - if (waitpid(pid, NULL, 0) == -1) + if (waitpid(pid, &g_status, 0) == -1) err(1, "waitpid"); /* Get the program's memory map. */ From owner-svn-src-all@freebsd.org Fri Jun 24 21:44:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A2A1B74E71; Fri, 24 Jun 2016 21:44:47 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D3CE25FF; Fri, 24 Jun 2016 21:44:47 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OLikcJ096478; Fri, 24 Jun 2016 21:44:46 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OLikjj096476; Fri, 24 Jun 2016 21:44:46 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201606242144.u5OLikjj096476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 24 Jun 2016 21:44:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302180 - in head: sys/sys tests/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 21:44:47 -0000 Author: asomers Date: Fri Jun 24 21:44:46 2016 New Revision: 302180 URL: https://svnweb.freebsd.org/changeset/base/302180 Log: Fix bitstring allocation on 32-bit platforms sys/sys/bitstring.h Fix a rounding calculation that could undersize a bitstring on 32-bit platforms. tests/sys/sys/bitstring_test.h Add a test for bitstr_size PR: 210260 Reported by: Mark Millard Reviewed by: gibbs Approved by: re (marius) Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6848 Modified: head/sys/sys/bitstring.h head/tests/sys/sys/bitstring_test.c Modified: head/sys/sys/bitstring.h ============================================================================== --- head/sys/sys/bitstring.h Fri Jun 24 20:21:32 2016 (r302179) +++ head/sys/sys/bitstring.h Fri Jun 24 21:44:46 2016 (r302180) @@ -75,6 +75,12 @@ typedef unsigned long bitstr_t; #define _BITSTR_MASK (~0UL) #define _BITSTR_BITS (sizeof(bitstr_t) * 8) +#ifdef roundup2 +#define _bit_roundup2 roundup2 +#else +#define _bit_roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ +#endif + /* bitstr_t in bit string containing the bit. */ static inline int _bit_idx(int _bit) @@ -104,9 +110,8 @@ _bit_make_mask(int _start, int _stop) } /*----------------------------- Public Interface -----------------------------*/ -/* Number of bytes consumed by a bit string of nbits bits */ -#define bitstr_size(_nbits) \ - (((_nbits) + _BITSTR_BITS - 1) / 8) +/* Number of bytes allocated for a bit string of nbits bits */ +#define bitstr_size(_nbits) (_bit_roundup2(_nbits, _BITSTR_BITS) / 8) /* Allocate a bit string initialized with no bits set. */ #ifdef _KERNEL @@ -123,7 +128,7 @@ bit_alloc(int _nbits) } #endif -/* Allocate a bit string on the stack with no bits set. */ +/* Allocate a bit string on the stack */ #define bit_decl(name, nbits) \ ((name)[bitstr_size(nbits) / sizeof(bitstr_t)]) Modified: head/tests/sys/sys/bitstring_test.c ============================================================================== --- head/tests/sys/sys/bitstring_test.c Fri Jun 24 20:21:32 2016 (r302179) +++ head/tests/sys/sys/bitstring_test.c Fri Jun 24 21:44:46 2016 (r302180) @@ -102,6 +102,17 @@ ATF_TC_BODY(bitstr_in_struct, tc) bit_nclear(test_struct.bitstr, 0, 8); } +ATF_TC_WITHOUT_HEAD(bitstr_size); +ATF_TC_BODY(bitstr_size, tc) +{ + size_t sob = sizeof(bitstr_t); + + ATF_CHECK_EQ(0, bitstr_size(0)); + ATF_CHECK_EQ(sob, bitstr_size(1)); + ATF_CHECK_EQ(sob, bitstr_size(sob * 8)); + ATF_CHECK_EQ(2 * sob, bitstr_size(sob * 8 + 1)); +} + BITSTRING_TC_DEFINE(bit_set) /* bitstr_t *bitstr, int nbits, const char *memloc */ { @@ -407,6 +418,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, bitstr_in_struct); + ATF_TP_ADD_TC(tp, bitstr_size); BITSTRING_TC_ADD(tp, bit_set); BITSTRING_TC_ADD(tp, bit_clear); BITSTRING_TC_ADD(tp, bit_ffs); From owner-svn-src-all@freebsd.org Fri Jun 24 22:49:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B8B1B80D18; Fri, 24 Jun 2016 22:49:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12AF729A5; Fri, 24 Jun 2016 22:49:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5OMnWXV019174; Fri, 24 Jun 2016 22:49:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5OMnWbN019173; Fri, 24 Jun 2016 22:49:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201606242249.u5OMnWbN019173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 24 Jun 2016 22:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302181 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 22:49:33 -0000 Author: jhb Date: Fri Jun 24 22:49:32 2016 New Revision: 302181 URL: https://svnweb.freebsd.org/changeset/base/302181 Log: Add a tunable to disable migration of MSI-X interrupts. The new 'machdep.disable_msix_migration' tunable can be set to 1 to disable migration of MSI-X interrupts. Xen versions prior to 4.6.0 do not properly handle updates to MSI-X table entries after the initial write. In particular, the operation to unmask a table entry after updating it during migration is not propagated to the "real" table for passthrough devices causing the interrupt to remain masked. At least some systems in EC2 are affected by this bug when using SRIOV. The tunable can be set in loader.conf as a workaround. Submitted by: Jeremiah Lott (original patch) Approved by: re (marius) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D6947 Modified: head/sys/x86/x86/msi.c Modified: head/sys/x86/x86/msi.c ============================================================================== --- head/sys/x86/x86/msi.c Fri Jun 24 21:44:46 2016 (r302180) +++ head/sys/x86/x86/msi.c Fri Jun 24 22:49:32 2016 (r302181) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -148,6 +149,16 @@ struct pic msi_pic = { .pic_reprogram_pin = NULL, }; +/* + * Xen hypervisors prior to 4.6.0 do not properly handle updates to + * enabled MSI-X table entries. Allow migration of MSI-X interrupts + * to be disabled via a tunable. + */ +static int msix_disable_migration = 0; +SYSCTL_INT(_machdep, OID_AUTO, disable_msix_migration, CTLFLAG_RDTUN, + &msix_disable_migration, 0, + "Disable migration of MSI-X interrupts between CPUs"); + static int msi_enabled; static int msi_last_irq; static struct mtx msi_lock; @@ -226,6 +237,9 @@ msi_assign_cpu(struct intsrc *isrc, u_in if (msi->msi_first != msi) return (EINVAL); + if (msix_disable_migration && msi->msi_msix) + return (EINVAL); + /* Store information to free existing irq. */ old_vector = msi->msi_vector; old_id = msi->msi_cpu; From owner-svn-src-all@freebsd.org Fri Jun 24 23:22:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BD5AB8077D; Fri, 24 Jun 2016 23:22:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB88224B2; Fri, 24 Jun 2016 23:22:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5ONMhmM034366; Fri, 24 Jun 2016 23:22:43 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5ONMgqN034358; Fri, 24 Jun 2016 23:22:42 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201606242322.u5ONMgqN034358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 24 Jun 2016 23:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302182 - in head: crypto/openssh secure/usr.sbin/sshd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 23:22:44 -0000 Author: gjb Date: Fri Jun 24 23:22:42 2016 New Revision: 302182 URL: https://svnweb.freebsd.org/changeset/base/302182 Log: Revert r301551, which added blacklistd(8) to sshd(8). This change has functional impact, and other concerns raised by the OpenSSH maintainer. Requested by: des PR: 210479 (related) Approved by: re (marius) Sponsored by: The FreeBSD Foundation Deleted: head/crypto/openssh/blacklist.c head/crypto/openssh/blacklist_client.h Modified: head/crypto/openssh/auth-pam.c head/crypto/openssh/auth.c head/crypto/openssh/auth1.c head/crypto/openssh/auth2.c head/crypto/openssh/packet.c head/crypto/openssh/sshd.c head/secure/usr.sbin/sshd/Makefile head/secure/usr.sbin/sshd/Makefile.depend Modified: head/crypto/openssh/auth-pam.c ============================================================================== --- head/crypto/openssh/auth-pam.c Fri Jun 24 22:49:32 2016 (r302181) +++ head/crypto/openssh/auth-pam.c Fri Jun 24 23:22:42 2016 (r302182) @@ -98,9 +98,6 @@ #include "ssh-gss.h" #endif #include "monitor_wrap.h" -#ifdef USE_BLACKLIST -#include "blacklist_client.h" -#endif extern ServerOptions options; extern Buffer loginmsg; @@ -797,9 +794,6 @@ sshpam_query(void *ctx, char **name, cha free(msg); return (0); } -#ifdef USE_BLACKLIST - blacklist_notify(1); -#endif error("PAM: %s for %s%.100s from %.100s", msg, sshpam_authctxt->valid ? "" : "illegal user ", sshpam_authctxt->user, Modified: head/crypto/openssh/auth.c ============================================================================== --- head/crypto/openssh/auth.c Fri Jun 24 22:49:32 2016 (r302181) +++ head/crypto/openssh/auth.c Fri Jun 24 23:22:42 2016 (r302182) @@ -75,9 +75,6 @@ __RCSID("$FreeBSD$"); #include "authfile.h" #include "ssherr.h" #include "compat.h" -#ifdef USE_BLACKLIST -#include "blacklist_client.h" -#endif /* import */ extern ServerOptions options; @@ -309,10 +306,6 @@ auth_log(Authctxt *authctxt, int authent compat20 ? "ssh2" : "ssh1", authctxt->info != NULL ? ": " : "", authctxt->info != NULL ? authctxt->info : ""); -#ifdef USE_BLACKLIST - if (!authctxt->postponed) - blacklist_notify(!authenticated); -#endif free(authctxt->info); authctxt->info = NULL; @@ -647,9 +640,6 @@ getpwnamallow(const char *user) } #endif if (pw == NULL) { -#ifdef USE_BLACKLIST - blacklist_notify(1); -#endif logit("Invalid user %.100s from %.100s", user, get_remote_ipaddr()); #ifdef CUSTOM_FAILED_LOGIN Modified: head/crypto/openssh/auth1.c ============================================================================== --- head/crypto/openssh/auth1.c Fri Jun 24 22:49:32 2016 (r302181) +++ head/crypto/openssh/auth1.c Fri Jun 24 23:22:42 2016 (r302182) @@ -43,9 +43,6 @@ #endif #include "monitor_wrap.h" #include "buffer.h" -#ifdef USE_BLACKLIST -#include "blacklist_client.h" -#endif /* import */ extern ServerOptions options; @@ -340,9 +337,6 @@ do_authloop(Authctxt *authctxt) char *msg; size_t len; -#ifdef USE_BLACKLIST - blacklist_notify(1); -#endif error("Access denied for user %s by PAM account " "configuration", authctxt->user); len = buffer_len(&loginmsg); @@ -410,9 +404,6 @@ do_authentication(Authctxt *authctxt) else { debug("do_authentication: invalid user %s", user); authctxt->pw = fakepw(); -#ifdef USE_BLACKLIST - blacklist_notify(1); -#endif } /* Configuration may have changed as a result of Match */ Modified: head/crypto/openssh/auth2.c ============================================================================== --- head/crypto/openssh/auth2.c Fri Jun 24 22:49:32 2016 (r302181) +++ head/crypto/openssh/auth2.c Fri Jun 24 23:22:42 2016 (r302182) @@ -52,9 +52,6 @@ __RCSID("$FreeBSD$"); #include "pathnames.h" #include "buffer.h" #include "canohost.h" -#ifdef USE_BLACKLIST -#include "blacklist_client.h" -#endif #ifdef GSSAPI #include "ssh-gss.h" @@ -251,9 +248,6 @@ input_userauth_request(int type, u_int32 } else { logit("input_userauth_request: invalid user %s", user); authctxt->pw = fakepw(); -#ifdef USE_BLACKLIST - blacklist_notify(1); -#endif #ifdef SSH_AUDIT_EVENTS PRIVSEP(audit_event(SSH_INVALID_USER)); #endif Modified: head/crypto/openssh/packet.c ============================================================================== --- head/crypto/openssh/packet.c Fri Jun 24 22:49:32 2016 (r302181) +++ head/crypto/openssh/packet.c Fri Jun 24 23:22:42 2016 (r302182) @@ -86,9 +86,6 @@ __RCSID("$FreeBSD$"); #include "packet.h" #include "ssherr.h" #include "sshbuf.h" -#ifdef USE_BLACKLIST -#include "blacklist_client.h" -#endif #ifdef PACKET_DEBUG #define DBG(x) x @@ -2074,9 +2071,6 @@ sshpkt_fatal(struct ssh *ssh, const char case SSH_ERR_NO_KEX_ALG_MATCH: case SSH_ERR_NO_HOSTKEY_ALG_MATCH: if (ssh && ssh->kex && ssh->kex->failed_choice) { -#ifdef USE_BLACKLIST - blacklist_notify(1); -#endif fatal("Unable to negotiate with %.200s port %d: %s. " "Their offer: %s", ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), ssh_err(r), Modified: head/crypto/openssh/sshd.c ============================================================================== --- head/crypto/openssh/sshd.c Fri Jun 24 22:49:32 2016 (r302181) +++ head/crypto/openssh/sshd.c Fri Jun 24 23:22:42 2016 (r302182) @@ -135,9 +135,6 @@ __RCSID("$FreeBSD$"); #include "ssh-sandbox.h" #include "version.h" #include "ssherr.h" -#ifdef USE_BLACKLIST -#include "blacklist_client.h" -#endif #ifdef LIBWRAP #include @@ -391,9 +388,6 @@ grace_alarm_handler(int sig) kill(0, SIGTERM); } -#ifdef USE_BLACKLIST - blacklist_notify(1); -#endif /* Log error and exit. */ sigdie("Timeout before authentication for %s", get_remote_ipaddr()); } @@ -655,10 +649,6 @@ privsep_preauth_child(void) /* Demote the private keys to public keys. */ demote_sensitive_data(); -#ifdef USE_BLACKLIST - blacklist_init(); -#endif - /* Demote the child */ if (getuid() == 0 || geteuid() == 0) { /* Change our root directory */ @@ -1282,9 +1272,6 @@ server_accept_loop(int *sock_in, int *so for (i = 0; i < options.max_startups; i++) startup_pipes[i] = -1; -#ifdef USE_BLACKLIST - blacklist_init(); -#endif /* * Stay listening for connections until the system crashes or * the daemon is killed with a signal. Modified: head/secure/usr.sbin/sshd/Makefile ============================================================================== --- head/secure/usr.sbin/sshd/Makefile Fri Jun 24 22:49:32 2016 (r302181) +++ head/secure/usr.sbin/sshd/Makefile Fri Jun 24 23:22:42 2016 (r302182) @@ -40,13 +40,6 @@ CFLAGS+= -DUSE_BSM_AUDIT -DHAVE_GETAUDIT LIBADD+= bsm .endif -.if ${MK_BLACKLIST_SUPPORT} != "no" -CFLAGS+= -DUSE_BLACKLIST -I${SRCTOP}/contrib/blacklist/include -SRCS+= blacklist.c -LIBADD+= blacklist -LDFLAGS+=-L${LIBBLACKLISTDIR} -.endif - .if ${MK_KERBEROS_SUPPORT} != "no" CFLAGS+= -include krb5_config.h SRCS+= krb5_config.h Modified: head/secure/usr.sbin/sshd/Makefile.depend ============================================================================== --- head/secure/usr.sbin/sshd/Makefile.depend Fri Jun 24 22:49:32 2016 (r302181) +++ head/secure/usr.sbin/sshd/Makefile.depend Fri Jun 24 23:22:42 2016 (r302182) @@ -17,7 +17,6 @@ DIRDEPS = \ kerberos5/lib/libroken \ kerberos5/lib/libwind \ lib/${CSU_DIR} \ - lib/libblacklist \ lib/libbsm \ lib/libc \ lib/libcom_err \ From owner-svn-src-all@freebsd.org Fri Jun 24 23:36:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78DF7B8099E; Fri, 24 Jun 2016 23:36:23 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DCAC2B62; Fri, 24 Jun 2016 23:36:23 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5ONaMDZ038111; Fri, 24 Jun 2016 23:36:22 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5ONaMUV038110; Fri, 24 Jun 2016 23:36:22 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201606242336.u5ONaMUV038110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Fri, 24 Jun 2016 23:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302183 - head/sys/dev/urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 23:36:23 -0000 Author: avos Date: Fri Jun 24 23:36:22 2016 New Revision: 302183 URL: https://svnweb.freebsd.org/changeset/base/302183 Log: urtwn: fix memory leak on device restart Free data buffers every time when device is stopped, not when it is detached; they are allocated at the initialization stage. How-to-reproduce: 1) ifconfig wlan0 create wlandev urtwn0 up 2) vmstat -m | grep USBdev 3) service netif restart 4) vmstat -m | grep USBdev Also, remove usbd_transfer_drain() call; it is already called by usbd_transfer_unsetup(). Tested with RTL8188CUS, STA mode. Approved by: re (marius) Modified: head/sys/dev/urtwn/if_urtwn.c Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Fri Jun 24 23:22:42 2016 (r302182) +++ head/sys/dev/urtwn/if_urtwn.c Fri Jun 24 23:36:22 2016 (r302183) @@ -683,7 +683,6 @@ urtwn_detach(device_t self) { struct urtwn_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; - unsigned int x; /* Prevent further ioctls. */ URTWN_LOCK(sc); @@ -698,26 +697,6 @@ urtwn_detach(device_t self) /* stop all USB transfers */ usbd_transfer_unsetup(sc->sc_xfer, URTWN_N_TRANSFER); - /* Prevent further allocations from RX/TX data lists. */ - URTWN_LOCK(sc); - STAILQ_INIT(&sc->sc_tx_active); - STAILQ_INIT(&sc->sc_tx_inactive); - STAILQ_INIT(&sc->sc_tx_pending); - - STAILQ_INIT(&sc->sc_rx_active); - STAILQ_INIT(&sc->sc_rx_inactive); - URTWN_UNLOCK(sc); - - /* drain USB transfers */ - for (x = 0; x != URTWN_N_TRANSFER; x++) - usbd_transfer_drain(sc->sc_xfer[x]); - - /* Free data buffers. */ - URTWN_LOCK(sc); - urtwn_free_tx_list(sc); - urtwn_free_rx_list(sc); - URTWN_UNLOCK(sc); - if (ic->ic_softc == sc) { ieee80211_draintask(ic, &sc->cmdq_task); ieee80211_ifdetach(ic); @@ -1359,12 +1338,19 @@ static void urtwn_free_rx_list(struct urtwn_softc *sc) { urtwn_free_list(sc, sc->sc_rx, URTWN_RX_LIST_COUNT); + + STAILQ_INIT(&sc->sc_rx_active); + STAILQ_INIT(&sc->sc_rx_inactive); } static void urtwn_free_tx_list(struct urtwn_softc *sc) { urtwn_free_list(sc, sc->sc_tx, URTWN_TX_LIST_COUNT); + + STAILQ_INIT(&sc->sc_tx_active); + STAILQ_INIT(&sc->sc_tx_inactive); + STAILQ_INIT(&sc->sc_tx_pending); } static void @@ -5579,6 +5565,8 @@ urtwn_stop(struct urtwn_softc *sc) urtwn_abort_xfers(sc); urtwn_drain_mbufq(sc); + urtwn_free_tx_list(sc); + urtwn_free_rx_list(sc); urtwn_power_off(sc); URTWN_UNLOCK(sc); } From owner-svn-src-all@freebsd.org Fri Jun 24 23:39:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 002AEB80AB5; Fri, 24 Jun 2016 23:39:46 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C51562DB8; Fri, 24 Jun 2016 23:39:45 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5ONdjLv038257; Fri, 24 Jun 2016 23:39:45 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5ONdjlP038256; Fri, 24 Jun 2016 23:39:45 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201606242339.u5ONdjlP038256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 24 Jun 2016 23:39:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302184 - head/release/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 23:39:46 -0000 Author: cperciva Date: Fri Jun 24 23:39:44 2016 New Revision: 302184 URL: https://svnweb.freebsd.org/changeset/base/302184 Log: Turn off MSI-X interrupt migration by default in EC2 instances; this works around a bug in older versions of Xen and unbreaks SR-IOV (aka. "EC2 Enhanced Networking"). Approved by: re (gjb) Thanks to: jhb, Jeremiah Lott Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf ============================================================================== --- head/release/tools/ec2.conf Fri Jun 24 23:36:22 2016 (r302183) +++ head/release/tools/ec2.conf Fri Jun 24 23:39:44 2016 (r302184) @@ -77,6 +77,12 @@ vm_extra_pre_umount() { # by default for now. echo 'hw.xbd.xbd_enable_indirect="0"' >> ${DESTDIR}/boot/loader.conf + # Some EC2 instances run on a version of Xen which has a bug relating + # to the migration of MSI-X interrupts; this is visible as SR-IOV + # networking (aka. "EC2 Enhanced Networking") not being able to pass + # packets. Disable MSI-X interrupt migration to work around this bug. + echo 'machdep.disable_msix_migration="1"' >> ${DESTDIR}/boot/loader.conf + # The first time the AMI boots, the installed "first boot" scripts # should be allowed to run: # * ec2_configinit (download and process EC2 user-data) From owner-svn-src-all@freebsd.org Fri Jun 24 23:42:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0847FB80C11; Fri, 24 Jun 2016 23:42:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6A6B1256; Fri, 24 Jun 2016 23:42:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5ONgXga041634; Fri, 24 Jun 2016 23:42:33 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5ONgXTu041633; Fri, 24 Jun 2016 23:42:33 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201606242342.u5ONgXTu041633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 24 Jun 2016 23:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302185 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 23:42:35 -0000 Author: gjb Date: Fri Jun 24 23:42:33 2016 New Revision: 302185 URL: https://svnweb.freebsd.org/changeset/base/302185 Log: Update the release notes following r302182. Approved by: re (implicit, relnotes) Sponsored by: The FreeBSD Foundation Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Fri Jun 24 23:39:44 2016 (r302184) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Fri Jun 24 23:42:33 2016 (r302185) @@ -621,9 +621,8 @@ A selection of system daemons, including: fingerd, ftpd, - rlogind, - rshd, and - sshd have been modified to support + rlogind, and + rshd have been modified to support sending notifications to the blacklistd daemon. From owner-svn-src-all@freebsd.org Fri Jun 24 23:43:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7D52B80C61; Fri, 24 Jun 2016 23:43:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99FDB13DA; Fri, 24 Jun 2016 23:43:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5ONhJww041703; Fri, 24 Jun 2016 23:43:19 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5ONhJRq041702; Fri, 24 Jun 2016 23:43:19 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201606242343.u5ONhJRq041702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Fri, 24 Jun 2016 23:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302186 - head/sys/dev/urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2016 23:43:20 -0000 Author: avos Date: Fri Jun 24 23:43:19 2016 New Revision: 302186 URL: https://svnweb.freebsd.org/changeset/base/302186 Log: urtwn: use m_get2() in Rx path. Replace m_getcl() with m_get2(); this fixes 'frame too long' messages for frames, which are longer than MCLBYTES (can be easily triggered when A-MSDU is used). Tested with RTL8188CUS (AP) and RTL8188EU (STA). Approved by: re (marius) Modified: head/sys/dev/urtwn/if_urtwn.c Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Fri Jun 24 23:42:33 2016 (r302185) +++ head/sys/dev/urtwn/if_urtwn.c Fri Jun 24 23:43:19 2016 (r302186) @@ -895,14 +895,7 @@ urtwn_rx_copy_to_mbuf(struct urtwn_softc goto fail; } - if (__predict_false(totlen > MCLBYTES)) { - /* convert to m_getjcl if this happens */ - device_printf(sc->sc_dev, "%s: frame too long: %d (%d)\n", - __func__, pktlen, totlen); - goto fail; - } - - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_get2(totlen, M_NOWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m == NULL)) { device_printf(sc->sc_dev, "%s: could not allocate RX mbuf\n", __func__); From owner-svn-src-all@freebsd.org Sat Jun 25 04:33:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F6E1B73BBD; Sat, 25 Jun 2016 04:33:03 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9EF21822; Sat, 25 Jun 2016 04:33:02 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5P4X2VE050454; Sat, 25 Jun 2016 04:33:02 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5P4X1G8050443; Sat, 25 Jun 2016 04:33:01 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201606250433.u5P4X1G8050443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sat, 25 Jun 2016 04:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302189 - in head/sys: dev/bhnd dev/bhnd/cores/chipc mips/broadcom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 04:33:03 -0000 Author: landonf Date: Sat Jun 25 04:33:00 2016 New Revision: 302189 URL: https://svnweb.freebsd.org/changeset/base/302189 Log: bhnd(4): Perform explicit chipc child enumeration. Replaces use of DEVICE_IDENTIFY with explicit enumeration of chipc child devices using the chipc capability structure. This is a precursor to PMU support, which requires more complex resource assignment handling than achievable with the static device name-based hints table. Reviewed by: Michael Zhilin (Broadcom MIPS support) Approved by: re (gjb), adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6896 Modified: head/sys/dev/bhnd/bhnd_bus_if.m head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c head/sys/dev/bhnd/cores/chipc/chipc.c head/sys/dev/bhnd/cores/chipc/chipc_cfi.c head/sys/dev/bhnd/cores/chipc/chipc_private.h head/sys/dev/bhnd/cores/chipc/chipc_slicer.c head/sys/dev/bhnd/cores/chipc/chipc_slicer.h head/sys/dev/bhnd/cores/chipc/chipc_spi.c head/sys/dev/bhnd/cores/chipc/chipc_spi.h head/sys/dev/bhnd/cores/chipc/chipc_subr.c head/sys/dev/bhnd/cores/chipc/chipcreg.h head/sys/dev/bhnd/cores/chipc/chipcvar.h head/sys/mips/broadcom/uart_bus_chipc.c Modified: head/sys/dev/bhnd/bhnd_bus_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_bus_if.m Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/bhnd_bus_if.m Sat Jun 25 04:33:00 2016 (r302189) @@ -55,6 +55,12 @@ CODE { panic("bhnd_bus_get_chipid unimplemented"); } + static bhnd_attach_type + bhnd_bus_null_get_attach_type(device_t dev, device_t child) + { + panic("bhnd_bus_get_attach_type unimplemented"); + } + static int bhnd_bus_null_read_board_info(device_t dev, device_t child, struct bhnd_board_info *info) @@ -197,7 +203,7 @@ METHOD const struct bhnd_chipid * get_ch METHOD bhnd_attach_type get_attach_type { device_t dev; device_t child; -} DEFAULT bhnd_bus_generic_get_attach_type; +} DEFAULT bhnd_bus_null_get_attach_type; /** * Attempt to read the BHND board identification from the parent bus. Modified: head/sys/dev/bhnd/bhnd_subr.c ============================================================================== --- head/sys/dev/bhnd/bhnd_subr.c Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/bhnd_subr.c Sat Jun 25 04:33:00 2016 (r302189) @@ -1159,21 +1159,3 @@ bhnd_bus_generic_deactivate_resource(dev return (EINVAL); }; -/** - * Helper function for implementing BHND_BUS_GET_ATTACH_TYPE(). - * - * This implementation of BHND_BUS_GET_ATTACH_TYPE() simply calls the - * BHND_BUS_GET_ATTACH_TYPE() method of the parent of @p dev. - */ -bhnd_attach_type -bhnd_bus_generic_get_attach_type(device_t dev, device_t child) -{ - /* iterate from cores via bhnd to bridge or SoC */ - if (device_get_parent(dev) != NULL) - return (BHND_BUS_GET_ATTACH_TYPE(device_get_parent(dev), - child)); - - panic("bhnd_bus_get_attach_type unimplemented"); - /* Unreachable */ - return (BHND_ATTACH_ADAPTER); -} Modified: head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m ============================================================================== --- head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m Sat Jun 25 04:33:00 2016 (r302189) @@ -36,32 +36,16 @@ INTERFACE bhnd_chipc; # HEADER { - #include /* forward declarations */ struct chipc_caps; - struct chipc_caps *bhnd_chipc_generic_get_caps(device_t dev); } CODE { - - /** - * Helper function for implementing BHND_CHIPC_GET_CAPS(). - * - * This implementation of BHND_CHIPC_GET_CAPS() simply calls the - * BHND_CHIPC_GET_CAPS() method of the parent of @p dev. - */ - struct chipc_caps* - bhnd_chipc_generic_get_caps(device_t dev) + static struct chipc_caps * + bhnd_chipc_null_get_caps(device_t dev) { - - if (device_get_parent(dev) != NULL) - return (BHND_CHIPC_GET_CAPS(device_get_parent(dev))); - panic("bhnd_chipc_generic_get_caps unimplemented"); - /* Unreachable */ - return (NULL); } - } /** @@ -91,7 +75,7 @@ METHOD void write_chipctrl { */ METHOD struct chipc_caps * get_caps { device_t dev; -} DEFAULT bhnd_chipc_generic_get_caps; +} DEFAULT bhnd_chipc_null_get_caps; /** * Enable hardware access to the SPROM/OTP source. @@ -114,12 +98,3 @@ METHOD int enable_sprom { METHOD void disable_sprom { device_t dev; } - -/** - * Return the flash configuration register value - * - * @param dev A bhnd(4) ChipCommon device - */ -METHOD uint32_t get_flash_cfg { - device_t dev; -} Modified: head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c Sat Jun 25 04:33:00 2016 (r302189) @@ -54,22 +54,6 @@ __FBSDID("$FreeBSD$"); #define CHIPC_VALID_SPROM_SRC(_src) \ ((_src) == BHND_NVRAM_SRC_SPROM || (_src) == BHND_NVRAM_SRC_OTP) -static void -chipc_sprom_identify(driver_t *driver, device_t parent) -{ - struct chipc_caps *caps; - - caps = BHND_CHIPC_GET_CAPS(parent); - if (!CHIPC_VALID_SPROM_SRC(caps->nvram_src)) - return; - - if (device_find_child(parent, "bhnd_nvram", 0) != NULL) - return; - - if (BUS_ADD_CHILD(parent, 0, "bhnd_nvram", 0) == NULL) - device_printf(parent, "add bhnd_nvram failed\n"); -} - static int chipc_sprom_probe(device_t dev) { @@ -113,7 +97,6 @@ chipc_sprom_attach(device_t dev) static device_method_t chipc_sprom_methods[] = { /* Device interface */ - DEVMETHOD(device_identify, chipc_sprom_identify), DEVMETHOD(device_probe, chipc_sprom_probe), DEVMETHOD(device_attach, chipc_sprom_attach), DEVMETHOD_END Modified: head/sys/dev/bhnd/cores/chipc/chipc.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc.c Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/cores/chipc/chipc.c Sat Jun 25 04:33:00 2016 (r302189) @@ -37,25 +37,8 @@ __FBSDID("$FreeBSD$"); * With the exception of some very early chipsets, the ChipCommon core * has been included in all HND SoCs and chipsets based on the siba(4) * and bcma(4) interconnects, providing a common interface to chipset - * identification, bus enumeration, UARTs, clocks, watchdog interrupts, GPIO, - * flash, etc. - * - * The purpose of this driver is memory resource management for ChipCommon drivers - * like UART, PMU, flash. ChipCommon core has several memory regions. - * - * ChipCommon driver has memory resource manager. Driver - * gets information about BHND core ports/regions and map them - * into drivers' resources. - * - * Here is overview of mapping: - * - * ------------------------------------------------------ - * | Port.Region| Purpose | - * ------------------------------------------------------ - * | 0.0 | PMU, SPI(0x40), UART(0x300) | - * | 1.0 | ? | - * | 1.1 | MMIO flash (SPI & CFI) | - * ------------------------------------------------------ + * identification, bus enumeration, UARTs, clocks, watchdog interrupts, + * GPIO, flash, etc. */ #include @@ -76,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include "chipcreg.h" #include "chipcvar.h" + #include "chipc_private.h" devclass_t bhnd_chipc_devclass; /**< bhnd(4) chipcommon device class */ @@ -123,49 +107,10 @@ static struct bhnd_device_quirk chipc_qu BHND_DEVICE_QUIRK_END }; +// FIXME: IRQ shouldn't be hard-coded +#define CHIPC_MIPS_IRQ 2 -/* - * Here is resource configuration hints for child devices - * - * [Flash] There are 2 flash resources: - * - resource ID (rid) = 0: memory-mapped flash memory - * - resource ID (rid) = 1: memory-mapped flash registers (i.e for SPI) - * - * [UART] Uses IRQ and memory resources: - * - resource ID (rid) = 0: memory-mapped registers - * - IRQ resource ID (rid) = 0: shared IRQ line for Tx/Rx. - */ - -static const struct chipc_hint { - const char *name; - int unit; - int type; - int rid; - rman_res_t base; /* relative to parent resource */ - rman_res_t size; - u_int port; /* ignored if SYS_RES_IRQ */ - u_int region; -} chipc_hints[] = { - // FIXME: cfg/spi port1.1 mapping on siba(4) SoCs - // FIXME: IRQ shouldn't be hardcoded - /* device unit type rid base size port,region */ - { "bhnd_nvram", 0, SYS_RES_MEMORY, 0, CHIPC_SPROM_OTP, CHIPC_SPROM_OTP_SIZE, 0,0 }, - { "uart", 0, SYS_RES_MEMORY, 0, CHIPC_UART0_BASE, CHIPC_UART_SIZE, 0,0 }, - { "uart", 0, SYS_RES_IRQ, 0, 2, 1 }, - { "uart", 1, SYS_RES_MEMORY, 0, CHIPC_UART1_BASE, CHIPC_UART_SIZE, 0,0 }, - { "uart", 1, SYS_RES_IRQ, 0, 2, 1 }, - { "spi", 0, SYS_RES_MEMORY, 0, 0, RM_MAX_END, 1,1 }, - { "spi", 0, SYS_RES_MEMORY, 1, CHIPC_SFLASH_BASE, CHIPC_SFLASH_SIZE, 0,0 }, - { "cfi", 0, SYS_RES_MEMORY, 0, 0, RM_MAX_END, 1,1}, - { "cfi", 0, SYS_RES_MEMORY, 1, CHIPC_SFLASH_BASE, CHIPC_SFLASH_SIZE, 0,0 }, - { NULL } -}; - - -static int chipc_try_activate_resource( - struct chipc_softc *sc, device_t child, - int type, int rid, struct resource *r, - bool req_direct); +static int chipc_add_children(struct chipc_softc *sc); static bhnd_nvram_src chipc_find_nvram_src(struct chipc_softc *sc, struct chipc_caps *caps); @@ -175,6 +120,11 @@ static int chipc_read_caps(struct chi static bool chipc_should_enable_sprom( struct chipc_softc *sc); +static int chipc_try_activate_resource( + struct chipc_softc *sc, device_t child, + int type, int rid, struct resource *r, + bool req_direct); + static int chipc_init_rman(struct chipc_softc *sc); static void chipc_free_rman(struct chipc_softc *sc); static struct rman *chipc_get_rman(struct chipc_softc *sc, @@ -210,9 +160,6 @@ static int chipc_attach(device_t dev) { struct chipc_softc *sc; - bhnd_addr_t enum_addr; - uint32_t ccid_reg; - uint8_t chip_type; int error; sc = device_get_softc(dev); @@ -231,7 +178,7 @@ chipc_attach(device_t dev) goto failed; } - /* Allocate the region containing our core registers */ + /* Allocate the region containing the chipc register block */ if ((sc->core_region = chipc_find_region_by_rid(sc, 0)) == NULL) { error = ENXIO; goto failed; @@ -242,30 +189,10 @@ chipc_attach(device_t dev) if (error) { sc->core_region = NULL; goto failed; - } else { - sc->core = sc->core_region->cr_res; } - /* Fetch our chipset identification data */ - ccid_reg = bhnd_bus_read_4(sc->core, CHIPC_ID); - chip_type = CHIPC_GET_BITS(ccid_reg, CHIPC_ID_BUS); - - switch (chip_type) { - case BHND_CHIPTYPE_SIBA: - /* enumeration space starts at the ChipCommon register base. */ - enum_addr = rman_get_start(sc->core->res); - break; - case BHND_CHIPTYPE_BCMA: - case BHND_CHIPTYPE_BCMA_ALT: - enum_addr = bhnd_bus_read_4(sc->core, CHIPC_EROMPTR); - break; - default: - device_printf(dev, "unsupported chip type %hhu\n", chip_type); - error = ENODEV; - goto failed; - } - - sc->ccid = bhnd_parse_chipid(ccid_reg, enum_addr); + /* Save a direct reference to our chipc registers */ + sc->core = sc->core_region->cr_res; /* Fetch and parse capability register(s) */ if ((error = chipc_read_caps(sc, &sc->caps))) @@ -274,8 +201,10 @@ chipc_attach(device_t dev) if (bootverbose) chipc_print_caps(sc->dev, &sc->caps); - /* Probe and attach children */ - bus_generic_probe(dev); + /* Attach all supported child devices */ + if ((error = chipc_add_children(sc))) + goto failed; + if ((error = bus_generic_attach(dev))) goto failed; @@ -313,6 +242,119 @@ chipc_detach(device_t dev) return (0); } +static int +chipc_add_children(struct chipc_softc *sc) +{ + device_t child; + const char *flash_bus; + int error; + + /* SPROM/OTP */ + if (sc->caps.nvram_src == BHND_NVRAM_SRC_SPROM || + sc->caps.nvram_src == BHND_NVRAM_SRC_OTP) + { + child = BUS_ADD_CHILD(sc->dev, 0, "bhnd_nvram", -1); + if (child == NULL) { + device_printf(sc->dev, "failed to add nvram device\n"); + return (ENXIO); + } + + /* Both OTP and external SPROM are mapped at CHIPC_SPROM_OTP */ + error = chipc_set_resource(sc, child, SYS_RES_MEMORY, 0, + CHIPC_SPROM_OTP, CHIPC_SPROM_OTP_SIZE, 0, 0); + if (error) + return (error); + } + +#ifdef notyet + /* + * PMU/SLOWCLK/INSTACLK + * + * On AOB ("Always on Bus") devices, a PMU core (if it exists) is + * enumerated directly by the bhnd(4) bus -- not chipc. + * + * Otherwise, we always add a PMU child device, and let the + * chipc bhnd_pmu drivers probe for it. If the core supports an + * earlier non-PMU clock/power register interface, one of the instaclk, + * powerctl, or null bhnd_pmu drivers will claim the device. + */ + if (!sc->caps.aob || (sc->caps.aob && !sc->caps.pmu)) { + child = BUS_ADD_CHILD(sc->dev, 0, "bhnd_pmu", -1); + if (child == NULL) { + device_printf(sc->dev, "failed to add pmu\n"); + return (ENXIO); + } + + /* Associate the applicable register block */ + error = 0; + if (sc->caps.pmu) { + error = chipc_set_resource(sc, child, SYS_RES_MEMORY, 0, + CHIPC_PMU, CHIPC_PMU_SIZE, 0, 0); + } else if (sc->caps.power_control) { + error = chipc_set_resource(sc, child, SYS_RES_MEMORY, 0, + CHIPC_PWRCTL, CHIPC_PWRCTL_SIZE, 0, 0); + } + + if (error) + return (error); + + } +#endif /* notyet */ + + /* All remaining devices are SoC-only */ + if (bhnd_get_attach_type(sc->dev) != BHND_ATTACH_NATIVE) + return (0); + + /* UARTs */ + for (u_int i = 0; i < min(sc->caps.num_uarts, CHIPC_UART_MAX); i++) { + child = BUS_ADD_CHILD(sc->dev, 0, "uart", -1); + if (child == NULL) { + device_printf(sc->dev, "failed to add uart%u\n", i); + return (ENXIO); + } + + /* Shared IRQ */ + error = bus_set_resource(child, SYS_RES_IRQ, 0, CHIPC_MIPS_IRQ, + 1); + if (error) { + device_printf(sc->dev, "failed to set uart%u irq %u\n", + i, CHIPC_MIPS_IRQ); + return (error); + } + + /* UART registers are mapped sequentially */ + error = chipc_set_resource(sc, child, SYS_RES_MEMORY, 0, + CHIPC_UART(i), CHIPC_UART_SIZE, 0, 0); + if (error) + return (error); + } + + /* Flash */ + flash_bus = chipc_flash_bus_name(sc->caps.flash_type); + if (flash_bus != NULL) { + child = BUS_ADD_CHILD(sc->dev, 0, flash_bus, -1); + if (child == NULL) { + device_printf(sc->dev, "failed to add %s device\n", + flash_bus); + return (ENXIO); + } + + /* flash memory mapping */ + error = chipc_set_resource(sc, child, SYS_RES_MEMORY, 0, + 0, RM_MAX_END, 1, 1); + if (error) + return (error); + + /* flashctrl registers */ + error = chipc_set_resource(sc, child, SYS_RES_MEMORY, 1, + CHIPC_SFLASH_BASE, CHIPC_SFLASH_SIZE, 0, 0); + if (error) + return (error); + } + + return (0); +} + /** * Determine the NVRAM data source for this device. * @@ -411,7 +453,6 @@ chipc_read_caps(struct chipc_softc *sc, /* Determine flash type and parameters */ caps->cfi_width = 0; - switch (CHIPC_GET_BITS(cap_reg, CHIPC_CAP_FLASH)) { case CHIPC_CAP_SFLASH_ST: caps->flash_type = CHIPC_SFLASH_ST; @@ -420,6 +461,7 @@ chipc_read_caps(struct chipc_softc *sc, caps->flash_type = CHIPC_SFLASH_AT; break; case CHIPC_CAP_NFLASH: + /* unimplemented */ caps->flash_type = CHIPC_NFLASH; break; case CHIPC_CAP_PFLASH: @@ -548,33 +590,16 @@ chipc_child_location_str(device_t dev, d static device_t chipc_add_child(device_t dev, u_int order, const char *name, int unit) { + struct chipc_softc *sc; struct chipc_devinfo *dinfo; - const struct chipc_hint *hint; device_t child; - devclass_t child_dc; - int error; - int busrel_unit; + + sc = device_get_softc(dev); child = device_add_child_ordered(dev, order, name, unit); if (child == NULL) return (NULL); - /* system-wide device unit */ - unit = device_get_unit(child); - child_dc = device_get_devclass(child); - - busrel_unit = 0; - for (int i = 0; i < unit; i++) { - device_t tmp; - - tmp = devclass_get_device(child_dc, i); - if (tmp != NULL && (device_get_parent(tmp) == dev)) - busrel_unit++; - } - - /* bus-wide device unit (override unit for further hint matching) */ - unit = busrel_unit; - dinfo = malloc(sizeof(struct chipc_devinfo), M_BHND, M_NOWAIT); if (dinfo == NULL) { device_delete_child(dev, child); @@ -584,93 +609,7 @@ chipc_add_child(device_t dev, u_int orde resource_list_init(&dinfo->resources); device_set_ivars(child, dinfo); - /* Hint matching requires a device name */ - if (name == NULL) - return (child); - - /* Use hint table to set child resources */ - for (hint = chipc_hints; hint->name != NULL; hint++) { - bhnd_addr_t region_addr; - bhnd_size_t region_size; - - /* Check device name */ - if (strcmp(hint->name, name) != 0) - continue; - - /* Check device unit */ - if (hint->unit >= 0 && unit != hint->unit) - continue; - - switch (hint->type) { - case SYS_RES_IRQ: - /* Add child resource */ - error = bus_set_resource(child, hint->type, hint->rid, - hint->base, hint->size); - if (error) { - device_printf(dev, - "bus_set_resource() failed for %s: %d\n", - device_get_nameunit(child), error); - goto failed; - } - break; - - case SYS_RES_MEMORY: - /* Fetch region address and size */ - error = bhnd_get_region_addr(dev, BHND_PORT_DEVICE, - hint->port, hint->region, ®ion_addr, - ®ion_size); - if (error) { - device_printf(dev, - "lookup of %s%u.%u failed: %d\n", - bhnd_port_type_name(BHND_PORT_DEVICE), - hint->port, hint->region, error); - goto failed; - } - - /* Verify requested range is mappable */ - if (hint->base > region_size || - (hint->size != RM_MAX_END && - (hint->size > region_size || - region_size - hint->base < hint->size ))) - { - device_printf(dev, - "%s%u.%u region cannot map requested range " - "%#jx+%#jx\n", - bhnd_port_type_name(BHND_PORT_DEVICE), - hint->port, hint->region, hint->base, - hint->size); - } - - /* - * Add child resource. If hint doesn't define the end - * of resource window (RX_MAX_END), use end of region. - */ - - error = bus_set_resource(child, - hint->type, - hint->rid, region_addr + hint->base, - (hint->size == RM_MAX_END) ? - region_size - hint->base : - hint->size); - if (error) { - device_printf(dev, - "bus_set_resource() failed for %s: %d\n", - device_get_nameunit(child), error); - goto failed; - } - break; - default: - device_printf(child, "unknown hint resource type: %d\n", - hint->type); - break; - } - } - return (child); - -failed: - device_delete_child(dev, child); - return (NULL); } static void @@ -705,7 +644,7 @@ chipc_rman_init_regions (struct chipc_so u_int num_regions; int error; - num_regions = bhnd_get_region_count(sc->dev, port, port); + num_regions = bhnd_get_region_count(sc->dev, type, port); for (u_int region = 0; region < num_regions; region++) { /* Allocate new region record */ cr = chipc_alloc_region(sc, type, port, region); @@ -1349,15 +1288,6 @@ chipc_get_caps(device_t dev) return (&sc->caps); } -static uint32_t -chipc_get_flash_cfg(device_t dev) -{ - struct chipc_softc *sc; - - sc = device_get_softc(dev); - return (bhnd_bus_read_4(sc->core, CHIPC_FLASH_CFG)); -} - static device_method_t chipc_methods[] = { /* Device interface */ DEVMETHOD(device_probe, chipc_probe), @@ -1399,7 +1329,6 @@ static device_method_t chipc_methods[] = DEVMETHOD(bhnd_chipc_enable_sprom, chipc_enable_sprom_pins), DEVMETHOD(bhnd_chipc_disable_sprom, chipc_disable_sprom_pins), DEVMETHOD(bhnd_chipc_get_caps, chipc_get_caps), - DEVMETHOD(bhnd_chipc_get_flash_cfg, chipc_get_flash_cfg), DEVMETHOD_END }; Modified: head/sys/dev/bhnd/cores/chipc/chipc_cfi.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc_cfi.c Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/cores/chipc/chipc_cfi.c Sat Jun 25 04:33:00 2016 (r302189) @@ -40,90 +40,39 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include "bhnd_chipc_if.h" -#include "chipc_slicer.h" + #include "chipcreg.h" #include "chipcvar.h" - -/* - * **************************** PROTOTYPES **************************** - */ - -static void chipc_cfi_identify(driver_t *driver, device_t parent); -static int chipc_cfi_probe(device_t dev); -static int chipc_cfi_attach(device_t dev); - -/* - * **************************** IMPLEMENTATION ************************ - */ - -static void -chipc_cfi_identify(driver_t *driver, device_t parent) -{ - struct chipc_caps *caps; - - if (device_find_child(parent, cfi_driver_name, -1) != NULL) - return; - - caps = BHND_CHIPC_GET_CAPS(parent); - if (caps == NULL) - return; - - if (caps->flash_type != CHIPC_PFLASH_CFI) - return; - - BUS_ADD_CHILD(parent, 0, cfi_driver_name, -1); - return; -} +#include "chipc_slicer.h" static int chipc_cfi_probe(device_t dev) { - int error; - int enabled; - int byteswap; - uint32_t flash_config; struct cfi_softc *sc; + int error; sc = device_get_softc(dev); - flash_config = BHND_CHIPC_GET_FLASH_CFG(device_get_parent(dev)); - - enabled = (flash_config & CHIPC_CF_EN); - byteswap = (flash_config & CHIPC_CF_BS); - - if (enabled == 0) - device_disable(dev); - - BHND_DEBUG_DEV(dev, "trying attach flash enabled=%d swapbytes=%d", - enabled, byteswap); - sc->sc_width = 0; - error = cfi_probe(dev); - if (error == 0) - device_set_desc(dev, "ChipCommon CFI"); + if ((error = cfi_probe(dev)) > 0) + return (error); + + device_set_desc(dev, "Broadcom ChipCommon CFI"); return (error); } static int chipc_cfi_attach(device_t dev) { - int error; - - error = cfi_attach(dev); - if (error) - return (error); - - flash_register_slicer(chipc_slicer_cfi); - return (0); + chipc_register_slicer(CHIPC_PFLASH_CFI); + return (cfi_attach(dev)); } static device_method_t chipc_cfi_methods[] = { /* device interface */ - DEVMETHOD(device_identify, chipc_cfi_identify), DEVMETHOD(device_probe, chipc_cfi_probe), DEVMETHOD(device_attach, chipc_cfi_attach), DEVMETHOD(device_detach, cfi_detach), @@ -138,4 +87,3 @@ static driver_t chipc_cfi_driver = { }; DRIVER_MODULE(cfi, bhnd_chipc, chipc_cfi_driver, cfi_devclass, 0, 0); - Modified: head/sys/dev/bhnd/cores/chipc/chipc_private.h ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc_private.h Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/cores/chipc/chipc_private.h Sat Jun 25 04:33:00 2016 (r302189) @@ -55,6 +55,11 @@ int chipc_init_child_resource(struct struct resource *parent, bhnd_size_t offset, bhnd_size_t size); +int chipc_set_resource(struct chipc_softc *sc, + device_t child, int type, int rid, + rman_res_t start, rman_res_t count, u_int port, + u_int region); + struct chipc_region *chipc_alloc_region(struct chipc_softc *sc, bhnd_port_type type, u_int port, u_int region); Modified: head/sys/dev/bhnd/cores/chipc/chipc_slicer.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc_slicer.c Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/cores/chipc/chipc_slicer.c Sat Jun 25 04:33:00 2016 (r302189) @@ -54,58 +54,88 @@ __FBSDID("$FreeBSD$"); #include #include "chipc_spi.h" -static int chipc_slicer_walk(device_t dev, struct resource* res, +static int chipc_slicer_walk(device_t dev, struct resource *res, struct flash_slice *slices, int *nslices); +void +chipc_register_slicer(chipc_flash flash_type) +{ + switch (flash_type) { + case CHIPC_SFLASH_AT: + case CHIPC_SFLASH_ST: + flash_register_slicer(chipc_slicer_spi); + break; + case CHIPC_PFLASH_CFI: + flash_register_slicer(chipc_slicer_cfi); + break; + default: + /* Unsupported */ + break; + } +} + int chipc_slicer_cfi(device_t dev, struct flash_slice *slices, int *nslices) { struct cfi_softc *sc; + device_t parent; - if (strcmp("cfi", device_get_name(dev)) != 0) - return (0); + /* must be CFI flash */ + if (device_get_devclass(dev) != devclass_find("cfi")) + return (ENXIO); + + /* must be attached to chipc */ + if ((parent = device_get_parent(dev)) == NULL) { + BHND_ERROR_DEV(dev, "no found ChipCommon device"); + return (ENXIO); + } - sc = device_get_softc(dev); + if (device_get_devclass(parent) != devclass_find("bhnd_chipc")) { + BHND_ERROR_DEV(dev, "no found ChipCommon device"); + return (ENXIO); + } + sc = device_get_softc(dev); return (chipc_slicer_walk(dev, sc->sc_res, slices, nslices)); } int chipc_slicer_spi(device_t dev, struct flash_slice *slices, int *nslices) { - /* flash(mx25l) <- spibus <- chipc_spi */ - device_t spibus; - device_t chipc_spi; struct chipc_spi_softc *sc; + device_t chipc, spi, spibus; BHND_DEBUG_DEV(dev, "initting SPI slicer: %s", device_get_name(dev)); - if (strcmp("mx25l", device_get_name(dev)) != 0) - return (EINVAL); - + /* must be SPI-attached flash */ spibus = device_get_parent(dev); if (spibus == NULL) { BHND_ERROR_DEV(dev, "no found ChipCommon SPI BUS device"); - return (EINVAL); + return (ENXIO); } - chipc_spi = device_get_parent(spibus); - if (chipc_spi == NULL) { - BHND_ERROR_DEV(spibus, "no found ChipCommon SPI device"); - return (EINVAL); + spi = device_get_parent(spibus); + if (spi == NULL) { + BHND_ERROR_DEV(dev, "no found ChipCommon SPI device"); + return (ENXIO); } - sc = device_get_softc(chipc_spi); + chipc = device_get_parent(spi); + if (device_get_devclass(chipc) != devclass_find("bhnd_chipc")) { + BHND_ERROR_DEV(dev, "no found ChipCommon device"); + return (ENXIO); + } - return (chipc_slicer_walk(dev, sc->sc_res, slices, nslices)); + sc = device_get_softc(spi); + return (chipc_slicer_walk(dev, sc->sc_flash_res, slices, nslices)); } /* * Main processing part */ static int -chipc_slicer_walk(device_t dev, struct resource* res, - struct flash_slice *slices, int *nslices) +chipc_slicer_walk(device_t dev, struct resource *res, + struct flash_slice *slices, int *nslices) { uint32_t fw_len; uint32_t fs_ofs; Modified: head/sys/dev/bhnd/cores/chipc/chipc_slicer.h ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc_slicer.h Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/cores/chipc/chipc_slicer.h Sat Jun 25 04:33:00 2016 (r302189) @@ -34,10 +34,13 @@ #include +#include "chipcvar.h" + #define TRX_MAGIC 0x30524448 #define CFE_MAGIC 0x43464531 #define NVRAM_MAGIC 0x48534C46 +void chipc_register_slicer(chipc_flash flash_type); int chipc_slicer_spi(device_t dev, struct flash_slice *slices, int *nslices); int chipc_slicer_cfi(device_t dev, struct flash_slice *slices, Modified: head/sys/dev/bhnd/cores/chipc/chipc_spi.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc_spi.c Sat Jun 25 02:09:49 2016 (r302188) +++ head/sys/dev/bhnd/cores/chipc/chipc_spi.c Sat Jun 25 04:33:00 2016 (r302189) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2016 Michael Zhilin + * Copyright (c) 2016 Landon Fuller * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,135 +42,134 @@ __FBSDID("$FreeBSD$"); #include #include -/* - * SPI BUS interface - */ + #include +#include "bhnd_chipc_if.h" + #include "spibus_if.h" #include "chipcreg.h" #include "chipcvar.h" -#include "chipc_spi.h" -#include "bhnd_chipc_if.h" - -/* - * Flash slicer - */ #include "chipc_slicer.h" -/* - * **************************** PROTOTYPES **************************** - */ +#include "chipc_spi.h" -static void chipc_spi_identify(driver_t *driver, device_t parent); static int chipc_spi_probe(device_t dev); static int chipc_spi_attach(device_t dev); +static int chipc_spi_detach(device_t dev); static int chipc_spi_transfer(device_t dev, device_t child, struct spi_command *cmd); static int chipc_spi_txrx(struct chipc_spi_softc *sc, uint8_t in, uint8_t* out); static int chipc_spi_wait(struct chipc_spi_softc *sc); -/* - * **************************** IMPLEMENTATION ************************ - */ +static int +chipc_spi_probe(device_t dev) +{ + device_set_desc(dev, "Broadcom ChipCommon SPI"); + return (BUS_PROBE_NOWILDCARD); +} -static void -chipc_spi_identify(driver_t *driver, device_t parent) +static int +chipc_spi_attach(device_t dev) { - struct chipc_caps *caps; - device_t spidev; - device_t spibus; - device_t flash; - char* flash_name; - int err; - - flash_name = NULL; - - if (device_find_child(parent, "spi", -1) != NULL) - return; - - caps = BHND_CHIPC_GET_CAPS(parent); - if (caps == NULL) { - BHND_ERROR_DEV(parent, "can't retrieve ChipCommon capabilities"); - return; - } + struct chipc_spi_softc *sc; + struct chipc_caps *ccaps; + device_t flash_dev; + device_t spibus; + const char *flash_name; + int error; - switch (caps->flash_type) { - case CHIPC_SFLASH_AT: - flash_name = "at45d"; - break; - case CHIPC_SFLASH_ST: - flash_name = "mx25l"; - break; - default: - return; - } + sc = device_get_softc(dev); - spidev = BUS_ADD_CHILD(parent, 0, "spi", -1); - if (spidev == NULL) { - BHND_ERROR_DEV(parent, "can't add chipc_spi to ChipCommon"); - return; + /* Allocate SPI controller registers */ + sc->sc_rid = 1; + sc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rid, + RF_ACTIVE); + if (sc->sc_res == NULL) { + device_printf(dev, "failed to allocate device registers\n"); + return (ENXIO); } - err = device_probe_and_attach(spidev); - if (err) { - BHND_ERROR_DEV(spidev, "failed attach chipc_spi: %d", err); - return; + /* Allocate flash shadow region */ + sc->sc_flash_rid = 0; + sc->sc_flash_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->sc_flash_rid, RF_ACTIVE); + if (sc->sc_flash_res == NULL) { + device_printf(dev, "failed to allocate flash region\n"); + error = ENXIO; + goto failed; } - spibus = device_find_child(spidev, "spibus", -1); - if (spibus == NULL) { - BHND_ERROR_DEV(spidev, "can't find spibus under chipc_spi"); - return; + /* + * Add flash device + * + * XXX: This should be replaced with a DEVICE_IDENTIFY implementation + * in chipc-specific subclasses of the mx25l and at45d drivers. + */ + if ((spibus = device_add_child(dev, "spibus", -1)) == NULL) { + device_printf(dev, "failed to add spibus\n"); + error = ENXIO; + goto failed; } - flash = BUS_ADD_CHILD(spibus, 0, flash_name, -1); - if (flash == NULL) { - BHND_ERROR_DEV(spibus, "can't add %s to spibus", flash_name); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Jun 25 04:34:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6B7BB73C5D; Sat, 25 Jun 2016 04:34:56 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 825D11A22; Sat, 25 Jun 2016 04:34:56 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5P4Yt2b050570; Sat, 25 Jun 2016 04:34:55 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5P4YsKN050557; Sat, 25 Jun 2016 04:34:54 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201606250434.u5P4YsKN050557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sat, 25 Jun 2016 04:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302190 - in head/sys/mips: atheros broadcom conf sentry5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 04:34:56 -0000 Author: landonf Date: Sat Jun 25 04:34:54 2016 New Revision: 302190 URL: https://svnweb.freebsd.org/changeset/base/302190 Log: Replace mips/sentry5 with mips/broadcom The delta between SENTRY5 and BCM was already small due to BCM being derived from SENTRY5; re-integrating the two avoids the maintenance overhead of keeping them both in sync with bhnd(4) changes. - Re-integrate minor SENTRY5 deltas in bcm_machdep.c - Modify uart_cpu_chipc to allow specifying UART debug/console flags via kenv and device hints. - Switch SENTRY5 to std.broadcom - Enabled CFI flash support for SENTRY5 Reviewed by: Michael Zhilin (Broadcom MIPS support) Approved by: re (gjb), adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6897 Deleted: head/sys/mips/sentry5/files.sentry5 head/sys/mips/sentry5/obio.c head/sys/mips/sentry5/obiovar.h head/sys/mips/sentry5/s5_machdep.c head/sys/mips/sentry5/s5reg.h head/sys/mips/sentry5/std.sentry5 head/sys/mips/sentry5/uart_bus_sbusart.c head/sys/mips/sentry5/uart_cpu_sbusart.c Modified: head/sys/mips/atheros/ar71xx_chip.c head/sys/mips/atheros/ar71xx_machdep.c head/sys/mips/atheros/ar724x_chip.c head/sys/mips/atheros/ar91xx_chip.c head/sys/mips/broadcom/bcm_machdep.c head/sys/mips/broadcom/bcm_socinfo.c head/sys/mips/broadcom/bcm_socinfo.h head/sys/mips/broadcom/std.broadcom head/sys/mips/broadcom/uart_cpu_chipc.c head/sys/mips/conf/BCM head/sys/mips/conf/BCM.hints head/sys/mips/conf/SENTRY5 head/sys/mips/conf/SENTRY5.hints Modified: head/sys/mips/atheros/ar71xx_chip.c ============================================================================== --- head/sys/mips/atheros/ar71xx_chip.c Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/atheros/ar71xx_chip.c Sat Jun 25 04:34:54 2016 (r302190) @@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - /* XXX these should replace the current definitions in ar71xxreg.h */ /* XXX perhaps an ar71xx_chip.h header file? */ #define AR71XX_PLL_REG_CPU_CONFIG AR71XX_PLL_CPU_BASE + 0x00 Modified: head/sys/mips/atheros/ar71xx_machdep.c ============================================================================== --- head/sys/mips/atheros/ar71xx_machdep.c Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/atheros/ar71xx_machdep.c Sat Jun 25 04:34:54 2016 (r302190) @@ -58,8 +58,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - extern char edata[], end[]; /* 4KB static data aread to keep a copy of the bootload env until Modified: head/sys/mips/atheros/ar724x_chip.c ============================================================================== --- head/sys/mips/atheros/ar724x_chip.c Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/atheros/ar724x_chip.c Sat Jun 25 04:34:54 2016 (r302190) @@ -59,8 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - static void ar724x_chip_detect_mem_size(void) { Modified: head/sys/mips/atheros/ar91xx_chip.c ============================================================================== --- head/sys/mips/atheros/ar91xx_chip.c Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/atheros/ar91xx_chip.c Sat Jun 25 04:34:54 2016 (r302190) @@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - static void ar91xx_chip_detect_mem_size(void) { Modified: head/sys/mips/broadcom/bcm_machdep.c ============================================================================== --- head/sys/mips/broadcom/bcm_machdep.c Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/broadcom/bcm_machdep.c Sat Jun 25 04:34:54 2016 (r302190) @@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include "bcm_socinfo.h" #ifdef CFE @@ -79,7 +78,9 @@ __FBSDID("$FreeBSD$"); #endif #if 0 -#define BROADCOM_TRACE 0 +#define BCM_TRACE(_fmt, ...) printf(_fmt, ##__VA_ARGS__) +#else +#define BCM_TRACE(_fmt, ...) #endif extern int *edata; @@ -109,16 +110,12 @@ mips_init(void) result = cfe_enummem(i / 2, 0, &addr, &len, &type); if (result < 0) { -#ifdef BROADCOM_TRACE - printf("There is no phys memory for: %d\n", i); -#endif + BCM_TRACE("There is no phys memory for: %d\n", i); phys_avail[i] = phys_avail[i + 1] = 0; break; } - if (type != CFE_MI_AVAILABLE){ -#ifdef BROADCOM_TRACE - printf("phys memory is not available: %d\n", i); -#endif + if (type != CFE_MI_AVAILABLE) { + BCM_TRACE("phys memory is not available: %d\n", i); continue; } @@ -131,19 +128,16 @@ mips_init(void) */ phys_avail[i] += MIPS_KSEG0_TO_PHYS(kernel_kseg0_end); } -#ifdef BROADCOM_TRACE - printf("phys memory is available for: %d\n", i); - printf(" => addr = %jx\n", addr); - printf(" => len = %jd\n", len); -#endif + + BCM_TRACE("phys memory is available for: %d\n", i); + BCM_TRACE(" => addr = %jx\n", addr); + BCM_TRACE(" => len = %jd\n", len); + phys_avail[i + 1] = addr + len; physmem += len; } -#ifdef BROADCOM_TRACE - printf("Total phys memory is : %ld\n", physmem); -#endif - + BCM_TRACE("Total phys memory is : %ld\n", physmem); realmem = btoc(physmem); #endif @@ -165,15 +159,25 @@ mips_init(void) #endif } -#define BCM_REG_CHIPC 0x18000000 - - void platform_reset(void) { printf("bcm::platform_reset()\n"); intr_disable(); + +#if defined(CFE) + cfe_exit(0, 0); +#else + /* PMU watchdog reset */ BCM_WRITE_REG32(BCM_REG_CHIPC_PMUWD_OFFS, 2); /* PMU watchdog */ +#endif + +#if 0 + /* Non-PMU reset + * XXX: Need chipc capability flags */ + *((volatile uint8_t *)MIPS_PHYS_TO_KSEG1(SENTRY5_EXTIFADR)) = 0x80; +#endif + for (;;); } @@ -194,6 +198,37 @@ platform_start(__register_t a0, __regist /* Initialize pcpu stuff */ mips_pcpu0_init(); +#if 0 + /* + * Probe the Broadcom on-chip PLL clock registers + * and discover the CPU pipeline clock and bus clock + * multipliers from this. + * XXX: Wrong place. You have to ask the ChipCommon + * or External Interface cores on the SiBa. + */ + uint32_t busmult, cpumult, refclock, clkcfg1; +#define S5_CLKCFG1_REFCLOCK_MASK 0x0000001F +#define S5_CLKCFG1_BUSMULT_MASK 0x000003E0 +#define S5_CLKCFG1_BUSMULT_SHIFT 5 +#define S5_CLKCFG1_CPUMULT_MASK 0xFFFFFC00 +#define S5_CLKCFG1_CPUMULT_SHIFT 10 + + counter_freq = 100000000; /* XXX */ + + clkcfg1 = s5_rd_clkcfg1(); + printf("clkcfg1 = 0x%08x\n", clkcfg1); + + refclock = clkcfg1 & 0x1F; + busmult = ((clkcfg1 & 0x000003E0) >> 5) + 1; + cpumult = ((clkcfg1 & 0xFFFFFC00) >> 10) + 1; + + printf("refclock = %u\n", refclock); + printf("busmult = %u\n", busmult); + printf("cpumult = %u\n", cpumult); + + counter_freq = cpumult * refclock; +#endif + socinfo = bcm_get_socinfo(); platform_counter_freq = socinfo->cpurate * 1000 * 1000; /* BCM4718 is 480MHz */ @@ -212,10 +247,10 @@ platform_start(__register_t a0, __regist if (a3 == CFE_EPTSEAL) cfe_init(a0, a2); #endif + cninit(); mips_init(); - /* BCM471x timer is 1/2 of Clk */ - mips_timer_init_params(platform_counter_freq, 1); + mips_timer_init_params(platform_counter_freq, socinfo->double_count); } Modified: head/sys/mips/broadcom/bcm_socinfo.c ============================================================================== --- head/sys/mips/broadcom/bcm_socinfo.c Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/broadcom/bcm_socinfo.c Sat Jun 25 04:34:54 2016 (r302190) @@ -33,22 +33,23 @@ __FBSDID("$FreeBSD$"); /* found on https://wireless.wiki.kernel.org/en/users/drivers/b43/soc */ struct bcm_socinfo bcm_socinfos[] = { - {0x00005300, 600, 25000000}, /* BCM4706 to check */ - {0x0022B83A, 300, 20000000}, /* BCM4716B0 ASUS RT-N12 */ - {0x00914716, 354, 20000000}, /* BCM4717A1 to check */ - {0x00A14716, 480, 20000000}, /* BCM4718A1 ASUS RT-N16 */ - {0x00435356, 300, 25000000}, /* BCM5356A1 (RT-N10, WNR1000v3) */ - {0x00825357, 500, 20000000}, /* BCM5358UB0 ASUS RT-N53A1 */ - {0x00845357, 300, 20000000}, /* BCM5357B0 to check */ - {0x00945357, 500, 20000000}, /* BCM5358 */ - {0x00A45357, 500, 20000000}, /* BCM47186B0 Tenda N60 */ - {0x0085D144, 300, 20000000}, /* BCM5356C0 */ - {0x00B5D144, 300, 20000000}, /* BCM5357C0 */ + {0x00005300, 600, 25000000, 1}, /* BCM4706 to check */ + {0x0022B83A, 300, 20000000, 1}, /* BCM4716B0 ASUS RT-N12 */ + {0x00914716, 354, 20000000, 1}, /* BCM4717A1 to check */ + {0x00A14716, 480, 20000000, 1}, /* BCM4718A1 ASUS RT-N16 */ + {0x00435356, 300, 25000000, 1}, /* BCM5356A1 (RT-N10, WNR1000v3) */ + {0x00825357, 500, 20000000, 1}, /* BCM5358UB0 ASUS RT-N53A1 */ + {0x00845357, 300, 20000000, 1}, /* BCM5357B0 to check */ + {0x00945357, 500, 20000000, 1}, /* BCM5358 */ + {0x00A45357, 500, 20000000, 1}, /* BCM47186B0 Tenda N60 */ + {0x0085D144, 300, 20000000, 1}, /* BCM5356C0 */ + {0x00B5D144, 300, 20000000, 1}, /* BCM5357C0 */ + {0x00015365, 200, 0, 1}, /* BCM5365 */ {0,0,0} }; /* Most popular BCM SoC info */ -struct bcm_socinfo BCM_DEFAULT_SOCINFO = {0x0, 300, 20000000}; +struct bcm_socinfo BCM_DEFAULT_SOCINFO = {0x0, 300, 20000000, 0}; struct bcm_socinfo* bcm_get_socinfo_by_socid(uint32_t key) Modified: head/sys/mips/broadcom/bcm_socinfo.h ============================================================================== --- head/sys/mips/broadcom/bcm_socinfo.h Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/broadcom/bcm_socinfo.h Sat Jun 25 04:34:54 2016 (r302190) @@ -35,9 +35,10 @@ #include struct bcm_socinfo { - uint32_t id; - uint32_t cpurate; /* in MHz */ - uint32_t uartrate; /* in Hz */ + uint32_t id; + uint32_t cpurate; /* in MHz */ + uint32_t uartrate; /* in Hz */ + int double_count; }; struct bcm_socinfo* bcm_get_socinfo_by_socid(uint32_t key); Modified: head/sys/mips/broadcom/std.broadcom ============================================================================== --- head/sys/mips/broadcom/std.broadcom Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/broadcom/std.broadcom Sat Jun 25 04:34:54 2016 (r302190) @@ -3,5 +3,7 @@ machine mips mipsel -cpu CPU_MIPS74K +makeoptions INTRNG +options INTRNG + files "../broadcom/files.broadcom" Modified: head/sys/mips/broadcom/uart_cpu_chipc.c ============================================================================== --- head/sys/mips/broadcom/uart_cpu_chipc.c Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/broadcom/uart_cpu_chipc.c Sat Jun 25 04:34:54 2016 (r302190) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #include #include #include @@ -48,31 +50,74 @@ __FBSDID("$FreeBSD$"); bus_space_tag_t uart_bus_space_io; bus_space_tag_t uart_bus_space_mem; +static struct uart_class *chipc_uart_class = &uart_ns8250_class; + +#define CHIPC_UART_BAUDRATE 115200 + int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); } -int -uart_cpu_getdev(int devtype, struct uart_devinfo *di) +static int +uart_cpu_init(struct uart_devinfo *di, int uart, int baudrate) { - struct uart_class *class; struct bcm_socinfo *socinfo; + if (uart >= CHIPC_UART_MAX) + return (EINVAL); + socinfo = bcm_get_socinfo(); - class = &uart_ns8250_class; - di->ops = uart_getops(class); + di->ops = uart_getops(chipc_uart_class); di->bas.chan = 0; - di->bas.bst = mips_bus_space_generic; - di->bas.bsh = (bus_space_handle_t)BCM_SOCREG(BCM_REG_CHIPC_UART); + di->bas.bst = uart_bus_space_mem; + di->bas.bsh = (bus_space_handle_t) BCM_SOCREG(CHIPC_UART(uart)); di->bas.regshft = 0; di->bas.rclk = socinfo->uartrate; /* in Hz */ - di->baudrate = 115200; + di->baudrate = baudrate; di->databits = 8; di->stopbits = 1; di->parity = UART_PARITY_NONE; + + return (0); +} + +int +uart_cpu_getdev(int devtype, struct uart_devinfo *di) +{ + int ivar; + uart_bus_space_io = NULL; uart_bus_space_mem = mips_bus_space_generic; - return (0); + + /* Check the environment. */ + if (uart_getenv(devtype, di, chipc_uart_class) == 0) + return (0); + + /* Scan the device hints for the first matching device */ + for (int i = 0; i < CHIPC_UART_MAX; i++) { + if (resource_int_value("uart", i, "flags", &ivar)) + continue; + + /* Check usability */ + if (devtype == UART_DEV_CONSOLE && !UART_FLAGS_CONSOLE(ivar)) + continue; + + if (devtype == UART_DEV_DBGPORT && !UART_FLAGS_DBGPORT(ivar)) + continue; + + if (resource_int_value("uart", i, "disabled", &ivar) == 0 && + ivar == 0) + continue; + + /* Found */ + if (resource_int_value("uart", i, "baud", &ivar) != 0) + ivar = CHIPC_UART_BAUDRATE; + + return (uart_cpu_init(di, i, ivar)); + } + + /* Default to uart0/115200 */ + return (uart_cpu_init(di, 0, CHIPC_UART_BAUDRATE)); } Modified: head/sys/mips/conf/BCM ============================================================================== --- head/sys/mips/conf/BCM Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/conf/BCM Sat Jun 25 04:34:54 2016 (r302190) @@ -6,6 +6,7 @@ # ident BCM +cpu CPU_MIPS74K hints "BCM.hints" include "../broadcom/std.broadcom" @@ -16,9 +17,6 @@ options ALT_BREAK_TO_DEBUGGER options BREAK_TO_DEBUGGER options BOOTVERBOSE=0 -makeoptions INTRNG -options INTRNG - makeoptions TRAMPLOADADDR=0x80800000 makeoptions DEBUG="-g3" #Build kernel with gdb(1) debug symbols makeoptions MODULES_OVERRIDE="" Modified: head/sys/mips/conf/BCM.hints ============================================================================== --- head/sys/mips/conf/BCM.hints Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/conf/BCM.hints Sat Jun 25 04:34:54 2016 (r302190) @@ -2,4 +2,3 @@ hint.bhnd.0.at="nexus0" hint.bhnd.0.maddr="0x18000000" hint.bhnd.0.msize="0x00100000" - Modified: head/sys/mips/conf/SENTRY5 ============================================================================== --- head/sys/mips/conf/SENTRY5 Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/conf/SENTRY5 Sat Jun 25 04:34:54 2016 (r302190) @@ -25,11 +25,11 @@ # ident SENTRY5 +cpu CPU_MIPS4KC +makeoptions TRAMPLOADADDR=0x807963c0 -# XXX only siba should be hardwired for now; we will use -# bus enumeration there hints "SENTRY5.hints" -include "../sentry5/std.sentry5" +include "../broadcom/std.broadcom" # sentry5 normally ships with cfe firmware; use the console for now options CFE @@ -78,11 +78,10 @@ device usb # USB Bus (required) device uhci # UHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) -# need to teach the code to ignore the bridge.... +device cfi # parallel flash +device cfid - -# XXX notyet; need to be auto probed children of siba_cc. -#device uart +device uart device loop device ether Modified: head/sys/mips/conf/SENTRY5.hints ============================================================================== --- head/sys/mips/conf/SENTRY5.hints Sat Jun 25 04:33:00 2016 (r302189) +++ head/sys/mips/conf/SENTRY5.hints Sat Jun 25 04:34:54 2016 (r302190) @@ -1,5 +1,7 @@ # $FreeBSD$ hint.bhnd.0.at="nexus0" -hint.bhnd.0.maddr="0x18000000" -hint.bhnd.0.msize="0x1000" -# XXX irq? +hint.bhnd.0.maddr="0x18000000" +hint.bhnd.0.msize="0x00100000" + +# console on uart1 +hint.uart.1.flags="0x10" From owner-svn-src-all@freebsd.org Sat Jun 25 04:36:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01FD6B73D45; Sat, 25 Jun 2016 04:36:32 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFDF11C6D; Sat, 25 Jun 2016 04:36:31 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5P4aVnE050685; Sat, 25 Jun 2016 04:36:31 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5P4aUWT050676; Sat, 25 Jun 2016 04:36:30 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201606250436.u5P4aUWT050676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sat, 25 Jun 2016 04:36:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302191 - in head/sys/dev/bhnd: . bcma siba X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 04:36:32 -0000 Author: landonf Date: Sat Jun 25 04:36:30 2016 New Revision: 302191 URL: https://svnweb.freebsd.org/changeset/base/302191 Log: bhnd(4): Add devinfo allocation and child addition methods, modeled on pci_if. This allows bhnd(4) to manage per-device state (such as per-core pmu/clock refcounting) on behalf of subclass driver instances. Approved by: re (gjb), adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6959 Modified: head/sys/dev/bhnd/bcma/bcma.c head/sys/dev/bhnd/bcma/bcma_subr.c head/sys/dev/bhnd/bcma/bcmavar.h head/sys/dev/bhnd/bhnd.c head/sys/dev/bhnd/bhnd_bus_if.m head/sys/dev/bhnd/bhndvar.h head/sys/dev/bhnd/siba/siba.c head/sys/dev/bhnd/siba/siba_subr.c head/sys/dev/bhnd/siba/sibavar.h Modified: head/sys/dev/bhnd/bcma/bcma.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma.c Sat Jun 25 04:34:54 2016 (r302190) +++ head/sys/dev/bhnd/bcma/bcma.c Sat Jun 25 04:36:30 2016 (r302191) @@ -181,14 +181,6 @@ bcma_write_ivar(device_t dev, device_t c } } -static void -bcma_child_deleted(device_t dev, device_t child) -{ - struct bcma_devinfo *dinfo = device_get_ivars(child); - if (dinfo != NULL) - bcma_free_dinfo(dev, dinfo); -} - static struct resource_list * bcma_get_resource_list(device_t dev, device_t child) { @@ -415,6 +407,19 @@ bcma_get_region_addr(device_t dev, devic return (ENOENT); } +static struct bhnd_devinfo * +bcma_alloc_bhnd_dinfo(device_t dev) +{ + struct bcma_devinfo *dinfo = bcma_alloc_dinfo(dev); + return ((struct bhnd_devinfo *)dinfo); +} + +static void +bcma_free_bhnd_dinfo(device_t dev, struct bhnd_devinfo *dinfo) +{ + bcma_free_dinfo(dev, (struct bcma_devinfo *)dinfo); +} + /** * Scan a device enumeration ROM table, adding all valid discovered cores to * the bus. @@ -431,8 +436,7 @@ bcma_add_children(device_t bus, struct r struct bcma_devinfo *dinfo; device_t child; int error; - - dinfo = NULL; + corecfg = NULL; /* Initialize our reader */ @@ -450,26 +454,20 @@ bcma_add_children(device_t bus, struct r goto failed; } - /* Allocate per-device bus info */ - dinfo = bcma_alloc_dinfo(bus, corecfg); - if (dinfo == NULL) { - error = ENXIO; - goto failed; - } - - /* The dinfo instance now owns the corecfg value */ - corecfg = NULL; - /* Add the child device */ - child = device_add_child(bus, NULL, -1); + child = BUS_ADD_CHILD(bus, 0, NULL, -1); if (child == NULL) { error = ENXIO; goto failed; } - /* The child device now owns the dinfo pointer */ - device_set_ivars(child, dinfo); - dinfo = NULL; + /* Initialize device ivars */ + dinfo = device_get_ivars(child); + if ((error = bcma_init_dinfo(bus, dinfo, corecfg))) + goto failed; + + /* The dinfo instance now owns the corecfg value */ + corecfg = NULL; /* If pins are floating or the hardware is otherwise * unpopulated, the device shouldn't be used. */ @@ -482,9 +480,6 @@ bcma_add_children(device_t bus, struct r return (0); failed: - if (dinfo != NULL) - bcma_free_dinfo(bus, dinfo); - if (corecfg != NULL) bcma_free_corecfg(corecfg); @@ -499,13 +494,14 @@ static device_method_t bcma_methods[] = DEVMETHOD(device_detach, bcma_detach), /* Bus interface */ - DEVMETHOD(bus_child_deleted, bcma_child_deleted), DEVMETHOD(bus_read_ivar, bcma_read_ivar), DEVMETHOD(bus_write_ivar, bcma_write_ivar), DEVMETHOD(bus_get_resource_list, bcma_get_resource_list), /* BHND interface */ DEVMETHOD(bhnd_bus_find_hostb_device, bcma_find_hostb_device), + DEVMETHOD(bhnd_bus_alloc_devinfo, bcma_alloc_bhnd_dinfo), + DEVMETHOD(bhnd_bus_free_devinfo, bcma_free_bhnd_dinfo), DEVMETHOD(bhnd_bus_reset_core, bcma_reset_core), DEVMETHOD(bhnd_bus_suspend_core, bcma_suspend_core), DEVMETHOD(bhnd_bus_get_port_count, bcma_get_port_count), Modified: head/sys/dev/bhnd/bcma/bcma_subr.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_subr.c Sat Jun 25 04:34:54 2016 (r302190) +++ head/sys/dev/bhnd/bcma/bcma_subr.c Sat Jun 25 04:36:30 2016 (r302191) @@ -186,28 +186,54 @@ bcma_dinfo_init_resource_info(device_t b } } + /** - * Allocate and initialize new device info structure, assuming ownership - * of the provided core configuration. + * Allocate and return a new empty device info structure. * * @param bus The requesting bus device. - * @param corecfg Device core configuration. + * + * @retval NULL if allocation failed. */ struct bcma_devinfo * -bcma_alloc_dinfo(device_t bus, struct bcma_corecfg *corecfg) +bcma_alloc_dinfo(device_t bus) { struct bcma_devinfo *dinfo; - dinfo = malloc(sizeof(struct bcma_devinfo), M_BHND, M_NOWAIT); + dinfo = malloc(sizeof(struct bcma_devinfo), M_BHND, M_NOWAIT|M_ZERO); if (dinfo == NULL) - return NULL; + return (NULL); - dinfo->corecfg = corecfg; + dinfo->corecfg = NULL; dinfo->res_agent = NULL; dinfo->rid_agent = -1; resource_list_init(&dinfo->resources); + return (dinfo); +} + +/** + * Initialize a device info structure previously allocated via + * bcma_alloc_dinfo, assuming ownership of the provided core + * configuration. + * + * @param bus The requesting bus device. + * @param dinfo The device info instance. + * @param corecfg Device core configuration; ownership of this value + * will be assumed by @p dinfo. + * + * @retval 0 success + * @retval non-zero initialization failed. + */ +int +bcma_init_dinfo(device_t bus, struct bcma_devinfo *dinfo, + struct bcma_corecfg *corecfg) +{ + KASSERT(dinfo->corecfg == NULL, ("dinfo previously initialized")); + + /* Save core configuration value */ + dinfo->corecfg = corecfg; + /* The device ports must always be initialized first to ensure that * rid 0 maps to the first device port */ bcma_dinfo_init_resource_info(bus, dinfo, &corecfg->dev_ports); @@ -215,7 +241,7 @@ bcma_alloc_dinfo(device_t bus, struct bc bcma_dinfo_init_resource_info(bus, dinfo, &corecfg->bridge_ports); bcma_dinfo_init_resource_info(bus, dinfo, &corecfg->wrapper_ports); - return dinfo; + return (0); } /** @@ -227,9 +253,11 @@ bcma_alloc_dinfo(device_t bus, struct bc void bcma_free_dinfo(device_t bus, struct bcma_devinfo *dinfo) { - bcma_free_corecfg(dinfo->corecfg); resource_list_free(&dinfo->resources); + if (dinfo->corecfg != NULL) + bcma_free_corecfg(dinfo->corecfg); + /* Release agent resource, if any */ if (dinfo->res_agent != NULL) { bhnd_release_resource(bus, SYS_RES_MEMORY, dinfo->rid_agent, Modified: head/sys/dev/bhnd/bcma/bcmavar.h ============================================================================== --- head/sys/dev/bhnd/bcma/bcmavar.h Sat Jun 25 04:34:54 2016 (r302190) +++ head/sys/dev/bhnd/bcma/bcmavar.h Sat Jun 25 04:36:30 2016 (r302191) @@ -69,7 +69,9 @@ int bcma_add_children(device_t bus, struct bcma_sport_list *bcma_corecfg_get_port_list(struct bcma_corecfg *cfg, bhnd_port_type type); -struct bcma_devinfo *bcma_alloc_dinfo(device_t bus, +struct bcma_devinfo *bcma_alloc_dinfo(device_t bus); +int bcma_init_dinfo(device_t bus, + struct bcma_devinfo *dinfo, struct bcma_corecfg *corecfg); void bcma_free_dinfo(device_t bus, struct bcma_devinfo *dinfo); @@ -132,7 +134,9 @@ struct bcma_corecfg { * BCMA per-device info */ struct bcma_devinfo { - struct resource_list resources; /**< Slave port memory regions. */ + struct bhnd_devinfo bhnd_dinfo; /**< superclass device info. */ + + struct resource_list resources; /**< Slave port memory regions. */ struct bcma_corecfg *corecfg; /**< IP core/block config */ struct bhnd_resource *res_agent; /**< Agent (wrapper) resource, or NULL. Not @@ -147,4 +151,4 @@ struct bcma_softc { device_t hostb_dev; /**< host bridge core, or NULL */ }; -#endif /* _BCMA_BCMAVAR_H_ */ \ No newline at end of file +#endif /* _BCMA_BCMAVAR_H_ */ Modified: head/sys/dev/bhnd/bhnd.c ============================================================================== --- head/sys/dev/bhnd/bhnd.c Sat Jun 25 04:34:54 2016 (r302190) +++ head/sys/dev/bhnd/bhnd.c Sat Jun 25 04:36:30 2016 (r302191) @@ -493,6 +493,54 @@ bhnd_child_location_str(device_t dev, de } /** + * Default bhnd(4) bus driver implementation of BUS_ADD_CHILD(). + * + * This implementation manages internal bhnd(4) state, and must be called + * by subclassing drivers. + */ +device_t +bhnd_generic_add_child(device_t dev, u_int order, const char *name, int unit) +{ + struct bhnd_devinfo *dinfo; + device_t child; + + child = device_add_child_ordered(dev, order, name, unit); + if (child == NULL) + return (NULL); + + if ((dinfo = BHND_BUS_ALLOC_DEVINFO(dev)) == NULL) { + device_delete_child(dev, child); + return (NULL); + } + + device_set_ivars(child, dinfo); + + /* Inform concrete bus driver. */ + BHND_BUS_CHILD_ADDED(dev, child); + + return (child); +} + +/** + * Default bhnd(4) bus driver implementation of BUS_CHILD_DELETED(). + * + * This implementation manages internal bhnd(4) state, and must be called + * by subclassing drivers. + */ +void +bhnd_generic_child_deleted(device_t dev, device_t child) +{ + struct bhnd_softc *sc; + struct bhnd_devinfo *dinfo; + + sc = device_get_softc(dev); + + /* Free device info */ + if ((dinfo = device_get_ivars(child)) != NULL) + BHND_BUS_FREE_DEVINFO(dev, dinfo); +} + +/** * Helper function for implementing BUS_SUSPEND_CHILD(). * * TODO: Power management @@ -611,6 +659,8 @@ static device_method_t bhnd_methods[] = DEVMETHOD(device_resume, bhnd_generic_resume), /* Bus interface */ + DEVMETHOD(bus_add_child, bhnd_generic_add_child), + DEVMETHOD(bus_child_deleted, bhnd_generic_child_deleted), DEVMETHOD(bus_probe_nomatch, bhnd_generic_probe_nomatch), DEVMETHOD(bus_print_child, bhnd_generic_print_child), DEVMETHOD(bus_child_pnpinfo_str, bhnd_child_pnpinfo_str), Modified: head/sys/dev/bhnd/bhnd_bus_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_bus_if.m Sat Jun 25 04:34:54 2016 (r302190) +++ head/sys/dev/bhnd/bhnd_bus_if.m Sat Jun 25 04:36:30 2016 (r302191) @@ -41,6 +41,7 @@ HEADER { struct bhnd_board_info; struct bhnd_core_info; struct bhnd_chipid; + struct bhnd_devinfo; struct bhnd_resource; } @@ -67,6 +68,11 @@ CODE { { panic("bhnd_bus_read_boardinfo unimplemented"); } + + static void + bhnd_bus_null_child_added(device_t dev, device_t child) + { + } static device_t bhnd_bus_null_find_hostb_device(device_t dev) @@ -228,6 +234,46 @@ METHOD int read_board_info { } DEFAULT bhnd_bus_null_read_board_info; /** + * Allocate and zero-initialize a buffer suitably sized and aligned for a + * bhnd_devinfo structure. + * + * @param dev The bhnd bus device. + * + * @retval non-NULL success + * @retval NULL allocation failed + */ +METHOD struct bhnd_devinfo * alloc_devinfo { + device_t dev; +}; + +/** + * Release memory previously allocated for @p devinfo. + * + * @param dev The bhnd bus device. + * @param dinfo A devinfo buffer previously allocated via + * BHND_BUS_ALLOC_DEVINFO(). + */ +METHOD void free_devinfo { + device_t dev; + struct bhnd_devinfo *dinfo; +}; + +/** + * Notify a bhnd bus that a child was added. + * + * Called at the end of BUS_ADD_CHILD() to allow the concrete bhnd(4) + * driver instance to initialize any additional driver-specific state for the + * child. + * + * @param dev The bhnd bus whose child is being added. + * @param child The child added to @p dev. + */ +METHOD void child_added { + device_t dev; + device_t child; +} DEFAULT bhnd_bus_null_child_added; + +/** * Reset the device's hardware core. * * @param dev The parent of @p child. Modified: head/sys/dev/bhnd/bhndvar.h ============================================================================== --- head/sys/dev/bhnd/bhndvar.h Sat Jun 25 04:34:54 2016 (r302190) +++ head/sys/dev/bhnd/bhndvar.h Sat Jun 25 04:36:30 2016 (r302191) @@ -46,6 +46,13 @@ MALLOC_DECLARE(M_BHND); DECLARE_CLASS(bhnd_driver); /** + * bhnd per-device info. Must be first member of all subclass + * devinfo structures. + */ +struct bhnd_devinfo { +}; + +/** * bhnd driver instance state. Must be first member of all subclass * softc structures. */ @@ -66,6 +73,10 @@ int bhnd_generic_print_child(device_t void bhnd_generic_probe_nomatch(device_t dev, device_t child); +device_t bhnd_generic_add_child(device_t dev, u_int order, + const char *name, int unit); +void bhnd_generic_child_deleted(device_t dev, + device_t child); int bhnd_generic_suspend_child(device_t dev, device_t child); int bhnd_generic_resume_child(device_t dev, Modified: head/sys/dev/bhnd/siba/siba.c ============================================================================== --- head/sys/dev/bhnd/siba/siba.c Sat Jun 25 04:34:54 2016 (r302190) +++ head/sys/dev/bhnd/siba/siba.c Sat Jun 25 04:36:30 2016 (r302191) @@ -206,14 +206,6 @@ siba_write_ivar(device_t dev, device_t c } } -static void -siba_child_deleted(device_t dev, device_t child) -{ - struct siba_devinfo *dinfo = device_get_ivars(child); - if (dinfo != NULL) - siba_free_dinfo(dev, dinfo); -} - static struct resource_list * siba_get_resource_list(device_t dev, device_t child) { @@ -436,6 +428,19 @@ siba_register_addrspaces(device_t dev, s return (0); } +static struct bhnd_devinfo * +siba_alloc_bhnd_dinfo(device_t dev) +{ + struct siba_devinfo *dinfo = siba_alloc_dinfo(dev); + return ((struct bhnd_devinfo *)dinfo); +} + +static void +siba_free_bhnd_dinfo(device_t dev, struct bhnd_devinfo *dinfo) +{ + siba_free_dinfo(dev, (struct siba_devinfo *)dinfo); +} + /** * Scan the core table and add all valid discovered cores to * the bus. @@ -556,6 +561,13 @@ siba_add_children(device_t dev, const st goto cleanup; } + /* Add the child device */ + child = BUS_ADD_CHILD(dev, 0, NULL, -1); + if (child == NULL) { + error = ENXIO; + goto cleanup; + } + /* Read the core info */ idhigh = bus_read_4(r, SB0_REG_ABS(SIBA_CFG0_IDHIGH)); idlow = bus_read_4(r, SB0_REG_ABS(SIBA_CFG0_IDLOW)); @@ -570,27 +582,18 @@ siba_add_children(device_t dev, const st cores[i].unit++; } - /* Allocate per-device bus info */ - dinfo = siba_alloc_dinfo(dev, &cid); - if (dinfo == NULL) { + /* Initialize per-device bus info */ + if ((dinfo = device_get_ivars(child)) == NULL) { error = ENXIO; goto cleanup; } - /* Register the core's address space(s). */ - if ((error = siba_register_addrspaces(dev, dinfo, r))) + if ((error = siba_init_dinfo(dev, dinfo, &cid))) goto cleanup; - /* Add the child device */ - child = device_add_child(dev, NULL, -1); - if (child == NULL) { - error = ENXIO; + /* Register the core's address space(s). */ + if ((error = siba_register_addrspaces(dev, dinfo, r))) goto cleanup; - } - - /* The child device now owns the dinfo pointer */ - device_set_ivars(child, dinfo); - dinfo = NULL; /* If pins are floating or the hardware is otherwise * unpopulated, the device shouldn't be used. */ @@ -606,9 +609,6 @@ cleanup: if (cores != NULL) free(cores, M_BHND); - if (dinfo != NULL) - siba_free_dinfo(dev, dinfo); - if (r != NULL) bus_release_resource(dev, SYS_RES_MEMORY, rid, r); @@ -624,13 +624,14 @@ static device_method_t siba_methods[] = DEVMETHOD(device_suspend, siba_suspend), /* Bus interface */ - DEVMETHOD(bus_child_deleted, siba_child_deleted), DEVMETHOD(bus_read_ivar, siba_read_ivar), DEVMETHOD(bus_write_ivar, siba_write_ivar), DEVMETHOD(bus_get_resource_list, siba_get_resource_list), /* BHND interface */ DEVMETHOD(bhnd_bus_find_hostb_device, siba_find_hostb_device), + DEVMETHOD(bhnd_bus_alloc_devinfo, siba_alloc_bhnd_dinfo), + DEVMETHOD(bhnd_bus_free_devinfo, siba_free_bhnd_dinfo), DEVMETHOD(bhnd_bus_reset_core, siba_reset_core), DEVMETHOD(bhnd_bus_suspend_core, siba_suspend_core), DEVMETHOD(bhnd_bus_get_port_count, siba_get_port_count), Modified: head/sys/dev/bhnd/siba/siba_subr.c ============================================================================== --- head/sys/dev/bhnd/siba/siba_subr.c Sat Jun 25 04:34:54 2016 (r302190) +++ head/sys/dev/bhnd/siba/siba_subr.c Sat Jun 25 04:36:30 2016 (r302191) @@ -106,23 +106,21 @@ siba_parse_core_id(uint32_t idhigh, uint } /** - * Allocate and initialize new device info structure, copying the - * provided core id. + * Allocate and return a new empty device info structure. * - * @param dev The requesting bus device. - * @param core Device core info. + * @param bus The requesting bus device. + * + * @retval NULL if allocation failed. */ struct siba_devinfo * -siba_alloc_dinfo(device_t bus, const struct siba_core_id *core_id) +siba_alloc_dinfo(device_t bus) { struct siba_devinfo *dinfo; - dinfo = malloc(sizeof(struct siba_devinfo), M_BHND, M_NOWAIT); + dinfo = malloc(sizeof(struct siba_devinfo), M_BHND, M_NOWAIT|M_ZERO); if (dinfo == NULL) return NULL; - dinfo->core_id = *core_id; - for (u_int i = 0; i < nitems(dinfo->cfg); i++) { dinfo->cfg[i] = NULL; dinfo->cfg_rid[i] = -1; @@ -134,6 +132,25 @@ siba_alloc_dinfo(device_t bus, const str } /** + * Initialize a device info structure previously allocated via + * siba_alloc_dinfo, copying the provided core id. + * + * @param dev The requesting bus device. + * @param dinfo The device info instance. + * @param core Device core info. + * + * @retval 0 success + * @retval non-zero initialization failed. + */ +int +siba_init_dinfo(device_t dev, struct siba_devinfo *dinfo, + const struct siba_core_id *core_id) +{ + dinfo->core_id = *core_id; + return (0); +} + +/** * Map an addrspace index to its corresponding bhnd(4) port number. * * @param addrspace Address space index. Modified: head/sys/dev/bhnd/siba/sibavar.h ============================================================================== --- head/sys/dev/bhnd/siba/sibavar.h Sat Jun 25 04:34:54 2016 (r302190) +++ head/sys/dev/bhnd/siba/sibavar.h Sat Jun 25 04:36:30 2016 (r302191) @@ -63,7 +63,9 @@ struct siba_core_id siba_parse_core_id( int siba_add_children(device_t bus, const struct bhnd_chipid *chipid); -struct siba_devinfo *siba_alloc_dinfo(device_t dev, +struct siba_devinfo *siba_alloc_dinfo(device_t dev); +int siba_init_dinfo(device_t dev, + struct siba_devinfo *dinfo, const struct siba_core_id *core_id); void siba_free_dinfo(device_t dev, struct siba_devinfo *dinfo); @@ -136,6 +138,8 @@ struct siba_core_id { * siba(4) per-device info */ struct siba_devinfo { + struct bhnd_devinfo bhnd_dinfo; /**< superclass device info. */ + struct resource_list resources; /**< per-core memory regions. */ struct siba_core_id core_id; /**< core identification info */ struct siba_addrspace addrspace[SIBA_MAX_ADDRSPACE]; /**< memory map descriptors */ From owner-svn-src-all@freebsd.org Sat Jun 25 09:32:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3028B803B8; Sat, 25 Jun 2016 09:32:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFAC21703; Sat, 25 Jun 2016 09:32:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5P9WZvL060717; Sat, 25 Jun 2016 09:32:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5P9WZ4C060716; Sat, 25 Jun 2016 09:32:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606250932.u5P9WZ4C060716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 25 Jun 2016 09:32:35 +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: r302192 - stable/10/sys/nlm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 09:32:37 -0000 Author: kib Date: Sat Jun 25 09:32:35 2016 New Revision: 302192 URL: https://svnweb.freebsd.org/changeset/base/302192 Log: MFC r302013: After the vnode unlock, mount point might be destroyed immediately, dropping the reference on mnt_cred. Prevent this by referencing the temporal credentials before unlock. Modified: stable/10/sys/nlm/nlm_advlock.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/nlm/nlm_advlock.c ============================================================================== --- stable/10/sys/nlm/nlm_advlock.c Sat Jun 25 04:36:30 2016 (r302191) +++ stable/10/sys/nlm/nlm_advlock.c Sat Jun 25 09:32:35 2016 (r302192) @@ -210,7 +210,7 @@ nlm_advlock_internal(struct vnode *vp, v struct rpc_callextra ext; struct nlm_feedback_arg nf; AUTH *auth; - struct ucred *cred; + struct ucred *cred, *cred1; struct nlm_file_svid *ns; int svid; int error; @@ -240,15 +240,17 @@ nlm_advlock_internal(struct vnode *vp, v else retries = INT_MAX; - if (unlock_vp) - VOP_UNLOCK(vp, 0); - /* * We need to switch to mount-point creds so that we can send - * packets from a privileged port. + * packets from a privileged port. Reference mnt_cred and + * switch to them before unlocking the vnode, since mount + * point could be unmounted right after unlock. */ cred = td->td_ucred; td->td_ucred = vp->v_mount->mnt_cred; + crhold(td->td_ucred); + if (unlock_vp) + VOP_UNLOCK(vp, 0); host = nlm_find_host_by_name(servername, sa, vers); auth = authunix_create(cred); @@ -373,7 +375,9 @@ nlm_advlock_internal(struct vnode *vp, v if (ns) nlm_free_svid(ns); + cred1 = td->td_ucred; td->td_ucred = cred; + crfree(cred1); AUTH_DESTROY(auth); nlm_host_release(host); From owner-svn-src-all@freebsd.org Sat Jun 25 10:08:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B339CB80BEE; Sat, 25 Jun 2016 10:08:05 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68F9D261E; Sat, 25 Jun 2016 10:08:05 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PA84xd071938; Sat, 25 Jun 2016 10:08:04 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5PA84lN071937; Sat, 25 Jun 2016 10:08:04 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201606251008.u5PA84lN071937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sat, 25 Jun 2016 10:08: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: r302193 - stable/10/lib/libc/stdlib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 10:08:05 -0000 Author: ed Date: Sat Jun 25 10:08:04 2016 New Revision: 302193 URL: https://svnweb.freebsd.org/changeset/base/302193 Log: MFC r300775: Let l64a() properly null terminate its result. Though the buffer used by l64a() is initialized with null bytes, repetetive calls may end up having trailing garbage of previous invocations because we don't end up terminating the string. Instead of importing NetBSD's fix, use this opportunity to simplify this function dramatically, for example by just storing the Base64 character set in a string. There is also no need to do the bitmasking, as we can just use the proper integer type from . Modified: stable/10/lib/libc/stdlib/l64a.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdlib/l64a.c ============================================================================== --- stable/10/lib/libc/stdlib/l64a.c Sat Jun 25 09:32:35 2016 (r302192) +++ stable/10/lib/libc/stdlib/l64a.c Sat Jun 25 10:08:04 2016 (r302193) @@ -12,18 +12,13 @@ __RCSID("$NetBSD: l64a.c,v 1.13 2003/07/ #include __FBSDID("$FreeBSD$"); +#include #include -#define ADOT 46 /* ASCII '.' */ -#define ASLASH ADOT + 1 /* ASCII '/' */ -#define A0 48 /* ASCII '0' */ -#define AA 65 /* ASCII 'A' */ -#define Aa 97 /* ASCII 'a' */ - char * l64a(long value) { - static char buf[8]; + static char buf[7]; (void)l64a_r(value, buf, sizeof(buf)); return (buf); @@ -32,21 +27,18 @@ l64a(long value) int l64a_r(long value, char *buffer, int buflen) { - long v; - int digit; - - v = value & (long)0xffffffff; - for (; v != 0 && buflen > 1; buffer++, buflen--) { - digit = v & 0x3f; - if (digit < 2) - *buffer = digit + ADOT; - else if (digit < 12) - *buffer = digit + A0 - 2; - else if (digit < 38) - *buffer = digit + AA - 12; - else - *buffer = digit + Aa - 38; + static const char chars[] = + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + uint32_t v; + + v = value; + while (buflen-- > 0) { + if (v == 0) { + *buffer = '\0'; + return (0); + } + *buffer++ = chars[v & 0x3f]; v >>= 6; } - return (v == 0 ? 0 : -1); + return (-1); } From owner-svn-src-all@freebsd.org Sat Jun 25 11:30:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F132BB80126; Sat, 25 Jun 2016 11:30:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B12CC1ECE; Sat, 25 Jun 2016 11:30:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PBUeVd001989; Sat, 25 Jun 2016 11:30:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5PBUeGC001988; Sat, 25 Jun 2016 11:30:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606251130.u5PBUeGC001988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 25 Jun 2016 11:30:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302194 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 11:30:42 -0000 Author: kib Date: Sat Jun 25 11:30:40 2016 New Revision: 302194 URL: https://svnweb.freebsd.org/changeset/base/302194 Log: For pthread_mutex_trylock() call on owned error-check or non-portable adaptive mutex, return EDEADLK as required by POSIX. The pthread_mutex_lock() is already compliant. Tested by: Guy Yur Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Approved by: re (gjb) Modified: head/lib/libthr/thread/thr_mutex.c Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 10:08:04 2016 (r302193) +++ head/lib/libthr/thread/thr_mutex.c Sat Jun 25 11:30:40 2016 (r302194) @@ -850,9 +850,12 @@ mutex_self_trylock(struct pthread_mutex switch (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: - case PTHREAD_MUTEX_NORMAL: case PTHREAD_MUTEX_ADAPTIVE_NP: - ret = EBUSY; + ret = EDEADLK; + break; + + case PTHREAD_MUTEX_NORMAL: + ret = EBUSY; break; case PTHREAD_MUTEX_RECURSIVE: From owner-svn-src-all@freebsd.org Sat Jun 25 11:31:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFBD6B80180; Sat, 25 Jun 2016 11:31:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80E9F20FC; Sat, 25 Jun 2016 11:31:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PBVPkI002644; Sat, 25 Jun 2016 11:31:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5PBVPH2002642; Sat, 25 Jun 2016 11:31:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606251131.u5PBVPH2002642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 25 Jun 2016 11:31:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302195 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 11:31:26 -0000 Author: kib Date: Sat Jun 25 11:31:25 2016 New Revision: 302195 URL: https://svnweb.freebsd.org/changeset/base/302195 Log: Do not clear robust lists pointers on fork. The forked child thread lists must be functional. Reported by: Daniel Engberg , Guy Yur Tested by: Guy Yur Sponsored by: The FreeBSD Foundation Approved by: re (gjb), including the KBI change Modified: head/sys/kern/kern_thr.c head/sys/sys/proc.h Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Sat Jun 25 11:30:40 2016 (r302194) +++ head/sys/kern/kern_thr.c Sat Jun 25 11:31:25 2016 (r302195) @@ -234,6 +234,7 @@ thread_create(struct thread *td, struct bcopy(&td->td_startcopy, &newtd->td_startcopy, __rangeof(struct thread, td_startcopy, td_endcopy)); newtd->td_proc = td->td_proc; + newtd->td_rb_list = newtd->td_rbp_list = newtd->td_rb_inact = 0; thread_cow_get(newtd, td); error = initialize_thread(newtd, thunk); Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sat Jun 25 11:30:40 2016 (r302194) +++ head/sys/sys/proc.h Sat Jun 25 11:31:25 2016 (r302195) @@ -282,9 +282,6 @@ struct thread { int td_no_sleeping; /* (k) Sleeping disabled count. */ int td_dom_rr_idx; /* (k) RR Numa domain selection. */ void *td_su; /* (k) FFS SU private */ - uintptr_t td_rb_list; /* (k) Robust list head. */ - uintptr_t td_rbp_list; /* (k) Robust priv list head. */ - uintptr_t td_rb_inact; /* (k) Current in-action mutex loc. */ #define td_endzero td_sigmask /* Copied during fork1() or create_thread(). */ @@ -298,6 +295,9 @@ struct thread { u_char td_base_user_pri; /* (t) Base user pri */ u_int td_dbg_sc_code; /* (c) Syscall code to debugger. */ u_int td_dbg_sc_narg; /* (c) Syscall arg count to debugger.*/ + uintptr_t td_rb_list; /* (k) Robust list head. */ + uintptr_t td_rbp_list; /* (k) Robust priv list head. */ + uintptr_t td_rb_inact; /* (k) Current in-action mutex loc. */ #define td_endcopy td_pcb /* From owner-svn-src-all@freebsd.org Sat Jun 25 11:34:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2281B8033A; Sat, 25 Jun 2016 11:34:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 851B625BB; Sat, 25 Jun 2016 11:34:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PBY6Tq005552; Sat, 25 Jun 2016 11:34:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5PBY6E2005551; Sat, 25 Jun 2016 11:34:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606251134.u5PBY6E2005551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 25 Jun 2016 11:34:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302196 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 11:34:07 -0000 Author: kib Date: Sat Jun 25 11:34:06 2016 New Revision: 302196 URL: https://svnweb.freebsd.org/changeset/base/302196 Log: Since VOP_INACTIVE() is not guaranteed to be called, all cleanups executed by inactive methods, must be repeated on reclaim. In particular, unlink and free sillyrenamed vnode both on inactivation and reclaim. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Approved by: re (gjb) Modified: head/sys/fs/nfsclient/nfs_clnode.c Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Sat Jun 25 11:31:25 2016 (r302195) +++ head/sys/fs/nfsclient/nfs_clnode.c Sat Jun 25 11:34:06 2016 (r302196) @@ -198,15 +198,41 @@ nfs_freesillyrename(void *arg, __unused free(sp, M_NEWNFSREQ); } -int -ncl_inactive(struct vop_inactive_args *ap) +static void +ncl_releasesillyrename(struct vnode *vp, struct thread *td) { struct nfsnode *np; struct sillyrename *sp; - struct vnode *vp = ap->a_vp; - boolean_t retv; + ASSERT_VOP_ELOCKED(vp, "releasesillyrename"); np = VTONFS(vp); + mtx_lock(&np->n_mtx); + if (vp->v_type != VDIR) { + sp = np->n_sillyrename; + np->n_sillyrename = NULL; + } else + sp = NULL; + if (sp != NULL) { + mtx_unlock(&np->n_mtx); + (void) ncl_vinvalbuf(vp, 0, td, 1); + /* + * Remove the silly file that was rename'd earlier + */ + ncl_removeit(sp, vp); + crfree(sp->s_cred); + TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp); + taskqueue_enqueue(taskqueue_thread, &sp->s_task); + mtx_lock(&np->n_mtx); + } + np->n_flag &= NMODIFIED; + mtx_unlock(&np->n_mtx); +} + +int +ncl_inactive(struct vop_inactive_args *ap) +{ + struct vnode *vp = ap->a_vp; + boolean_t retv; if (NFS_ISV4(vp) && vp->v_type == VREG) { /* @@ -228,26 +254,7 @@ ncl_inactive(struct vop_inactive_args *a } } - mtx_lock(&np->n_mtx); - if (vp->v_type != VDIR) { - sp = np->n_sillyrename; - np->n_sillyrename = NULL; - } else - sp = NULL; - if (sp) { - mtx_unlock(&np->n_mtx); - (void) ncl_vinvalbuf(vp, 0, ap->a_td, 1); - /* - * Remove the silly file that was rename'd earlier - */ - ncl_removeit(sp, vp); - crfree(sp->s_cred); - TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp); - taskqueue_enqueue(taskqueue_thread, &sp->s_task); - mtx_lock(&np->n_mtx); - } - np->n_flag &= NMODIFIED; - mtx_unlock(&np->n_mtx); + ncl_releasesillyrename(vp, ap->a_td); return (0); } @@ -268,6 +275,8 @@ ncl_reclaim(struct vop_reclaim_args *ap) if (nfs_reclaim_p != NULL) nfs_reclaim_p(ap); + ncl_releasesillyrename(vp, ap->a_td); + /* * Destroy the vm object and flush associated pages. */ From owner-svn-src-all@freebsd.org Sat Jun 25 12:46:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A3E3B80C08; Sat, 25 Jun 2016 12:46:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0DE91C2E; Sat, 25 Jun 2016 12:46:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PCkJ64031783; Sat, 25 Jun 2016 12:46:19 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5PCkJkH031782; Sat, 25 Jun 2016 12:46:19 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201606251246.u5PCkJkH031782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 25 Jun 2016 12:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302197 - head/usr.bin/sockstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 12:46:20 -0000 Author: tuexen Date: Sat Jun 25 12:46:18 2016 New Revision: 302197 URL: https://svnweb.freebsd.org/changeset/base/302197 Log: This patch fixes two bugs: * sctp46, tcp46, and udp46 sockets are displayed as such and not as sctp4 6, tcp4 6, udp4 6. This bug was introduced in http://svnweb.freebsd.org/base?view=revision&revision=187915 * For SCTP sockets, the the -4 and -6 flags are honoured as much as possible. This means IPv4 sockets are handled correctly, IPv6 sockets are displayed as sctp46, since it is currently not possible to distinguish between sctp6 and sctp46. Approved by: re (gjb) MFC after: 1 week Modified: head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Sat Jun 25 11:34:06 2016 (r302196) +++ head/usr.bin/sockstat/sockstat.c Sat Jun 25 12:46:18 2016 (r302197) @@ -338,7 +338,12 @@ gather_sctp(void) sock->state = SCTP_LISTEN; if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) { sock->family = AF_INET6; - sock->vflag = INP_IPV6; + /* + * Currently there is no way to distinguish between + * IPv6 only sockets or dual family sockets. + * So mark it as dual socket. + */ + sock->vflag = INP_IPV6 | INP_IPV4; } else { sock->family = AF_INET; sock->vflag = INP_IPV4; @@ -406,6 +411,7 @@ gather_sctp(void) offset += sizeof(struct xsctp_tcb); if (no_stcb) { if (opt_l && + (sock->vflag & vflag) && (!opt_L || !local_all_loopback) && ((xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE) || (xstcb->last == 1))) { @@ -428,7 +434,12 @@ gather_sctp(void) sock->state = (int)xstcb->state; if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) { sock->family = AF_INET6; - sock->vflag = INP_IPV6; + /* + * Currently there is no way to distinguish + * between IPv6 only sockets or dual family + * sockets. So mark it as dual socket. + */ + sock->vflag = INP_IPV6 | INP_IPV4; } else { sock->family = AF_INET; sock->vflag = INP_IPV4; @@ -519,7 +530,9 @@ gather_sctp(void) prev_faddr = faddr; } if (opt_c) { - if (!opt_L || !(local_all_loopback || foreign_all_loopback)) { + if ((sock->vflag & vflag) && + (!opt_L || + !(local_all_loopback || foreign_all_loopback))) { hash = (int)((uintptr_t)sock->socket % HASHSIZE); sock->next = sockhash[hash]; sockhash[hash] = sock; @@ -963,9 +976,11 @@ displaysock(struct sock *s, int pos) pos += xprintf(" "); pos += xprintf("%s", s->protoname); if (s->vflag & INP_IPV4) - pos += xprintf("4 "); + pos += xprintf("4"); if (s->vflag & INP_IPV6) - pos += xprintf("6 "); + pos += xprintf("6"); + if (s->vflag & (INP_IPV4 | INP_IPV6)) + pos += xprintf(" "); laddr = s->laddr; faddr = s->faddr; first = 1; From owner-svn-src-all@freebsd.org Sat Jun 25 12:54:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18875B80EB4; Sat, 25 Jun 2016 12:54:29 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D993712CE; Sat, 25 Jun 2016 12:54:28 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PCsSpZ035633; Sat, 25 Jun 2016 12:54:28 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5PCsSMD035632; Sat, 25 Jun 2016 12:54:28 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201606251254.u5PCsSMD035632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 25 Jun 2016 12:54:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302198 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 12:54:29 -0000 Author: bapt Date: Sat Jun 25 12:54:27 2016 New Revision: 302198 URL: https://svnweb.freebsd.org/changeset/base/302198 Log: Remove reference to mroute6d in /etc/netstart. mroute6d has been removed in r298512. PR: 209405 Submitted by: Trond.Endrestol@ximalas.info Approved by: re (gjb) Modified: head/etc/netstart Modified: head/etc/netstart ============================================================================== --- head/etc/netstart Sat Jun 25 12:46:18 2016 (r302197) +++ head/etc/netstart Sat Jun 25 12:54:27 2016 (r302198) @@ -52,7 +52,6 @@ _start=quietstart /etc/rc.d/ppp ${_start} /etc/rc.d/ipfw ${_start} /etc/rc.d/routing ${_start} -/etc/rc.d/mroute6d ${_start} /etc/rc.d/route6d ${_start} /etc/rc.d/routed ${_start} /etc/rc.d/rtsold ${_start} From owner-svn-src-all@freebsd.org Sat Jun 25 13:44:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4964BB818EA; Sat, 25 Jun 2016 13:44:13 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DF6E1D11; Sat, 25 Jun 2016 13:44:12 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=/qXbVfR6fGpdRg5Jh4+WeMz7Mqh3wZFReTq+e5FJSHA=; b=pZTKNgcit1OONo0dhH0msLRxw0tdPJ5P0NarQD/KnxVsAUD+uLetSRyMZCNaxyo+RLnpSFBMHUJhIzD96CeqGHQAsV3r3ea0Ix1Tje8DYjhpZW92P1Jay/80hjwxQx1UkBBDO5IEtexGOkkw0rD6+yhF2LaD3RTJs0HhHWQXdMw=; Received: from [37.229.193.176] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1bGnsS-0002Tx-6W ; Sat, 25 Jun 2016 16:44:04 +0300 Date: Sat, 25 Jun 2016 16:44:03 +0300 From: Ivan Klymenko To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625164403.70684b3b@nonamehost.local> In-Reply-To: <201606251130.u5PBUeGC001988@repo.freebsd.org> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=37.229.193.176; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 13:44:13 -0000 On Sat, 25 Jun 2016 11:30:40 +0000 (UTC) Konstantin Belousov wrote: > Author: kib > Date: Sat Jun 25 11:30:40 2016 > New Revision: 302194 > URL: https://svnweb.freebsd.org/changeset/base/302194 > > Log: > For pthread_mutex_trylock() call on owned error-check or > non-portable adaptive mutex, return EDEADLK as required by POSIX. The > pthread_mutex_lock() is already compliant. > > Tested by: Guy Yur > Sponsored by: The FreeBSD Foundation > MFC after: 2 weeks > Approved by: re (gjb) > > Modified: > head/lib/libthr/thread/thr_mutex.c > > Modified: head/lib/libthr/thread/thr_mutex.c > ============================================================================== > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 10:08:04 > 2016 (r302193) +++ head/lib/libthr/thread/thr_mutex.c > Sat Jun 25 11:30:40 2016 (r302194) @@ -850,9 +850,12 @@ > mutex_self_trylock(struct pthread_mutex > switch (PMUTEX_TYPE(m->m_flags)) { > case PTHREAD_MUTEX_ERRORCHECK: > - case PTHREAD_MUTEX_NORMAL: > case PTHREAD_MUTEX_ADAPTIVE_NP: > - ret = EBUSY; > + ret = EDEADLK; > + break; > + > + case PTHREAD_MUTEX_NORMAL: > + ret = EBUSY; > break; > > case PTHREAD_MUTEX_RECURSIVE: Update for r302191 to r302196 console-kit-daemon: pid 1496 (console-kit-daemon), uid 0: exited on signal 6 pid 1581 (console-kit-daemon), uid 0: exited on signal 6 pid 5954 (console-kit-daemon), uid 0: exited on signal 6 pid 6010 (console-kit-daemon), uid 0: exited on signal 6 pid 6016 (console-kit-daemon), uid 0: exited on signal 6 Xorg session after authorization not started - black screen. From owner-svn-src-all@freebsd.org Sat Jun 25 13:55:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D53AB81B1F; Sat, 25 Jun 2016 13:55:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1CE21689; Sat, 25 Jun 2016 13:55:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u5PDt95P061654 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 25 Jun 2016 16:55:09 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u5PDt95P061654 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u5PDt97L061653; Sat, 25 Jun 2016 16:55:09 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Jun 2016 16:55:09 +0300 From: Konstantin Belousov To: Ivan Klymenko Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625135508.GV38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625164403.70684b3b@nonamehost.local> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 13:55:15 -0000 On Sat, Jun 25, 2016 at 04:44:03PM +0300, Ivan Klymenko wrote: > On Sat, 25 Jun 2016 11:30:40 +0000 (UTC) > Konstantin Belousov wrote: > > > Author: kib > > Date: Sat Jun 25 11:30:40 2016 > > New Revision: 302194 > > URL: https://svnweb.freebsd.org/changeset/base/302194 > > > > Log: > > For pthread_mutex_trylock() call on owned error-check or > > non-portable adaptive mutex, return EDEADLK as required by POSIX. The > > pthread_mutex_lock() is already compliant. > > > > Tested by: Guy Yur > > Sponsored by: The FreeBSD Foundation > > MFC after: 2 weeks > > Approved by: re (gjb) > > > > Modified: > > head/lib/libthr/thread/thr_mutex.c > > > > Modified: head/lib/libthr/thread/thr_mutex.c > > ============================================================================== > > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 10:08:04 > > 2016 (r302193) +++ head/lib/libthr/thread/thr_mutex.c > > Sat Jun 25 11:30:40 2016 (r302194) @@ -850,9 +850,12 @@ > > mutex_self_trylock(struct pthread_mutex > > switch (PMUTEX_TYPE(m->m_flags)) { > > case PTHREAD_MUTEX_ERRORCHECK: > > - case PTHREAD_MUTEX_NORMAL: > > case PTHREAD_MUTEX_ADAPTIVE_NP: > > - ret = EBUSY; > > + ret = EDEADLK; > > + break; > > + > > + case PTHREAD_MUTEX_NORMAL: > > + ret = EBUSY; > > break; > > > > case PTHREAD_MUTEX_RECURSIVE: > > Update for r302191 to r302196 console-kit-daemon: > pid 1496 (console-kit-daemon), uid 0: exited on signal 6 > pid 1581 (console-kit-daemon), uid 0: exited on signal 6 > pid 5954 (console-kit-daemon), uid 0: exited on signal 6 > pid 6010 (console-kit-daemon), uid 0: exited on signal 6 > pid 6016 (console-kit-daemon), uid 0: exited on signal 6 > > Xorg session after authorization not started - black screen. Why did you replied to r302194 with this information ? Does reverting r302194 (and only this revision) restores console-kit functionality ? From owner-svn-src-all@freebsd.org Sat Jun 25 14:04:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD2BBB81CAD; Sat, 25 Jun 2016 14:04:10 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84CFE1B83; Sat, 25 Jun 2016 14:04:10 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=1aOjvrVOS9EDKIUUtXd4wrvWk2Ibjl4Si3SeHsyUcOk=; b=IVppykzTbnvEQnDXuDqmgvQrYzFqR/YVCtbZTwHmg6l8vhnkkpSi4DW4vN7nL/IkNag/qz+yfXHcez+h7n24YNedjUYdd1CI0vJi3Gkc5Zvx2Y9NoztsJtzkL/i2dNd0thjf7KBzLJBUe/D8PSuxCI4ZyUgw4NeRzpiz5RKonws=; Received: from [37.229.193.176] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1bGoBr-000A4x-Ac ; Sat, 25 Jun 2016 17:04:07 +0300 Date: Sat, 25 Jun 2016 17:04:06 +0300 From: Ivan Klymenko To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625170406.77c79b2e@nonamehost.local> In-Reply-To: <20160625135508.GV38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=37.229.193.176; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 14:04:10 -0000 On Sat, 25 Jun 2016 16:55:09 +0300 Konstantin Belousov wrote: > On Sat, Jun 25, 2016 at 04:44:03PM +0300, Ivan Klymenko wrote: > > On Sat, 25 Jun 2016 11:30:40 +0000 (UTC) > > Konstantin Belousov wrote: > > > > > Author: kib > > > Date: Sat Jun 25 11:30:40 2016 > > > New Revision: 302194 > > > URL: https://svnweb.freebsd.org/changeset/base/302194 > > > > > > Log: > > > For pthread_mutex_trylock() call on owned error-check or > > > non-portable adaptive mutex, return EDEADLK as required by > > > POSIX. The pthread_mutex_lock() is already compliant. > > > > > > Tested by: Guy Yur > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 2 weeks > > > Approved by: re (gjb) > > > > > > Modified: > > > head/lib/libthr/thread/thr_mutex.c > > > > > > Modified: head/lib/libthr/thread/thr_mutex.c > > > ============================================================================== > > > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 10:08:04 > > > 2016 (r302193) +++ head/lib/libthr/thread/thr_mutex.c > > > Sat Jun 25 11:30:40 2016 (r302194) @@ -850,9 +850,12 @@ > > > mutex_self_trylock(struct pthread_mutex > > > switch (PMUTEX_TYPE(m->m_flags)) { > > > case PTHREAD_MUTEX_ERRORCHECK: > > > - case PTHREAD_MUTEX_NORMAL: > > > case PTHREAD_MUTEX_ADAPTIVE_NP: > > > - ret = EBUSY; > > > + ret = EDEADLK; > > > + break; > > > + > > > + case PTHREAD_MUTEX_NORMAL: > > > + ret = EBUSY; > > > break; > > > > > > case PTHREAD_MUTEX_RECURSIVE: > > > > Update for r302191 to r302196 console-kit-daemon: > > pid 1496 (console-kit-daemon), uid 0: exited on signal 6 > > pid 1581 (console-kit-daemon), uid 0: exited on signal 6 > > pid 5954 (console-kit-daemon), uid 0: exited on signal 6 > > pid 6010 (console-kit-daemon), uid 0: exited on signal 6 > > pid 6016 (console-kit-daemon), uid 0: exited on signal 6 > > > > Xorg session after authorization not started - black screen. > > Why did you replied to r302194 with this information ? Does reverting > r302194 (and only this revision) restores console-kit functionality ? I do not know which one commits it breaks r302194 or next 302195. I returned to r302191 for restores console-kit functionality. From owner-svn-src-all@freebsd.org Sat Jun 25 14:05:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D37EB81D98; Sat, 25 Jun 2016 14:05:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4695C1F04; Sat, 25 Jun 2016 14:05:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u5PE5TiI064616 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 25 Jun 2016 17:05:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u5PE5TiI064616 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u5PE5TrU064615; Sat, 25 Jun 2016 17:05:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Jun 2016 17:05:29 +0300 From: Konstantin Belousov To: Ivan Klymenko Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625140529.GW38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625170406.77c79b2e@nonamehost.local> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 14:05:35 -0000 On Sat, Jun 25, 2016 at 05:04:06PM +0300, Ivan Klymenko wrote: > On Sat, 25 Jun 2016 16:55:09 +0300 > Konstantin Belousov wrote: > > > On Sat, Jun 25, 2016 at 04:44:03PM +0300, Ivan Klymenko wrote: > > > On Sat, 25 Jun 2016 11:30:40 +0000 (UTC) > > > Konstantin Belousov wrote: > > > > > > > Author: kib > > > > Date: Sat Jun 25 11:30:40 2016 > > > > New Revision: 302194 > > > > URL: https://svnweb.freebsd.org/changeset/base/302194 > > > > > > > > Log: > > > > For pthread_mutex_trylock() call on owned error-check or > > > > non-portable adaptive mutex, return EDEADLK as required by > > > > POSIX. The pthread_mutex_lock() is already compliant. > > > > > > > > Tested by: Guy Yur > > > > Sponsored by: The FreeBSD Foundation > > > > MFC after: 2 weeks > > > > Approved by: re (gjb) > > > > > > > > Modified: > > > > head/lib/libthr/thread/thr_mutex.c > > > > > > > > Modified: head/lib/libthr/thread/thr_mutex.c > > > > ============================================================================== > > > > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 10:08:04 > > > > 2016 (r302193) +++ head/lib/libthr/thread/thr_mutex.c > > > > Sat Jun 25 11:30:40 2016 (r302194) @@ -850,9 +850,12 @@ > > > > mutex_self_trylock(struct pthread_mutex > > > > switch (PMUTEX_TYPE(m->m_flags)) { > > > > case PTHREAD_MUTEX_ERRORCHECK: > > > > - case PTHREAD_MUTEX_NORMAL: > > > > case PTHREAD_MUTEX_ADAPTIVE_NP: > > > > - ret = EBUSY; > > > > + ret = EDEADLK; > > > > + break; > > > > + > > > > + case PTHREAD_MUTEX_NORMAL: > > > > + ret = EBUSY; > > > > break; > > > > > > > > case PTHREAD_MUTEX_RECURSIVE: > > > > > > Update for r302191 to r302196 console-kit-daemon: > > > pid 1496 (console-kit-daemon), uid 0: exited on signal 6 > > > pid 1581 (console-kit-daemon), uid 0: exited on signal 6 > > > pid 5954 (console-kit-daemon), uid 0: exited on signal 6 > > > pid 6010 (console-kit-daemon), uid 0: exited on signal 6 > > > pid 6016 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > Xorg session after authorization not started - black screen. > > > > Why did you replied to r302194 with this information ? Does reverting > > r302194 (and only this revision) restores console-kit functionality ? > > I do not know which one commits it breaks r302194 or next 302195. > I returned to r302191 for restores console-kit functionality. Can you test, please ? Use r302195 kernel and previous libthr. From owner-svn-src-all@freebsd.org Sat Jun 25 14:18:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0973B82D97; Sat, 25 Jun 2016 14:18:04 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B44131A29; Sat, 25 Jun 2016 14:18:04 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=OKsNQr1PoLb8RRdK8791553T33yZiBVNpWcsZIWtYXs=; b=QZLPbPqmsv11nKaG9HhxfXcsLmZLsgCGI7n9qeTKtCbSPra03gV7kfKYQWBlcUe7f+M1viDxFHUiZaJTywJwiZjqAhfPpweo7dr6zZpcmA996eZSg5O90fnaXWu+tvwMWEIHU4vjoXvdPDhlhKImBfskAoZZvwrhjMe/JBQjvfU=; Received: from [37.229.193.176] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1bGoPJ-000FGI-Bp ; Sat, 25 Jun 2016 17:18:01 +0300 Date: Sat, 25 Jun 2016 17:18:00 +0300 From: Ivan Klymenko To: Konstantin Belousov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625171800.50a43746@nonamehost.local> In-Reply-To: <20160625140529.GW38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=37.229.193.176; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 14:18:05 -0000 On Sat, 25 Jun 2016 17:05:29 +0300 Konstantin Belousov wrote: > On Sat, Jun 25, 2016 at 05:04:06PM +0300, Ivan Klymenko wrote: > > On Sat, 25 Jun 2016 16:55:09 +0300 > > Konstantin Belousov wrote: > > > > > On Sat, Jun 25, 2016 at 04:44:03PM +0300, Ivan Klymenko wrote: > > > > On Sat, 25 Jun 2016 11:30:40 +0000 (UTC) > > > > Konstantin Belousov wrote: > > > > > > > > > Author: kib > > > > > Date: Sat Jun 25 11:30:40 2016 > > > > > New Revision: 302194 > > > > > URL: https://svnweb.freebsd.org/changeset/base/302194 > > > > > > > > > > Log: > > > > > For pthread_mutex_trylock() call on owned error-check or > > > > > non-portable adaptive mutex, return EDEADLK as required by > > > > > POSIX. The pthread_mutex_lock() is already compliant. > > > > > > > > > > Tested by: Guy Yur > > > > > Sponsored by: The FreeBSD Foundation > > > > > MFC after: 2 weeks > > > > > Approved by: re (gjb) > > > > > > > > > > Modified: > > > > > head/lib/libthr/thread/thr_mutex.c > > > > > > > > > > Modified: head/lib/libthr/thread/thr_mutex.c > > > > > ============================================================================== > > > > > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 > > > > > 10:08:04 2016 (r302193) +++ > > > > > head/lib/libthr/thread/thr_mutex.c Sat Jun 25 11:30:40 > > > > > 2016 (r302194) @@ -850,9 +850,12 @@ > > > > > mutex_self_trylock(struct pthread_mutex switch > > > > > (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: > > > > > - case PTHREAD_MUTEX_NORMAL: > > > > > case PTHREAD_MUTEX_ADAPTIVE_NP: > > > > > - ret = EBUSY; > > > > > + ret = EDEADLK; > > > > > + break; > > > > > + > > > > > + case PTHREAD_MUTEX_NORMAL: > > > > > + ret = EBUSY; > > > > > break; > > > > > > > > > > case PTHREAD_MUTEX_RECURSIVE: > > > > > > > > Update for r302191 to r302196 console-kit-daemon: > > > > pid 1496 (console-kit-daemon), uid 0: exited on signal 6 > > > > pid 1581 (console-kit-daemon), uid 0: exited on signal 6 > > > > pid 5954 (console-kit-daemon), uid 0: exited on signal 6 > > > > pid 6010 (console-kit-daemon), uid 0: exited on signal 6 > > > > pid 6016 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > > Xorg session after authorization not started - black screen. > > > > > > Why did you replied to r302194 with this information ? Does > > > reverting r302194 (and only this revision) restores console-kit > > > functionality ? > > > > I do not know which one commits it breaks r302194 or next 302195. > > I returned to r302191 for restores console-kit functionality. > Can you test, please ? Use r302195 kernel and previous libthr. Kernel r302195, world r302191 - works fine - the problem can not reproduce. From owner-svn-src-all@freebsd.org Sat Jun 25 14:29:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 805B7B82FE1; Sat, 25 Jun 2016 14:29:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10BD811F7; Sat, 25 Jun 2016 14:29:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u5PETFmk069892 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 25 Jun 2016 17:29:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u5PETFmk069892 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u5PETFFa069891; Sat, 25 Jun 2016 17:29:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Jun 2016 17:29:15 +0300 From: Konstantin Belousov To: Ivan Klymenko Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625142915.GX38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625171800.50a43746@nonamehost.local> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 14:29:21 -0000 On Sat, Jun 25, 2016 at 05:18:00PM +0300, Ivan Klymenko wrote: > On Sat, 25 Jun 2016 17:05:29 +0300 > Konstantin Belousov wrote: > > > On Sat, Jun 25, 2016 at 05:04:06PM +0300, Ivan Klymenko wrote: > > > On Sat, 25 Jun 2016 16:55:09 +0300 > > > Konstantin Belousov wrote: > > > > > > > On Sat, Jun 25, 2016 at 04:44:03PM +0300, Ivan Klymenko wrote: > > > > > On Sat, 25 Jun 2016 11:30:40 +0000 (UTC) > > > > > Konstantin Belousov wrote: > > > > > > > > > > > Author: kib > > > > > > Date: Sat Jun 25 11:30:40 2016 > > > > > > New Revision: 302194 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/302194 > > > > > > > > > > > > Log: > > > > > > For pthread_mutex_trylock() call on owned error-check or > > > > > > non-portable adaptive mutex, return EDEADLK as required by > > > > > > POSIX. The pthread_mutex_lock() is already compliant. > > > > > > > > > > > > Tested by: Guy Yur > > > > > > Sponsored by: The FreeBSD Foundation > > > > > > MFC after: 2 weeks > > > > > > Approved by: re (gjb) > > > > > > > > > > > > Modified: > > > > > > head/lib/libthr/thread/thr_mutex.c > > > > > > > > > > > > Modified: head/lib/libthr/thread/thr_mutex.c > > > > > > ============================================================================== > > > > > > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 > > > > > > 10:08:04 2016 (r302193) +++ > > > > > > head/lib/libthr/thread/thr_mutex.c Sat Jun 25 11:30:40 > > > > > > 2016 (r302194) @@ -850,9 +850,12 @@ > > > > > > mutex_self_trylock(struct pthread_mutex switch > > > > > > (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: > > > > > > - case PTHREAD_MUTEX_NORMAL: > > > > > > case PTHREAD_MUTEX_ADAPTIVE_NP: > > > > > > - ret = EBUSY; > > > > > > + ret = EDEADLK; > > > > > > + break; > > > > > > + > > > > > > + case PTHREAD_MUTEX_NORMAL: > > > > > > + ret = EBUSY; > > > > > > break; > > > > > > > > > > > > case PTHREAD_MUTEX_RECURSIVE: > > > > > > > > > > Update for r302191 to r302196 console-kit-daemon: > > > > > pid 1496 (console-kit-daemon), uid 0: exited on signal 6 > > > > > pid 1581 (console-kit-daemon), uid 0: exited on signal 6 > > > > > pid 5954 (console-kit-daemon), uid 0: exited on signal 6 > > > > > pid 6010 (console-kit-daemon), uid 0: exited on signal 6 > > > > > pid 6016 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > > > > Xorg session after authorization not started - black screen. > > > > > > > > Why did you replied to r302194 with this information ? Does > > > > reverting r302194 (and only this revision) restores console-kit > > > > functionality ? > > > > > > I do not know which one commits it breaks r302194 or next 302195. > > > I returned to r302191 for restores console-kit functionality. > > Can you test, please ? Use r302195 kernel and previous libthr. > > Kernel r302195, world r302191 - works fine - the problem can not > reproduce. Thank you. Could you get backtrace from the console-kit-daemon ? Only rebuild libthr: cd src/lib/libthr && make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all install then gather coredump and load it in gdb. Then you can revert the commit and rebuild working libthr. From owner-svn-src-all@freebsd.org Sat Jun 25 14:55:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2009BB80AA8; Sat, 25 Jun 2016 14:55:08 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3F95263A; Sat, 25 Jun 2016 14:55:07 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=zpsAJrRfQKQu83L0VRV2fc4O/f6OiS008GYK89YYPkA=; b=ESOP5dWUzjMAtyb9WaFwbk9CmGCnQH4k2Zi4t0+wt/b1AnQk6JhEYES0Mp0t2iEN0NrFsaLyC0GdVG1wuLyHM+OU+lju28C5yJijSw/3sqOT98LRwmDyW0nE7hl2JLktTzOss00U1iRS9BYhKY57BoBI1G+KcF0JBYtXJ1RnNqc=; Received: from [37.229.193.176] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1bGozA-0003CX-3e ; Sat, 25 Jun 2016 17:55:04 +0300 Date: Sat, 25 Jun 2016 17:55:03 +0300 From: Ivan Klymenko To: Konstantin Belousov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625175503.7c57d42b@nonamehost.local> In-Reply-To: <20160625142915.GX38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> <20160625142915.GX38613@kib.kiev.ua> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=37.229.193.176; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 14:55:08 -0000 On Sat, 25 Jun 2016 17:29:15 +0300 Konstantin Belousov wrote: > On Sat, Jun 25, 2016 at 05:18:00PM +0300, Ivan Klymenko wrote: > > On Sat, 25 Jun 2016 17:05:29 +0300 > > Konstantin Belousov wrote: > > > > > On Sat, Jun 25, 2016 at 05:04:06PM +0300, Ivan Klymenko wrote: > > > > On Sat, 25 Jun 2016 16:55:09 +0300 > > > > Konstantin Belousov wrote: > > > > > > > > > On Sat, Jun 25, 2016 at 04:44:03PM +0300, Ivan Klymenko > > > > > wrote: > > > > > > On Sat, 25 Jun 2016 11:30:40 +0000 (UTC) > > > > > > Konstantin Belousov wrote: > > > > > > > > > > > > > Author: kib > > > > > > > Date: Sat Jun 25 11:30:40 2016 > > > > > > > New Revision: 302194 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/302194 > > > > > > > > > > > > > > Log: > > > > > > > For pthread_mutex_trylock() call on owned error-check or > > > > > > > non-portable adaptive mutex, return EDEADLK as required by > > > > > > > POSIX. The pthread_mutex_lock() is already compliant. > > > > > > > > > > > > > > Tested by: Guy Yur > > > > > > > Sponsored by: The FreeBSD Foundation > > > > > > > MFC after: 2 weeks > > > > > > > Approved by: re (gjb) > > > > > > > > > > > > > > Modified: > > > > > > > head/lib/libthr/thread/thr_mutex.c > > > > > > > > > > > > > > Modified: head/lib/libthr/thread/thr_mutex.c > > > > > > > ============================================================================== > > > > > > > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 > > > > > > > 10:08:04 2016 (r302193) +++ > > > > > > > head/lib/libthr/thread/thr_mutex.c Sat Jun 25 11:30:40 > > > > > > > 2016 (r302194) @@ -850,9 +850,12 @@ > > > > > > > mutex_self_trylock(struct pthread_mutex switch > > > > > > > (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: > > > > > > > - case PTHREAD_MUTEX_NORMAL: > > > > > > > case PTHREAD_MUTEX_ADAPTIVE_NP: > > > > > > > - ret = EBUSY; > > > > > > > + ret = EDEADLK; > > > > > > > + break; > > > > > > > + > > > > > > > + case PTHREAD_MUTEX_NORMAL: > > > > > > > + ret = EBUSY; > > > > > > > break; > > > > > > > > > > > > > > case PTHREAD_MUTEX_RECURSIVE: > > > > > > > > > > > > Update for r302191 to r302196 console-kit-daemon: > > > > > > pid 1496 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > pid 1581 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > pid 5954 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > pid 6010 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > pid 6016 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > > > > > > Xorg session after authorization not started - black > > > > > > screen. > > > > > > > > > > Why did you replied to r302194 with this information ? Does > > > > > reverting r302194 (and only this revision) restores > > > > > console-kit functionality ? > > > > > > > > I do not know which one commits it breaks r302194 or next > > > > 302195. I returned to r302191 for restores console-kit > > > > functionality. > > > Can you test, please ? Use r302195 kernel and previous libthr. > > > > Kernel r302195, world r302191 - works fine - the problem can not > > reproduce. > > Thank you. > > Could you get backtrace from the console-kit-daemon ? Only rebuild > libthr: cd src/lib/libthr && make DEBUG_FLAGS=-g WITHOUT_TESTS=yes > all install then gather coredump and load it in gdb. Then you can > revert the commit and rebuild working libthr. > http://pastebin.com/wgmmicC3 If this information will be useful. From owner-svn-src-all@freebsd.org Sat Jun 25 15:20:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2B02B81372; Sat, 25 Jun 2016 15:20:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CBCC1736; Sat, 25 Jun 2016 15:20:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u5PFK6eL081925 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 25 Jun 2016 18:20:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u5PFK6eL081925 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u5PFK67o081923; Sat, 25 Jun 2016 18:20:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Jun 2016 18:20:06 +0300 From: Konstantin Belousov To: Ivan Klymenko Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625152006.GA38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> <20160625142915.GX38613@kib.kiev.ua> <20160625175503.7c57d42b@nonamehost.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625175503.7c57d42b@nonamehost.local> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 15:20:17 -0000 On Sat, Jun 25, 2016 at 05:55:03PM +0300, Ivan Klymenko wrote: > On Sat, 25 Jun 2016 17:29:15 +0300 > Konstantin Belousov wrote: > > > On Sat, Jun 25, 2016 at 05:18:00PM +0300, Ivan Klymenko wrote: > > > On Sat, 25 Jun 2016 17:05:29 +0300 > > > Konstantin Belousov wrote: > > > > > > > On Sat, Jun 25, 2016 at 05:04:06PM +0300, Ivan Klymenko wrote: > > > > > On Sat, 25 Jun 2016 16:55:09 +0300 > > > > > Konstantin Belousov wrote: > > > > > > > > > > > On Sat, Jun 25, 2016 at 04:44:03PM +0300, Ivan Klymenko > > > > > > wrote: > > > > > > > On Sat, 25 Jun 2016 11:30:40 +0000 (UTC) > > > > > > > Konstantin Belousov wrote: > > > > > > > > > > > > > > > Author: kib > > > > > > > > Date: Sat Jun 25 11:30:40 2016 > > > > > > > > New Revision: 302194 > > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/302194 > > > > > > > > > > > > > > > > Log: > > > > > > > > For pthread_mutex_trylock() call on owned error-check or > > > > > > > > non-portable adaptive mutex, return EDEADLK as required by > > > > > > > > POSIX. The pthread_mutex_lock() is already compliant. > > > > > > > > > > > > > > > > Tested by: Guy Yur > > > > > > > > Sponsored by: The FreeBSD Foundation > > > > > > > > MFC after: 2 weeks > > > > > > > > Approved by: re (gjb) > > > > > > > > > > > > > > > > Modified: > > > > > > > > head/lib/libthr/thread/thr_mutex.c > > > > > > > > > > > > > > > > Modified: head/lib/libthr/thread/thr_mutex.c > > > > > > > > ============================================================================== > > > > > > > > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 > > > > > > > > 10:08:04 2016 (r302193) +++ > > > > > > > > head/lib/libthr/thread/thr_mutex.c Sat Jun 25 11:30:40 > > > > > > > > 2016 (r302194) @@ -850,9 +850,12 @@ > > > > > > > > mutex_self_trylock(struct pthread_mutex switch > > > > > > > > (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: > > > > > > > > - case PTHREAD_MUTEX_NORMAL: > > > > > > > > case PTHREAD_MUTEX_ADAPTIVE_NP: > > > > > > > > - ret = EBUSY; > > > > > > > > + ret = EDEADLK; > > > > > > > > + break; > > > > > > > > + > > > > > > > > + case PTHREAD_MUTEX_NORMAL: > > > > > > > > + ret = EBUSY; > > > > > > > > break; > > > > > > > > > > > > > > > > case PTHREAD_MUTEX_RECURSIVE: > > > > > > > > > > > > > > Update for r302191 to r302196 console-kit-daemon: > > > > > > > pid 1496 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > pid 1581 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > pid 5954 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > pid 6010 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > pid 6016 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > > > > > > > > Xorg session after authorization not started - black > > > > > > > screen. > > > > > > > > > > > > Why did you replied to r302194 with this information ? Does > > > > > > reverting r302194 (and only this revision) restores > > > > > > console-kit functionality ? > > > > > > > > > > I do not know which one commits it breaks r302194 or next > > > > > 302195. I returned to r302191 for restores console-kit > > > > > functionality. > > > > Can you test, please ? Use r302195 kernel and previous libthr. > > > > > > Kernel r302195, world r302191 - works fine - the problem can not > > > reproduce. > > > > Thank you. > > > > Could you get backtrace from the console-kit-daemon ? Only rebuild > > libthr: cd src/lib/libthr && make DEBUG_FLAGS=-g WITHOUT_TESTS=yes > > all install then gather coredump and load it in gdb. Then you can > > revert the commit and rebuild working libthr. > > > > http://pastebin.com/wgmmicC3 If this information will be useful. Yes, it is useful, thank you. Please try this instead of reverting. diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index 2ad05ca..1ae75fb 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -850,10 +871,10 @@ mutex_self_trylock(struct pthread_mutex *m) switch (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: - case PTHREAD_MUTEX_ADAPTIVE_NP: ret = EDEADLK; break; + case PTHREAD_MUTEX_ADAPTIVE_NP: case PTHREAD_MUTEX_NORMAL: ret = EBUSY; break; From owner-svn-src-all@freebsd.org Sat Jun 25 16:03:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91617B82D5D; Sat, 25 Jun 2016 16:03:51 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5451D1978; Sat, 25 Jun 2016 16:03:50 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=Plt2bRyVxEI7fM5DTRYbdhuuhaWnxc4Ro5/69ZKs3NQ=; b=h3OR8fQ5UrIAlsr7mR+cBKheVLNLwRf8mEBV1YhcZAK+56DkVJmXMlOjCJorjVEY8oOiYetBUvojFNRnclQFqunPi1rKRxZBbpYVFyx/qVYbvT+9+lnuOm8gg1q/3n+0bNwLKFzia3oOg1UIqXBUu+pPIFqFYqs++JW5tycqszI=; Received: from [37.229.193.176] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1bGq3f-0003qw-EK ; Sat, 25 Jun 2016 19:03:47 +0300 Date: Sat, 25 Jun 2016 19:03:46 +0300 From: Ivan Klymenko To: Konstantin Belousov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625190346.19a1ef0d@nonamehost.local> In-Reply-To: <20160625152006.GA38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> <20160625142915.GX38613@kib.kiev.ua> <20160625175503.7c57d42b@nonamehost.local> <20160625152006.GA38613@kib.kiev.ua> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=37.229.193.176; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 16:03:51 -0000 On Sat, 25 Jun 2016 18:20:06 +0300 Konstantin Belousov wrote: > On Sat, Jun 25, 2016 at 05:55:03PM +0300, Ivan Klymenko wrote: > > On Sat, 25 Jun 2016 17:29:15 +0300 > > Konstantin Belousov wrote: > > > > > On Sat, Jun 25, 2016 at 05:18:00PM +0300, Ivan Klymenko wrote: > > > > On Sat, 25 Jun 2016 17:05:29 +0300 > > > > Konstantin Belousov wrote: > > > > > > > > > On Sat, Jun 25, 2016 at 05:04:06PM +0300, Ivan Klymenko > > > > > wrote: > > > > > > On Sat, 25 Jun 2016 16:55:09 +0300 > > > > > > Konstantin Belousov wrote: > > > > > > > > > > > > > On Sat, Jun 25, 2016 at 04:44:03PM +0300, Ivan Klymenko > > > > > > > wrote: > > > > > > > > On Sat, 25 Jun 2016 11:30:40 +0000 (UTC) > > > > > > > > Konstantin Belousov wrote: > > > > > > > > > > > > > > > > > Author: kib > > > > > > > > > Date: Sat Jun 25 11:30:40 2016 > > > > > > > > > New Revision: 302194 > > > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/302194 > > > > > > > > > > > > > > > > > > Log: > > > > > > > > > For pthread_mutex_trylock() call on owned > > > > > > > > > error-check or non-portable adaptive mutex, return > > > > > > > > > EDEADLK as required by POSIX. The > > > > > > > > > pthread_mutex_lock() is already compliant. > > > > > > > > > Tested by: Guy Yur > > > > > > > > > Sponsored by: The FreeBSD Foundation > > > > > > > > > MFC after: 2 weeks > > > > > > > > > Approved by: re (gjb) > > > > > > > > > > > > > > > > > > Modified: > > > > > > > > > head/lib/libthr/thread/thr_mutex.c > > > > > > > > > > > > > > > > > > Modified: head/lib/libthr/thread/thr_mutex.c > > > > > > > > > ============================================================================== > > > > > > > > > --- head/lib/libthr/thread/thr_mutex.c Sat Jun > > > > > > > > > 25 10:08:04 2016 (r302193) +++ > > > > > > > > > head/lib/libthr/thread/thr_mutex.c Sat Jun 25 11:30:40 > > > > > > > > > 2016 (r302194) @@ -850,9 +850,12 @@ > > > > > > > > > mutex_self_trylock(struct pthread_mutex switch > > > > > > > > > (PMUTEX_TYPE(m->m_flags)) { case > > > > > > > > > PTHREAD_MUTEX_ERRORCHECK: > > > > > > > > > - case PTHREAD_MUTEX_NORMAL: > > > > > > > > > case PTHREAD_MUTEX_ADAPTIVE_NP: > > > > > > > > > - ret = EBUSY; > > > > > > > > > + ret = EDEADLK; > > > > > > > > > + break; > > > > > > > > > + > > > > > > > > > + case PTHREAD_MUTEX_NORMAL: > > > > > > > > > + ret = EBUSY; > > > > > > > > > break; > > > > > > > > > > > > > > > > > > case PTHREAD_MUTEX_RECURSIVE: > > > > > > > > > > > > > > > > Update for r302191 to r302196 console-kit-daemon: > > > > > > > > pid 1496 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > > pid 1581 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > > pid 5954 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > > pid 6010 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > > pid 6016 (console-kit-daemon), uid 0: exited on signal 6 > > > > > > > > > > > > > > > > Xorg session after authorization not started - black > > > > > > > > screen. > > > > > > > > > > > > > > Why did you replied to r302194 with this information ? > > > > > > > Does reverting r302194 (and only this revision) restores > > > > > > > console-kit functionality ? > > > > > > > > > > > > I do not know which one commits it breaks r302194 or next > > > > > > 302195. I returned to r302191 for restores console-kit > > > > > > functionality. > > > > > Can you test, please ? Use r302195 kernel and previous > > > > > libthr. > > > > > > > > Kernel r302195, world r302191 - works fine - the problem can not > > > > reproduce. > > > > > > Thank you. > > > > > > Could you get backtrace from the console-kit-daemon ? Only > > > rebuild libthr: cd src/lib/libthr && make DEBUG_FLAGS=-g > > > WITHOUT_TESTS=yes all install then gather coredump and load it in > > > gdb. Then you can revert the commit and rebuild working libthr. > > > > > > > http://pastebin.com/wgmmicC3 If this information will be useful. > > Yes, it is useful, thank you. Please try this instead of reverting. > > diff --git a/lib/libthr/thread/thr_mutex.c > b/lib/libthr/thread/thr_mutex.c index 2ad05ca..1ae75fb 100644 > --- a/lib/libthr/thread/thr_mutex.c > +++ b/lib/libthr/thread/thr_mutex.c > @@ -850,10 +871,10 @@ mutex_self_trylock(struct pthread_mutex *m) > > switch (PMUTEX_TYPE(m->m_flags)) { > case PTHREAD_MUTEX_ERRORCHECK: > - case PTHREAD_MUTEX_ADAPTIVE_NP: > ret = EDEADLK; > break; > > + case PTHREAD_MUTEX_ADAPTIVE_NP: > case PTHREAD_MUTEX_NORMAL: > ret = EBUSY; > break; Strange, it's not helped http://pastebin.com/jbzP0JW2 From owner-svn-src-all@freebsd.org Sat Jun 25 16:16:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D449BB82F8B; Sat, 25 Jun 2016 16:16:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 535391EB4; Sat, 25 Jun 2016 16:16:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u5PGGFb0096030 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 25 Jun 2016 19:16:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u5PGGFb0096030 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u5PGGFc5096029; Sat, 25 Jun 2016 19:16:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Jun 2016 19:16:15 +0300 From: Konstantin Belousov To: Ivan Klymenko Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625161615.GD38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> <20160625142915.GX38613@kib.kiev.ua> <20160625175503.7c57d42b@nonamehost.local> <20160625152006.GA38613@kib.kiev.ua> <20160625190346.19a1ef0d@nonamehost.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625190346.19a1ef0d@nonamehost.local> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 16:16:20 -0000 On Sat, Jun 25, 2016 at 07:03:46PM +0300, Ivan Klymenko wrote: > On Sat, 25 Jun 2016 18:20:06 +0300 > Konstantin Belousov wrote: > > diff --git a/lib/libthr/thread/thr_mutex.c > > b/lib/libthr/thread/thr_mutex.c index 2ad05ca..1ae75fb 100644 > > --- a/lib/libthr/thread/thr_mutex.c > > +++ b/lib/libthr/thread/thr_mutex.c > > @@ -850,10 +871,10 @@ mutex_self_trylock(struct pthread_mutex *m) > > > > switch (PMUTEX_TYPE(m->m_flags)) { > > case PTHREAD_MUTEX_ERRORCHECK: > > - case PTHREAD_MUTEX_ADAPTIVE_NP: > > ret = EDEADLK; > > break; > > > > + case PTHREAD_MUTEX_ADAPTIVE_NP: > > case PTHREAD_MUTEX_NORMAL: > > ret = EBUSY; > > break; > > Strange, it's not helped http://pastebin.com/jbzP0JW2 Are you sure that the new libthr was installed ? Compile and run the following test, please, and show me the results. On the patched libthr, the program must not output anything and exits with error code 0. /* $Id: pthread_errrecurse.c,v 1.1 2016/06/25 16:12:41 kostik Exp kostik $ */ #include #include #include int main(void) { pthread_mutex_t m; pthread_mutexattr_t ma; int error; error = pthread_mutexattr_init(&ma); if (error != 0) err(1, "mutexattr_init"); error = pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ADAPTIVE_NP); if (error != 0) err(1, "mutexattr_settype"); error = pthread_mutex_init(&m, &ma); if (error != 0) err(1, "mutex_init"); error = pthread_mutex_trylock(&m); if (error != 0) err(1, "mutex_trylock 1"); error = pthread_mutex_trylock(&m); if (error != EBUSY) err(1, "mutex_trylock 2"); else if (error == 0) errx(1, "mutex_trylock 2 succeeded"); return (0); } From owner-svn-src-all@freebsd.org Sat Jun 25 17:03:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B164AB80C2A; Sat, 25 Jun 2016 17:03:09 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.netplex.net", Issuer "RapidSSL SHA256 CA - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DB5316F2; Sat, 25 Jun 2016 17:03:08 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.15.1/8.15.1/NETPLEX) with ESMTP id u5PH317c033643; Sat, 25 Jun 2016 13:03:01 -0400 X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.4.3 (mail.netplex.net [204.213.176.9]); Sat, 25 Jun 2016 13:03:01 -0400 (EDT) Date: Sat, 25 Jun 2016 13:03:01 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net Reply-To: Daniel Eischen To: Konstantin Belousov cc: Ivan Klymenko , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread In-Reply-To: <20160625161615.GD38613@kib.kiev.ua> Message-ID: References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> <20160625142915.GX38613@kib.kiev.ua> <20160625175503.7c57d42b@nonamehost.local> <20160625152006.GA38613@kib.kiev.ua> <20160625190346.19a1ef0d@nonamehost.local> <20160625161615.GD38613@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 17:03:09 -0000 On Sat, 25 Jun 2016, Konstantin Belousov wrote: > On Sat, Jun 25, 2016 at 07:03:46PM +0300, Ivan Klymenko wrote: >> On Sat, 25 Jun 2016 18:20:06 +0300 >> Konstantin Belousov wrote: >>> diff --git a/lib/libthr/thread/thr_mutex.c >>> b/lib/libthr/thread/thr_mutex.c index 2ad05ca..1ae75fb 100644 >>> --- a/lib/libthr/thread/thr_mutex.c >>> +++ b/lib/libthr/thread/thr_mutex.c >>> @@ -850,10 +871,10 @@ mutex_self_trylock(struct pthread_mutex *m) >>> >>> switch (PMUTEX_TYPE(m->m_flags)) { >>> case PTHREAD_MUTEX_ERRORCHECK: >>> - case PTHREAD_MUTEX_ADAPTIVE_NP: >>> ret = EDEADLK; >>> break; >>> >>> + case PTHREAD_MUTEX_ADAPTIVE_NP: >>> case PTHREAD_MUTEX_NORMAL: >>> ret = EBUSY; >>> break; >> >> Strange, it's not helped http://pastebin.com/jbzP0JW2 > > Are you sure that the new libthr was installed ? Compile and run the > following test, please, and show me the results. On the patched libthr, > the program must not output anything and exits with error code 0. Sorry for not noticing and coming in late, but I think the original change is wrong. I don't see in the 2013 POSIX spec or Solaris 11 man page (haven't checked Linux yet) where pthread_mutex_trylock() returns EDEADLK under any circumstance. http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_trylock.html http://docs.oracle.com/cd/E23824_01/html/821-1465/pthread-mutex-trylock-3c.html#scrolltoc -- DE From owner-svn-src-all@freebsd.org Sat Jun 25 17:14:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B36BAB80E57; Sat, 25 Jun 2016 17:14:43 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 803071C02; Sat, 25 Jun 2016 17:14:43 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 5BE55B80B6; Sat, 25 Jun 2016 19:14:39 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 3575B28494; Sat, 25 Jun 2016 19:14:40 +0200 (CEST) Date: Sat, 25 Jun 2016 19:14:40 +0200 From: Jilles Tjoelker To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625171440.GA19698@stack.nl> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201606251130.u5PBUeGC001988@repo.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 17:14:43 -0000 On Sat, Jun 25, 2016 at 11:30:40AM +0000, Konstantin Belousov wrote: > Author: kib > Date: Sat Jun 25 11:30:40 2016 > New Revision: 302194 > URL: https://svnweb.freebsd.org/changeset/base/302194 > Log: > For pthread_mutex_trylock() call on owned error-check or non-portable > adaptive mutex, return EDEADLK as required by POSIX. The > pthread_mutex_lock() is already compliant. > Tested by: Guy Yur > Sponsored by: The FreeBSD Foundation > MFC after: 2 weeks > Approved by: re (gjb) > Modified: > head/lib/libthr/thread/thr_mutex.c > Modified: head/lib/libthr/thread/thr_mutex.c > ============================================================================== > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 10:08:04 2016 (r302193) > +++ head/lib/libthr/thread/thr_mutex.c Sat Jun 25 11:30:40 2016 (r302194) > @@ -850,9 +850,12 @@ mutex_self_trylock(struct pthread_mutex > > switch (PMUTEX_TYPE(m->m_flags)) { > case PTHREAD_MUTEX_ERRORCHECK: > - case PTHREAD_MUTEX_NORMAL: > case PTHREAD_MUTEX_ADAPTIVE_NP: > - ret = EBUSY; > + ret = EDEADLK; > + break; > + > + case PTHREAD_MUTEX_NORMAL: > + ret = EBUSY; > break; > > case PTHREAD_MUTEX_RECURSIVE: I think POSIX (SUSv4tc1, XSH 3 pthread_mutex_lock) is clear that only pthread_mutex_lock() can fail with [EDEADLK], not pthread_mutex_trylock(). Instead, the error [EBUSY] listed for pthread_mutex_trylock() applies whenever the mutex could not be acquired because it was already locked. This includes the case where the mutex is owned by the current thread. Note that POSIX intends to allow not storing the owning thread's ID in non-recursive non-robust mutexes. Failing pthread_mutex_trylock() on owned mutexes only with [EBUSY] also matches our code before this commit and NetBSD's code, and is apparently expected by other code. Therefore, I think this commit should be reverted. -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Sat Jun 25 17:30:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50657B81072; Sat, 25 Jun 2016 17:30:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEEE112D8; Sat, 25 Jun 2016 17:30:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u5PHTuw6012726 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 25 Jun 2016 20:29:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u5PHTuw6012726 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u5PHTu6q012725; Sat, 25 Jun 2016 20:29:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Jun 2016 20:29:56 +0300 From: Konstantin Belousov To: Jilles Tjoelker , Daniel Eischen Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625172956.GE38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625171440.GA19698@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625171440.GA19698@stack.nl> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 17:30:03 -0000 On Sat, Jun 25, 2016 at 07:14:40PM +0200, Jilles Tjoelker wrote: > On Sat, Jun 25, 2016 at 11:30:40AM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Sat Jun 25 11:30:40 2016 > > New Revision: 302194 > > URL: https://svnweb.freebsd.org/changeset/base/302194 > > > Log: > > For pthread_mutex_trylock() call on owned error-check or non-portable > > adaptive mutex, return EDEADLK as required by POSIX. The > > pthread_mutex_lock() is already compliant. > > > Tested by: Guy Yur > > Sponsored by: The FreeBSD Foundation > > MFC after: 2 weeks > > Approved by: re (gjb) > > > Modified: > > head/lib/libthr/thread/thr_mutex.c > > > Modified: head/lib/libthr/thread/thr_mutex.c > > ============================================================================== > > --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 10:08:04 2016 (r302193) > > +++ head/lib/libthr/thread/thr_mutex.c Sat Jun 25 11:30:40 2016 (r302194) > > @@ -850,9 +850,12 @@ mutex_self_trylock(struct pthread_mutex > > > > switch (PMUTEX_TYPE(m->m_flags)) { > > case PTHREAD_MUTEX_ERRORCHECK: > > - case PTHREAD_MUTEX_NORMAL: > > case PTHREAD_MUTEX_ADAPTIVE_NP: > > - ret = EBUSY; > > + ret = EDEADLK; > > + break; > > + > > + case PTHREAD_MUTEX_NORMAL: > > + ret = EBUSY; > > break; > > > > case PTHREAD_MUTEX_RECURSIVE: > > I think POSIX (SUSv4tc1, XSH 3 pthread_mutex_lock) is clear that only > pthread_mutex_lock() can fail with [EDEADLK], not > pthread_mutex_trylock(). Instead, the error [EBUSY] listed for > pthread_mutex_trylock() applies whenever the mutex could not be acquired > because it was already locked. This includes the case where the mutex is > owned by the current thread. Note that POSIX intends to allow not > storing the owning thread's ID in non-recursive non-robust mutexes. > > Failing pthread_mutex_trylock() on owned mutexes only with [EBUSY] also > matches our code before this commit and NetBSD's code, and is apparently > expected by other code. > > Therefore, I think this commit should be reverted. > I already asked re for approval of the reversal and got it. But I am still hesitating doing the revert vs. returning EDEADLK for error-checking mutexes. My initial mistake was reading the statement about PTHREAD_MUTEX_ERRORCHECK returning EDEADLK as the requirement for both functions. It was induced by reading the following code in samba: https://github.com/samba-team/samba/blob/master/lib/tdb/common/mutex.c#L928 I did extracted this into stand-alone test and checked that glibc does return EDEADLK in this case. BTW, if somebody has Solaris machine available to test this, I would be grateful. Code is available at https://www.kib.kiev.ua/kib/pshared/pthread_samba.c I.e., plain revert would disable the only known to me consumer of the robust mutexes. The patch which I mailed last time, returns EDEADLK for trylock on ERRORCHECKed mutexes only. And I am tending toward glibc compatibility there, over the literal POSIX compliance, but I want to see the confirmation from the Klimenko' test first. From owner-svn-src-all@freebsd.org Sat Jun 25 17:43:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB958B814D9; Sat, 25 Jun 2016 17:43:21 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADA5D1DC9; Sat, 25 Jun 2016 17:43:21 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=IT5rcQLE7hgKyZnCAqJtt8U6JHe1r8mAlqCXQ2pV2xo=; b=ZqWkAaDqrcOw2rMgqR/qnLrcNpAYrL1Wp39Nme0xRkMiPKBJwbRKSEcbKD0s1bs3asImR/uB4t4KOsA2cvYF8NS9Si0riXgsumdflKoOCwA9xbI2ZnZPnTP2SvUhALL7MIuDlobbowXmjHXxZwfJPFWzOhUBRv/VJPl8rqfp3bg=; Received: from [37.229.193.176] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1bGrbx-000FWL-Tw ; Sat, 25 Jun 2016 20:43:17 +0300 Date: Sat, 25 Jun 2016 20:43:17 +0300 From: Ivan Klymenko To: Konstantin Belousov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625204317.0aae5c98@nonamehost.local> In-Reply-To: <20160625161615.GD38613@kib.kiev.ua> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625164403.70684b3b@nonamehost.local> <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> <20160625142915.GX38613@kib.kiev.ua> <20160625175503.7c57d42b@nonamehost.local> <20160625152006.GA38613@kib.kiev.ua> <20160625190346.19a1ef0d@nonamehost.local> <20160625161615.GD38613@kib.kiev.ua> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=37.229.193.176; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 17:43:22 -0000 On Sat, 25 Jun 2016 19:16:15 +0300 Konstantin Belousov wrote: > On Sat, Jun 25, 2016 at 07:03:46PM +0300, Ivan Klymenko wrote: > > On Sat, 25 Jun 2016 18:20:06 +0300 > > Konstantin Belousov wrote: > > > diff --git a/lib/libthr/thread/thr_mutex.c > > > b/lib/libthr/thread/thr_mutex.c index 2ad05ca..1ae75fb 100644 > > > --- a/lib/libthr/thread/thr_mutex.c > > > +++ b/lib/libthr/thread/thr_mutex.c > > > @@ -850,10 +871,10 @@ mutex_self_trylock(struct pthread_mutex *m) > > > > > > switch (PMUTEX_TYPE(m->m_flags)) { > > > case PTHREAD_MUTEX_ERRORCHECK: > > > - case PTHREAD_MUTEX_ADAPTIVE_NP: > > > ret = EDEADLK; > > > break; > > > > > > + case PTHREAD_MUTEX_ADAPTIVE_NP: > > > case PTHREAD_MUTEX_NORMAL: > > > ret = EBUSY; > > > break; > > > > Strange, it's not helped http://pastebin.com/jbzP0JW2 > > Are you sure that the new libthr was installed ? Compile and run the > following test, please, and show me the results. On the patched > libthr, the program must not output anything and exits with error > code 0. > > /* $Id: pthread_errrecurse.c,v 1.1 2016/06/25 16:12:41 kostik Exp > kostik $ */ > > #include > #include > #include > > int > main(void) > { > pthread_mutex_t m; > pthread_mutexattr_t ma; > int error; > > error = pthread_mutexattr_init(&ma); > if (error != 0) > err(1, "mutexattr_init"); > error = pthread_mutexattr_settype(&ma, > PTHREAD_MUTEX_ADAPTIVE_NP); if (error != 0) > err(1, "mutexattr_settype"); > error = pthread_mutex_init(&m, &ma); > if (error != 0) > err(1, "mutex_init"); > error = pthread_mutex_trylock(&m); > if (error != 0) > err(1, "mutex_trylock 1"); > error = pthread_mutex_trylock(&m); > if (error != EBUSY) > err(1, "mutex_trylock 2"); > else if (error == 0) > errx(1, "mutex_trylock 2 succeeded"); > return (0); > } > ./thr_mutex_test thr_mutex_test: mutex_trylock 2: No error: 0 From owner-svn-src-all@freebsd.org Sat Jun 25 18:05:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FC39B8188E; Sat, 25 Jun 2016 18:05:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 026BC18F4; Sat, 25 Jun 2016 18:05:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u5PI5iQn021825 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 25 Jun 2016 21:05:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u5PI5iQn021825 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u5PI5its021814; Sat, 25 Jun 2016 21:05:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Jun 2016 21:05:43 +0300 From: Konstantin Belousov To: Ivan Klymenko Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625180543.GF38613@kib.kiev.ua> References: <20160625135508.GV38613@kib.kiev.ua> <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> <20160625142915.GX38613@kib.kiev.ua> <20160625175503.7c57d42b@nonamehost.local> <20160625152006.GA38613@kib.kiev.ua> <20160625190346.19a1ef0d@nonamehost.local> <20160625161615.GD38613@kib.kiev.ua> <20160625204317.0aae5c98@nonamehost.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625204317.0aae5c98@nonamehost.local> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 18:05:53 -0000 On Sat, Jun 25, 2016 at 08:43:17PM +0300, Ivan Klymenko wrote: > ./thr_mutex_test > thr_mutex_test: mutex_trylock 2: No error: 0 Ok, there is a bug in my test, it must use errc(3) and not err(3). Please retest wth the updated code below. But I am sure that you would see EDEADLK (Resource deadlock avoided) error, which means that you have wrong, i.e. unpatched libthr, installed. For me, the output is sandy% ./pthread_errrecurse sandy% echo $? 0 From owner-svn-src-all@freebsd.org Sat Jun 25 18:07:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B29BB818E2; Sat, 25 Jun 2016 18:07:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D3A51A9D; Sat, 25 Jun 2016 18:07:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u5PI6vWU022177 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 25 Jun 2016 21:06:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u5PI6vWU022177 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u5PI6vlJ022176; Sat, 25 Jun 2016 21:06:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Jun 2016 21:06:57 +0300 From: Konstantin Belousov To: Ivan Klymenko Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625180657.GG38613@kib.kiev.ua> References: <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> <20160625142915.GX38613@kib.kiev.ua> <20160625175503.7c57d42b@nonamehost.local> <20160625152006.GA38613@kib.kiev.ua> <20160625190346.19a1ef0d@nonamehost.local> <20160625161615.GD38613@kib.kiev.ua> <20160625204317.0aae5c98@nonamehost.local> <20160625180543.GF38613@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625180543.GF38613@kib.kiev.ua> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 18:07:02 -0000 On Sat, Jun 25, 2016 at 09:05:43PM +0300, Konstantin Belousov wrote: > On Sat, Jun 25, 2016 at 08:43:17PM +0300, Ivan Klymenko wrote: > > ./thr_mutex_test > > thr_mutex_test: mutex_trylock 2: No error: 0 > > Ok, there is a bug in my test, it must use errc(3) and not err(3). Please > retest wth the updated code below. But I am sure that you would see > EDEADLK (Resource deadlock avoided) error, which means that you have > wrong, i.e. unpatched libthr, installed. > > For me, the output is > sandy% ./pthread_errrecurse > sandy% echo $? > 0 > Err, the updated test. /* $Id: pthread_errrecurse.c,v 1.2 2016/06/25 18:02:54 kostik Exp kostik $ */ #include #include #include int main(void) { pthread_mutex_t m; pthread_mutexattr_t ma; int error; error = pthread_mutexattr_init(&ma); if (error != 0) errc(1, error, "mutexattr_init"); error = pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ADAPTIVE_NP); if (error != 0) errc(1, error, "mutexattr_settype"); error = pthread_mutex_init(&m, &ma); if (error != 0) errc(1, error, "mutex_init"); error = pthread_mutex_trylock(&m); if (error != 0) errc(1, error, "mutex_trylock 1"); error = pthread_mutex_trylock(&m); if (error != EBUSY) errc(1, error, "mutex_trylock 2"); else if (error == 0) errx(1, "mutex_trylock 2 succeeded"); return (0); } From owner-svn-src-all@freebsd.org Sat Jun 25 18:25:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E70A3B81CDB; Sat, 25 Jun 2016 18:25:52 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B6032526; Sat, 25 Jun 2016 18:25:51 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=RcAXX/GOINFltmJUZNIh5aCeeJPDxSafm2nVRNzdl/c=; b=M4bqp3WUinoyCfKxVKdrotfaH0yAez7enNo1mLN6P0K/9k+vvRpD4aSzaPz4JrEvpQu1ZbF//voYh1Zodw5SIX851jDmjK4GlUICZIAHuaduHGIY9/bPJIyEe9kugmOKfYYnvNi07Ub3JDVFhmgdv4lpbobsm4D12OdgN9v6eN0=; Received: from [37.229.193.176] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1bGsH7-0004Pc-7T ; Sat, 25 Jun 2016 21:25:49 +0300 Date: Sat, 25 Jun 2016 21:25:48 +0300 From: Ivan Klymenko To: Konstantin Belousov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625212548.14057aa1@nonamehost.local> In-Reply-To: <20160625180657.GG38613@kib.kiev.ua> References: <20160625170406.77c79b2e@nonamehost.local> <20160625140529.GW38613@kib.kiev.ua> <20160625171800.50a43746@nonamehost.local> <20160625142915.GX38613@kib.kiev.ua> <20160625175503.7c57d42b@nonamehost.local> <20160625152006.GA38613@kib.kiev.ua> <20160625190346.19a1ef0d@nonamehost.local> <20160625161615.GD38613@kib.kiev.ua> <20160625204317.0aae5c98@nonamehost.local> <20160625180543.GF38613@kib.kiev.ua> <20160625180657.GG38613@kib.kiev.ua> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Authentication-Result: IP=37.229.193.176; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 18:25:53 -0000 On Sat, 25 Jun 2016 21:06:57 +0300 Konstantin Belousov wrote: > On Sat, Jun 25, 2016 at 09:05:43PM +0300, Konstantin Belousov wrote: > > On Sat, Jun 25, 2016 at 08:43:17PM +0300, Ivan Klymenko wrote: =20 > > > ./thr_mutex_test > > > thr_mutex_test: mutex_trylock 2: No error: 0 =20 > >=20 > > Ok, there is a bug in my test, it must use errc(3) and not err(3). > > Please retest wth the updated code below. But I am sure that you > > would see EDEADLK (Resource deadlock avoided) error, which means > > that you have wrong, i.e. unpatched libthr, installed. > >=20 > > For me, the output is=20 > > sandy% ./pthread_errrecurse > > sandy% echo $? > > 0 > > =20 > Err, the updated test. >=20 > /* $Id: pthread_errrecurse.c,v 1.2 2016/06/25 18:02:54 kostik Exp > kostik $ */ >=20 > #include > #include > #include >=20 > int > main(void) > { > pthread_mutex_t m; > pthread_mutexattr_t ma; > int error; >=20 > error =3D pthread_mutexattr_init(&ma); > if (error !=3D 0) > errc(1, error, "mutexattr_init"); > error =3D pthread_mutexattr_settype(&ma, > PTHREAD_MUTEX_ADAPTIVE_NP); if (error !=3D 0) > errc(1, error, "mutexattr_settype"); > error =3D pthread_mutex_init(&m, &ma); > if (error !=3D 0) > errc(1, error, "mutex_init"); > error =3D pthread_mutex_trylock(&m); > if (error !=3D 0) > errc(1, error, "mutex_trylock 1"); > error =3D pthread_mutex_trylock(&m); > if (error !=3D EBUSY) > errc(1, error, "mutex_trylock 2"); > else if (error =3D=3D 0) > errx(1, "mutex_trylock 2 succeeded"); > return (0); > } 1. Patched & installed libthr r302195 2. test for other soft: mousepad=20 GLib (gthread-posix.c): Unexpected error from C library during 'pthread_mutex_trylock': =D0=A3=D0=BD=D0=B8=D0=BA=D0=BD=D1=83=D1=82=D0=BE = =D0=B2=D0=B7=D0=B0=D1=94=D0=BC=D0=BD=D0=B5 =D0=B1=D0=BB=D0=BE=D0=BA=D1=83= =D0=B2=D0=B0=D0=BD=D0=BD=D1=8F =D1=80=D0=B5=D1=81=D1=83=D1=80=D1=81=D1=96= =D0=B2. Aborting. =D0=90=D0=B2=D0=B0=D1=80=D1=96=D0=B9=D0=BD=D0=B5 =D0=B7=D0=B0=D0= =B2=D0=B5=D1=80=D1=88=D0=B5=D0=BD=D0=BD=D1=8F(=D0=B7=D0=B0=D0=BF=D0=B8=D1= =81=D0=B0=D0=BD=D0=BE core) 3.test new ./thr_mutex_test=20 thr_mutex_test: mutex_trylock 2: No error: 0 4. restore patch & install original libthr r302195 5. test for other soft: mousepad GLib (gthread-posix.c): Unexpected error from C library during 'pthread_mutex_trylock': =D0=A3=D0=BD=D0=B8=D0=BA=D0=BD=D1=83=D1=82=D0=BE = =D0=B2=D0=B7=D0=B0=D1=94=D0=BC=D0=BD=D0=B5 =D0=B1=D0=BB=D0=BE=D0=BA=D1=83= =D0=B2=D0=B0=D0=BD=D0=BD=D1=8F =D1=80=D0=B5=D1=81=D1=83=D1=80=D1=81=D1=96= =D0=B2. Aborting. =D0=90=D0=B2=D0=B0=D1=80=D1=96=D0=B9=D0=BD=D0=B5 =D0=B7=D0=B0=D0= =B2=D0=B5=D1=80=D1=88=D0=B5=D0=BD=D0=BD=D1=8F(=D0=B7=D0=B0=D0=BF=D0=B8=D1= =81=D0=B0=D0=BD=D0=BE core) 6. test new ./thr_mutex_test=20 thr_mutex_test: mutex_trylock 2: No error: 0 7. restore & install libthr r302191 8. test for other soft: mousepad - complete run 9. test new ./thr_mutex_test=20 thr_mutex_test: mutex_trylock 2: No error: 0 From owner-svn-src-all@freebsd.org Sat Jun 25 18:36:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B845B81EFC; Sat, 25 Jun 2016 18:36:55 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.netplex.net", Issuer "RapidSSL SHA256 CA - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 187EE2A06; Sat, 25 Jun 2016 18:36:54 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.15.1/8.15.1/NETPLEX) with ESMTP id u5PIaqua011898; Sat, 25 Jun 2016 14:36:52 -0400 X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.4.3 (mail.netplex.net [204.213.176.9]); Sat, 25 Jun 2016 14:36:52 -0400 (EDT) Date: Sat, 25 Jun 2016 14:36:52 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net Reply-To: Daniel Eischen To: Konstantin Belousov cc: Jilles Tjoelker , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread In-Reply-To: <20160625172956.GE38613@kib.kiev.ua> Message-ID: References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625171440.GA19698@stack.nl> <20160625172956.GE38613@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 18:36:55 -0000 On Sat, 25 Jun 2016, Konstantin Belousov wrote: > On Sat, Jun 25, 2016 at 07:14:40PM +0200, Jilles Tjoelker wrote: >> On Sat, Jun 25, 2016 at 11:30:40AM +0000, Konstantin Belousov wrote: >>> Author: kib >>> Date: Sat Jun 25 11:30:40 2016 >>> New Revision: 302194 >>> URL: https://svnweb.freebsd.org/changeset/base/302194 >> >>> Log: >>> For pthread_mutex_trylock() call on owned error-check or non-portable >>> adaptive mutex, return EDEADLK as required by POSIX. The >>> pthread_mutex_lock() is already compliant. >> >>> Tested by: Guy Yur >>> Sponsored by: The FreeBSD Foundation >>> MFC after: 2 weeks >>> Approved by: re (gjb) >> >>> Modified: >>> head/lib/libthr/thread/thr_mutex.c >> >>> Modified: head/lib/libthr/thread/thr_mutex.c >>> ============================================================================== >>> --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 10:08:04 2016 (r302193) >>> +++ head/lib/libthr/thread/thr_mutex.c Sat Jun 25 11:30:40 2016 (r302194) >>> @@ -850,9 +850,12 @@ mutex_self_trylock(struct pthread_mutex >>> >>> switch (PMUTEX_TYPE(m->m_flags)) { >>> case PTHREAD_MUTEX_ERRORCHECK: >>> - case PTHREAD_MUTEX_NORMAL: >>> case PTHREAD_MUTEX_ADAPTIVE_NP: >>> - ret = EBUSY; >>> + ret = EDEADLK; >>> + break; >>> + >>> + case PTHREAD_MUTEX_NORMAL: >>> + ret = EBUSY; >>> break; >>> >>> case PTHREAD_MUTEX_RECURSIVE: >> >> I think POSIX (SUSv4tc1, XSH 3 pthread_mutex_lock) is clear that only >> pthread_mutex_lock() can fail with [EDEADLK], not >> pthread_mutex_trylock(). Instead, the error [EBUSY] listed for >> pthread_mutex_trylock() applies whenever the mutex could not be acquired >> because it was already locked. This includes the case where the mutex is >> owned by the current thread. Note that POSIX intends to allow not >> storing the owning thread's ID in non-recursive non-robust mutexes. >> >> Failing pthread_mutex_trylock() on owned mutexes only with [EBUSY] also >> matches our code before this commit and NetBSD's code, and is apparently >> expected by other code. >> >> Therefore, I think this commit should be reverted. >> > > I already asked re for approval of the reversal and got it. But I am still > hesitating doing the revert vs. returning EDEADLK for error-checking > mutexes. > > My initial mistake was reading the statement about PTHREAD_MUTEX_ERRORCHECK > returning EDEADLK as the requirement for both functions. It was induced > by reading the following code in samba: > https://github.com/samba-team/samba/blob/master/lib/tdb/common/mutex.c#L928 > I did extracted this into stand-alone test and checked that glibc does > return EDEADLK in this case. BTW, if somebody has Solaris machine available > to test this, I would be grateful. Code is available at > https://www.kib.kiev.ua/kib/pshared/pthread_samba.c > > I.e., plain revert would disable the only known to me consumer of the > robust mutexes. The patch which I mailed last time, returns EDEADLK for > trylock on ERRORCHECKed mutexes only. And I am tending toward glibc > compatibility there, over the literal POSIX compliance, but I want to > see the confirmation from the Klimenko' test first. That doesn't make glibc correct. Unless the standards change, we should return EBUSY in this case. It is also unexpected if an implementation's default mutex scheme is PTHREAD_MUTEX_ERRORCHECK and it returns EDEADLK in this case. It's not mentioned in the standard, and no portable application will be expecting it. -- DE From owner-svn-src-all@freebsd.org Sat Jun 25 20:20:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D80B3B81554; Sat, 25 Jun 2016 20:20:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A89BA1418; Sat, 25 Jun 2016 20:20:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PKKO4d000130; Sat, 25 Jun 2016 20:20:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5PKKOGr000129; Sat, 25 Jun 2016 20:20:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201606252020.u5PKKOGr000129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 25 Jun 2016 20:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302201 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 20:20:25 -0000 Author: kib Date: Sat Jun 25 20:20:24 2016 New Revision: 302201 URL: https://svnweb.freebsd.org/changeset/base/302201 Log: Revert r302194, there are issues with some applications after changing the return value, in particular console-kit-daemon. Reported by: Ivan Klymenko Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Approved by: re (gjb) Modified: head/lib/libthr/thread/thr_mutex.c Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Sat Jun 25 14:20:34 2016 (r302200) +++ head/lib/libthr/thread/thr_mutex.c Sat Jun 25 20:20:24 2016 (r302201) @@ -850,11 +850,8 @@ mutex_self_trylock(struct pthread_mutex switch (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: - case PTHREAD_MUTEX_ADAPTIVE_NP: - ret = EDEADLK; - break; - case PTHREAD_MUTEX_NORMAL: + case PTHREAD_MUTEX_ADAPTIVE_NP: ret = EBUSY; break; From owner-svn-src-all@freebsd.org Sat Jun 25 20:31:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1779BB81729; Sat, 25 Jun 2016 20:31:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D83661B9E; Sat, 25 Jun 2016 20:31:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PKVLss007627; Sat, 25 Jun 2016 20:31:21 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5PKVLFh007626; Sat, 25 Jun 2016 20:31:21 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606252031.u5PKVLFh007626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 25 Jun 2016 20:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302202 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 20:31:22 -0000 Author: adrian Date: Sat Jun 25 20:31:20 2016 New Revision: 302202 URL: https://svnweb.freebsd.org/changeset/base/302202 Log: [net80211] re-revert the ibss "is this local to the bss" patch. avos@ pointed out to me that this broke IBSS merging because the rest of the input path no longer was called for non-IBSS frames. I committed a change to not input non-IBSS frames, which stopped nodes being created for BSSes that weren't ours. Unfortunately thta stopped the input path for non-IBSS frames in general, so the management input path didn't work. So, I'll revert this until I come up with a better solution. (Hopefully before 11.) Reviewed by: avos Approved by: re (gjb) Modified: head/sys/net80211/ieee80211_adhoc.c Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Sat Jun 25 20:20:24 2016 (r302201) +++ head/sys/net80211/ieee80211_adhoc.c Sat Jun 25 20:31:20 2016 (r302202) @@ -371,7 +371,10 @@ adhoc_input(struct ieee80211_node *ni, s /* * Validate the bssid. */ - if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) && + if (!(type == IEEE80211_FC0_TYPE_MGT && + (subtype == IEEE80211_FC0_SUBTYPE_BEACON || + subtype == IEEE80211_FC0_SUBTYPE_PROBE_RESP)) && + !IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) && !IEEE80211_ADDR_EQ(bssid, ifp->if_broadcastaddr)) { /* not interested in */ IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, From owner-svn-src-all@freebsd.org Sat Jun 25 22:24:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BDCFB80937; Sat, 25 Jun 2016 22:24:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D18226B5; Sat, 25 Jun 2016 22:24:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PMOGIC049589; Sat, 25 Jun 2016 22:24:16 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5PMOGwH049588; Sat, 25 Jun 2016 22:24:16 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201606252224.u5PMOGwH049588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 25 Jun 2016 22:24:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302204 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 22:24:17 -0000 Author: bz Date: Sat Jun 25 22:24:16 2016 New Revision: 302204 URL: https://svnweb.freebsd.org/changeset/base/302204 Log: Unbreak building of LINT kernels after r302163. Approved by: re (gjb) Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Jun 25 21:39:21 2016 (r302203) +++ head/sys/conf/NOTES Sat Jun 25 22:24:16 2016 (r302204) @@ -1345,7 +1345,7 @@ options CAM_MAX_HIGHPOWER=4 options SCSI_NO_SENSE_STRINGS options SCSI_NO_OP_STRINGS options SCSI_DELAY=5000 # Be pessimistic about Joe SCSI device -options CAM_NETFLIX_IOSCHED +options CAM_IOSCHED_DYNAMIC # Options for the CAM CDROM driver: # CHANGER_MIN_BUSY_SECONDS: Guaranteed minimum time quantum for a changer LUN From owner-svn-src-all@freebsd.org Sat Jun 25 22:33:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECA31B80C4E; Sat, 25 Jun 2016 22:33:42 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B95EE2BF3; Sat, 25 Jun 2016 22:33:42 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 0A609358C61; Sun, 26 Jun 2016 00:33:39 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id DE09428494; Sun, 26 Jun 2016 00:33:38 +0200 (CEST) Date: Sun, 26 Jun 2016 00:33:38 +0200 From: Jilles Tjoelker To: Konstantin Belousov Cc: Daniel Eischen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302194 - head/lib/libthr/thread Message-ID: <20160625223338.GA22802@stack.nl> References: <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625171440.GA19698@stack.nl> <20160625172956.GE38613@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625172956.GE38613@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 22:33:43 -0000 On Sat, Jun 25, 2016 at 08:29:56PM +0300, Konstantin Belousov wrote: > I already asked re for approval of the reversal and got it. But I am still > hesitating doing the revert vs. returning EDEADLK for error-checking > mutexes. > My initial mistake was reading the statement about PTHREAD_MUTEX_ERRORCHECK > returning EDEADLK as the requirement for both functions. It was induced > by reading the following code in samba: > https://github.com/samba-team/samba/blob/master/lib/tdb/common/mutex.c#L928 > I did extracted this into stand-alone test and checked that glibc does > return EDEADLK in this case. BTW, if somebody has Solaris machine available > to test this, I would be grateful. Code is available at > https://www.kib.kiev.ua/kib/pshared/pthread_samba.c > I.e., plain revert would disable the only known to me consumer of the > robust mutexes. The patch which I mailed last time, returns EDEADLK for > trylock on ERRORCHECKed mutexes only. And I am tending toward glibc > compatibility there, over the literal POSIX compliance, but I want to > see the confirmation from the Klimenko' test first. To be bug-compatible with glibc, you'd need to return the wrong [EDEADLK] error for robust errorcheck mutexes only. Robust non-errorcheck and non-robust errorcheck mutexes return the correct [EBUSY]. I have not checked PI and PP mutexes which probably use a different code path. I'm not sure whether we should copy glibc's bug, but if we do it must be documented in the man page. I'm not happy with it because the bug may break applications written to the standard; at least, Samba developers should be contacted first. -- Jilles Tjoelker