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.9 required=3.0 tests=DKIMWL_WL_HIGH,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 9489EC33CA3 for ; Sat, 11 Jan 2020 14:25:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5917C2082E for ; Sat, 11 Jan 2020 14:25:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="O/lwfD5T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5917C2082E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D97A58E0005; Sat, 11 Jan 2020 09:25:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D48EC8E0001; Sat, 11 Jan 2020 09:25:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5D188E0005; Sat, 11 Jan 2020 09:25:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id B168C8E0001 for ; Sat, 11 Jan 2020 09:25:49 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 5D0951F10 for ; Sat, 11 Jan 2020 14:25:49 +0000 (UTC) X-FDA: 76365577218.27.ear79_6ce9dee72475a X-HE-Tag: ear79_6ce9dee72475a X-Filterd-Recvd-Size: 5273 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Sat, 11 Jan 2020 14:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578752747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GGoIHsVE82pWNtE8ANGT+vPghKxNCQjjb4O+CLBCJB0=; b=O/lwfD5T8mrURAxJbtVLpQJ5pbOirLKPYdOryyMtKa/92XGpuzxkJcRJc3wATJpjNvJU2g fna1zbx7o/ssZiT8k3/LXAs2O2VJ0vGq4tBM7THFZXJ8wl1fg/D0ablr3G2qgvYjG+iVAV YhwBl4qGrWkvUSISNBvIsZUy96pBjEw= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-426-TgiKyOdtODCWawrrDGXgMw-1; Sat, 11 Jan 2020 09:25:46 -0500 Received: by mail-wr1-f70.google.com with SMTP id h30so2408735wrh.5 for ; Sat, 11 Jan 2020 06:25:45 -0800 (PST) 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=uwm6fzYAwEwYeUfJoESjpA/0Z/xwqqojB6vogh+wkjc=; b=AReFcrqUaF6oIxGpSPJv2uUiPxzxSxZzo73rMpLTLaImWjxqdhVf3y9qXuesMNXspb ovsxXLqQVdBWcfpE5ob2H4VolTkVtDFMwbgh1F02nCHOVs67onpIDQC7nu+Y8/8tIb9s 9s3W/UX/BItQFe/zaNWJfiY32nPDkIJ7RnJj69ZbsNbzbCDkYuU07cIVI+eqUgz4e9VC L5TjbjHHPEucM5IkTGxhV9lGnpRLuQvbV3YRlvhLtIMTHtvrbLs4p3RddyPVZ16DkeYF PYlYCNTLmfMKP4goQURE5sR87gf+JgGicQ7849bL5otEhuKPwo1m84jraGDAOc9GauTM aqmQ== X-Gm-Message-State: APjAAAXPHsGj/HBRdQSVMa19GS/coe3uGQxp3ywcmIcDYI+Fqb8uvJjx sGzHtwWUmPducHAsg2IIvG6fDxmviVCXbt/RjPKOQ4AB840lT64vM9bs3rCA+bttWUzP+kLbDGX Lkbbo9fn3a0I= X-Received: by 2002:a05:600c:230d:: with SMTP id 13mr10515194wmo.13.1578752744910; Sat, 11 Jan 2020 06:25:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzSMY0g766OIWIeVMg+yNdNqGqj5e1pDAALjmcABqjRilt5M6mGJLkpE9/bqBayyDf6yzOWnA== X-Received: by 2002:a05:600c:230d:: with SMTP id 13mr10515180wmo.13.1578752744691; Sat, 11 Jan 2020 06:25:44 -0800 (PST) Received: from ?IPv6:2a01:598:a803:c918:4c2f:c5d7:9026:f3de? ([2a01:598:a803:c918:4c2f:c5d7:9026:f3de]) by smtp.gmail.com with ESMTPSA id z83sm6670184wmg.2.2020.01.11.06.25.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Jan 2020 06:25:44 -0800 (PST) From: David Hildenbrand Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v4] mm/memory_hotplug: Fix remove_memory() lockdep splat Date: Sat, 11 Jan 2020 15:25:43 +0100 Message-Id: References: <0BE8F7EF-01DC-47BD-899B-11FB8B40EB0A@lca.pw> Cc: David Hildenbrand , Dan Williams , Andrew Morton , stable , Vishal Verma , Pavel Tatashin , Michal Hocko , Dave Hansen , Linux MM , Linux Kernel Mailing List , Greg KH In-Reply-To: <0BE8F7EF-01DC-47BD-899B-11FB8B40EB0A@lca.pw> To: Qian Cai X-Mailer: iPhone Mail (17C54) X-MC-Unique: TgiKyOdtODCWawrrDGXgMw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: > Am 11.01.2020 um 14:56 schrieb Qian Cai : >=20 > =EF=BB=BF >=20 >> 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. >=20 > The point is that there are other paths does kn->count =E2=80=94> cpu_hot= plug_lock without needing device_hotplug_lock to race with memory removal. >=20 > kmem_cache_shrink_all+0x50/0x100 (cpu_hotplug_lock.rw_sem/mem_hotplug_loc= k.rw_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 >=20 But not the lock of the memory devices, or am I missing something?