From owner-freebsd-current@FreeBSD.ORG Sat Oct 3 16:13:57 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 F20051065693 for ; Sat, 3 Oct 2009 16:13:57 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id A25CF8FC15 for ; Sat, 3 Oct 2009 16:13:57 +0000 (UTC) Received: from [IPv6:::1] (pooker.samsco.org [168.103.85.57]) (authenticated bits=0) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id n93GDpPo032800; Sat, 3 Oct 2009 10:13:51 -0600 (MDT) (envelope-from scottl@samsco.org) Mime-Version: 1.0 (Apple Message framework v1075.2) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes From: Scott Long In-Reply-To: <200910031800.24896.hselasky@c2i.net> Date: Sat, 3 Oct 2009 10:13:51 -0600 Content-Transfer-Encoding: 7bit Message-Id: References: <20091002150931.K35591@pooker.samsco.org> <200910031230.51044.hselasky@c2i.net> <200910031800.24896.hselasky@c2i.net> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1075.2) X-Spam-Status: No, score=-3.0 required=3.8 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: freebsd-current@freebsd.org Subject: Re: [PATCH] Fix for USB media not found at boot 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, 03 Oct 2009 16:13:58 -0000 On Oct 3, 2009, at 10:00 AM, Hans Petter Selasky wrote: > On Saturday 03 October 2009 17:05:35 Scott Long wrote: >> On Oct 3, 2009, at 4:30 AM, Hans Petter Selasky wrote: >>> On Saturday 03 October 2009 10:19:57 Scott Long wrote: >>>> config_intrhook system will sleep after all >>> >>> Then why do you need the intr hook callback? >> >> The config_intrhook lets you know that interrupts are enabled, the >> scheduler is running, and mountroot hasn't run yet. It provides a >> very convenient and standard way to do exactly what we want with USB >> enumeration. > > Hi, > > The root HUB attach and explore code is already running from a > separate > thread, so won't that be superfluous? I mean, the HUB explore code > for any USB > HUB will not run until the scheduler is running anyway. > > In my opinion delaying the system until the boot disk is present is > just not > good. We should rather be event driven, so that every time a new > disk becomes > present it checks it for mountroot. > > while (1) { > if (mountroot is successful) > break; > if (ctrl+c is pressed) > manual_mountroot(); > printf("Waiting 1 second for root-disk to appear. Press CTRL+C > to > abort.\n"); > sleep(1); > } > Actually, if you want to truly be event based, then instead of sleeping for a fixed time and then polling for devices, go to sleep and have GEOM wake you up when a disk device arrives. You can still wake up periodically to provide status to the user (or not, it might get too noisy). Scott