From patchwork Fri Aug 17 07:59:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 958683 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41sFxz6mntz9s5b for ; Fri, 17 Aug 2018 18:00:55 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41sFxz4JpQzDrHP for ; Fri, 17 Aug 2018 18:00:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=david@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41sFw35hjyzDqm6 for ; Fri, 17 Aug 2018 17:59:15 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4DB2F819703B; Fri, 17 Aug 2018 07:59:13 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-9.ams2.redhat.com [10.36.117.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C54C10D18C9; Fri, 17 Aug 2018 07:59:09 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Subject: [PATCH RFC 1/2] drivers/base: export lock_device_hotplug/unlock_device_hotplug Date: Fri, 17 Aug 2018 09:59:00 +0200 Message-Id: <20180817075901.4608-2-david@redhat.com> In-Reply-To: <20180817075901.4608-1-david@redhat.com> References: <20180817075901.4608-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 17 Aug 2018 07:59:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 17 Aug 2018 07:59:13 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'david@redhat.com' RCPT:'' X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , David Hildenbrand , Heiko Carstens , linux-mm@kvack.org, Paul Mackerras , "K . Y . Srinivasan" , linux-s390@vger.kernel.org, Stephen Hemminger , Pavel Tatashin , linux-acpi@vger.kernel.org, David Rientjes , xen-devel@lists.xenproject.org, Len Brown , Haiyang Zhang , Dan Williams , Andrew Morton , Vlastimil Babka , Oscar Salvador , Greg Kroah-Hartman , "Rafael J . Wysocki" , Martin Schwidefsky , devel@linuxdriverproject.org, Vitaly Kuznetsov , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Vitaly Kuznetsov Well require to call add_memory()/add_memory_resource() with device_hotplug_lock held, to avoid a lock inversion. Allow external modules (e.g. hv_balloon) that make use of add_memory()/add_memory_resource() to lock device hotplug. Signed-off-by: Vitaly Kuznetsov [modify patch description] Signed-off-by: David Hildenbrand --- drivers/base/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 04bbcd779e11..9010b9e942b5 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -700,11 +700,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) {