From owner-freebsd-net@FreeBSD.ORG Thu Nov 15 19:16:12 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D1ABCF7F; Thu, 15 Nov 2012 19:16:12 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 91D4F8FC0C; Thu, 15 Nov 2012 19:16:12 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id kp6so1394560pab.13 for ; Thu, 15 Nov 2012 11:16:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=LzMa1B6/y8A8sezs+XidoLqSDprcGpzwIZPFFeIXyRg=; b=l16sRC/OV4FsCFGcaU0H0Li5U6jUZIxA7OSxi7Fd49/PYRL2Pb9hCx87z1kMwg4/Zg qv4FEtnTMpq0tS7wzy5AiN1H26Yu3CBjdXqLQ6ZHy99LT4onqmgMr+XXAexW0jNX4kwY Fm+x3CssdII0RONHk7FhXn2h+VrivL3C5Ra3wmCzKaxirI/s9K3vMqoRUx7eGncWe7pg jSzJX1rUMc4+HZEAmq8rO5C7q2Mpq+ytUQaaiWFhVPUiyL9/qc1yne9FzffiVRSRJmnt e9BuYbb5nfEorjSJGvl/zvPZ/KbR0zXKM8lzDq2G7mLtmUOuZkDs/zdWXPYRNPrRJWJ8 89CQ== MIME-Version: 1.0 Received: by 10.68.209.166 with SMTP id mn6mr1878624pbc.95.1353006972359; Thu, 15 Nov 2012 11:16:12 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.68.124.130 with HTTP; Thu, 15 Nov 2012 11:16:12 -0800 (PST) In-Reply-To: <201211151836.04709.zec@fer.hr> References: <201210291115.23845.zec@fer.hr> <201211151836.04709.zec@fer.hr> Date: Thu, 15 Nov 2012 11:16:12 -0800 X-Google-Sender-Auth: BzHBpD3CrgErucYcfhLLRpVLBUI Message-ID: Subject: Re: VIMAGE crashes on 9.x with hotplug net80211 devices From: Adrian Chadd To: Marko Zec Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-net@freebsd.org, Hans Petter Selasky , freebsd-hackers@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2012 19:16:12 -0000 Hans brings up a very good point for USB - they split if_alloc and if_attach across two different threads. So this works for non-USB devices, but not for USB devices. Hans, does each device implement its own workqueue for this kind of delayed action, or is there some generic work queue that is doing this work? Adrian On 15 November 2012 09:36, Marko Zec wrote: > On Thursday 15 November 2012 07:18:31 Adrian Chadd wrote: >> Hi, >> >> Here's what I have thus far. Please ignore the device_printf() change. >> >> This works for me, both for hotplug cardbus wireless devices as well >> as (inadvertently!) a USB bluetooth device. >> >> What do you think? > > It looks that you've hit the right spot to set curvnet context in > device_probe_and_attach(). > > Could you try out a slightly revised verstion (attached) - this one also > removes now redundant curvnet setting from linker routines (kldload / > kldunload), and adds a few extra bits which might be necessary for a > broader range of drivers to work. > > Note that I haven't tested this myself as I don't have a -CURRENT machine > ATM, but a similar patch for 8.3 apparently works fine, though I don't have > hotplugabble network cards to play with (neither cardbus nor USB)... > > Cheers, > > Marko