From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qa0-f45.google.com ([209.85.216.45]:62453 "EHLO mail-qa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936163Ab3DKSFY (ORCPT ); Thu, 11 Apr 2013 14:05:24 -0400 Date: Thu, 11 Apr 2013 11:05:17 -0700 From: Tejun Heo To: "Michael S. Tsirkin" Cc: Or Gerlitz , Ming Lei , Greg Kroah-Hartman , David Miller , Roland Dreier , netdev , Yan Burman , Jack Morgenstein , Bjorn Helgaas , linux-pci@vger.kernel.org Subject: Re: [PATCH repost for-3.9] pci: avoid work_on_cpu for nested SRIOV probes Message-ID: <20130411180517.GJ17641@mtj.dyndns.org> References: <20130411153030.GA22743@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20130411153030.GA22743@redhat.com> Sender: linux-pci-owner@vger.kernel.org List-ID: Hello, On Thu, Apr 11, 2013 at 06:30:30PM +0300, Michael S. Tsirkin wrote: > The issue is that a driver, in it's probe function, calls > pci_sriov_enable so a PF device probe causes VF probe (AKA nested > probe). Each probe in pci_device_probe is (normally) run through > work_on_cpu (this is to get the right numa node for memory allocated by > the driver). In turn work_on_cpu does this internally: > > schedule_work_on(cpu, &wfc.work); > flush_work(&wfc.work); > > So if you are running probe on CPU1, and cause another > probe on the same CPU, this will try to flush > workqueue from inside same workqueue which of course > deadlocks. > > Nested probing might be tricky to get right generally. Hmm... how about adding a work_on_cpu_nested() which takes @subclass argument? Wouldn't that be much cleaner? Thanks. -- tejun