From owner-freebsd-current@FreeBSD.ORG Sat Aug 1 12:12:03 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C4AF106566C; Sat, 1 Aug 2009 12:12:03 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mx1.freebsd.org (Postfix) with ESMTP id B404A8FC0C; Sat, 1 Aug 2009 12:12:02 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by fxm6 with SMTP id 6so569355fxm.43 for ; Sat, 01 Aug 2009 05:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=2B8KO3OyS4Zg30rO/3/zFa0myrDiL9MOfoaSy/IO6kM=; b=uV/Pro0W9C/a52zmoeOhvlsIADE5PNvymF0EQWY4rRJCP9rE5iHQtv52FC6CrZ68WH nM62Iw0GKMeeXtcw1uYrtmWKuXWPedbl67JjPCfBVuZWPdL09ycgwk3ZPQicWS1jScST PKUUGW8wOHLhG8n/cc9EqnjL55nki1DJcLggM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=ZkS6qWNKqVtrUR03exqtFgnerhdr+efTJfq1stC+HcTnyjfasvalMkO584BprDasIn vy0eGHgD1FKIfI87aOfNXRzn4Cu3cGB9pppGrWiCVgdc3N1nzcD+IRfg4dQDFTL+XovS h2WrVcqWnC+yQJsB7iMnoegjEBis/FU7Kj3Ho= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.124.17 with SMTP id s17mr1873768far.79.1249128721804; Sat, 01 Aug 2009 05:12:01 -0700 (PDT) In-Reply-To: <200908010630.21366.hselasky@c2i.net> References: <3bbf2fe10907310759o3be1f565t4122fcd66c4531f4@mail.gmail.com> <200907311919.26913.hselasky@c2i.net> <4e6cba830907311917j5d3c0eb6u7f7b1099d3acd504@mail.gmail.com> <200908010630.21366.hselasky@c2i.net> Date: Sat, 1 Aug 2009 14:12:01 +0200 X-Google-Sender-Auth: 6268fecb26211f93 Message-ID: <3bbf2fe10908010512j6aa02d9bk7a99f0f31ae313b2@mail.gmail.com> From: Attilio Rao To: Hans Petter Selasky Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Peter Holm , Giovanni Trematerra , freebsd-current@freebsd.org Subject: Re: [PATCH] Newbus locking X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2009 12:12:03 -0000 2009/8/1 Hans Petter Selasky : > > Attilio: Your newbus_lock() must be moved into usb_probe_and_attach(), and > maybe in usb_suspend_resume(). newbus_lock() should be locked always after > "udev->default_sx + 1" in usb_device.c. "udev->default_sx + 1" is the lock > protecting enumeration on a per-device level. Try on a usb device: > > usbconfig -u XXX -a YYY set_config 255 > > Then: > > usbconfig -u XXX -a YYY set_config 0 > > And I think you will have a prompt panic, because the newbus lock is not > locked. Nice catch, pho just reported that to me. I'm going to fix it now. Thanks. > BTW: Why do none of the device_get_xxx() functions not have newbus lock > assertions in them? Because not all the device_get_ functions need to be locked. Generally the context alredy provide correct locking for them. Attilio -- Peace can only be achieved by understanding - A. Einstein