Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp476258imm; Fri, 17 Aug 2018 01:00:33 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxUyDoKOyn83ClOeEcbltr0ZRF1ibXWurUhjAXZbks/hTZ/hYZ2ANpdmjvMIIPgTKJqaDel X-Received: by 2002:a62:1815:: with SMTP id 21-v6mr35625624pfy.227.1534492833121; Fri, 17 Aug 2018 01:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534492833; cv=none; d=google.com; s=arc-20160816; b=0rUxAiFkyTCKd8ZkvAr6c6vaIXZB8n9b0kRuotU09kDZbrtBbL1bVfvvMFFuWLYiNM uoJRwkfwyYktcBPXs1u1+MKIlfac+DOBHaQN8jiV/icPww9UStXUKQTpBJ4idxH2Op/9 K560UmiQt0AABZDgf/93wbWsfusY1MT6nQvcNcQhlvw2FdF0SeEXNHdUwV651dVQ6yzY /9yIMwX/2xmj1cgDvANc+VhA6LOoqWgrr5HSMT7r1UHY0zDiBeYbMWCVfzl4SCO9nIni cVOgvU2z3iEFhowNbTpokiRU9KLdAE7s/Rvsog+W6PRQARWUQOhAULPdkW1EfCizz1n9 Na0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Qb4hyL4rrGPoTYwIKYzHdGKRm4AdGEVxwOwM6doqdTo=; b=FVJQ1bEhuR1SIsu0EGOPzlhdpxhZ/XyniJ79f+NAkLadmLMqTkbia6938apMjvGLfZ sTmuJYANZOercKOkuweinq5WPc4x1sDFbqJLApADsCewVNCaDeAsMrKinLZ2TpblujLk zBRekQRz3PyTChpvGcIbD5ThfjdbVXjuUb+ahdkG9StKKpTgcZB4oBdo/CiA6hI1Xtep O3xM/Q39bkELg6g3QASm+uD0KNYvf43Fn4ks4wOVe9VY63dfG4iFn0pQMOJ4Zjd5eAEl NiSkgVIKbi6npDc3d7g0xU778Xe1eiaHprbutwBzVkssqnCqrW52S089dOJVypU64FkE znIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q30-v6si1377815pgk.253.2018.08.17.01.00.17; Fri, 17 Aug 2018 01:00:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726663AbeHQLBh (ORCPT + 99 others); Fri, 17 Aug 2018 07:01:37 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46278 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726422AbeHQLBh (ORCPT ); Fri, 17 Aug 2018 07:01:37 -0400 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 Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, devel@linuxdriverproject.org, linux-s390@vger.kernel.org, xen-devel@lists.xenproject.org, Andrew Morton , Michal Hocko , Vlastimil Babka , Dan Williams , Pavel Tatashin , Oscar Salvador , Vitaly Kuznetsov , Martin Schwidefsky , Heiko Carstens , David Hildenbrand , "K . Y . Srinivasan" , Haiyang Zhang , Stephen Hemminger , Benjamin Herrenschmidt , Paul Mackerras , "Rafael J . Wysocki" , Len Brown , Greg Kroah-Hartman , David Rientjes 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:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { -- 2.17.1