From owner-svn-src-stable-9@FreeBSD.ORG Mon Sep 16 02:01:37 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 83BA06CE; Mon, 16 Sep 2013 02:01:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6FD692336; Mon, 16 Sep 2013 02:01:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8G21bY3005605; Mon, 16 Sep 2013 02:01:37 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8G21bul005604; Mon, 16 Sep 2013 02:01:37 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201309160201.r8G21bul005604@svn.freebsd.org> From: Glen Barber Date: Mon, 16 Sep 2013 02:01:37 +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: r255606 - stable/9/share/man/man5 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 02:01:37 -0000 Author: gjb Date: Mon Sep 16 02:01:36 2013 New Revision: 255606 URL: http://svnweb.freebsd.org/changeset/base/255606 Log: MFC r255505: Do not install freebsd-update.conf.5 manual if WITHOUT_FREEBSD_UPDATE is set. Sponsored by: The FreeBSD Foundation Modified: stable/9/share/man/man5/Makefile Directory Properties: stable/9/share/man/man5/ (props changed) Modified: stable/9/share/man/man5/Makefile ============================================================================== --- stable/9/share/man/man5/Makefile Mon Sep 16 00:06:54 2013 (r255605) +++ stable/9/share/man/man5/Makefile Mon Sep 16 02:01:36 2013 (r255606) @@ -25,7 +25,6 @@ MAN= acct.5 \ fbtab.5 \ fdescfs.5 \ forward.5 \ - freebsd-update.conf.5 \ fs.5 \ fstab.5 \ group.5 \ @@ -80,6 +79,10 @@ MLINKS+=quota.user.5 quota.group.5 MLINKS+=rc.conf.5 rc.conf.local.5 MLINKS+=resolver.5 resolv.conf.5 +.if ${MK_FREEBSD_UPDATE} != "no" +MAN+= freebsd-update.conf.5 +.endif + .if ${MK_HESIOD} != "no" MAN+= hesiod.conf.5 .endif From owner-svn-src-stable-9@FreeBSD.ORG Mon Sep 16 10:04:20 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 885B6603; Mon, 16 Sep 2013 10:04:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 751032C4C; Mon, 16 Sep 2013 10:04:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8GA4KE0061767; Mon, 16 Sep 2013 10:04:20 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8GA4KWC061765; Mon, 16 Sep 2013 10:04:20 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201309161004.r8GA4KWC061765@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 16 Sep 2013 10:04:20 +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: r255609 - stable/9/sys/dev/usb/controller X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 10:04:20 -0000 Author: hselasky Date: Mon Sep 16 10:04:19 2013 New Revision: 255609 URL: http://svnweb.freebsd.org/changeset/base/255609 Log: MFC r255356: Revert parts of r245132 and r245175. We don't need to write to the IMAN register to clear the pending interrupt status bits. This patch tries to solve problems seen on the MacBook Air, as reported by Johannes Lundberg Modified: stable/9/sys/dev/usb/controller/xhci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/9/sys/dev/usb/controller/xhci.c Mon Sep 16 06:25:54 2013 (r255608) +++ stable/9/sys/dev/usb/controller/xhci.c Mon Sep 16 10:04:19 2013 (r255609) @@ -1446,7 +1446,6 @@ void xhci_interrupt(struct xhci_softc *sc) { uint32_t status; - uint32_t iman; USB_BUS_LOCK(&sc->sc_bus); @@ -1461,15 +1460,6 @@ xhci_interrupt(struct xhci_softc *sc) DPRINTFN(16, "real interrupt (status=0x%08x)\n", status); if (status & XHCI_STS_EINT) { - - /* acknowledge pending event */ - iman = XREAD4(sc, runt, XHCI_IMAN(0)); - - /* reset interrupt */ - XWRITE4(sc, runt, XHCI_IMAN(0), iman); - - DPRINTFN(16, "real interrupt (iman=0x%08x)\n", iman); - /* check for event(s) */ xhci_interrupt_poll(sc); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Sep 16 12:21:01 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CF93C157; Mon, 16 Sep 2013 12:21:01 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-vc0-x22a.google.com (mail-vc0-x22a.google.com [IPv6:2607:f8b0:400c:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 46B842909; Mon, 16 Sep 2013 12:21:01 +0000 (UTC) Received: by mail-vc0-f170.google.com with SMTP id kw10so2875048vcb.29 for ; Mon, 16 Sep 2013 05:21:00 -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-type; bh=QeFWoC/SpNYQK+98O1Q94Y86ns4aAjJP2d21UVAgUBg=; b=0w6QICdzbWQ4YrrlJj3VuGT42ooIjzFISsbNrzCKczpAz+0ep15r4FXjYpRGDOY7Ds fn4hx1V8IRPBYIc0agKH5qR6SGWnN+mIqmiOEoZTM+kDJSKKLv9xPDPuB4lKpOHnfDCd 8c0YBz//lcaB4rf3hsNnXmpwzbXm9sLP4EEACZH8Wh7aU3eiQsiM7aw+TjgfBNKWAZ7K npt//abJ9ojU662K+8lL7XJGTAO1z7n6gEgd+OvAF7BUfuIJ+mskRQpvqL0RRw/9H4Kn elnSRCo8W1DWJz0Qin4INi6ro4Ym5pvP8LRu4eeffzqpq9Jd0bwa5JfrLaz/ehLueX7g xG3g== X-Received: by 10.221.27.73 with SMTP id rp9mr89077vcb.29.1379334060356; Mon, 16 Sep 2013 05:21:00 -0700 (PDT) MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.58.229.167 with HTTP; Mon, 16 Sep 2013 05:20:20 -0700 (PDT) In-Reply-To: <201309141012.r8EACTW9032484@svn.freebsd.org> References: <201309141012.r8EACTW9032484@svn.freebsd.org> From: Ivan Voras Date: Mon, 16 Sep 2013 14:20:20 +0200 X-Google-Sender-Auth: -y21_rtjgQzQ_FrNZlbQMtxW_rw Message-ID: Subject: Re: svn commit: r255567 - stable/9/sys/geom/zero To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 12:21:01 -0000 On 14 September 2013 12:12, Alexander Motin wrote: > Add unmapped BIO support to GEOM ZERO if kern.geom.zero.clear is cleared. > + if (g_zero_clear && (bp->bio_flags & BIO_UNMAPPED) == 0) > memset(bp->bio_data, g_zero_byte, bp->bio_length); Umm, I might be wrong, but won't this basically export random kernel memory to anyone reading from /dev/gzero? From owner-svn-src-stable-9@FreeBSD.ORG Mon Sep 16 12:42:20 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 45379791; Mon, 16 Sep 2013 12:42:20 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bk0-x235.google.com (mail-bk0-x235.google.com [IPv6:2a00:1450:4008:c01::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2C9132A7C; Mon, 16 Sep 2013 12:42:19 +0000 (UTC) Received: by mail-bk0-f53.google.com with SMTP id d7so1466355bkh.26 for ; Mon, 16 Sep 2013 05:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=IK9gujTyD/CEzs5FG0gpjZhq63qEta1WhhBQI7b2QUA=; b=ZTEMbU1eHUqi8lrqNjrGy29Q+QXN44VnyEWcVUhIr1v6tgWhZ5MeX+CCEzw1s0Nvz0 ayIr+Hjq2e/WlOuBMMP2y9neEX3XueInsUpk3Bbwqk4iMB0kNddOkcyFIPv8OVo1c3Mr JZRWBUzw0AEn0d5Rep3ly3Q5TQvgHa5KILGnnPMYAlMPzPnnqZPoIuW3y1FT2b/2qfnu u5r0s7tld6kpw5w3DiD7pgIB+tgNBqsaxjZ0Z6KU62QJ913AyWnG6XiUT3oc+PYpvHo4 uLfHJev1ML89cb+xVqbyLNH3MtG325uMjLXupXiXnY+9NIujBajD0rHHZDMZjRqOQ9R/ cWpA== X-Received: by 10.204.123.199 with SMTP id q7mr24693336bkr.10.1379335337405; Mon, 16 Sep 2013 05:42:17 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([5.248.115.71]) by mx.google.com with ESMTPSA id b6sm7562305bko.16.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 05:42:16 -0700 (PDT) Sender: Alexander Motin Message-ID: <5236FCA6.6070106@FreeBSD.org> Date: Mon, 16 Sep 2013 15:42:14 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130616 Thunderbird/17.0.6 MIME-Version: 1.0 To: Ivan Voras Subject: Re: svn commit: r255567 - stable/9/sys/geom/zero References: <201309141012.r8EACTW9032484@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 12:42:20 -0000 On 16.09.2013 15:20, Ivan Voras wrote: > On 14 September 2013 12:12, Alexander Motin wrote: > >> Add unmapped BIO support to GEOM ZERO if kern.geom.zero.clear is cleared. > >> + if (g_zero_clear && (bp->bio_flags & BIO_UNMAPPED) == 0) >> memset(bp->bio_data, g_zero_byte, bp->bio_length); > > > Umm, I might be wrong, but won't this basically export random kernel > memory to anyone reading from /dev/gzero? I may be wrong, but I think it won't. Buffer for reading is provided by the caller, mapped to KVA and then unmapped back without modifications. If there was some garbage in the buffer, it will remain there, but that is a caller's garbage. There may be exceptions in case of of gstripe and graid3 that allocate own buffers I am not sure they clean before use, but do you know many people using graid3 on top of gzero? -- Alexander Motin From owner-svn-src-stable-9@FreeBSD.ORG Mon Sep 16 16:43:58 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2AF8FB27; Mon, 16 Sep 2013 16:43:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 13D8C2B2D; Mon, 16 Sep 2013 16:43:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8GGhvvp076004; Mon, 16 Sep 2013 16:43:57 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8GGhv97076003; Mon, 16 Sep 2013 16:43:57 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201309161643.r8GGhv97076003@svn.freebsd.org> From: Xin LI Date: Mon, 16 Sep 2013 16:43:57 +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: r255616 - stable/9/usr.sbin/mtree X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 16:43:58 -0000 Author: delphij Date: Mon Sep 16 16:43:57 2013 New Revision: 255616 URL: http://svnweb.freebsd.org/changeset/base/255616 Log: MFC r255483: Do not emit size for non-regular files. There is nothing that mtree(1) can do in this situation and would cause confusion. Modified: stable/9/usr.sbin/mtree/create.c Directory Properties: stable/9/usr.sbin/mtree/ (props changed) Modified: stable/9/usr.sbin/mtree/create.c ============================================================================== --- stable/9/usr.sbin/mtree/create.c Mon Sep 16 15:10:11 2013 (r255615) +++ stable/9/usr.sbin/mtree/create.c Mon Sep 16 16:43:57 2013 (r255616) @@ -208,7 +208,7 @@ statf(int indent, FTSENT *p) output(indent, &offset, "mode=%#o", p->fts_statp->st_mode & MBITS); if (keys & F_NLINK && p->fts_statp->st_nlink != 1) output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink); - if (keys & F_SIZE) + if (keys & F_SIZE && S_ISREG(p->fts_statp->st_mode)) output(indent, &offset, "size=%jd", (intmax_t)p->fts_statp->st_size); if (keys & F_TIME) From owner-svn-src-stable-9@FreeBSD.ORG Tue Sep 17 12:50:58 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 50817207; Tue, 17 Sep 2013 12:50:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3E2F5237C; Tue, 17 Sep 2013 12:50:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8HCowKI029093; Tue, 17 Sep 2013 12:50:58 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8HCovlT029090; Tue, 17 Sep 2013 12:50:57 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201309171250.r8HCovlT029090@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 17 Sep 2013 12:50:57 +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: r255630 - stable/9/sys/dev/usb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Sep 2013 12:50:58 -0000 Author: hselasky Date: Tue Sep 17 12:50:57 2013 New Revision: 255630 URL: http://svnweb.freebsd.org/changeset/base/255630 Log: MFC r248246: - Make quirk for reading device descriptor from broken USB devices. Else they won't enumerate at all: hw.usb.full_ddesc=1 - Reduce the USB descriptor read timeout from 1000ms to 500ms. Typical value for LOW speed devices is 50-100ms. - Enumerate USB device a maximum of 3 times when a port connection change event is detected, before giving up. Modified: stable/9/sys/dev/usb/usb_device.c stable/9/sys/dev/usb/usb_request.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usb_device.c ============================================================================== --- stable/9/sys/dev/usb/usb_device.c Tue Sep 17 11:48:47 2013 (r255629) +++ stable/9/sys/dev/usb/usb_device.c Tue Sep 17 12:50:57 2013 (r255630) @@ -1673,10 +1673,14 @@ usb_alloc_device(device_t parent_dev, st err = usbd_setup_device_desc(udev, NULL); if (err != 0) { - /* XXX try to re-enumerate the device */ + /* try to enumerate two more times */ err = usbd_req_re_enumerate(udev, NULL); - if (err) - goto done; + if (err != 0) { + err = usbd_req_re_enumerate(udev, NULL); + if (err != 0) { + goto done; + } + } } /* Modified: stable/9/sys/dev/usb/usb_request.c ============================================================================== --- stable/9/sys/dev/usb/usb_request.c Tue Sep 17 11:48:47 2013 (r255629) +++ stable/9/sys/dev/usb/usb_request.c Tue Sep 17 12:50:57 2013 (r255630) @@ -71,6 +71,11 @@ static int usb_no_cs_fail; SYSCTL_INT(_hw_usb, OID_AUTO, no_cs_fail, CTLFLAG_RW, &usb_no_cs_fail, 0, "USB clear stall failures are ignored, if set"); +static int usb_full_ddesc; + +SYSCTL_INT(_hw_usb, OID_AUTO, full_ddesc, CTLFLAG_RW, + &usb_full_ddesc, 0, "USB always read complete device descriptor, if set"); + #ifdef USB_DEBUG #ifdef USB_REQ_DEBUG /* The following structures are used in connection to fault injection. */ @@ -996,7 +1001,7 @@ usbd_req_get_desc(struct usb_device *ude USETW(req.wLength, min_len); err = usbd_do_request_flags(udev, mtx, &req, - desc, 0, NULL, 1000); + desc, 0, NULL, 500 /* ms */); if (err) { if (!retries) { @@ -1881,32 +1886,41 @@ usbd_setup_device_desc(struct usb_device */ switch (udev->speed) { case USB_SPEED_FULL: - case USB_SPEED_LOW: + if (usb_full_ddesc != 0) { + /* get full device descriptor */ + err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); + if (err == 0) + break; + } + + /* get partial device descriptor, some devices crash on this */ err = usbd_req_get_desc(udev, mtx, NULL, &udev->ddesc, USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0); - if (err != 0) { - DPRINTFN(0, "getting device descriptor " - "at addr %d failed, %s\n", udev->address, - usbd_errstr(err)); - return (err); - } + if (err != 0) + break; + + /* get the full device descriptor */ + err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); break; + default: DPRINTF("Minimum MaxPacketSize is large enough " - "to hold the complete device descriptor\n"); - break; - } + "to hold the complete device descriptor or " + "only once MaxPacketSize choice\n"); - /* get the full device descriptor */ - err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); - - /* try one more time, if error */ - if (err) + /* get the full device descriptor */ err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); - if (err) { - DPRINTF("addr=%d, getting full desc failed\n", - udev->address); + /* try one more time, if error */ + if (err != 0) + err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); + break; + } + + if (err != 0) { + DPRINTFN(0, "getting device descriptor " + "at addr %d failed, %s\n", udev->address, + usbd_errstr(err)); return (err); } From owner-svn-src-stable-9@FreeBSD.ORG Tue Sep 17 12:53:09 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E66E3480; Tue, 17 Sep 2013 12:53:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D19FA23A3; Tue, 17 Sep 2013 12:53:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8HCr9qU029863; Tue, 17 Sep 2013 12:53:09 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8HCr909029862; Tue, 17 Sep 2013 12:53:09 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201309171253.r8HCr909029862@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 17 Sep 2013 12:53: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: r255631 - stable/9/sys/dev/usb/input X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Sep 2013 12:53:10 -0000 Author: hselasky Date: Tue Sep 17 12:53:09 2013 New Revision: 255631 URL: http://svnweb.freebsd.org/changeset/base/255631 Log: MFC r254572: Force keyboards which don't have the required HID fields to use the USB BOOT protocol for now. PR: usb/181425 Modified: stable/9/sys/dev/usb/input/ukbd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/9/sys/dev/usb/input/ukbd.c Tue Sep 17 12:50:57 2013 (r255630) +++ stable/9/sys/dev/usb/input/ukbd.c Tue Sep 17 12:53:09 2013 (r255631) @@ -1126,8 +1126,12 @@ ukbd_parse_hid(struct ukbd_softc *sc, co HID_USAGE2(HUP_KEYBOARD, 0x00), hid_input, 0, &sc->sc_loc_events, &flags, &sc->sc_id_events)) { - sc->sc_flags |= UKBD_FLAG_EVENTS; - DPRINTFN(1, "Found keyboard events\n"); + if (flags & HIO_VARIABLE) { + DPRINTFN(1, "Ignoring keyboard event control\n"); + } else { + sc->sc_flags |= UKBD_FLAG_EVENTS; + DPRINTFN(1, "Found keyboard event array\n"); + } } /* figure out leds on keyboard */ From owner-svn-src-stable-9@FreeBSD.ORG Tue Sep 17 18:47:31 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AD6BCFA4; Tue, 17 Sep 2013 18:47:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 99B2729E8; Tue, 17 Sep 2013 18:47:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8HIlVc5018716; Tue, 17 Sep 2013 18:47:31 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8HIlV5r018714; Tue, 17 Sep 2013 18:47:31 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201309171847.r8HIlV5r018714@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 17 Sep 2013 18:47:31 +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: r255649 - stable/9/sys/netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Sep 2013 18:47:31 -0000 Author: ae Date: Tue Sep 17 18:47:31 2013 New Revision: 255649 URL: http://svnweb.freebsd.org/changeset/base/255649 Log: MFC r255235: Remove unused code and sort variables declarations. PR: kern/181822 Modified: stable/9/sys/netinet/ip_mroute.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/ip_mroute.c ============================================================================== --- stable/9/sys/netinet/ip_mroute.c Tue Sep 17 18:46:10 2013 (r255648) +++ stable/9/sys/netinet/ip_mroute.c Tue Sep 17 18:47:31 2013 (r255649) @@ -703,10 +703,9 @@ ip_mrouter_init(struct socket *so, int v static int X_ip_mrouter_done(void) { - vifi_t vifi; - int i; struct ifnet *ifp; - struct ifreq ifr; + int i; + vifi_t vifi; MROUTER_LOCK(); @@ -731,11 +730,6 @@ X_ip_mrouter_done(void) for (vifi = 0; vifi < V_numvifs; vifi++) { if (!in_nullhost(V_viftable[vifi].v_lcl_addr) && !(V_viftable[vifi].v_flags & (VIFF_TUNNEL | VIFF_REGISTER))) { - struct sockaddr_in *so = (struct sockaddr_in *)&(ifr.ifr_addr); - - so->sin_len = sizeof(struct sockaddr_in); - so->sin_family = AF_INET; - so->sin_addr.s_addr = INADDR_ANY; ifp = V_viftable[vifi].v_ifp; if_allmulti(ifp, 0); } From owner-svn-src-stable-9@FreeBSD.ORG Wed Sep 18 06:38:41 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 89036F07; Wed, 18 Sep 2013 06:38:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7464A20F6; Wed, 18 Sep 2013 06:38:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8I6cfr2094056; Wed, 18 Sep 2013 06:38:41 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8I6cfe9094055; Wed, 18 Sep 2013 06:38:41 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201309180638.r8I6cfe9094055@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 18 Sep 2013 06:38:41 +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: r255663 - stable/9/sys/dev/usb/storage X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Sep 2013 06:38:41 -0000 Author: hselasky Date: Wed Sep 18 06:38:40 2013 New Revision: 255663 URL: http://svnweb.freebsd.org/changeset/base/255663 Log: MFC r255472: Clear correct data structure. Modified: stable/9/sys/dev/usb/storage/umass.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/storage/umass.c ============================================================================== --- stable/9/sys/dev/usb/storage/umass.c Wed Sep 18 04:44:54 2013 (r255662) +++ stable/9/sys/dev/usb/storage/umass.c Wed Sep 18 06:38:40 2013 (r255663) @@ -1320,10 +1320,12 @@ umass_t_bbb_command_callback(struct usb_ } sc->cbw.bCDBLength = sc->sc_transfer.cmd_len; + /* copy SCSI command data */ memcpy(sc->cbw.CBWCDB, sc->sc_transfer.cmd_data, sc->sc_transfer.cmd_len); - memset(sc->sc_transfer.cmd_data + + /* clear remaining command area */ + memset(sc->cbw.CBWCDB + sc->sc_transfer.cmd_len, 0, sizeof(sc->cbw.CBWCDB) - sc->sc_transfer.cmd_len); From owner-svn-src-stable-9@FreeBSD.ORG Wed Sep 18 11:07:33 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 397C19D0; Wed, 18 Sep 2013 11:07:33 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 26B5521CC; Wed, 18 Sep 2013 11:07:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8IB7XxE037436; Wed, 18 Sep 2013 11:07:33 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8IB7X7Q037435; Wed, 18 Sep 2013 11:07:33 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201309181107.r8IB7X7Q037435@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 18 Sep 2013 11:07:32 +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: r255666 - stable/9/usr.bin/netstat X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Sep 2013 11:07:33 -0000 Author: pluknet Date: Wed Sep 18 11:07:32 2013 New Revision: 255666 URL: http://svnweb.freebsd.org/changeset/base/255666 Log: MFC r248114 (by melifaro): Add forgotten .El Modified: stable/9/usr.bin/netstat/netstat.1 Directory Properties: stable/9/usr.bin/netstat/ (props changed) Modified: stable/9/usr.bin/netstat/netstat.1 ============================================================================== --- stable/9/usr.bin/netstat/netstat.1 Wed Sep 18 08:37:14 2013 (r255665) +++ stable/9/usr.bin/netstat/netstat.1 Wed Sep 18 11:07:32 2013 (r255666) @@ -307,6 +307,7 @@ The flags field shows available ISR hand .It Li D Ta Dv NETISR_SNP_FLAGS_DRAINEDCPU Ta "Has queue drain handler" .It Li F Ta Dv NETISR_SNP_FLAGS_M2FLOW Ta "Able to map mbuf to flow id" .El +.El .Pp Some options have the general meaning: .Bl -tag -width flag From owner-svn-src-stable-9@FreeBSD.ORG Thu Sep 19 05:40:50 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8089A6E2; Thu, 19 Sep 2013 05:40:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6E6762335; Thu, 19 Sep 2013 05:40:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8J5eoOL032497; Thu, 19 Sep 2013 05:40:50 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8J5eogY032496; Thu, 19 Sep 2013 05:40:50 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201309190540.r8J5eogY032496@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 19 Sep 2013 05:40:50 +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: r255693 - stable/9/sys/dev/usb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Sep 2013 05:40:50 -0000 Author: hselasky Date: Thu Sep 19 05:40:49 2013 New Revision: 255693 URL: http://svnweb.freebsd.org/changeset/base/255693 Log: MFC r255488: Don't issue USB resume signalling in USB device mode, if the USB power mode is ON and suspend is detected. This confuses iPads running in USB host mode at least. Modified: stable/9/sys/dev/usb/usb_hub.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usb_hub.c ============================================================================== --- stable/9/sys/dev/usb/usb_hub.c Thu Sep 19 05:07:51 2013 (r255692) +++ stable/9/sys/dev/usb/usb_hub.c Thu Sep 19 05:40:49 2013 (r255693) @@ -2067,7 +2067,8 @@ usbd_transfer_power_ref(struct usb_xfer static uint8_t usb_peer_should_wakeup(struct usb_device *udev) { - return ((udev->power_mode == USB_POWER_MODE_ON) || + return (((udev->power_mode == USB_POWER_MODE_ON) && + (udev->flags.usb_mode == USB_MODE_HOST)) || (udev->driver_added_refcount != udev->bus->driver_added_refcount) || (udev->re_enumerate_wait != 0) || (udev->pwr_save.type_refs[UE_ISOCHRONOUS] != 0) || From owner-svn-src-stable-9@FreeBSD.ORG Thu Sep 19 19:43:29 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9D734FF0; Thu, 19 Sep 2013 19:43:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8A58E2519; Thu, 19 Sep 2013 19:43:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8JJhTSO083081; Thu, 19 Sep 2013 19:43:29 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8JJhTNG083080; Thu, 19 Sep 2013 19:43:29 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201309191943.r8JJhTNG083080@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 19 Sep 2013 19:43:29 +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: r255710 - stable/9/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-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Sep 2013 19:43:29 -0000 Author: glebius Date: Thu Sep 19 19:43:29 2013 New Revision: 255710 URL: http://svnweb.freebsd.org/changeset/base/255710 Log: Merge from r245741 from head: If lagg(4) can't forward a packet due to underlying port problems, return much more meaningful ENETDOWN to the stack, instead of EBUSY. Modified: stable/9/sys/net/if_lagg.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/if_lagg.c ============================================================================== --- stable/9/sys/net/if_lagg.c Thu Sep 19 18:56:00 2013 (r255709) +++ stable/9/sys/net/if_lagg.c Thu Sep 19 19:43:29 2013 (r255710) @@ -820,7 +820,7 @@ lagg_port_output(struct ifnet *ifp, stru /* drop any other frames */ m_freem(m); - return (EBUSY); + return (ENETDOWN); } static void @@ -1893,7 +1893,7 @@ lagg_lacp_start(struct lagg_softc *sc, s lp = lacp_select_tx_port(sc, m); if (lp == NULL) { m_freem(m); - return (EBUSY); + return (ENETDOWN); } /* Send mbuf */ From owner-svn-src-stable-9@FreeBSD.ORG Thu Sep 19 22:06:28 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CD54C36B; Thu, 19 Sep 2013 22:06:28 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B9EF42CE2; Thu, 19 Sep 2013 22:06:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8JM6Sim059240; Thu, 19 Sep 2013 22:06:28 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8JM6SM9059239; Thu, 19 Sep 2013 22:06:28 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201309192206.r8JM6SM9059239@svn.freebsd.org> From: Devin Teske Date: Thu, 19 Sep 2013 22:06:28 +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: r255719 - stable/9/usr.sbin/bsdconfig/examples X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Sep 2013 22:06:28 -0000 Author: dteske Date: Thu Sep 19 22:06:28 2013 New Revision: 255719 URL: http://svnweb.freebsd.org/changeset/base/255719 Log: MFC r255340: Long URLs don't always appear even with autosizing and other tricks. So, add some whitespace to put the URL on a line by itself, maximizing view. MFC r255341: Remove unnecessary mediaClose (FTP operations are done with either ftp(1) or fetch(1), neither of which are stateful, compared to how sysinstall(8) did FTP operations, maintaining an open session until mediaClose). Modified: stable/9/usr.sbin/bsdconfig/examples/browse_packages.sh Directory Properties: stable/9/usr.sbin/bsdconfig/ (props changed) Modified: stable/9/usr.sbin/bsdconfig/examples/browse_packages.sh ============================================================================== --- stable/9/usr.sbin/bsdconfig/examples/browse_packages.sh Thu Sep 19 20:30:35 2013 (r255718) +++ stable/9/usr.sbin/bsdconfig/examples/browse_packages.sh Thu Sep 19 22:06:28 2013 (r255719) @@ -17,9 +17,8 @@ if [ ! -e "$TMPDIR/packages/INDEX" ]; th # For older releases, use ftp://ftp-archive.freebsd.org mediaSetFTP mediaOpen - f_show_info "Downloading packages/INDEX from %s" "$_ftpPath" + f_show_info "Downloading packages/INDEX from\n %s" "$_ftpPath" f_device_get media packages/INDEX > $TMPDIR/packages/INDEX - mediaClose fi _directoryPath=$TMPDIR mediaSetDirectory From owner-svn-src-stable-9@FreeBSD.ORG Fri Sep 20 07:31:33 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 76985753; Fri, 20 Sep 2013 07:31:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 63AED23E8; Fri, 20 Sep 2013 07:31:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8K7VXNM064871; Fri, 20 Sep 2013 07:31:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8K7VXCS064870; Fri, 20 Sep 2013 07:31:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201309200731.r8K7VXCS064870@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 20 Sep 2013 07:31:33 +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: r255727 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Sep 2013 07:31:33 -0000 Author: kib Date: Fri Sep 20 07:31:32 2013 New Revision: 255727 URL: http://svnweb.freebsd.org/changeset/base/255727 Log: MFC r255509: Reduce the scope of the proctree_lock. Modified: stable/9/sys/kern/subr_prf.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_prf.c ============================================================================== --- stable/9/sys/kern/subr_prf.c Fri Sep 20 05:06:03 2013 (r255726) +++ stable/9/sys/kern/subr_prf.c Fri Sep 20 07:31:32 2013 (r255727) @@ -151,26 +151,25 @@ uprintf(const char *fmt, ...) PROC_LOCK(p); if ((p->p_flag & P_CONTROLT) == 0) { PROC_UNLOCK(p); - retval = 0; - goto out; + sx_sunlock(&proctree_lock); + return (0); } SESS_LOCK(p->p_session); pca.tty = p->p_session->s_ttyp; SESS_UNLOCK(p->p_session); PROC_UNLOCK(p); if (pca.tty == NULL) { - retval = 0; - goto out; + sx_sunlock(&proctree_lock); + return (0); } pca.flags = TOTTY; pca.p_bufr = NULL; va_start(ap, fmt); tty_lock(pca.tty); + sx_sunlock(&proctree_lock); retval = kvprintf(fmt, putchar, &pca, 10, ap); tty_unlock(pca.tty); va_end(ap); -out: - sx_sunlock(&proctree_lock); return (retval); } @@ -211,6 +210,7 @@ tprintf(struct proc *p, int pri, const c va_start(ap, fmt); if (pca.tty != NULL) tty_lock(pca.tty); + sx_sunlock(&proctree_lock); kvprintf(fmt, putchar, &pca, 10, ap); if (pca.tty != NULL) tty_unlock(pca.tty); @@ -218,7 +218,6 @@ tprintf(struct proc *p, int pri, const c if (sess != NULL) sess_release(sess); msgbuftrigger = 1; - sx_sunlock(&proctree_lock); } /* From owner-svn-src-stable-9@FreeBSD.ORG Fri Sep 20 07:35:08 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CB1E1994; Fri, 20 Sep 2013 07:35:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B8893240C; Fri, 20 Sep 2013 07:35:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8K7Z8vU066220; Fri, 20 Sep 2013 07:35:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8K7Z8Hk066219; Fri, 20 Sep 2013 07:35:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201309200735.r8K7Z8Hk066219@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 20 Sep 2013 07:35:08 +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: r255728 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Sep 2013 07:35:08 -0000 Author: kib Date: Fri Sep 20 07:35:08 2013 New Revision: 255728 URL: http://svnweb.freebsd.org/changeset/base/255728 Log: MFC r255510: When opening or closing fifo, ensure that the vnode is locked exclusively. Modified: stable/9/sys/kern/vfs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Fri Sep 20 07:31:32 2013 (r255727) +++ stable/9/sys/kern/vfs_vnops.c Fri Sep 20 07:35:08 2013 (r255728) @@ -254,6 +254,8 @@ restart: goto bad; } } + if (vp->v_type == VFIFO && VOP_ISLOCKED(vp) != LK_EXCLUSIVE) + vn_lock(vp, LK_UPGRADE | LK_RETRY); if ((error = VOP_OPEN(vp, fmode, cred, td, fp)) != 0) goto bad; @@ -307,7 +309,7 @@ vn_close(vp, flags, file_cred, td) struct mount *mp; int error, lock_flags; - if (!(flags & FWRITE) && vp->v_mount != NULL && + if (vp->v_type != VFIFO && !(flags & FWRITE) && vp->v_mount != NULL && vp->v_mount->mnt_kern_flag & MNTK_EXTENDED_SHARED) lock_flags = LK_SHARED; else From owner-svn-src-stable-9@FreeBSD.ORG Fri Sep 20 07:45:38 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D01FED18; Fri, 20 Sep 2013 07:45:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A47A724A5; Fri, 20 Sep 2013 07:45:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8K7jcsa071752; Fri, 20 Sep 2013 07:45:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8K7jcMc071749; Fri, 20 Sep 2013 07:45:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201309200745.r8K7jcMc071749@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 20 Sep 2013 07:45:38 +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: r255729 - in stable/9/sys: kern sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Sep 2013 07:45:38 -0000 Author: kib Date: Fri Sep 20 07:45:37 2013 New Revision: 255729 URL: http://svnweb.freebsd.org/changeset/base/255729 Log: MFC r255527: Use TAILQ instead of STAILQ for kqeueue filedescriptors to ensure constant time removal on kqueue close. Modified: stable/9/sys/kern/kern_event.c stable/9/sys/sys/event.h stable/9/sys/sys/eventvar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/kern/kern_event.c ============================================================================== --- stable/9/sys/kern/kern_event.c Fri Sep 20 07:35:08 2013 (r255728) +++ stable/9/sys/kern/kern_event.c Fri Sep 20 07:45:37 2013 (r255729) @@ -707,7 +707,7 @@ sys_kqueue(struct thread *td, struct kqu TASK_INIT(&kq->kq_task, 0, kqueue_task, kq); FILEDESC_XLOCK(fdp); - SLIST_INSERT_HEAD(&fdp->fd_kqlist, kq, kq_list); + TAILQ_INSERT_HEAD(&fdp->fd_kqlist, kq, kq_list); FILEDESC_XUNLOCK(fdp); finit(fp, FREAD | FWRITE, DTYPE_KQUEUE, kq, &kqueueops); @@ -1708,7 +1708,7 @@ kqueue_close(struct file *fp, struct thr KQ_UNLOCK(kq); FILEDESC_XLOCK(fdp); - SLIST_REMOVE(&fdp->fd_kqlist, kq, kqueue, kq_list); + TAILQ_REMOVE(&fdp->fd_kqlist, kq, kq_list); FILEDESC_XUNLOCK(fdp); seldrain(&kq->kq_sel); @@ -2044,7 +2044,7 @@ knote_fdclose(struct thread *td, int fd) * We shouldn't have to worry about new kevents appearing on fd * since filedesc is locked. */ - SLIST_FOREACH(kq, &fdp->fd_kqlist, kq_list) { + TAILQ_FOREACH(kq, &fdp->fd_kqlist, kq_list) { KQ_LOCK(kq); again: Modified: stable/9/sys/sys/event.h ============================================================================== --- stable/9/sys/sys/event.h Fri Sep 20 07:35:08 2013 (r255728) +++ stable/9/sys/sys/event.h Fri Sep 20 07:45:37 2013 (r255729) @@ -134,7 +134,7 @@ struct kevent { struct knote; SLIST_HEAD(klist, knote); struct kqueue; -SLIST_HEAD(kqlist, kqueue); +TAILQ_HEAD(kqlist, kqueue); struct knlist { struct klist kl_list; void (*kl_lock)(void *); /* lock function */ Modified: stable/9/sys/sys/eventvar.h ============================================================================== --- stable/9/sys/sys/eventvar.h Fri Sep 20 07:35:08 2013 (r255728) +++ stable/9/sys/sys/eventvar.h Fri Sep 20 07:45:37 2013 (r255729) @@ -41,7 +41,7 @@ struct kqueue { struct mtx kq_lock; int kq_refcnt; - SLIST_ENTRY(kqueue) kq_list; + TAILQ_ENTRY(kqueue) kq_list; TAILQ_HEAD(, knote) kq_head; /* list of pending event */ int kq_count; /* number of pending events */ struct selinfo kq_sel; From owner-svn-src-stable-9@FreeBSD.ORG Fri Sep 20 21:51:39 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 991DF8BC; Fri, 20 Sep 2013 21:51:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 84FC32497; Fri, 20 Sep 2013 21:51:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8KLpd3n004112; Fri, 20 Sep 2013 21:51:39 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8KLpdC1004111; Fri, 20 Sep 2013 21:51:39 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201309202151.r8KLpdC1004111@svn.freebsd.org> From: Mark Johnston Date: Fri, 20 Sep 2013 21:51:39 +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: r255740 - stable/9/sys/dev/mfi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Sep 2013 21:51:39 -0000 Author: markj Date: Fri Sep 20 21:51:38 2013 New Revision: 255740 URL: http://svnweb.freebsd.org/changeset/base/255740 Log: MFC r254742: Hold mfi_io_lock across calls to xpt_rescan() and xpt_alloc_ccb_nowait(). xpt_rescan() expects the SIM lock to be held, and we trip a mtx_assert if the driver initiates multiple rescans in quick succession. Modified: stable/9/sys/dev/mfi/mfi_cam.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mfi/mfi_cam.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_cam.c Fri Sep 20 21:26:51 2013 (r255739) +++ stable/9/sys/dev/mfi/mfi_cam.c Fri Sep 20 21:51:38 2013 (r255740) @@ -307,17 +307,16 @@ mfip_cam_rescan(struct mfi_softc *sc, ui return; } camsc->state = MFIP_STATE_RESCAN; - mtx_unlock(&sc->mfi_io_lock); ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { + mtx_unlock(&sc->mfi_io_lock); device_printf(sc->mfi_dev, "Cannot allocate ccb for bus rescan.\n"); return; } sim = camsc->sim; - mtx_lock(&sc->mfi_io_lock); if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sim), tid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); @@ -326,11 +325,8 @@ mfip_cam_rescan(struct mfi_softc *sc, ui "Cannot create path for bus rescan.\n"); return; } - mtx_unlock(&sc->mfi_io_lock); - xpt_rescan(ccb); - mtx_lock(&sc->mfi_io_lock); camsc->state = MFIP_STATE_NONE; mtx_unlock(&sc->mfi_io_lock); } From owner-svn-src-stable-9@FreeBSD.ORG Fri Sep 20 22:00:08 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 65394F3C; Fri, 20 Sep 2013 22:00:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 52EC024F5; Fri, 20 Sep 2013 22:00:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8KM08EG008227; Fri, 20 Sep 2013 22:00:08 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8KM08RN008226; Fri, 20 Sep 2013 22:00:08 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201309202200.r8KM08RN008226@svn.freebsd.org> From: Mark Johnston Date: Fri, 20 Sep 2013 22:00:08 +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: r255743 - stable/9/sys/compat/linux X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Sep 2013 22:00:08 -0000 Author: markj Date: Fri Sep 20 22:00:07 2013 New Revision: 255743 URL: http://svnweb.freebsd.org/changeset/base/255743 Log: MFC r254467: Remove a couple of unused macros. Modified: stable/9/sys/compat/linux/linux_dtrace.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/compat/linux/linux_dtrace.h ============================================================================== --- stable/9/sys/compat/linux/linux_dtrace.h Fri Sep 20 21:53:08 2013 (r255742) +++ stable/9/sys/compat/linux/linux_dtrace.h Fri Sep 20 22:00:07 2013 (r255743) @@ -72,11 +72,6 @@ #define LIN_SDT_PROBE_DEFINE5(a, b, c, d, e, f, g, h) _LIN_SDT_PROBE_DEFINE5(\ LINUX_DTRACE, a, b, c, d, e, f, g, h) -#define _LIN_SDT_PROBE_ARGTYPE(a, b, c, d, e, f) SDT_PROBE_ARGTYPE(a, b,\ - c, d, e, f) -#define LIN_SDT_PROBE_ARGTYPE(a, b, c, d, e) _LIN_SDT_PROBE_ARGTYPE( \ - LINUX_DTRACE, a, b, c, d, e) - #define LIN_SDT_PROBE0(a, b, c) SDT_PROBE1(LINUX_DTRACE, a, b, \ c, 0) #define LIN_SDT_PROBE1(a, b, c, d) SDT_PROBE1(LINUX_DTRACE, a, b, \ From owner-svn-src-stable-9@FreeBSD.ORG Fri Sep 20 23:50:15 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3E8ABA26; Fri, 20 Sep 2013 23:50:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 29DB62A56; Fri, 20 Sep 2013 23:50:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8KNoFCb079162; Fri, 20 Sep 2013 23:50:15 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8KNoFsd079161; Fri, 20 Sep 2013 23:50:15 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201309202350.r8KNoFsd079161@svn.freebsd.org> From: Mark Johnston Date: Fri, 20 Sep 2013 23:50:15 +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: r255749 - stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Sep 2013 23:50:15 -0000 Author: markj Date: Fri Sep 20 23:50:14 2013 New Revision: 255749 URL: http://svnweb.freebsd.org/changeset/base/255749 Log: MFC r250953: The fasttrap provider cleans up probes asynchronously when a process with USDT probes exits. This was previously done with a callout; however, it is possible to sleep while holding the DTrace mutexes, so a panic will occur on INVARIANTS kernels if the callout handler can't immediately acquire one of these mutexes. This panic will be frequently triggered on systems where a USDT-enabled program (perl, for instance) is often run. This revision changes the fasttrap cleanup mechanism so that a dedicated thread is used instead of a callout. The old behaviour is otherwise preserved. MFC r252493: Be sure to destory the fasttrap cleanup mutex when unloading the fasttrap module. This should be MFCed with r250953. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Fri Sep 20 23:22:00 2013 (r255748) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Fri Sep 20 23:50:14 2013 (r255749) @@ -155,9 +155,9 @@ static struct cdevsw fasttrap_cdevsw = { static struct cdev *fasttrap_cdev; static dtrace_meta_provider_id_t fasttrap_meta_id; -static struct callout fasttrap_timeout; +static struct proc *fasttrap_cleanup_proc; static struct mtx fasttrap_cleanup_mtx; -static uint_t fasttrap_cleanup_work; +static uint_t fasttrap_cleanup_work, fasttrap_cleanup_drain, fasttrap_cleanup_cv; /* * Generation count on modifications to the global tracepoint lookup table. @@ -310,8 +310,11 @@ fasttrap_mod_barrier(uint64_t gen) } /* - * This is the timeout's callback for cleaning up the providers and their - * probes. + * This function performs asynchronous cleanup of fasttrap providers. The + * Solaris implementation of this mechanism use a timeout that's activated in + * fasttrap_pid_cleanup(), but this doesn't work in FreeBSD: one may sleep while + * holding the DTrace mutexes, but it is unsafe to sleep in a callout handler. + * Thus we use a dedicated process to perform the cleanup when requested. */ /*ARGSUSED*/ static void @@ -322,11 +325,8 @@ fasttrap_pid_cleanup_cb(void *data) dtrace_provider_id_t provid; int i, later = 0, rval; - static volatile int in = 0; - ASSERT(in == 0); - in = 1; - - while (fasttrap_cleanup_work) { + mtx_lock(&fasttrap_cleanup_mtx); + while (!fasttrap_cleanup_drain || later > 0) { fasttrap_cleanup_work = 0; mtx_unlock(&fasttrap_cleanup_mtx); @@ -397,39 +397,32 @@ fasttrap_pid_cleanup_cb(void *data) } mutex_exit(&bucket->ftb_mtx); } - mtx_lock(&fasttrap_cleanup_mtx); - } -#if 0 - ASSERT(fasttrap_timeout != 0); -#endif + /* + * If we were unable to retire a provider, try again after a + * second. This situation can occur in certain circumstances + * where providers cannot be unregistered even though they have + * no probes enabled because of an execution of dtrace -l or + * something similar. + */ + if (later > 0 || fasttrap_cleanup_work || + fasttrap_cleanup_drain) { + mtx_unlock(&fasttrap_cleanup_mtx); + pause("ftclean", hz); + mtx_lock(&fasttrap_cleanup_mtx); + } else + mtx_sleep(&fasttrap_cleanup_cv, &fasttrap_cleanup_mtx, + 0, "ftcl", 0); + } /* - * If we were unable to remove a retired provider, try again after - * a second. This situation can occur in certain circumstances where - * providers cannot be unregistered even though they have no probes - * enabled because of an execution of dtrace -l or something similar. - * If the timeout has been disabled (set to 1 because we're trying - * to detach), we set fasttrap_cleanup_work to ensure that we'll - * get a chance to do that work if and when the timeout is reenabled - * (if detach fails). - */ - if (later > 0) { - if (callout_active(&fasttrap_timeout)) { - callout_reset(&fasttrap_timeout, hz, - &fasttrap_pid_cleanup_cb, NULL); - } - - else if (later > 0) - fasttrap_cleanup_work = 1; - } else { -#if !defined(sun) - /* Nothing to be done for FreeBSD */ -#endif - } + * Wake up the thread in fasttrap_unload() now that we're done. + */ + wakeup(&fasttrap_cleanup_drain); + mtx_unlock(&fasttrap_cleanup_mtx); - in = 0; + kthread_exit(); } /* @@ -440,8 +433,10 @@ fasttrap_pid_cleanup(void) { mtx_lock(&fasttrap_cleanup_mtx); - fasttrap_cleanup_work = 1; - callout_reset(&fasttrap_timeout, 1, &fasttrap_pid_cleanup_cb, NULL); + if (!fasttrap_cleanup_work) { + fasttrap_cleanup_work = 1; + wakeup(&fasttrap_cleanup_cv); + } mtx_unlock(&fasttrap_cleanup_mtx); } @@ -991,7 +986,6 @@ fasttrap_pid_enable(void *arg, dtrace_id proc_t *p = NULL; int i, rc; - ASSERT(probe != NULL); ASSERT(!probe->ftp_enabled); ASSERT(id == probe->ftp_id); @@ -2272,17 +2266,23 @@ static int fasttrap_load(void) { ulong_t nent; - int i; + int i, ret; /* Create the /dev/dtrace/fasttrap entry. */ fasttrap_cdev = make_dev(&fasttrap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "dtrace/fasttrap"); mtx_init(&fasttrap_cleanup_mtx, "fasttrap clean", "dtrace", MTX_DEF); - callout_init_mtx(&fasttrap_timeout, &fasttrap_cleanup_mtx, 0); mutex_init(&fasttrap_count_mtx, "fasttrap count mtx", MUTEX_DEFAULT, NULL); + ret = kproc_create(fasttrap_pid_cleanup_cb, NULL, + &fasttrap_cleanup_proc, 0, 0, "ftcleanup"); + if (ret != 0) { + destroy_dev(fasttrap_cdev); + return (ret); + } + #if defined(sun) fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS, "fasttrap-max-probes", FASTTRAP_MAX_DEFAULT); @@ -2389,15 +2389,6 @@ fasttrap_unload(void) return (-1); /* - * Prevent any new timeouts from running by setting fasttrap_timeout - * to a non-zero value, and wait for the current timeout to complete. - */ - mtx_lock(&fasttrap_cleanup_mtx); - fasttrap_cleanup_work = 0; - callout_drain(&fasttrap_timeout); - mtx_unlock(&fasttrap_cleanup_mtx); - - /* * Iterate over all of our providers. If there's still a process * that corresponds to that pid, fail to detach. */ @@ -2431,26 +2422,21 @@ fasttrap_unload(void) } if (fail) { - uint_t work; - /* - * If we're failing to detach, we need to unblock timeouts - * and start a new timeout if any work has accumulated while - * we've been unsuccessfully trying to detach. - */ - mtx_lock(&fasttrap_cleanup_mtx); - work = fasttrap_cleanup_work; - callout_drain(&fasttrap_timeout); - mtx_unlock(&fasttrap_cleanup_mtx); - - if (work) - fasttrap_pid_cleanup(); - (void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL, &fasttrap_meta_id); return (-1); } + mtx_lock(&fasttrap_cleanup_mtx); + fasttrap_cleanup_drain = 1; + /* Wait for the cleanup thread to finish up and signal us. */ + wakeup(&fasttrap_cleanup_cv); + mtx_sleep(&fasttrap_cleanup_drain, &fasttrap_cleanup_mtx, 0, "ftcld", + 0); + fasttrap_cleanup_proc = NULL; + mtx_destroy(&fasttrap_cleanup_mtx); + #ifdef DEBUG mutex_enter(&fasttrap_count_mtx); ASSERT(fasttrap_pid_count == 0); From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 21 16:46:37 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 68772455; Sat, 21 Sep 2013 16:46:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 52E6D28F1; Sat, 21 Sep 2013 16:46:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8LGkb0I032270; Sat, 21 Sep 2013 16:46:37 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8LGkYbF032233; Sat, 21 Sep 2013 16:46:34 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201309211646.r8LGkYbF032233@svn.freebsd.org> From: Mark Johnston Date: Sat, 21 Sep 2013 16:46:34 +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: r255763 - in stable/9/sys: cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/sys cddl/dev/dtrace cddl/dev/fbt cddl/dev/sdt kern netinet sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Sep 2013 16:46:37 -0000 Author: markj Date: Sat Sep 21 16:46:34 2013 New Revision: 255763 URL: http://svnweb.freebsd.org/changeset/base/255763 Log: MFC r252894: Add SDT_PROBE_DEFINE0 for consistency with SDT_PROBE0. MFC r253022: Also define SDT_PROBE_DEFINE0 for the !KDTRACE_HOOKS case. MFC r254266: Add event handlers for module load and unload events. The load handlers are called after the module has been loaded, and the unload handlers are called before the module is unloaded. Moreover, the module unload handlers may return an error to prevent the unload from proceeding. MFC r254267: Remove some unused fields from struct linker_file. They were added in r172862 for use by the DTrace SDT framework but don't seem to have ever been used. MFC r254268: FreeBSD's DTrace implementation has a few problems with respect to handling probes declared in a kernel module when that module is unloaded. In particular, * Unloading a module with active SDT probes will cause a panic. [1] * A module's (FBT/SDT) probes aren't destroyed when the module is unloaded; trying to use them after the fact will generally cause a panic. This change fixes both problems by porting the DTrace module load/unload handlers from illumos and registering them with the corresponding EVENTHANDLER(9) handlers. This allows the DTrace framework to destroy all probes defined in a module when that module is unloaded, and to prevent a module unload from proceeding if some of its probes are active. The latter problem has already been fixed for FBT probes by checking lf->nenabled in kern_kldunload(), but moving the check into the DTrace framework generalizes it to all kernel providers and also fixes a race in the current implementation (since a probe may be activated between the check and the call to linker_file_unload()). Additionally, the SDT implementation has been reworked to define SDT providers/probes/argtypes in linker sets rather than using SYSINIT/SYSUNINIT to create and destroy SDT probes when a module is loaded or unloaded. This simplifies things quite a bit since it means that pretty much all of the SDT code can live in sdt.ko, and since it becomes easier to integrate SDT with the DTrace framework. Furthermore, this allows FreeBSD to be quite flexible in that SDT providers spanning multiple modules can be created on the fly when a module is loaded; at the moment it looks like illumos' SDT implementation requires all SDT probes to be statically defined in a single kernel table. MFC r254309: Use kld_{load,unload} instead of mod_{load,unload} for the linker file load and unload event handlers added in r254266. MFC r254350: Specify SDT probe argument types in the probe definition itself rather than using SDT_PROBE_ARGTYPE(). This will make it easy to extend the SDT(9) API to allow probes with dynamically-translated types. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h stable/9/sys/cddl/dev/dtrace/dtrace_load.c stable/9/sys/cddl/dev/dtrace/dtrace_unload.c stable/9/sys/cddl/dev/fbt/fbt.c stable/9/sys/cddl/dev/sdt/sdt.c stable/9/sys/kern/kern_exec.c stable/9/sys/kern/kern_exit.c stable/9/sys/kern/kern_fork.c stable/9/sys/kern/kern_linker.c stable/9/sys/kern/kern_proc.c stable/9/sys/kern/kern_sdt.c stable/9/sys/kern/kern_sig.c stable/9/sys/kern/kern_timeout.c stable/9/sys/kern/vfs_syscalls.c stable/9/sys/netinet/sctp_dtrace_define.h stable/9/sys/sys/eventhandler.h stable/9/sys/sys/linker.h stable/9/sys/sys/sdt.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sat Sep 21 16:46:34 2013 (r255763) @@ -115,6 +115,7 @@ #if !defined(sun) #include #include +#include #include #include #include @@ -239,6 +240,8 @@ int dtrace_in_probe; /* non-zero if exe #if defined(__i386__) || defined(__amd64__) uintptr_t dtrace_in_probe_addr; /* Address of invop when already in probe */ #endif +static eventhandler_tag dtrace_kld_load_tag; +static eventhandler_tag dtrace_kld_unload_tag; #endif /* @@ -8035,19 +8038,6 @@ dtrace_probe_description(const dtrace_pr (void) strncpy(pdp->dtpd_name, prp->dtpr_name, DTRACE_NAMELEN - 1); } -#if !defined(sun) -static int -dtrace_probe_provide_cb(linker_file_t lf, void *arg) -{ - dtrace_provider_t *prv = (dtrace_provider_t *) arg; - - prv->dtpv_pops.dtps_provide_module(prv->dtpv_arg, lf); - - return(0); -} -#endif - - /* * Called to indicate that a probe -- or probes -- should be provided by a * specfied provider. If the specified description is NULL, the provider will @@ -8101,8 +8091,6 @@ dtrace_probe_provide(dtrace_probedesc_t prv->dtpv_pops.dtps_provide_module(prv->dtpv_arg, ctl); } while ((ctl = ctl->mod_next) != &modules); -#else - (void) linker_file_foreach(dtrace_probe_provide_cb, prv); #endif mutex_exit(&mod_lock); @@ -15121,7 +15109,6 @@ dtrace_helpers_duplicate(proc_t *from, p dtrace_helper_provider_register(to, newhelp, NULL); } -#if defined(sun) /* * DTrace Hook Functions */ @@ -15133,7 +15120,9 @@ dtrace_module_loaded(modctl_t *ctl) mutex_enter(&dtrace_provider_lock); mutex_enter(&mod_lock); +#if defined(sun) ASSERT(ctl->mod_busy); +#endif /* * We're going to call each providers per-module provide operation @@ -15179,17 +15168,46 @@ dtrace_module_loaded(modctl_t *ctl) } static void +#if defined(sun) dtrace_module_unloaded(modctl_t *ctl) +#else +dtrace_module_unloaded(modctl_t *ctl, int *error) +#endif { dtrace_probe_t template, *probe, *first, *next; dtrace_provider_t *prov; +#if !defined(sun) + char modname[DTRACE_MODNAMELEN]; + size_t len; +#endif +#if defined(sun) template.dtpr_mod = ctl->mod_modname; +#else + /* Handle the fact that ctl->filename may end in ".ko". */ + strlcpy(modname, ctl->filename, sizeof(modname)); + len = strlen(ctl->filename); + if (len > 3 && strcmp(modname + len - 3, ".ko") == 0) + modname[len - 3] = '\0'; + template.dtpr_mod = modname; +#endif mutex_enter(&dtrace_provider_lock); mutex_enter(&mod_lock); mutex_enter(&dtrace_lock); +#if !defined(sun) + if (ctl->nenabled > 0) { + /* Don't allow unloads if a probe is enabled. */ + mutex_exit(&dtrace_provider_lock); + mutex_exit(&dtrace_lock); + *error = -1; + printf( + "kldunload: attempt to unload module that has DTrace probes enabled\n"); + return; + } +#endif + if (dtrace_bymod == NULL) { /* * The DTrace module is loaded (obviously) but not attached; @@ -15219,8 +15237,13 @@ dtrace_module_unloaded(modctl_t *ctl) * probe, either. */ if (dtrace_err_verbose) { +#if defined(sun) cmn_err(CE_WARN, "unloaded module '%s' had " "enabled probes", ctl->mod_modname); +#else + cmn_err(CE_WARN, "unloaded module '%s' had " + "enabled probes", modname); +#endif } return; @@ -15263,7 +15286,11 @@ dtrace_module_unloaded(modctl_t *ctl) kmem_free(probe->dtpr_mod, strlen(probe->dtpr_mod) + 1); kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1); kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1); +#if defined(sun) vmem_free(dtrace_arena, (void *)(uintptr_t)probe->dtpr_id, 1); +#else + free_unr(dtrace_arena, probe->dtpr_id); +#endif kmem_free(probe, sizeof (dtrace_probe_t)); } @@ -15272,6 +15299,26 @@ dtrace_module_unloaded(modctl_t *ctl) mutex_exit(&dtrace_provider_lock); } +#if !defined(sun) +static void +dtrace_kld_load(void *arg __unused, linker_file_t lf) +{ + + dtrace_module_loaded(lf); +} + +static void +dtrace_kld_unload(void *arg __unused, linker_file_t lf, int *error) +{ + + if (*error != 0) + /* We already have an error, so don't do anything. */ + return; + dtrace_module_unloaded(lf, error); +} +#endif + +#if defined(sun) static void dtrace_suspend(void) { Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Sat Sep 21 16:46:34 2013 (r255763) @@ -2287,8 +2287,10 @@ extern void dtrace_membar_producer(void) extern void dtrace_membar_consumer(void); extern void (*dtrace_cpu_init)(processorid_t); +#if defined(sun) extern void (*dtrace_modload)(modctl_t *); extern void (*dtrace_modunload)(modctl_t *); +#endif extern void (*dtrace_helpers_cleanup)(void); extern void (*dtrace_helpers_fork)(proc_t *parent, proc_t *child); extern void (*dtrace_cpustart_init)(void); Modified: stable/9/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- stable/9/sys/cddl/dev/dtrace/dtrace_load.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/cddl/dev/dtrace/dtrace_load.c Sat Sep 21 16:46:34 2013 (r255763) @@ -56,6 +56,12 @@ dtrace_load(void *dummy) /* Hang our hook for exceptions. */ dtrace_invop_init(); + /* Register callbacks for linker file load and unload events. */ + dtrace_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, + dtrace_kld_load, NULL, EVENTHANDLER_PRI_ANY); + dtrace_kld_unload_tag = EVENTHANDLER_REGISTER(kld_unload, + dtrace_kld_unload, NULL, EVENTHANDLER_PRI_ANY); + /* * XXX This is a short term hack to avoid having to comment * out lots and lots of lock/unlock calls. Modified: stable/9/sys/cddl/dev/dtrace/dtrace_unload.c ============================================================================== --- stable/9/sys/cddl/dev/dtrace/dtrace_unload.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/cddl/dev/dtrace/dtrace_unload.c Sat Sep 21 16:46:34 2013 (r255763) @@ -67,6 +67,8 @@ dtrace_unload() } dtrace_provider = NULL; + EVENTHANDLER_DEREGISTER(kld_load, dtrace_kld_load_tag); + EVENTHANDLER_DEREGISTER(kld_unload, dtrace_kld_unload_tag); if ((state = dtrace_anon_grab()) != NULL) { /* Modified: stable/9/sys/cddl/dev/fbt/fbt.c ============================================================================== --- stable/9/sys/cddl/dev/fbt/fbt.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/cddl/dev/fbt/fbt.c Sat Sep 21 16:46:34 2013 (r255763) @@ -1329,6 +1329,15 @@ fbt_getargdesc(void *arg __unused, dtrac return; } +static int +fbt_linker_file_cb(linker_file_t lf, void *arg) +{ + + fbt_provide_module(arg, lf); + + return (0); +} + static void fbt_load(void *dummy) { @@ -1353,8 +1362,10 @@ fbt_load(void *dummy) if (dtrace_register("fbt", &fbt_attr, DTRACE_PRIV_USER, NULL, &fbt_pops, NULL, &fbt_id) != 0) return; -} + /* Create probes for the kernel and already-loaded modules. */ + linker_file_foreach(fbt_linker_file_cb, NULL); +} static int fbt_unload() Modified: stable/9/sys/cddl/dev/sdt/sdt.c ============================================================================== --- stable/9/sys/cddl/dev/sdt/sdt.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/cddl/dev/sdt/sdt.c Sat Sep 21 16:46:34 2013 (r255763) @@ -24,36 +24,44 @@ * */ -#ifndef KDTRACE_HOOKS -#define KDTRACE_HOOKS -#endif +#include "opt_kdtrace.h" #include #include #include + #include +#include #include #include -#include #include +#include +#include +#include #include #include - -#include +#include #include -#define SDT_ADDR2NDX(addr) (((uintptr_t)(addr)) >> 4) +#include +#include -static d_open_t sdt_open; -static int sdt_unload(void); +/* DTrace methods. */ static void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); static void sdt_provide_probes(void *, dtrace_probedesc_t *); static void sdt_destroy(void *, dtrace_id_t, void *); static void sdt_enable(void *, dtrace_id_t, void *); static void sdt_disable(void *, dtrace_id_t, void *); + +static d_open_t sdt_open; static void sdt_load(void *); -static int sdt_provider_unreg_callback(struct sdt_provider *prov, - void *arg); +static int sdt_unload(void *); +static void sdt_create_provider(struct sdt_provider *); +static void sdt_create_probe(struct sdt_probe *); +static void sdt_kld_load(void *, struct linker_file *); +static void sdt_kld_unload(void *, struct linker_file *, int *); + +static MALLOC_DEFINE(M_SDT, "SDT", "DTrace SDT providers"); static struct cdevsw sdt_cdevsw = { .d_version = D_VERSION, @@ -79,141 +87,261 @@ static dtrace_pops_t sdt_pops = { sdt_getargdesc, NULL, NULL, - sdt_destroy + sdt_destroy, }; -static struct cdev *sdt_cdev; +static struct cdev *sdt_cdev; -static int -sdt_argtype_callback(struct sdt_argtype *argtype, void *arg) -{ - dtrace_argdesc_t *desc = arg; +static TAILQ_HEAD(, sdt_provider) sdt_prov_list; - if (desc->dtargd_ndx == argtype->ndx) { - desc->dtargd_mapping = desc->dtargd_ndx; /* XXX */ - strlcpy(desc->dtargd_native, argtype->type, - sizeof(desc->dtargd_native)); - desc->dtargd_xlate[0] = '\0'; /* XXX */ - } - - return (0); -} +eventhandler_tag sdt_kld_load_tag; +eventhandler_tag sdt_kld_unload_tag; static void -sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) +sdt_create_provider(struct sdt_provider *prov) { - struct sdt_probe *probe = parg; + struct sdt_provider *curr, *newprov; - if (desc->dtargd_ndx < probe->n_args) - (void) (sdt_argtype_listall(probe, sdt_argtype_callback, desc)); - else - desc->dtargd_ndx = DTRACE_ARGNONE; + TAILQ_FOREACH(curr, &sdt_prov_list, prov_entry) + if (strcmp(prov->name, curr->name) == 0) { + /* The provider has already been defined. */ + curr->sdt_refs++; + return; + } - return; + /* + * Make a copy of prov so that we don't lose fields if its module is + * unloaded but the provider isn't destroyed. This could happen with + * a provider that spans multiple modules. + */ + newprov = malloc(sizeof(*newprov), M_SDT, M_WAITOK | M_ZERO); + newprov->name = strdup(prov->name, M_SDT); + prov->sdt_refs = newprov->sdt_refs = 1; + TAILQ_INIT(&newprov->probe_list); + + TAILQ_INSERT_TAIL(&sdt_prov_list, newprov, prov_entry); + + (void)dtrace_register(newprov->name, &sdt_attr, DTRACE_PRIV_USER, NULL, + &sdt_pops, NULL, (dtrace_provider_id_t *)&newprov->id); + prov->id = newprov->id; } -static int -sdt_probe_callback(struct sdt_probe *probe, void *arg __unused) +static void +sdt_create_probe(struct sdt_probe *probe) { - struct sdt_provider *prov = probe->prov; - char mod[64]; - char func[64]; - char name[64]; + struct sdt_provider *prov; + char mod[DTRACE_MODNAMELEN]; + char func[DTRACE_FUNCNAMELEN]; + char name[DTRACE_NAMELEN]; + size_t len; + + TAILQ_FOREACH(prov, &sdt_prov_list, prov_entry) + if (strcmp(prov->name, probe->prov->name) == 0) + break; + + KASSERT(prov != NULL, ("probe defined without a provider")); + + /* If no module name was specified, use the module filename. */ + if (*probe->mod == 0) { + len = strlcpy(mod, probe->sdtp_lf->filename, sizeof(mod)); + if (len > 3 && strcmp(mod + len - 3, ".ko") == 0) + mod[len - 3] = '\0'; + } else + strlcpy(mod, probe->mod, sizeof(mod)); /* * Unfortunately this is necessary because the Solaris DTrace * code mixes consts and non-consts with casts to override * the incompatibilies. On FreeBSD, we use strict warnings - * in gcc, so we have to respect const vs non-const. + * in the C compiler, so we have to respect const vs non-const. */ - strlcpy(mod, probe->mod, sizeof(mod)); strlcpy(func, probe->func, sizeof(func)); strlcpy(name, probe->name, sizeof(name)); - if (dtrace_probe_lookup(prov->id, mod, func, name) != 0) - return (0); + if (dtrace_probe_lookup(prov->id, mod, func, name) != DTRACE_IDNONE) + return; - (void) dtrace_probe_create(prov->id, probe->mod, probe->func, - probe->name, 1, probe); + TAILQ_INSERT_TAIL(&prov->probe_list, probe, probe_entry); - return (0); + (void)dtrace_probe_create(prov->id, mod, func, name, 1, probe); } -static int -sdt_provider_entry(struct sdt_provider *prov, void *arg) +/* Probes are created through the SDT module load/unload hook. */ +static void +sdt_provide_probes(void *arg, dtrace_probedesc_t *desc) { - return (sdt_probe_listall(prov, sdt_probe_callback, NULL)); } static void -sdt_provide_probes(void *arg, dtrace_probedesc_t *desc) +sdt_enable(void *arg __unused, dtrace_id_t id, void *parg) { - if (desc != NULL) - return; + struct sdt_probe *probe = parg; - (void) sdt_provider_listall(sdt_provider_entry, NULL); + probe->id = id; + probe->sdtp_lf->nenabled++; } static void -sdt_destroy(void *arg, dtrace_id_t id, void *parg) +sdt_disable(void *arg __unused, dtrace_id_t id, void *parg) { - /* Nothing to do here. */ + struct sdt_probe *probe = parg; + + KASSERT(probe->sdtp_lf->nenabled > 0, ("no probes enabled")); + + probe->id = 0; + probe->sdtp_lf->nenabled--; } static void -sdt_enable(void *arg, dtrace_id_t id, void *parg) +sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) { + struct sdt_argtype *argtype; struct sdt_probe *probe = parg; - probe->id = id; + if (desc->dtargd_ndx < probe->n_args) { + TAILQ_FOREACH(argtype, &probe->argtype_list, argtype_entry) { + if (desc->dtargd_ndx == argtype->ndx) { + /* XXX */ + desc->dtargd_mapping = desc->dtargd_ndx; + strlcpy(desc->dtargd_native, argtype->type, + sizeof(desc->dtargd_native)); + desc->dtargd_xlate[0] = '\0'; /* XXX */ + } + } + } else + desc->dtargd_ndx = DTRACE_ARGNONE; } static void -sdt_disable(void *arg, dtrace_id_t id, void *parg) +sdt_destroy(void *arg, dtrace_id_t id, void *parg) { - struct sdt_probe *probe = parg; + struct sdt_probe *probe; - probe->id = 0; + probe = parg; + TAILQ_REMOVE(&probe->prov->probe_list, probe, probe_entry); +} + +/* + * Called from the kernel linker when a module is loaded, before + * dtrace_module_loaded() is called. This is done so that it's possible to + * register new providers when modules are loaded. We cannot do this in the + * provide_module method since it's called with the provider lock held + * and dtrace_register() will try to acquire it again. + */ +static void +sdt_kld_load(void *arg __unused, struct linker_file *lf) +{ + struct sdt_provider **prov, **begin, **end; + struct sdt_probe **probe, **p_begin, **p_end; + struct sdt_argtype **argtype, **a_begin, **a_end; + + if (linker_file_lookup_set(lf, "sdt_providers_set", &begin, &end, NULL)) + return; + for (prov = begin; prov < end; prov++) + sdt_create_provider(*prov); + + if (linker_file_lookup_set(lf, "sdt_probes_set", &p_begin, &p_end, + NULL)) + return; + for (probe = p_begin; probe < p_end; probe++) { + (*probe)->sdtp_lf = lf; + sdt_create_probe(*probe); + TAILQ_INIT(&(*probe)->argtype_list); + } + + if (linker_file_lookup_set(lf, "sdt_argtypes_set", &a_begin, &a_end, + NULL)) + return; + for (argtype = a_begin; argtype < a_end; argtype++) { + (*argtype)->probe->n_args++; + TAILQ_INSERT_TAIL(&(*argtype)->probe->argtype_list, *argtype, + argtype_entry); + } +} + +static void +sdt_kld_unload(void *arg __unused, struct linker_file *lf, int *error __unused) +{ + struct sdt_provider *prov, **curr, **begin, **end, *tmp; + + if (*error != 0) + /* We already have an error, so don't do anything. */ + return; + else if (linker_file_lookup_set(lf, "sdt_providers_set", &begin, &end, NULL)) + /* No DTrace providers are declared in this file. */ + return; + + /* + * Go through all the providers declared in this linker file and + * unregister any that aren't declared in another loaded file. + */ + for (curr = begin; curr < end; curr++) { + TAILQ_FOREACH_SAFE(prov, &sdt_prov_list, prov_entry, tmp) { + if (strcmp(prov->name, (*curr)->name) == 0) { + if (prov->sdt_refs == 1) { + TAILQ_REMOVE(&sdt_prov_list, prov, + prov_entry); + dtrace_unregister(prov->id); + free(prov->name, M_SDT); + free(prov, M_SDT); + } else + prov->sdt_refs--; + break; + } + } + } } static int -sdt_provider_reg_callback(struct sdt_provider *prov, void *arg __unused) +sdt_linker_file_cb(linker_file_t lf, void *arg __unused) { - return (dtrace_register(prov->name, &sdt_attr, DTRACE_PRIV_USER, - NULL, &sdt_pops, NULL, (dtrace_provider_id_t *) &prov->id)); + + sdt_kld_load(NULL, lf); + + return (0); } static void -sdt_load(void *dummy) +sdt_load(void *arg __unused) { + + TAILQ_INIT(&sdt_prov_list); + /* Create the /dev/dtrace/sdt entry. */ sdt_cdev = make_dev(&sdt_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "dtrace/sdt"); sdt_probe_func = dtrace_probe; - sdt_register_callbacks(sdt_provider_reg_callback, NULL, - sdt_provider_unreg_callback, NULL, sdt_probe_callback, NULL); -} + sdt_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, sdt_kld_load, NULL, + EVENTHANDLER_PRI_ANY); + sdt_kld_unload_tag = EVENTHANDLER_REGISTER(kld_unload, sdt_kld_unload, + NULL, EVENTHANDLER_PRI_ANY); -static int -sdt_provider_unreg_callback(struct sdt_provider *prov, void *arg __unused) -{ - return (dtrace_unregister(prov->id)); + /* Pick up probes from the kernel and already-loaded linker files. */ + linker_file_foreach(sdt_linker_file_cb, NULL); } static int -sdt_unload() +sdt_unload(void *arg __unused) { - int error = 0; + struct sdt_provider *prov, *tmp; + + EVENTHANDLER_DEREGISTER(kld_load, sdt_kld_load_tag); + EVENTHANDLER_DEREGISTER(kld_unload, sdt_kld_unload_tag); sdt_probe_func = sdt_probe_stub; - sdt_deregister_callbacks(); - + TAILQ_FOREACH_SAFE(prov, &sdt_prov_list, prov_entry, tmp) { + TAILQ_REMOVE(&sdt_prov_list, prov, prov_entry); + dtrace_unregister(prov->id); + free(prov->name, M_SDT); + free(prov, M_SDT); + } + destroy_dev(sdt_cdev); - return (error); + return (0); } /* ARGSUSED */ @@ -235,7 +363,6 @@ sdt_modevent(module_t mod __unused, int default: error = EOPNOTSUPP; break; - } return (error); @@ -243,8 +370,10 @@ sdt_modevent(module_t mod __unused, int /* ARGSUSED */ static int -sdt_open(struct cdev *dev __unused, int oflags __unused, int devtype __unused, struct thread *td __unused) +sdt_open(struct cdev *dev __unused, int oflags __unused, int devtype __unused, + struct thread *td __unused) { + return (0); } Modified: stable/9/sys/kern/kern_exec.c ============================================================================== --- stable/9/sys/kern/kern_exec.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/kern/kern_exec.c Sat Sep 21 16:46:34 2013 (r255763) @@ -95,12 +95,9 @@ dtrace_execexit_func_t dtrace_fasttrap_e #endif SDT_PROVIDER_DECLARE(proc); -SDT_PROBE_DEFINE(proc, kernel, , exec, exec); -SDT_PROBE_ARGTYPE(proc, kernel, , exec, 0, "char *"); -SDT_PROBE_DEFINE(proc, kernel, , exec_failure, exec-failure); -SDT_PROBE_ARGTYPE(proc, kernel, , exec_failure, 0, "int"); -SDT_PROBE_DEFINE(proc, kernel, , exec_success, exec-success); -SDT_PROBE_ARGTYPE(proc, kernel, , exec_success, 0, "char *"); +SDT_PROBE_DEFINE1(proc, kernel, , exec, exec, "char *"); +SDT_PROBE_DEFINE1(proc, kernel, , exec_failure, exec-failure, "int"); +SDT_PROBE_DEFINE1(proc, kernel, , exec_success, exec-success, "char *"); MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments"); Modified: stable/9/sys/kern/kern_exit.c ============================================================================== --- stable/9/sys/kern/kern_exit.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/kern/kern_exit.c Sat Sep 21 16:46:34 2013 (r255763) @@ -94,8 +94,7 @@ dtrace_execexit_func_t dtrace_fasttrap_e #endif SDT_PROVIDER_DECLARE(proc); -SDT_PROBE_DEFINE(proc, kernel, , exit, exit); -SDT_PROBE_ARGTYPE(proc, kernel, , exit, 0, "int"); +SDT_PROBE_DEFINE1(proc, kernel, , exit, exit, "int"); /* Hook for NFS teardown procedure. */ void (*nlminfo_release_p)(struct proc *p); Modified: stable/9/sys/kern/kern_fork.c ============================================================================== --- stable/9/sys/kern/kern_fork.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/kern/kern_fork.c Sat Sep 21 16:46:34 2013 (r255763) @@ -89,10 +89,8 @@ dtrace_fork_func_t dtrace_fasttrap_fork; #endif SDT_PROVIDER_DECLARE(proc); -SDT_PROBE_DEFINE(proc, kernel, , create, create); -SDT_PROBE_ARGTYPE(proc, kernel, , create, 0, "struct proc *"); -SDT_PROBE_ARGTYPE(proc, kernel, , create, 1, "struct proc *"); -SDT_PROBE_ARGTYPE(proc, kernel, , create, 2, "int"); +SDT_PROBE_DEFINE3(proc, kernel, , create, create, "struct proc *", + "struct proc *", "int"); #ifndef _SYS_SYSPROTO_H_ struct fork_args { Modified: stable/9/sys/kern/kern_linker.c ============================================================================== --- stable/9/sys/kern/kern_linker.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/kern/kern_linker.c Sat Sep 21 16:46:34 2013 (r255763) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -580,8 +581,6 @@ linker_make_file(const char *pathname, l lf->ndeps = 0; lf->deps = NULL; lf->loadcnt = ++loadcnt; - lf->sdt_probes = NULL; - lf->sdt_nprobes = 0; STAILQ_INIT(&lf->common); TAILQ_INIT(&lf->modules); TAILQ_INSERT_TAIL(&linker_files, lf, link); @@ -1044,6 +1043,9 @@ kern_kldload(struct thread *td, const ch lf->userrefs++; if (fileid != NULL) *fileid = lf->id; + + EVENTHANDLER_INVOKE(kld_load, lf); + #ifdef HWPMC_HOOKS KLD_DOWNGRADE(); pkm.pm_file = lf->filename; @@ -1099,12 +1101,10 @@ kern_kldunload(struct thread *td, int fi if (lf) { KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs)); - /* Check if there are DTrace probes enabled on this file. */ - if (lf->nenabled > 0) { - printf("kldunload: attempt to unload file that has" - " DTrace probes enabled\n"); + EVENTHANDLER_INVOKE(kld_unload, lf, &error); + if (error != 0) error = EBUSY; - } else if (lf->userrefs == 0) { + else if (lf->userrefs == 0) { /* * XXX: maybe LINKER_UNLOAD_FORCE should override ? */ Modified: stable/9/sys/kern/kern_proc.c ============================================================================== --- stable/9/sys/kern/kern_proc.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/kern/kern_proc.c Sat Sep 21 16:46:34 2013 (r255763) @@ -91,33 +91,18 @@ __FBSDID("$FreeBSD$"); #endif SDT_PROVIDER_DEFINE(proc); -SDT_PROBE_DEFINE(proc, kernel, ctor, entry, entry); -SDT_PROBE_ARGTYPE(proc, kernel, ctor, entry, 0, "struct proc *"); -SDT_PROBE_ARGTYPE(proc, kernel, ctor, entry, 1, "int"); -SDT_PROBE_ARGTYPE(proc, kernel, ctor, entry, 2, "void *"); -SDT_PROBE_ARGTYPE(proc, kernel, ctor, entry, 3, "int"); -SDT_PROBE_DEFINE(proc, kernel, ctor, return, return); -SDT_PROBE_ARGTYPE(proc, kernel, ctor, return, 0, "struct proc *"); -SDT_PROBE_ARGTYPE(proc, kernel, ctor, return, 1, "int"); -SDT_PROBE_ARGTYPE(proc, kernel, ctor, return, 2, "void *"); -SDT_PROBE_ARGTYPE(proc, kernel, ctor, return, 3, "int"); -SDT_PROBE_DEFINE(proc, kernel, dtor, entry, entry); -SDT_PROBE_ARGTYPE(proc, kernel, dtor, entry, 0, "struct proc *"); -SDT_PROBE_ARGTYPE(proc, kernel, dtor, entry, 1, "int"); -SDT_PROBE_ARGTYPE(proc, kernel, dtor, entry, 2, "void *"); -SDT_PROBE_ARGTYPE(proc, kernel, dtor, entry, 3, "struct thread *"); -SDT_PROBE_DEFINE(proc, kernel, dtor, return, return); -SDT_PROBE_ARGTYPE(proc, kernel, dtor, return, 0, "struct proc *"); -SDT_PROBE_ARGTYPE(proc, kernel, dtor, return, 1, "int"); -SDT_PROBE_ARGTYPE(proc, kernel, dtor, return, 2, "void *"); -SDT_PROBE_DEFINE(proc, kernel, init, entry, entry); -SDT_PROBE_ARGTYPE(proc, kernel, init, entry, 0, "struct proc *"); -SDT_PROBE_ARGTYPE(proc, kernel, init, entry, 1, "int"); -SDT_PROBE_ARGTYPE(proc, kernel, init, entry, 2, "int"); -SDT_PROBE_DEFINE(proc, kernel, init, return, return); -SDT_PROBE_ARGTYPE(proc, kernel, init, return, 0, "struct proc *"); -SDT_PROBE_ARGTYPE(proc, kernel, init, return, 1, "int"); -SDT_PROBE_ARGTYPE(proc, kernel, init, return, 2, "int"); +SDT_PROBE_DEFINE4(proc, kernel, ctor, entry, entry, "struct proc *", "int", + "void *", "int"); +SDT_PROBE_DEFINE4(proc, kernel, ctor, return, return, "struct proc *", "int", + "void *", "int"); +SDT_PROBE_DEFINE4(proc, kernel, dtor, entry, entry, "struct proc *", "int", + "void *", "struct thread *"); +SDT_PROBE_DEFINE3(proc, kernel, dtor, return, return, "struct proc *", "int", + "void *"); +SDT_PROBE_DEFINE3(proc, kernel, init, entry, entry, "struct proc *", "int", + "int"); +SDT_PROBE_DEFINE3(proc, kernel, init, return, return, "struct proc *", "int", + "int"); MALLOC_DEFINE(M_PGRP, "pgrp", "process group header"); MALLOC_DEFINE(M_SESSION, "session", "session header"); Modified: stable/9/sys/kern/kern_sdt.c ============================================================================== --- stable/9/sys/kern/kern_sdt.c Sat Sep 21 14:23:20 2013 (r255762) +++ stable/9/sys/kern/kern_sdt.c Sat Sep 21 16:46:34 2013 (r255763) @@ -23,317 +23,29 @@ * SUCH DAMAGE. * * $FreeBSD$ - * - * Backend for the Statically Defined Tracing (SDT) kernel support. This is - * required to allow a module to load even though DTrace kernel support may - * not be present. A module may be built with SDT probes in it which are - * registered and deregistered via SYSINIT/SYSUNINIT. - * */ #include "opt_kdtrace.h" -#include #include #include -#include -#include -#include -#include -#include #include /* - * This is the list of statically defined tracing providers. - */ -static TAILQ_HEAD(sdt_provider_list_head, sdt_provider) sdt_provider_list; - -/* - * Mutex to serialise access to the SDT provider list. - */ -static struct sx sdt_sx; - -/* - * Hook for the DTrace probe function. The 'sdt' provider will set this - * to dtrace_probe when it loads. + * Hook for the DTrace probe function. The SDT provider will set this to + * dtrace_probe() when it loads. */ sdt_probe_func_t sdt_probe_func = sdt_probe_stub; -static sdt_provider_listall_func_t sdt_provider_register_func = NULL; -static sdt_provider_listall_func_t sdt_provider_deregister_func = NULL; -static sdt_probe_listall_func_t sdt_probe_register_func = NULL; - -static void *sdt_provider_register_arg; -static void *sdt_provider_deregister_arg; -static void *sdt_probe_register_arg; - -static int sdt_provider_listall_locked(sdt_provider_listall_func_t, void *); - /* * This is a stub for probe calls in case kernel DTrace support isn't - * compiled in. It should never get called because there is no DTrace - * support to enable it. + * enabled. It should never get called because there is no DTrace support + * to enable it. */ void sdt_probe_stub(uint32_t id, uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4) { - printf("sdt_probe_stub: Why did this get called?\n"); -} - -/* - * Called from SYSINIT to register a provider. - */ -void -sdt_provider_register(void *arg) -{ - struct sdt_provider *prov = arg; - - sx_xlock(&sdt_sx); - - TAILQ_INSERT_TAIL(&sdt_provider_list, prov, prov_entry); - - TAILQ_INIT(&prov->probe_list); - - if (sdt_provider_register_func != NULL) - sdt_provider_register_func(prov, sdt_provider_register_arg); - - sx_xunlock(&sdt_sx); -} - -/* - * Called from SYSUNINIT to de-register a provider. - */ -void -sdt_provider_deregister(void *arg) -{ - struct sdt_provider *prov = arg; - - sx_xlock(&sdt_sx); - - TAILQ_REMOVE(&sdt_provider_list, prov, prov_entry); - - if (sdt_provider_deregister_func != NULL) - sdt_provider_deregister_func(prov, sdt_provider_deregister_arg); - - sx_xunlock(&sdt_sx); -} - -/* - * Called from SYSINIT to register a statically defined trace probe. - */ -void -sdt_probe_register(void *arg) -{ - struct sdt_probe *probe = arg; - - /* - * Check the reference structure version. Only version 1 is - * supported at the moment. - */ - if (probe->version != sizeof(struct sdt_probe)) { - printf("%s:%s:%s has version %d when %d required\n", probe->mod, probe->func, probe->name, probe->version, (int) sizeof(struct sdt_probe)); - return; - } - - sx_xlock(&sdt_sx); - - TAILQ_INSERT_TAIL(&probe->prov->probe_list, probe, probe_entry); - - TAILQ_INIT(&probe->argtype_list); - - probe->state = SDT_INIT; - - if (sdt_probe_register_func != NULL) - sdt_probe_register_func(probe, sdt_provider_register_arg); - - sx_xunlock(&sdt_sx); -} - -/* - * Called from SYSUNINIT to de-register a statically defined trace probe. - */ -void -sdt_probe_deregister(void *arg) -{ - struct sdt_probe *probe = arg; - - sx_xlock(&sdt_sx); - - if (probe->state == SDT_INIT) { - TAILQ_REMOVE(&probe->prov->probe_list, probe, probe_entry); - probe->state = SDT_UNINIT; - } - - sx_xunlock(&sdt_sx); -} - -/* - * Called from SYSINIT to register a statically defined trace probe argument. - */ -void -sdt_argtype_register(void *arg) -{ - struct sdt_argtype *argtype = arg; - - sx_xlock(&sdt_sx); - - TAILQ_INSERT_TAIL(&argtype->probe->argtype_list, argtype, argtype_entry); - - argtype->probe->n_args++; - - sx_xunlock(&sdt_sx); -} - -/* - * Called from SYSUNINIT to de-register a statically defined trace probe argument. - */ -void -sdt_argtype_deregister(void *arg) -{ - struct sdt_argtype *argtype = arg; - - sx_xlock(&sdt_sx); - - TAILQ_REMOVE(&argtype->probe->argtype_list, argtype, argtype_entry); - - sx_xunlock(&sdt_sx); -} - -static void -sdt_init(void *arg) -{ - sx_init_flags(&sdt_sx, "Statically Defined Tracing", SX_NOWITNESS); - - TAILQ_INIT(&sdt_provider_list); -} - -SYSINIT(sdt, SI_SUB_KDTRACE, SI_ORDER_FIRST, sdt_init, NULL); - -static void -sdt_uninit(void *arg) -{ - sx_destroy(&sdt_sx); -} - -SYSUNINIT(sdt, SI_SUB_KDTRACE, SI_ORDER_FIRST, sdt_uninit, NULL); - -/* - * List statically defined tracing providers. - */ -int -sdt_provider_listall(sdt_provider_listall_func_t callback_func, void *arg) -{ - int error; - - sx_xlock(&sdt_sx); - error = sdt_provider_listall_locked(callback_func, arg); - sx_xunlock(&sdt_sx); - - return (error); -} - -static int -sdt_provider_listall_locked(sdt_provider_listall_func_t callback_func, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 21 22:07:24 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C78F71D2; Sat, 21 Sep 2013 22:07:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B4C562B15; Sat, 21 Sep 2013 22:07:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8LM7O2a001391; Sat, 21 Sep 2013 22:07:24 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8LM7OcC001390; Sat, 21 Sep 2013 22:07:24 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201309212207.r8LM7OcC001390@svn.freebsd.org> From: Rick Macklem Date: Sat, 21 Sep 2013 22:07:24 +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: r255769 - stable/9/sys/fs/nfsclient X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Sep 2013 22:07:24 -0000 Author: rmacklem Date: Sat Sep 21 22:07:24 2013 New Revision: 255769 URL: http://svnweb.freebsd.org/changeset/base/255769 Log: MFC: r255216 Crashes have been observed for NFSv4.1 mounts when the system is being shut down which were caused by the nfscbd_pool being destroyed before the backchannel is disabled. This patch is believed to fix the problem, by simply avoiding ever destroying the nfscbd_pool. Since the NFS client module cannot be unloaded, this should not cause a memory leak. Modified: stable/9/sys/fs/nfsclient/nfs_clkrpc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clkrpc.c Sat Sep 21 21:40:57 2013 (r255768) +++ stable/9/sys/fs/nfsclient/nfs_clkrpc.c Sat Sep 21 22:07:24 2013 (r255769) @@ -270,20 +270,13 @@ nfsrvd_cbinit(int terminating) NFSD_LOCK_ASSERT(); - if (terminating) { + if (nfscbd_pool == NULL) { NFSD_UNLOCK(); - svcpool_destroy(nfscbd_pool); - nfscbd_pool = NULL; + nfscbd_pool = svcpool_create("nfscbd", NULL); + nfscbd_pool->sp_rcache = NULL; + nfscbd_pool->sp_assign = NULL; + nfscbd_pool->sp_done = NULL; NFSD_LOCK(); } - - NFSD_UNLOCK(); - - nfscbd_pool = svcpool_create("nfscbd", NULL); - nfscbd_pool->sp_rcache = NULL; - nfscbd_pool->sp_assign = NULL; - nfscbd_pool->sp_done = NULL; - - NFSD_LOCK(); } From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 21 22:10:03 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8D3F34E2; Sat, 21 Sep 2013 22:10:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7AD392B59; Sat, 21 Sep 2013 22:10:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8LMA3Vv004190; Sat, 21 Sep 2013 22:10:03 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8LMA3fD004188; Sat, 21 Sep 2013 22:10:03 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201309212210.r8LMA3fD004188@svn.freebsd.org> From: Rick Macklem Date: Sat, 21 Sep 2013 22:10:03 +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: r255770 - stable/9/sys/rpc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Sep 2013 22:10:03 -0000 Author: rmacklem Date: Sat Sep 21 22:10:02 2013 New Revision: 255770 URL: http://svnweb.freebsd.org/changeset/base/255770 Log: MFC: r255284 It was reported via email that the cu_sent field used by the krpc client side UDP was observed as way out of range and caused the rpc.lockd daemon to hang trying to do an RPC. Inspection of the code found two places where the RPC request is re-queued, but the value of cu_sent was not incremented. Since cu_sent is always decremented when the RPC request is dequeued, I think this could have caused cu_sent to go out of range. This patch adds lines to increment cu_sent for these two cases. Modified: stable/9/sys/rpc/clnt_dg.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/rpc/clnt_dg.c ============================================================================== --- stable/9/sys/rpc/clnt_dg.c Sat Sep 21 22:07:24 2013 (r255769) +++ stable/9/sys/rpc/clnt_dg.c Sat Sep 21 22:10:02 2013 (r255770) @@ -682,6 +682,7 @@ get_reply: next_sendtime += retransmit_time; goto send_again; } + cu->cu_sent += CWNDSCALE; TAILQ_INSERT_TAIL(&cs->cs_pending, cr, cr_link); } @@ -733,6 +734,7 @@ got_reply: */ XDR_DESTROY(&xdrs); mtx_lock(&cs->cs_lock); + cu->cu_sent += CWNDSCALE; TAILQ_INSERT_TAIL(&cs->cs_pending, cr, cr_link); cr->cr_mrep = NULL; From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 21 22:13:18 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id F113D7E3; Sat, 21 Sep 2013 22:13:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DC54D2B94; Sat, 21 Sep 2013 22:13:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8LMDHhs007254; Sat, 21 Sep 2013 22:13:17 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8LMDHPL007252; Sat, 21 Sep 2013 22:13:17 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201309212213.r8LMDHPL007252@svn.freebsd.org> From: Rick Macklem Date: Sat, 21 Sep 2013 22:13:17 +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: r255773 - stable/9/sys/nlm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Sep 2013 22:13:18 -0000 Author: rmacklem Date: Sat Sep 21 22:13:17 2013 New Revision: 255773 URL: http://svnweb.freebsd.org/changeset/base/255773 Log: MFC: r255333 Intermittent crashes in the NLM (rpc.lockd) code during system shutdown was reporetd via email. The crashes occurred because the client side NLM would attempt to use its socket after it had been destroyed. Looking at the code, it would soclose() once the reference count on the socket handling structure went to 0. Unfortunately, nlm_host_get_rpc() will simply allocate a new socket handling structure when none exists and use the now soclose()d socket. Since there doesn't seem to be a safe way to determine when the socket is no longer needed, this patch modifies the code so that it never soclose()es the socket. Since there is only one socket ever created, this does not introduce a leak when the rpc.lockd is stopped/restarted. The patch also disables unloading of the nfslockd module, since it is not safe to do so (and has never been safe to do so, from what I can see). Modified: stable/9/sys/nlm/nlm_prot_impl.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/nlm/nlm_prot_impl.c ============================================================================== --- stable/9/sys/nlm/nlm_prot_impl.c Sat Sep 21 22:12:09 2013 (r255772) +++ stable/9/sys/nlm/nlm_prot_impl.c Sat Sep 21 22:13:17 2013 (r255773) @@ -133,6 +133,11 @@ static time_t nlm_grace_threshold; static time_t nlm_next_idle_check; /* + * A flag to indicate the server is already running. + */ +static int nlm_is_running; + +/* * A socket to use for RPC - shared by all IPv4 RPC clients. */ static struct socket *nlm_socket; @@ -1526,51 +1531,51 @@ nlm_server_main(int addr_count, char **a struct nlm_waiting_lock *nw; vop_advlock_t *old_nfs_advlock; vop_reclaim_t *old_nfs_reclaim; - int v4_used; -#ifdef INET6 - int v6_used; -#endif - if (nlm_socket) { + if (nlm_is_running != 0) { NLM_ERR("NLM: can't start server - " "it appears to be running already\n"); return (EPERM); } - memset(&opt, 0, sizeof(opt)); + if (nlm_socket == NULL) { + memset(&opt, 0, sizeof(opt)); - nlm_socket = NULL; - error = socreate(AF_INET, &nlm_socket, SOCK_DGRAM, 0, - td->td_ucred, td); - if (error) { - NLM_ERR("NLM: can't create IPv4 socket - error %d\n", error); - return (error); - } - opt.sopt_dir = SOPT_SET; - opt.sopt_level = IPPROTO_IP; - opt.sopt_name = IP_PORTRANGE; - portlow = IP_PORTRANGE_LOW; - opt.sopt_val = &portlow; - opt.sopt_valsize = sizeof(portlow); - sosetopt(nlm_socket, &opt); + error = socreate(AF_INET, &nlm_socket, SOCK_DGRAM, 0, + td->td_ucred, td); + if (error) { + NLM_ERR("NLM: can't create IPv4 socket - error %d\n", + error); + return (error); + } + opt.sopt_dir = SOPT_SET; + opt.sopt_level = IPPROTO_IP; + opt.sopt_name = IP_PORTRANGE; + portlow = IP_PORTRANGE_LOW; + opt.sopt_val = &portlow; + opt.sopt_valsize = sizeof(portlow); + sosetopt(nlm_socket, &opt); #ifdef INET6 - nlm_socket6 = NULL; - error = socreate(AF_INET6, &nlm_socket6, SOCK_DGRAM, 0, - td->td_ucred, td); - if (error) { - NLM_ERR("NLM: can't create IPv6 socket - error %d\n", error); - goto out; - return (error); - } - opt.sopt_dir = SOPT_SET; - opt.sopt_level = IPPROTO_IPV6; - opt.sopt_name = IPV6_PORTRANGE; - portlow = IPV6_PORTRANGE_LOW; - opt.sopt_val = &portlow; - opt.sopt_valsize = sizeof(portlow); - sosetopt(nlm_socket6, &opt); + nlm_socket6 = NULL; + error = socreate(AF_INET6, &nlm_socket6, SOCK_DGRAM, 0, + td->td_ucred, td); + if (error) { + NLM_ERR("NLM: can't create IPv6 socket - error %d\n", + error); + soclose(nlm_socket); + nlm_socket = NULL; + return (error); + } + opt.sopt_dir = SOPT_SET; + opt.sopt_level = IPPROTO_IPV6; + opt.sopt_name = IPV6_PORTRANGE; + portlow = IPV6_PORTRANGE_LOW; + opt.sopt_val = &portlow; + opt.sopt_valsize = sizeof(portlow); + sosetopt(nlm_socket6, &opt); #endif + } nlm_auth = authunix_create(curthread->td_ucred); @@ -1622,6 +1627,7 @@ nlm_server_main(int addr_count, char **a error = EINVAL; goto out; } + nlm_is_running = 1; NLM_DEBUG(1, "NLM: local NSM state is %d\n", smstat.state); nlm_nsm_state = smstat.state; @@ -1638,6 +1644,7 @@ nlm_server_main(int addr_count, char **a nfs_reclaim_p = old_nfs_reclaim; out: + nlm_is_running = 0; if (pool) svcpool_destroy(pool); @@ -1661,13 +1668,8 @@ out: * nlm_hosts to the host (which may remove it from the list * and free it). After this phase, the only entries in the * nlm_host list should be from other threads performing - * client lock requests. We arrange to defer closing the - * sockets until the last RPC client handle is released. + * client lock requests. */ - v4_used = 0; -#ifdef INET6 - v6_used = 0; -#endif mtx_lock(&nlm_global_lock); TAILQ_FOREACH(nw, &nlm_waiting_locks, nw_link) { wakeup(nw); @@ -1678,43 +1680,10 @@ out: nlm_host_release(host); mtx_lock(&nlm_global_lock); } - TAILQ_FOREACH_SAFE(host, &nlm_hosts, nh_link, nhost) { - mtx_lock(&host->nh_lock); - if (host->nh_srvrpc.nr_client - || host->nh_clntrpc.nr_client) { - if (host->nh_addr.ss_family == AF_INET) - v4_used++; -#ifdef INET6 - if (host->nh_addr.ss_family == AF_INET6) - v6_used++; -#endif - /* - * Note that the rpc over udp code copes - * correctly with the fact that a socket may - * be used by many rpc handles. - */ - if (host->nh_srvrpc.nr_client) - CLNT_CONTROL(host->nh_srvrpc.nr_client, - CLSET_FD_CLOSE, 0); - if (host->nh_clntrpc.nr_client) - CLNT_CONTROL(host->nh_clntrpc.nr_client, - CLSET_FD_CLOSE, 0); - } - mtx_unlock(&host->nh_lock); - } mtx_unlock(&nlm_global_lock); AUTH_DESTROY(nlm_auth); - if (!v4_used) - soclose(nlm_socket); - nlm_socket = NULL; -#ifdef INET6 - if (!v6_used) - soclose(nlm_socket6); - nlm_socket6 = NULL; -#endif - return (error); } @@ -2438,7 +2407,15 @@ static int nfslockd_modevent(module_t mod, int type, void *data) { - return (0); + switch (type) { + case MOD_LOAD: + return (0); + case MOD_UNLOAD: + /* The NLM module cannot be safely unloaded. */ + /* FALLTHROUGH */ + default: + return (EOPNOTSUPP); + } } static moduledata_t nfslockd_mod = { "nfslockd",