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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 7134DC33CA3 for ; Fri, 10 Jan 2020 17:39:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 369F420842 for ; Fri, 10 Jan 2020 17:39:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="NjJNvotb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 369F420842 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CD1DA8E0006; Fri, 10 Jan 2020 12:39:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C5CD28E0001; Fri, 10 Jan 2020 12:39:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFCC68E0006; Fri, 10 Jan 2020 12:39:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id 9A45F8E0001 for ; Fri, 10 Jan 2020 12:39:23 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 558D049961B for ; Fri, 10 Jan 2020 17:39:23 +0000 (UTC) X-FDA: 76362436206.01.shirt64_8c07d6c1af03a X-HE-Tag: shirt64_8c07d6c1af03a X-Filterd-Recvd-Size: 5022 Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Fri, 10 Jan 2020 17:39:22 +0000 (UTC) Received: by mail-oi1-f196.google.com with SMTP id c77so2541476oib.7 for ; Fri, 10 Jan 2020 09:39:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5Q1GBS2pY7ztdnXlxR3cAwmNzA2VCbkxidjpkZWDyrg=; b=NjJNvotbDqOEkfMWJSRvy4vwUYI02ZW1vOSpc2cHl5/mvinqgRmosIgnU9GAnW7jfZ v9Vlcqf//c1HxTEGAMSoZCLpIf7OE3Teox/n23PC6nclz3FTEGTEHizc0gQrIDAvsx1Y z2auqAILAT2p3aJc/R68vhuZw3zZjJkER2JgIND3oe962/kDbQ1yOS3VDme/pzfRXFPh lJK61eqLfeVM6f+PohuKoP5pcrgpSmWSfvGFwSh/GXRr/35//kLdmgKLKui3a3P5XyoS 7o6za661JWFcr9eLDUbZUMVUQMLMHVoXInq4fTFQGyx1Imnt4LS/VFXOLos7XaVFBpLW 76oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5Q1GBS2pY7ztdnXlxR3cAwmNzA2VCbkxidjpkZWDyrg=; b=VeU1C6zIIa+3GckXZxE3cSQNK7OxzZK/hZbfsSXozbsgO7+ISnSLbWjFiYWbVi277b TJUnFKqy9uy2HFCsj52NWszgiNUYNrtfublYFb9tMxclgRTnpSZjQ6cRmupk6fpG0RNM FOQC1nqkrBaE0hiBtECUKA9TULiKN5vdA2fIxUsGuKApPutwSLizBsRXNK5kTWZjEpg3 T9Ejt14rD/AYOVmUXf+Mke0qLmocjKS9g0h8vS/PnQBNkH51UAT4QmjyrkAcgI3oTA+d Y9sKBdVAtwDi/uj2WTMpM12AuCxfq946gsiuoxxtQTzY5/q0JcSPsNBJlQSYIEfQRyyU qbVg== X-Gm-Message-State: APjAAAUhyhl73egKEbLNlh2ghZ/0SmyLPAhiEKodW1RPKI0Ybvkk/9ny cxmM+UuhrgKumP23SEIijP/OsM95jR1iWKlpHXJILQ== X-Google-Smtp-Source: APXvYqxARCQe9P9OLwQdhXf4V41HnnrUs1BdyjYA2CaZfxWAt/5GhiRBCgVf4q02kq9VN+CH7UUrqyW8cIun9nTI8Yc= X-Received: by 2002:aca:1103:: with SMTP id 3mr2970929oir.70.1578677961220; Fri, 10 Jan 2020 09:39:21 -0800 (PST) MIME-Version: 1.0 References: <157863061737.2230556.3959730620803366776.stgit@dwillia2-desk3.amr.corp.intel.com> <4d0334e2-c4e7-6d3f-99ba-2ca0495e1549@redhat.com> <64902066-51dd-9693-53fc-4a5975c58409@redhat.com> In-Reply-To: <64902066-51dd-9693-53fc-4a5975c58409@redhat.com> From: Dan Williams Date: Fri, 10 Jan 2020 09:39:10 -0800 Message-ID: Subject: Re: [PATCH] mm/memory_hotplug: Fix remove_memory() lockdep splat To: David Hildenbrand Cc: Andrew Morton , stable , Vishal Verma , Pavel Tatashin , Michal Hocko , Dave Hansen , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" 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: On Fri, Jan 10, 2020 at 9:36 AM David Hildenbrand wrote: > > On 10.01.20 18:33, Dan Williams wrote: > > On Fri, Jan 10, 2020 at 9:29 AM David Hildenbrand wrote: > > [..] > >>> So then the comment is actively misleading for that case. I would > >>> expect an explicit _unlocked path for that case with a comment about > >>> why it's special. Is there already a comment to that effect somewhere? > >>> > >> > >> __add_memory() - the locked variant - is called from the same ACPI location > >> either locked or unlocked. I added a comment back then after a longe > >> discussion with Michal: > >> > >> drivers/acpi/scan.c: > >> /* > >> * 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. > >> */ > >> > >> > >> It really is a special case, though. > > > > That's a large comment block when we could have just taken the lock. > > There's probably many other code paths in the kernel where some locks > > are not necessary before userspace is up, but the code takes the lock > > anyway to minimize the code maintenance burden. Is there really a > > compelling reason to be clever here? > > It was a lengthy discussion back then and I was sharing your opinion. I > even had a patch ready to enforce that we are holding the lock (that's > how I identified that specific case in the first place). Ok, apologies I missed that opportunity to back you up. Michal, is this still worth it?