From: Mark Rutland <mark.rutland@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
akpm@linux-foundation.org, will.deacon@arm.com,
catalin.marinas@arm.com, mhocko@suse.com,
mgorman@techsingularity.net, james.morse@arm.com,
robin.murphy@arm.com, cpandya@codeaurora.org,
arunks@codeaurora.org, dan.j.williams@intel.com,
osalvador@suse.de, david@redhat.com, cai@lca.pw,
logang@deltatee.com, ira.weiny@intel.com
Subject: Re: [PATCH V2 2/2] arm64/mm: Enable memory hot remove
Date: Tue, 23 Apr 2019 17:05:25 +0100 [thread overview]
Message-ID: <20190423160525.GD56999@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <97413c39-a4a9-ea1b-7093-eb18f950aad7@arm.com>
On Tue, Apr 23, 2019 at 01:01:58PM +0530, Anshuman Khandual wrote:
> Generic usage for init_mm.pagetable_lock
>
> Unless I have missed something else these are the generic init_mm kernel page table
> modifiers at runtime (at least which uses init_mm.page_table_lock)
>
> 1. ioremap_page_range() /* Mapped I/O memory area */
> 2. apply_to_page_range() /* Change existing kernel linear map */
> 3. vmap_page_range() /* Vmalloc area */
Internally, those all use the __p??_alloc() functions to handle racy
additions by transiently taking the PTL when installing a new table, but
otherwise walk kernel tables _without_ the PTL held. Note that none of
these ever free an intermediate level of table.
I believe that the idea is that operations on separate VMAs should never
conflict at the leaf level, and operations on the same VMA should be
serialised somehow w.r.t. that VMA.
AFAICT, these functions are _never_ called on the linear/direct map or
vmemmap VA ranges, and whether or not these can conflict with hot-remove
is entirely dependent on whether those ranges can share a level of table
with the vmalloc region.
Do you know how likely that is to occur? e.g. what proportion of the
vmalloc region may share a level of table with the linear or vmemmap
regions in a typical arm64 or x86 configuration? Can we deliberately
provoke this failure case?
[...]
> In all of the above.
>
> - Page table pages [p4d|pud|pmd|pte]_alloc_[kernel] settings are
> protected with init_mm.page_table_lock
Racy addition is protect in this manner.
> - Should not it require init_mm.page_table_lock for all leaf level
> (PUD|PMD|PTE) modification as well ?
As above, I believe that the PTL is assumed to not be necessary there
since other mutual exclusion should be in effect to prevent racy
modification of leaf entries.
> - Should not this require init_mm.page_table_lock for page table walk
> itself ?
>
> Not taking an overall lock for all these three operations will
> potentially race with an ongoing memory hot remove operation which
> takes an overall lock as proposed. Wondering if this has this been
> safe till now ?
I suspect that the answer is that hot-remove is not thoroughly
stress-tested today, and conflicts are possible but rare.
As above, can we figure out how likely conflicts are, and try to come up
with a stress test?
Is it possible to avoid these specific conflicts (ignoring ptdump) by
aligning VA regions such that they cannot share intermediate levels of
table?
Thanks,
Mark.
next prev parent reply other threads:[~2019-04-23 16:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-14 5:59 [PATCH V2 0/2] " Anshuman Khandual
2019-04-14 5:59 ` [PATCH V2 1/2] mm/hotplug: Reorder arch_remove_memory() call in __remove_memory() Anshuman Khandual
2019-04-15 13:58 ` David Hildenbrand
2019-04-16 10:12 ` Anshuman Khandual
2019-04-14 5:59 ` [PATCH V2 2/2] arm64/mm: Enable memory hot remove Anshuman Khandual
2019-04-15 13:48 ` Mark Rutland
2019-04-17 9:58 ` Anshuman Khandual
2019-04-17 14:21 ` Mark Rutland
2019-04-17 16:45 ` Anshuman Khandual
2019-04-17 17:39 ` Mark Rutland
2019-04-18 5:28 ` Anshuman Khandual
2019-04-23 7:31 ` Anshuman Khandual
2019-04-23 7:37 ` David Hildenbrand
2019-04-23 7:45 ` Anshuman Khandual
2019-04-23 7:51 ` David Hildenbrand
2019-04-23 8:37 ` Anshuman Khandual
2019-04-23 16:05 ` Mark Rutland [this message]
2019-04-24 5:59 ` Anshuman Khandual
2019-04-24 8:19 ` Mark Rutland
2019-04-15 13:55 ` David Hildenbrand
2019-04-16 9:52 ` Anshuman Khandual
2019-05-13 8:22 ` [PATCH V2 0/2] " David Hildenbrand
2019-05-13 8:37 ` Anshuman Khandual
2019-05-13 10:01 ` 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=20190423160525.GD56999@lakrids.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=arunks@codeaurora.org \
--cc=cai@lca.pw \
--cc=catalin.marinas@arm.com \
--cc=cpandya@codeaurora.org \
--cc=dan.j.williams@intel.com \
--cc=david@redhat.com \
--cc=ira.weiny@intel.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=logang@deltatee.com \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=robin.murphy@arm.com \
--cc=will.deacon@arm.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