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, DKIM_VALID_AU,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 F3DF2C33C9E for ; Sat, 11 Jan 2020 13:56:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7817E20661 for ; Sat, 11 Jan 2020 13:56:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="OK9i4wKZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7817E20661 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lca.pw Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D12098E0005; Sat, 11 Jan 2020 08:56:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC1E28E0001; Sat, 11 Jan 2020 08:56:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD89C8E0005; Sat, 11 Jan 2020 08:56:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id A4E238E0001 for ; Sat, 11 Jan 2020 08:56:03 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 1A6B1181AC9C6 for ; Sat, 11 Jan 2020 13:56:03 +0000 (UTC) X-FDA: 76365502206.21.field97_8c16ab2e44463 X-HE-Tag: field97_8c16ab2e44463 X-Filterd-Recvd-Size: 4640 Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Sat, 11 Jan 2020 13:56:02 +0000 (UTC) Received: by mail-qv1-f66.google.com with SMTP id dp13so2090429qvb.7 for ; Sat, 11 Jan 2020 05:56:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=pLHRqkxg+SGX61pyQZgO27/FZ0iiiEv81an7baxGtT8=; b=OK9i4wKZg4fpUMfvuXi2xTweFEImd2guEcKGUGG9TGCnq/lnobxG5dIEKh+f5v4Z5t RJguCkMFef6Kyh658FgBzhIuXfuA2DgakWfeWnR5v8dRbT9qsGppLVUSHaQx1fTTI3pp 7jSMOw8w7XL1PQ+Xuzu9phKMirES4XYeQUnPXdJIjnRp6Q5jifr+F7juLnTV6HiKHdsh 7hEzCE4KcXFZkEVQjIKHWm0BmPvivOR6+QT7EzNH/rUSKN9P1VIxVYEEfV42I9+WrzwV wf8m+vDhPxjuRfRnPbZUta1RTimN7ihWkbwg8ulLOVSY0hBdFoYkV6x01ICtFF3AJHnM CRLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=pLHRqkxg+SGX61pyQZgO27/FZ0iiiEv81an7baxGtT8=; b=GjX3TweDZz32HR9qnxJBgRH94CiJaFzUnngJA/OAOvBsAhwFT8P8AVBYZQqhnYE7ax fnpNNCGIl1HPxar1KmMgL/xfEQkimc66f10ELJWmg6vRRZEvu0pyxRGVvUl5h9KV7TOm hBt82J4hlVVtxaRCAKLMqp6Fda3yPabu4KkhwjMwX09kP/MLpZzfm/B6I/7EYGM2/Mbl fDs7fNyXGrfvWKJSi9VT0e6MfIcp5F+Hu7/cjy8iybXiCQB60v/YHhmVoyegsTEDTZka Xz6C8QJ6Xc3AAol6ih0aFbLKumjLhS0CMXoq6cXqZp05FC8Y8D67B87WTC655Q+XbRfP iktA== X-Gm-Message-State: APjAAAXtfqWsb14OvdmZgyRSFv5SU3tvEpynz38Tl3QdQD1ogNCptnqF NFthevK7t12w5bCwsaAaPT2jxADbuL8vpg== X-Google-Smtp-Source: APXvYqyGmywokZQjVyxs1thk3QfLbiLA75tqN71SQZ7K+dfrdGpw+G6es//twpI2Pr5mRwsHAW+hHA== X-Received: by 2002:a05:6214:180e:: with SMTP id o14mr3499290qvw.209.1578750961706; Sat, 11 Jan 2020 05:56:01 -0800 (PST) Received: from [192.168.1.183] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id c8sm2636707qtv.61.2020.01.11.05.56.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Jan 2020 05:56:01 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Qian Cai Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v4] mm/memory_hotplug: Fix remove_memory() lockdep splat Date: Sat, 11 Jan 2020 08:55:59 -0500 Message-Id: <0BE8F7EF-01DC-47BD-899B-11FB8B40EB0A@lca.pw> References: Cc: Dan Williams , Andrew Morton , stable , Vishal Verma , Pavel Tatashin , Michal Hocko , Dave Hansen , Linux MM , Linux Kernel Mailing List , Greg KH In-Reply-To: To: David Hildenbrand X-Mailer: iPhone Mail (17C54) 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 Jan 11, 2020, at 6:03 AM, David Hildenbrand wrote: >=20 > So I just remember why I think this (and the previously reported done > for ACPI DIMMs) are false positives. The actual locking order is >=20 > onlining/offlining from user space: >=20 > kn->count -> device_hotplug_lock -> cpu_hotplug_lock -> mem_hotplug_lock >=20 > memory removal: >=20 > device_hotplug_lock -> cpu_hotplug_lock -> mem_hotplug_lock -> kn->count >=20 >=20 > This looks like a locking inversion - but it's not. Whenever we come via > user space we do a mutex_trylock(), which resolves this issue by backing > up. The device_hotplug_lock will prevent >=20 > I have no clue why the device_hotplug_lock does not pop up in the > lockdep report here. Sounds wrong to me. >=20 > I think this is a false positive and not stable material. The point is that there are other paths does kn->count =E2=80=94> cpu_hotplu= g_lock without needing device_hotplug_lock to race with memory removal. kmem_cache_shrink_all+0x50/0x100 (cpu_hotplug_lock.rw_sem/mem_hotplug_lock.r= w_sem) shrink_store+0x34/0x60 slab_attr_store+0x6c/0x170 sysfs_kf_write+0x70/0xb0 kernfs_fop_write+0x11c/0x270 ((kn->count) __vfs_write+0x3c/0x70 vfs_write+0xcc/0x200 ksys_write+0x7c/0x140 system_call+0x5c/0x6=