From patchwork Thu Apr 11 20:41:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 235923 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6DEDC2C00BB for ; Fri, 12 Apr 2013 06:41:25 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934628Ab3DKUlP (ORCPT ); Thu, 11 Apr 2013 16:41:15 -0400 Received: from mail-qe0-f54.google.com ([209.85.128.54]:61919 "EHLO mail-qe0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933891Ab3DKUlM (ORCPT ); Thu, 11 Apr 2013 16:41:12 -0400 Received: by mail-qe0-f54.google.com with SMTP id s14so1159639qeb.13 for ; Thu, 11 Apr 2013 13:41:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=kozfL1ZeOCq6eXIgX+xjaBamdFFmf1bSkymUX6J0rk0=; b=zOrNlxjBfQKOMoGlLJqfjzoCKyETZY03UfrYh4BOLfWJc+kO7cUBNLNe2Pojdgx2PN Fgbb/ZpZpzICG7nodB/NCWUavErMKiSRfZ08NUoiTYwOsE6uSuE3MWU182rQzxmuFXzD vt/85dSx6SwOBMmnaKKFSBAnfwlWNwKUxAZ2FgdjwrIsQDAc45Dvu15R4YjmOQlTATb4 wVQvupZeJEmz42tyICu2vfAA4FvAG6cpupGfoGWdUXZSRh3CCcSWJLBscqTbjfcfplAy 1CG/4hkMu9S9+TQ5yD5znZ8x7D3cNSBerUosEMbrqi0S2jB5Nb+2k9ptm8of2VRLTlif t95g== X-Received: by 10.224.213.138 with SMTP id gw10mr8715454qab.98.1365712871427; Thu, 11 Apr 2013 13:41:11 -0700 (PDT) Received: from mtj.dyndns.org (nat-pool-3-rdu.redhat.com. [66.187.233.203]) by mx.google.com with ESMTPS id ei3sm9574248qab.10.2013.04.11.13.41.07 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 11 Apr 2013 13:41:10 -0700 (PDT) Date: Thu, 11 Apr 2013 13:41:04 -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: <20130411204104.GC11956@mtj.dyndns.org> References: <20130411153030.GA22743@redhat.com> <20130411180517.GJ17641@mtj.dyndns.org> <20130411185853.GE23301@redhat.com> <20130411190408.GM17641@mtj.dyndns.org> <20130411191717.GB25515@redhat.com> <20130411192005.GN17641@mtj.dyndns.org> <20130411203053.GC25515@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130411203053.GC25515@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Hello, On Thu, Apr 11, 2013 at 11:30:53PM +0300, Michael S. Tsirkin wrote: > Okay, so you are saying it's a false-positive? Yeah, I think so. It didn't actually lock up, right? It it did, our analysis upto this point is likely to be completely wrong. > Want to send a patch so Or can try it out? Hmmm... something like the following on the workqueue side (completely untested). --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 8afab27..899d470 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -466,14 +466,21 @@ static inline bool __deprecated flush_delayed_work_sync(struct delayed_work *dwo } #ifndef CONFIG_SMP -static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) +static inline long work_on_cpu_nested(unsigned int cpu, long (*fn)(void *), + void *arg, int subclass) { return fn(arg); } #else -long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); +long work_on_cpu_nested(unsigned int cpu, long (*fn)(void *), void *arg, + int subclass); #endif /* CONFIG_SMP */ +static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) +{ + return work_on_cpu_nested(cpu, fn, arg, 0); +} + #ifdef CONFIG_FREEZER extern void freeze_workqueues_begin(void); extern bool freeze_workqueues_busy(void); diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 81f2457..c2be670 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3555,25 +3555,30 @@ static void work_for_cpu_fn(struct work_struct *work) } /** - * work_on_cpu - run a function in user context on a particular cpu + * work_on_cpu_nested - run a function in user context on a particular cpu * @cpu: the cpu to run on * @fn: the function to run * @arg: the function arg + * @subclass: lockdep subclass * * This will return the value @fn returns. * It is up to the caller to ensure that the cpu doesn't go offline. * The caller must not hold any locks which would prevent @fn from completing. + * + * XXX: explain @subclass */ -long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) +long work_on_cpu_nested(unsigned int cpu, long (*fn)(void *), void *arg, + int subclass) { struct work_for_cpu wfc = { .fn = fn, .arg = arg }; INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); + lock_set_subclass(&wfc.work.lockdep_map, subclass, _RET_IP_); schedule_work_on(cpu, &wfc.work); flush_work(&wfc.work); return wfc.ret; } -EXPORT_SYMBOL_GPL(work_on_cpu); +EXPORT_SYMBOL_GPL(work_on_cpu_nested); #endif /* CONFIG_SMP */ #ifdef CONFIG_FREEZER