linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Qian Cai <cai@lca.pw>
Cc: David Hildenbrand <david@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	stable <stable@vger.kernel.org>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	Michal Hocko <mhocko@suse.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Linux MM <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v4] mm/memory_hotplug: Fix remove_memory() lockdep splat
Date: Sat, 11 Jan 2020 15:25:43 +0100	[thread overview]
Message-ID: <A5A31713-0D55-487C-814A-1415BB26DC1F@redhat.com> (raw)
In-Reply-To: <0BE8F7EF-01DC-47BD-899B-11FB8B40EB0A@lca.pw>



> Am 11.01.2020 um 14:56 schrieb Qian Cai <cai@lca.pw>:
> 
> 
> 
>> On Jan 11, 2020, at 6:03 AM, David Hildenbrand <david@redhat.com> wrote:
>> 
>> So I just remember why I think this (and the previously reported done
>> for ACPI DIMMs) are false positives. The actual locking order is
>> 
>> onlining/offlining from user space:
>> 
>> kn->count -> device_hotplug_lock -> cpu_hotplug_lock -> mem_hotplug_lock
>> 
>> memory removal:
>> 
>> device_hotplug_lock -> cpu_hotplug_lock -> mem_hotplug_lock -> kn->count
>> 
>> 
>> 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
>> 
>> I have no clue why the device_hotplug_lock does not pop up in the
>> lockdep report here. Sounds wrong to me.
>> 
>> I think this is a false positive and not stable material.
> 
> The point is that there are other paths does kn->count —> cpu_hotplug_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.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
> 

But not the lock of the memory devices, or am I missing something?



  reply	other threads:[~2020-01-11 14:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10 21:22 Dan Williams
2020-01-10 22:33 ` David Hildenbrand
2020-01-10 23:29   ` Dan Williams
2020-01-11 11:03     ` David Hildenbrand
2020-01-11 13:55       ` Qian Cai
2020-01-11 14:25         ` David Hildenbrand [this message]
2020-01-11 14:52           ` David Hildenbrand
2020-01-11 17:41             ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A5A31713-0D55-487C-814A-1415BB26DC1F@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=stable@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox