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: 10568503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D290139A for ; Fri, 17 Aug 2018 07:59:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95A6B2B0A2 for ; Fri, 17 Aug 2018 07:59:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89DFA2B0A5; Fri, 17 Aug 2018 07:59:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A96D2B0A2 for ; Fri, 17 Aug 2018 07:59:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B0E1F6B0722; Fri, 17 Aug 2018 03:59:14 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id ABE0E6B0724; Fri, 17 Aug 2018 03:59:14 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B01E6B0725; Fri, 17 Aug 2018 03:59:14 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f197.google.com (mail-qt0-f197.google.com [209.85.216.197]) by kanga.kvack.org (Postfix) with ESMTP id 6985A6B0722 for ; Fri, 17 Aug 2018 03:59:14 -0400 (EDT) Received: by mail-qt0-f197.google.com with SMTP id l23-v6so5666985qtp.1 for ; Fri, 17 Aug 2018 00:59:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=Qb4hyL4rrGPoTYwIKYzHdGKRm4AdGEVxwOwM6doqdTo=; b=nQxggCjZ4avXLRLx3CzhFHaIKW2DYM5KQHDRshMI84ypw3Fe9GWNp5FB7tI4TAq3+x rwXPA3jKlhj0YgAifEPi/StQ0LF3RsTJWNpdVL0XzuR4qborILUycOUnRlmaJrDYXedZ lfqibV0hEhjWUj+mnBUw+4jjMVhGRkx8yppWpQ392ZybldnEuuWqUSwQXeuO4rLSi6N6 p7EbkOxqqWzVK+wyGLQLypXq017BvnLciC2zrgao5eOjZ0kEJYPYExiy7a4VZuhvdcXU jmHagrIQXe+ru8D8T5Kxyrqq1aXFNGf3ZJ2XnH3/mZKxqkrdJj1mVvogKvJT3jG+lrcK 3tBQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AOUpUlFwhvk889Mo0nxskRJXI6SVhypYOVUMnH7HSZ85bE2A+/9b6Lmf NMm/PLb52ncmu8lLZarT84GW1YKniIbcNU3/fExcpGeMj+QnlR53KmkiFLnyb+Wxbg+Jwh1qHSt r/FT8P6bc5Ihjg5OwtgDR0+9kZGBsp5IVwQkLedd5RJjt4orUbJGwS0KSgt7f7ZskCg== X-Received: by 2002:ac8:23a5:: with SMTP id q34-v6mr33887522qtq.196.1534492754214; Fri, 17 Aug 2018 00:59:14 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwrW8pzJSiaiWTxzwqLYzry8/UMvKr6Y6UbzolQWHBrFxq45scewCfPUJf3cGBI31sJNyEw X-Received: by 2002:ac8:23a5:: with SMTP id q34-v6mr33887509qtq.196.1534492753773; Fri, 17 Aug 2018 00:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534492753; cv=none; d=google.com; s=arc-20160816; b=Wnom2He268J7s9/OSR1N0lSBrB/OVRQfBAs4JejdI2Dz9pRP2c8MaQJmkAXzIl3Cfx gHBEL5T1E0ucVky1MAy+ZTYK3c/KXmydLg+gggVk4ogofzs5tQmIeQlsejNhi3cvIHLM JJH8+5gtBVisUv3G3CoFrVioKvJZK8LB4b6cYAxa/5PUt9FD0PZn3GOkb826yHEUeoLe KRBXqpV6sCQ9mU0ynHT/gBp4BjhQqTf3fVACNYWbk/MNhuBRaYXIUF+lrNrFO9KyvTfh N4Ga10lZfi9PN7JBmLQVnqRP7WaEq1KD1VkZpj0Nfkb8yVLKcwybVG26azJbtaSWxj3j XMvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Qb4hyL4rrGPoTYwIKYzHdGKRm4AdGEVxwOwM6doqdTo=; b=Tbnj4BCChntVsN5QvdioQMllYdk6naGqvgxWppgcdu0KQKVIKkYe+CCIPatrOCsDwn WSCDks37gp40nOAQC11ukD8i3bhjPE874Amo4jrqosI1w+bfIAHn3X0z//QLX58ui0Tj c70zoZT87k7WXCDwlSjcQPPs3SGAM5VL4T8TCGAkvSHuqa1QTYo6ANl9d93R3shu68fV kvlhqlU0jotDSQ0cL3shKtjp8y4WaaIgU5+plkJIH2SJ9pyRuPMlmygeyV1MDTTK4PQn yPvoMkvs1cbf2eM/eOC2A596X8oKgLs+hIHvNDQPdKaCs5ZQLJyaUlKKo7o17IlBD+9s vAOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id a65-v6si1438434qkg.6.2018.08.17.00.59.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Aug 2018 00:59:13 -0700 (PDT) Received-SPF: pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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:'' X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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) {