From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754197AbbBKUjw (ORCPT ); Wed, 11 Feb 2015 15:39:52 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41206 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752959AbbBKUjt (ORCPT ); Wed, 11 Feb 2015 15:39:49 -0500 Date: Wed, 11 Feb 2015 12:39:47 -0800 From: Andrew Morton To: Vitaly Kuznetsov Cc: Greg Kroah-Hartman , "K. Y. Srinivasan" , Haiyang Zhang , Yasuaki Ishimatsu , Tang Chen , Vlastimil Babka , David Rientjes , Fabian Frederick , Zhang Zhen , Vladimir Davydov , Wang Nan , linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, linux-mm@kvack.org, "Rafael J. Wysocki" Subject: Re: [PATCH 1/3] driver core: export lock_device_hotplug/unlock_device_hotplug Message-Id: <20150211123947.3318933f2aca54e11324b088@linux-foundation.org> In-Reply-To: <1423669462-30918-2-git-send-email-vkuznets@redhat.com> References: <1423669462-30918-1-git-send-email-vkuznets@redhat.com> <1423669462-30918-2-git-send-email-vkuznets@redhat.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Feb 2015 16:44:20 +0100 Vitaly Kuznetsov wrote: > add_memory() is supposed to be run with device_hotplug_lock grabbed, otherwise > it can race with e.g. device_online(). Allow external modules (hv_balloon for > now) to lock device hotplug. > > ... > > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -55,11 +55,13 @@ void lock_device_hotplug(void) > { > mutex_lock(&device_hotplug_lock); > } > +EXPORT_SYMBOL_GPL(lock_device_hotplug); > > void unlock_device_hotplug(void) > { > mutex_unlock(&device_hotplug_lock); > } > +EXPORT_SYMBOL_GPL(unlock_device_hotplug); > > int lock_device_hotplug_sysfs(void) > { It's kinda crazy that lock_device_hotplug_sysfs() didn't get any documentation. I suggest adding this while you're in there: --- a/drivers/base/core.c~a +++ a/drivers/base/core.c @@ -61,6 +61,9 @@ void unlock_device_hotplug(void) mutex_unlock(&device_hotplug_lock); } +/* + * "git show 5e33bc4165f3ed" for details + */ int lock_device_hotplug_sysfs(void) { if (mutex_trylock(&device_hotplug_lock)) which is a bit lazy but whatev. I'll assume that Greg (or Rafael?) will be processing this patchset.