All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pasha Tatashin <Pavel.Tatashin@microsoft.com>
To: David Hildenbrand <david@redhat.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: Michal Hocko <mhocko@suse.com>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Len Brown <lenb@kernel.org>,
	YASUAKI ISHIMATSU <yasu.isimatu@gmail.com>,
	Nathan Fontenot <nfont@linux.vnet.ibm.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Oscar Salvador <osalvador@suse.de>,
	Juergen Gross <jgross@suse.com>,
	Mathieu Malaterre <malat@debian.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	John
Subject: Re: [PATCH RFCv2 2/6] mm/memory_hotplug: make add_memory() take the device_hotplug_lock
Date: Thu, 30 Aug 2018 19:36:43 +0000	[thread overview]
Message-ID: <b535ed4a-faa1-9281-e759-ef4b599298ae__43256.4387600452$1535657727$gmane$org@microsoft.com> (raw)
In-Reply-To: <20180821104418.12710-3-david@redhat.com>

On 8/21/18 6:44 AM, David Hildenbrand wrote:
> add_memory() currently does not take the device_hotplug_lock, however
> is aleady called under the lock from
> 	arch/powerpc/platforms/pseries/hotplug-memory.c
> 	drivers/acpi/acpi_memhotplug.c
> to synchronize against CPU hot-remove and similar.
> 
> In general, we should hold the device_hotplug_lock when adding memory
> to synchronize against online/offline request (e.g. from user space) -
> which already resulted in lock inversions due to device_lock() and
> mem_hotplug_lock - see 30467e0b3be ("mm, hotplug: fix concurrent memory
> hot-add deadlock"). add_memory()/add_memory_resource() will create memory
> block devices, so this really feels like the right thing to do.
> 
> Holding the device_hotplug_lock makes sure that a memory block device
> can really only be accessed (e.g. via .online/.state) from user space,
> once the memory has been fully added to the system.
> 
> The lock is not held yet in
> 	drivers/xen/balloon.c
> 	arch/powerpc/platforms/powernv/memtrace.c
> 	drivers/s390/char/sclp_cmd.c
> 	drivers/hv/hv_balloon.c
> So, let's either use the locked variants or take the lock.
> 
> Don't export add_memory_resource(), as it once was exported to be used
> by XEN, which is never built as a module. If somebody requires it, we
> also have to export a locked variant (as device_hotplug_lock is never
> exported).

Reviewed-by: Pavel Tatashin <pavel.tatashin@microsoft.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-08-30 19:36 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21 10:44 [PATCH RFCv2 0/6] mm: online/offline_pages called w.o. mem_hotplug_lock David Hildenbrand
2018-08-21 10:44 ` David Hildenbrand
2018-08-21 10:44 ` [PATCH RFCv2 1/6] mm/memory_hotplug: make remove_memory() take the device_hotplug_lock David Hildenbrand
2018-08-21 10:44 ` David Hildenbrand
2018-08-21 10:44   ` David Hildenbrand
2018-08-30 19:35   ` Pasha Tatashin
2018-08-30 19:35   ` Pasha Tatashin
2018-08-30 19:35     ` Pasha Tatashin
2018-08-30 19:35     ` Pasha Tatashin
2018-08-31 13:12     ` David Hildenbrand
2018-08-31 13:12       ` David Hildenbrand
2018-08-31 13:12     ` David Hildenbrand
2018-08-21 10:44 ` [PATCH RFCv2 2/6] mm/memory_hotplug: make add_memory() " David Hildenbrand
2018-08-21 10:44   ` David Hildenbrand
2018-08-30 19:36   ` Pasha Tatashin
2018-08-30 19:36     ` Pasha Tatashin
2018-08-30 19:36     ` Pasha Tatashin
2018-08-30 19:36   ` Pasha Tatashin [this message]
2018-08-21 10:44 ` David Hildenbrand
2018-08-21 10:44 ` [PATCH RFCv2 3/6] mm/memory_hotplug: fix online/offline_pages called w.o. mem_hotplug_lock David Hildenbrand
2018-08-21 10:44   ` David Hildenbrand
2018-08-30 19:37   ` Pasha Tatashin
2018-08-30 19:37     ` Pasha Tatashin
2018-08-30 19:37     ` Pasha Tatashin
2018-08-30 19:37   ` Pasha Tatashin
2018-09-03  0:36   ` Rashmica
2018-09-03  0:36     ` Rashmica
2018-09-17  7:32     ` David Hildenbrand
2018-09-17  7:32     ` David Hildenbrand
2018-09-17  7:32       ` David Hildenbrand
2018-09-25  1:26       ` Rashmica Gupta
2018-09-25  1:26         ` Rashmica Gupta
2018-09-25  1:26       ` Rashmica Gupta
2018-08-21 10:44 ` David Hildenbrand
2018-08-21 10:44 ` [PATCH RFCv2 4/6] powerpc/powernv: hold device_hotplug_lock when calling device_online() David Hildenbrand
2018-08-21 10:44 ` David Hildenbrand
2018-08-21 10:44   ` David Hildenbrand
2018-08-30 19:38   ` Pasha Tatashin
2018-08-30 19:38     ` Pasha Tatashin
2018-08-30 19:38   ` Pasha Tatashin
2018-08-21 10:44 ` [PATCH RFCv2 5/6] powerpc/powernv: hold device_hotplug_lock in memtrace_offline_pages() David Hildenbrand
2018-08-21 10:44 ` David Hildenbrand
2018-08-30 19:38   ` Pasha Tatashin
2018-08-30 19:38     ` Pasha Tatashin
2018-08-30 19:38   ` Pasha Tatashin
2018-08-21 10:44 ` [PATCH RFCv2 6/6] memory-hotplug.txt: Add some details about locking internals David Hildenbrand
2018-08-30 19:38   ` Pasha Tatashin
2018-08-30 19:38   ` Pasha Tatashin
2018-08-30 19:38     ` Pasha Tatashin
2018-08-30 19:38     ` Pasha Tatashin
2018-08-21 10:44 ` David Hildenbrand
2018-08-30 12:31 ` [PATCH RFCv2 0/6] mm: online/offline_pages called w.o. mem_hotplug_lock David Hildenbrand
2018-08-30 12:31   ` David Hildenbrand
2018-08-30 15:54   ` Pasha Tatashin
2018-08-30 15:54   ` Pasha Tatashin
2018-08-30 15:54     ` Pasha Tatashin
2018-08-30 15:54     ` Pasha Tatashin
2018-08-30 12:31 ` David Hildenbrand
2018-08-31 20:54 ` Oscar Salvador
2018-08-31 20:54 ` Oscar Salvador
2018-08-31 20:54   ` Oscar Salvador
2018-09-01 14:03   ` David Hildenbrand
2018-09-01 14:03   ` David Hildenbrand
2018-09-01 14:03     ` David Hildenbrand

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='b535ed4a-faa1-9281-e759-ef4b599298ae__43256.4387600452$1535657727$gmane$org@microsoft.com' \
    --to=pavel.tatashin@microsoft.com \
    --cc=benh@kernel.crashing.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jgross@suse.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=malat@debian.org \
    --cc=mhocko@suse.com \
    --cc=mpe@ellerman.id.au \
    --cc=nfont@linux.vnet.ibm.com \
    --cc=osalvador@suse.de \
    --cc=paulus@samba.org \
    --cc=rjw@rjwysocki.net \
    --cc=vbabka@suse.cz \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yasu.isimatu@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.