From: "Oliver O'Halloran" <oohall@gmail.com> To: Balbir Singh <bsingharora@gmail.com> Cc: Rashmica Gupta <rashmica.g@gmail.com>, linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, Anton Blanchard <anton@samba.org>, Reza Arbab <arbab@linux.vnet.ibm.com>, "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org> Subject: Re: [PATCH 8/9] powerpc/mm: Wire up hpte_removebolted for powernv Date: Thu, 13 Apr 2017 14:21:53 +1000 [thread overview] Message-ID: <CAOSf1CHr2uMC1f5fMkqVpS7-J1K20cHShjp7FcNawV2KL4D_Dw@mail.gmail.com> (raw) In-Reply-To: <1491961986.8380.13.camel@gmail.com> On Wed, Apr 12, 2017 at 11:53 AM, Balbir Singh <bsingharora@gmail.com> wrote: > On Wed, 2017-04-12 at 03:42 +1000, Oliver O'Halloran wrote: >> From: Rashmica Gupta <rashmica.g@gmail.com> >> >> Adds support for removing bolted (i.e kernel linear mapping) mappings on >> powernv. This is needed to support memory hot unplug operations which >> are required for the teardown of DAX/PMEM devices. >> >> Cc: Rashmica Gupta <rashmica.g@gmail.com> >> Cc: Anton Blanchard <anton@samba.org> >> Signed-off-by: Oliver O'Halloran <oohall@gmail.com> >> --- >> Could the original author of this add their S-o-b? I pulled it out of >> Rashmica's memtrace patch, but I remember someone saying Anton wrote >> it originally. >> --- >> arch/powerpc/mm/hash_native_64.c | 31 +++++++++++++++++++++++++++++++ >> 1 file changed, 31 insertions(+) >> >> diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c >> index 65bb8f33b399..9ba91d4905a4 100644 >> --- a/arch/powerpc/mm/hash_native_64.c >> +++ b/arch/powerpc/mm/hash_native_64.c >> @@ -407,6 +407,36 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, >> tlbie(vpn, psize, psize, ssize, 0); >> } >> >> +/* >> + * Remove a bolted kernel entry. Memory hotplug uses this. >> + * >> + * No need to lock here because we should be the only user. > > As long as this is after the necessary isolation and is called from > arch_remove_memory(), I think we should be fine > >> + */ >> +static int native_hpte_removebolted(unsigned long ea, int psize, int ssize) >> +{ >> + unsigned long vpn; >> + unsigned long vsid; >> + long slot; >> + struct hash_pte *hptep; >> + >> + vsid = get_kernel_vsid(ea, ssize); >> + vpn = hpt_vpn(ea, vsid, ssize); >> + >> + slot = native_hpte_find(vpn, psize, ssize); >> + if (slot == -1) >> + return -ENOENT; > > If slot == -1, it means someone else removed the HPTE entry? Are we racing? > I suspect we should never hit this situation during hotunplug, specifically > since this is bolted. Or the slot was never populated in the first place. I'd rather keep the current behaviour since it aligns with the behaviour of pSeries_lpar_hpte_removebolted and we might hit these situations in the future if the sub-section hotplug patches are merged (big if...). > >> + >> + hptep = htab_address + slot; >> + >> + /* Invalidate the hpte */ >> + hptep->v = 0; > > Under DEBUG or otherwise, I would add more checks like > > 1. was hpte_v & HPTE_V_VALID and BOLTED set? If not, we've already invalidated > that hpte and we can skip the tlbie. Since this was bolted you might be right > that it is always valid and bolted A VM_WARN_ON() if the bolted bit is clear might be appropriate. We don't need to check the valid bit since hpte_native_find() will fail if it's cleared. > >> + >> + /* Invalidate the TLB */ >> + tlbie(vpn, psize, psize, ssize, 0); > > The API also does not clear linear_map_hash_slots[] under DEBUG_PAGEALLOC I'm not sure what API you're referring to here. The tracking for linear_map_hash_slots[] is agnostic of mmu_hash_ops so we shouldn't be touching it here. It also looks like DEBUG_PAGEALLOC is a bit broken with hotplugged memory anyway so I think that's a fix for a different patch. > >> + return 0; >> +} >> + >> + > > Balbir Singh. _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
WARNING: multiple messages have this Message-ID (diff)
From: "Oliver O'Halloran" <oohall@gmail.com> To: Balbir Singh <bsingharora@gmail.com> Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, Reza Arbab <arbab@linux.vnet.ibm.com>, "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>, Rashmica Gupta <rashmica.g@gmail.com>, Anton Blanchard <anton@samba.org> Subject: Re: [PATCH 8/9] powerpc/mm: Wire up hpte_removebolted for powernv Date: Thu, 13 Apr 2017 14:21:53 +1000 [thread overview] Message-ID: <CAOSf1CHr2uMC1f5fMkqVpS7-J1K20cHShjp7FcNawV2KL4D_Dw@mail.gmail.com> (raw) In-Reply-To: <1491961986.8380.13.camel@gmail.com> On Wed, Apr 12, 2017 at 11:53 AM, Balbir Singh <bsingharora@gmail.com> wrote: > On Wed, 2017-04-12 at 03:42 +1000, Oliver O'Halloran wrote: >> From: Rashmica Gupta <rashmica.g@gmail.com> >> >> Adds support for removing bolted (i.e kernel linear mapping) mappings on >> powernv. This is needed to support memory hot unplug operations which >> are required for the teardown of DAX/PMEM devices. >> >> Cc: Rashmica Gupta <rashmica.g@gmail.com> >> Cc: Anton Blanchard <anton@samba.org> >> Signed-off-by: Oliver O'Halloran <oohall@gmail.com> >> --- >> Could the original author of this add their S-o-b? I pulled it out of >> Rashmica's memtrace patch, but I remember someone saying Anton wrote >> it originally. >> --- >> arch/powerpc/mm/hash_native_64.c | 31 +++++++++++++++++++++++++++++++ >> 1 file changed, 31 insertions(+) >> >> diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c >> index 65bb8f33b399..9ba91d4905a4 100644 >> --- a/arch/powerpc/mm/hash_native_64.c >> +++ b/arch/powerpc/mm/hash_native_64.c >> @@ -407,6 +407,36 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, >> tlbie(vpn, psize, psize, ssize, 0); >> } >> >> +/* >> + * Remove a bolted kernel entry. Memory hotplug uses this. >> + * >> + * No need to lock here because we should be the only user. > > As long as this is after the necessary isolation and is called from > arch_remove_memory(), I think we should be fine > >> + */ >> +static int native_hpte_removebolted(unsigned long ea, int psize, int ssize) >> +{ >> + unsigned long vpn; >> + unsigned long vsid; >> + long slot; >> + struct hash_pte *hptep; >> + >> + vsid = get_kernel_vsid(ea, ssize); >> + vpn = hpt_vpn(ea, vsid, ssize); >> + >> + slot = native_hpte_find(vpn, psize, ssize); >> + if (slot == -1) >> + return -ENOENT; > > If slot == -1, it means someone else removed the HPTE entry? Are we racing? > I suspect we should never hit this situation during hotunplug, specifically > since this is bolted. Or the slot was never populated in the first place. I'd rather keep the current behaviour since it aligns with the behaviour of pSeries_lpar_hpte_removebolted and we might hit these situations in the future if the sub-section hotplug patches are merged (big if...). > >> + >> + hptep = htab_address + slot; >> + >> + /* Invalidate the hpte */ >> + hptep->v = 0; > > Under DEBUG or otherwise, I would add more checks like > > 1. was hpte_v & HPTE_V_VALID and BOLTED set? If not, we've already invalidated > that hpte and we can skip the tlbie. Since this was bolted you might be right > that it is always valid and bolted A VM_WARN_ON() if the bolted bit is clear might be appropriate. We don't need to check the valid bit since hpte_native_find() will fail if it's cleared. > >> + >> + /* Invalidate the TLB */ >> + tlbie(vpn, psize, psize, ssize, 0); > > The API also does not clear linear_map_hash_slots[] under DEBUG_PAGEALLOC I'm not sure what API you're referring to here. The tracking for linear_map_hash_slots[] is agnostic of mmu_hash_ops so we shouldn't be touching it here. It also looks like DEBUG_PAGEALLOC is a bit broken with hotplugged memory anyway so I think that's a fix for a different patch. > >> + return 0; >> +} >> + >> + > > Balbir Singh.
next prev parent reply other threads:[~2017-04-13 4:21 UTC|newest] Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-04-11 17:42 ZONE_DEVICE and pmem API support for powerpc Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-11 17:42 ` [PATCH 1/9] mm/huge_memory: Use zap_deposited_table() more Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-12 5:44 ` Aneesh Kumar K.V 2017-04-12 5:44 ` Aneesh Kumar K.V 2017-04-18 21:35 ` David Rientjes 2017-04-18 21:35 ` David Rientjes 2017-04-11 17:42 ` [PATCH 2/9] mm/huge_memory: Deposit a pgtable for DAX PMD faults when required Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-12 5:51 ` Aneesh Kumar K.V 2017-04-12 5:51 ` Aneesh Kumar K.V 2017-04-12 5:51 ` Aneesh Kumar K.V 2017-04-11 17:42 ` [PATCH 3/9] powerpc/mm: Add _PAGE_DEVMAP for ppc64 Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-12 0:19 ` Stephen Rothwell 2017-04-12 0:19 ` Stephen Rothwell 2017-04-12 3:07 ` Aneesh Kumar K.V 2017-04-12 3:07 ` Aneesh Kumar K.V 2017-04-13 5:20 ` Aneesh Kumar K.V 2017-04-13 5:20 ` Aneesh Kumar K.V 2017-04-11 17:42 ` [PATCH 4/9] powerpc/mm: Reshuffle vmemmap_free() Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-12 0:33 ` Stephen Rothwell 2017-04-12 0:33 ` Stephen Rothwell 2017-04-11 17:42 ` [PATCH 5/9] powerpc/vmemmap: Add altmap support Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-12 0:24 ` Balbir Singh 2017-04-12 0:24 ` Balbir Singh 2017-04-11 17:42 ` [PATCH 6/9] powerpc, mm: Enable ZONE_DEVICE on powerpc Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-12 0:25 ` Balbir Singh 2017-04-12 0:25 ` Balbir Singh 2017-04-12 0:43 ` Stephen Rothwell 2017-04-12 0:43 ` Stephen Rothwell 2017-04-12 2:03 ` Michael Ellerman 2017-04-12 2:03 ` Michael Ellerman 2017-04-11 17:42 ` [PATCH 7/9] powerpc/mm: Wire up ioremap_cache Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-23 11:53 ` [7/9] " Michael Ellerman 2017-04-23 11:53 ` Michael Ellerman 2017-04-11 17:42 ` [PATCH 8/9] powerpc/mm: Wire up hpte_removebolted for powernv Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran [not found] ` <20170411174233.21902-9-oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2017-04-11 22:50 ` Anton Blanchard 2017-04-11 22:50 ` Anton Blanchard 2017-04-12 0:18 ` Stephen Rothwell 2017-04-12 0:18 ` Stephen Rothwell 2017-04-12 3:30 ` Rashmica Gupta 2017-04-12 3:30 ` Rashmica Gupta 2017-04-12 1:53 ` Balbir Singh 2017-04-12 1:53 ` Balbir Singh 2017-04-13 4:21 ` Oliver O'Halloran [this message] 2017-04-13 4:21 ` Oliver O'Halloran 2017-04-13 10:10 ` Michael Ellerman 2017-04-13 10:10 ` Michael Ellerman 2017-04-11 17:42 ` [PATCH 9/9] powerpc: Add pmem API support Oliver O'Halloran 2017-04-11 17:42 ` Oliver O'Halloran 2017-04-11 18:22 ` ZONE_DEVICE and pmem API support for powerpc Dan Williams 2017-04-11 18:22 ` Dan Williams 2017-04-12 9:14 ` Oliver O'Halloran 2017-04-12 9:14 ` Oliver O'Halloran 2017-04-12 1:10 ` Stephen Rothwell 2017-04-12 1:10 ` Stephen Rothwell
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=CAOSf1CHr2uMC1f5fMkqVpS7-J1K20cHShjp7FcNawV2KL4D_Dw@mail.gmail.com \ --to=oohall@gmail.com \ --cc=anton@samba.org \ --cc=arbab@linux.vnet.ibm.com \ --cc=bsingharora@gmail.com \ --cc=linux-nvdimm@lists.01.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=rashmica.g@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: linkBe 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.