From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9429C19759 for ; Thu, 1 Aug 2019 16:42:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE9CC20838 for ; Thu, 1 Aug 2019 16:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730152AbfHAQmo (ORCPT ); Thu, 1 Aug 2019 12:42:44 -0400 Received: from mga14.intel.com ([192.55.52.115]:27139 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729082AbfHAQmo (ORCPT ); Thu, 1 Aug 2019 12:42:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Aug 2019 09:42:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,334,1559545200"; d="scan'208";a="324299006" Received: from rjwysock-mobl1.ger.corp.intel.com (HELO [10.249.145.65]) ([10.249.145.65]) by orsmga004.jf.intel.com with ESMTP; 01 Aug 2019 09:42:37 -0700 Subject: Re: [PATCH v1] drivers/acpi/scan.c: Document why we don't need the device_hotplug_lock To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-acpi@vger.kernel.org, Michal Hocko , Oscar Salvador , Andrew Morton References: <20190731135306.31524-1-david@redhat.com> From: "Rafael J. Wysocki" Organization: Intel Technology Poland Sp. z o. o., KRS 101882, ul. Slowackiego 173, 80-298 Gdansk Message-ID: Date: Thu, 1 Aug 2019 18:42:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190731135306.31524-1-david@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On 7/31/2019 3:53 PM, David Hildenbrand wrote: > Let's document why the lock is not needed in acpi_scan_init(), right now > this is not really obvious. > > Cc: Rafael J. Wysocki > Cc: Michal Hocko > Cc: Oscar Salvador > Cc: Andrew Morton > Signed-off-by: David Hildenbrand Acked-by: Rafael J. Wysocki > --- > > @Andrew, can you drop "drivers/acpi/scan.c: acquire device_hotplug_lock in > acpi_scan_init()" and add this patch instead? Thanks > > --- > drivers/acpi/scan.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c > index 0e28270b0fd8..8444af6cd514 100644 > --- a/drivers/acpi/scan.c > +++ b/drivers/acpi/scan.c > @@ -2204,6 +2204,12 @@ int __init acpi_scan_init(void) > acpi_gpe_apply_masked_gpes(); > acpi_update_all_gpes(); > > + /* > + * Although we call__add_memory() that is documented to require the > + * device_hotplug_lock, it is not necessary here because this is an > + * early code when userspace or any other code path cannot trigger > + * hotplug/hotunplug operations. > + */ > mutex_lock(&acpi_scan_lock); > /* > * Enumerate devices in the ACPI namespace.