From: ar@linux.vnet.ibm.com (Andrea Reale)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] Hot-remove implementation for arm64
Date: Fri, 21 Apr 2017 11:05:01 +0100 [thread overview]
Message-ID: <20170421100500.GB20029@samekh> (raw)
In-Reply-To: <535ba380-56e8-db3d-25c5-14d51e48105f@redhat.com>
Hi all,
thanks for taking the time to comment. Replies in-line.
On Wed, Apr 19, 2017 at 08:53:13AM -0700, Laura Abbott wrote:
> On 04/18/2017 11:48 AM, Ard Biesheuvel wrote:
> >On 18 April 2017 at 19:21, Mark Rutland <mark.rutland@arm.com> wrote:
> >>On Fri, Apr 14, 2017 at 03:01:58PM +0100, Andrea Reale wrote:
[...]
> >>
> >> From a quick scan, I see that it's necessary to use pgtable_page_ctor()
> >>for pages that will be used for userspace page tables, but it's not
> >>clear to me if it's ever necessary for pages used for kernel page
> >>tables.
> >>
> >>If it is, we appear to have a bug on arm64.
> >>
> >>Laura, Ard, thoughts?
> >>
> >
> >The generic apply_to_page_range() will expect the PTE lock to be
> >initialized for page table pages that are not part of init_mm. For
> >arm64, that is precisely efi_mm as far as I am aware. For EFI, the
> >locking is unnecessary but does no harm (the permissions are set once
> >via apply_to_page_range() at boot), so I added this call when adding
> >support for strict permissions in EFI rt services mappings.
> >
> >So I think it is appropriate for create_pgd_mapping() to be in charge
> >of calling the ctor(). We simply have no destroy_pgd_mapping()
> >counterpart that would be the place for the dtor() call, given that we
> >never take down EFI rt services mappi >
> >Whether it makes sense or not to lock/unlock in apply_to_page_range()
> >is something I did not spend any brain cycles on at the time.
> >
>
> Agreed there shouldn't be a problem right now. I do think the locking is
> appropriate in apply_to_page_range given what other functions also get
> locked.
>
> I really wish this were less asymmetrical though since it get hard
> to reason about. It looks like hotplug_paging will call the ctor,
> so is there an issue with calling hot-remove on memory that was once
> hot-added or is that not a concern?
>
> Thanks,
> Laura
I think the confusion comes from the fact that, in hotplug_paging, we are
passing pgd_pgtable_alloc as the page allocator for __create_pgd_mapping,
which always calls the ctor.
If I got things right (but, please, correct me if I am wrong), we don't
need to get the pte_lock that the ctor gets since - in hotplug - we are
adding to init_mm.
Moreover, I am just realizing that calling the dtor while hot-removing
might create problems when removing memory that *was not* previously
hotplugged, as we are calling a dtor on something that was never
ctor'ed. Is that what you were hinting at, Laura?
Thanks and best regards,
Andrea
WARNING: multiple messages have this Message-ID (diff)
From: Andrea Reale <ar@linux.vnet.ibm.com>
To: Laura Abbott <labbott@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Mark Rutland <mark.rutland@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Florian Fainelli <f.fainelli@gmail.com>,
m.bielski@virtualopensystems.com, scott.branden@broadcom.com,
Will Deacon <will.deacon@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Xishi Qiu <qiuxishi@huawei.com>
Subject: Re: [PATCH 4/5] Hot-remove implementation for arm64
Date: Fri, 21 Apr 2017 11:05:01 +0100 [thread overview]
Message-ID: <20170421100500.GB20029@samekh> (raw)
In-Reply-To: <535ba380-56e8-db3d-25c5-14d51e48105f@redhat.com>
Hi all,
thanks for taking the time to comment. Replies in-line.
On Wed, Apr 19, 2017 at 08:53:13AM -0700, Laura Abbott wrote:
> On 04/18/2017 11:48 AM, Ard Biesheuvel wrote:
> >On 18 April 2017 at 19:21, Mark Rutland <mark.rutland@arm.com> wrote:
> >>On Fri, Apr 14, 2017 at 03:01:58PM +0100, Andrea Reale wrote:
[...]
> >>
> >> From a quick scan, I see that it's necessary to use pgtable_page_ctor()
> >>for pages that will be used for userspace page tables, but it's not
> >>clear to me if it's ever necessary for pages used for kernel page
> >>tables.
> >>
> >>If it is, we appear to have a bug on arm64.
> >>
> >>Laura, Ard, thoughts?
> >>
> >
> >The generic apply_to_page_range() will expect the PTE lock to be
> >initialized for page table pages that are not part of init_mm. For
> >arm64, that is precisely efi_mm as far as I am aware. For EFI, the
> >locking is unnecessary but does no harm (the permissions are set once
> >via apply_to_page_range() at boot), so I added this call when adding
> >support for strict permissions in EFI rt services mappings.
> >
> >So I think it is appropriate for create_pgd_mapping() to be in charge
> >of calling the ctor(). We simply have no destroy_pgd_mapping()
> >counterpart that would be the place for the dtor() call, given that we
> >never take down EFI rt services mappi >
> >Whether it makes sense or not to lock/unlock in apply_to_page_range()
> >is something I did not spend any brain cycles on at the time.
> >
>
> Agreed there shouldn't be a problem right now. I do think the locking is
> appropriate in apply_to_page_range given what other functions also get
> locked.
>
> I really wish this were less asymmetrical though since it get hard
> to reason about. It looks like hotplug_paging will call the ctor,
> so is there an issue with calling hot-remove on memory that was once
> hot-added or is that not a concern?
>
> Thanks,
> Laura
I think the confusion comes from the fact that, in hotplug_paging, we are
passing pgd_pgtable_alloc as the page allocator for __create_pgd_mapping,
which always calls the ctor.
If I got things right (but, please, correct me if I am wrong), we don't
need to get the pte_lock that the ctor gets since - in hotplug - we are
adding to init_mm.
Moreover, I am just realizing that calling the dtor while hot-removing
might create problems when removing memory that *was not* previously
hotplugged, as we are calling a dtor on something that was never
ctor'ed. Is that what you were hinting at, Laura?
Thanks and best regards,
Andrea
next prev parent reply other threads:[~2017-04-21 10:05 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 14:54 [PATCH 0/5] Memory hotplug support for arm64 - complete patchset Andrea Reale
2017-04-11 14:54 ` Andrea Reale
2017-04-11 14:54 ` [PATCH 1/5] arm64: memory-hotplug: Add MEMORY_HOTPLUG, MEMORY_HOTREMOVE, MEMORY_PROBE Andrea Reale
2017-04-11 14:54 ` Andrea Reale
2017-04-12 0:20 ` kbuild test robot
2017-04-12 0:20 ` kbuild test robot
2017-04-11 14:54 ` [PATCH 2/5] arm64: defconfig: enable MEMORY_HOTPLUG config options Andrea Reale
2017-04-11 14:54 ` Andrea Reale
2017-04-11 14:55 ` [PATCH 3/5] Memory hotplug support for arm64 platform (v2) Andrea Reale
2017-04-11 14:55 ` Andrea Reale
2017-04-11 15:58 ` Mark Rutland
2017-04-11 15:58 ` Mark Rutland
2017-04-24 16:44 ` Maciej Bielski
2017-04-24 16:44 ` Maciej Bielski
2017-04-24 17:35 ` Maciej Bielski
2017-04-24 17:35 ` Maciej Bielski
2017-04-11 14:55 ` [PATCH 4/5] Hot-remove implementation for arm64 Andrea Reale
2017-04-11 14:55 ` Andrea Reale
2017-04-11 17:12 ` Mark Rutland
2017-04-11 17:12 ` Mark Rutland
2017-04-14 14:01 ` Andrea Reale
2017-04-14 14:01 ` Andrea Reale
2017-04-18 18:21 ` Mark Rutland
2017-04-18 18:21 ` Mark Rutland
2017-04-18 18:48 ` Ard Biesheuvel
2017-04-18 18:48 ` Ard Biesheuvel
2017-04-19 15:53 ` Laura Abbott
2017-04-19 15:53 ` Laura Abbott
2017-04-21 10:05 ` Andrea Reale [this message]
2017-04-21 10:05 ` Andrea Reale
2017-04-24 23:59 ` Laura Abbott
2017-04-24 23:59 ` Laura Abbott
2017-04-21 10:02 ` Andrea Reale
2017-04-21 10:02 ` Andrea Reale
2017-04-11 14:56 ` [PATCH 5/5] Add "remove" probe driver for memory hot-remove Andrea Reale
2017-04-11 14:56 ` Andrea Reale
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=20170421100500.GB20029@samekh \
--to=ar@linux.vnet.ibm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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.