* [RFC v2 0/2] powerpc/mm: enable memory hotplug on radix
@ 2016-08-17 15:51 Reza Arbab
2016-08-17 15:51 ` [RFC v2 1/2] powerpc/mm: refactor {create,remove}_section_mapping() Reza Arbab
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Reza Arbab @ 2016-08-17 15:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Aneesh Kumar K.V, Balbir Singh, linuxppc-dev
Memory hotplug is leading to hash page table calls, even on radix:
...
arch_add_memory
create_section_mapping
htab_bolt_mapping
BUG_ON(!ppc_md.hpte_insert);
Refactor {create,remove}_section_mapping() into hash__ and radix__ variants.
RFC/TODO:
I wasn't sure what to do in radix__remove_section_mapping(). Its vmemmap
counterpart radix__vmemmap_remove_mapping() is stubbed as a FIXME. I left it
empty for now.
v2:
* Do not simply fall through to vmemmap_{create,remove}_mapping(). As Aneesh
and Michael pointed out, they are tied to CONFIG_SPARSEMEM_VMEMMAP and only
did what I needed by luck anyway.
v1:
* https://lkml.kernel.org/r/1466699962-22412-1-git-send-email-arbab@linux.vnet.ibm.com
Reza Arbab (2):
powerpc/mm: refactor {create,remove}_section_mapping()
powerpc/mm: add radix__{create,remove}_section_mapping()
arch/powerpc/include/asm/book3s/64/hash.h | 5 +++++
arch/powerpc/include/asm/book3s/64/radix.h | 5 +++++
arch/powerpc/include/asm/sparsemem.h | 22 ++++++++++++++++++++--
arch/powerpc/mm/hash_utils_64.c | 4 ++--
arch/powerpc/mm/pgtable-radix.c | 23 +++++++++++++++++++++++
5 files changed, 55 insertions(+), 4 deletions(-)
--
1.8.3.1
*** BLURB HERE ***
Reza Arbab (2):
powerpc/mm: refactor {create,remove}_section_mapping()
powerpc/mm: add radix__{create,remove}_section_mapping()
arch/powerpc/include/asm/book3s/64/hash.h | 5 +++++
arch/powerpc/include/asm/book3s/64/radix.h | 5 +++++
arch/powerpc/include/asm/sparsemem.h | 22 ++++++++++++++++++++--
arch/powerpc/mm/hash_utils_64.c | 4 ++--
arch/powerpc/mm/pgtable-radix.c | 23 +++++++++++++++++++++++
5 files changed, 55 insertions(+), 4 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [RFC v2 1/2] powerpc/mm: refactor {create,remove}_section_mapping()
2016-08-17 15:51 [RFC v2 0/2] powerpc/mm: enable memory hotplug on radix Reza Arbab
@ 2016-08-17 15:51 ` Reza Arbab
2016-08-17 15:51 ` [RFC v2 2/2] powerpc/mm: add radix__{create, remove}_section_mapping() Reza Arbab
2016-08-21 16:15 ` [RFC v2 0/2] powerpc/mm: enable memory hotplug on radix Aneesh Kumar K.V
2 siblings, 0 replies; 4+ messages in thread
From: Reza Arbab @ 2016-08-17 15:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Aneesh Kumar K.V, Balbir Singh, linuxppc-dev
Change {create,remove}_section_mapping() to be inline wrappers around
functions prefixed with "hash__".
This is preparation for the addition of their "radix__" variants. No
functional change.
Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/book3s/64/hash.h | 5 +++++
arch/powerpc/include/asm/sparsemem.h | 14 ++++++++++++--
arch/powerpc/mm/hash_utils_64.c | 4 ++--
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h
index f61cad3..dd90574 100644
--- a/arch/powerpc/include/asm/book3s/64/hash.h
+++ b/arch/powerpc/include/asm/book3s/64/hash.h
@@ -201,6 +201,11 @@ extern int __meminit hash__vmemmap_create_mapping(unsigned long start,
unsigned long phys);
extern void hash__vmemmap_remove_mapping(unsigned long start,
unsigned long page_size);
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+int hash__create_section_mapping(unsigned long start, unsigned long end);
+int hash__remove_section_mapping(unsigned long start, unsigned long end);
+#endif /* CONFIG_MEMORY_HOTPLUG */
#endif /* !__ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */
diff --git a/arch/powerpc/include/asm/sparsemem.h b/arch/powerpc/include/asm/sparsemem.h
index f6fc0ee..5014e0d 100644
--- a/arch/powerpc/include/asm/sparsemem.h
+++ b/arch/powerpc/include/asm/sparsemem.h
@@ -16,8 +16,18 @@
#endif /* CONFIG_SPARSEMEM */
#ifdef CONFIG_MEMORY_HOTPLUG
-extern int create_section_mapping(unsigned long start, unsigned long end);
-extern int remove_section_mapping(unsigned long start, unsigned long end);
+static inline int create_section_mapping(unsigned long start,
+ unsigned long end)
+{
+ return hash__create_section_mapping(start, end);
+}
+
+static inline int remove_section_mapping(unsigned long start,
+ unsigned long end)
+{
+ return hash__remove_section_mapping(start, end);
+}
+
#ifdef CONFIG_NUMA
extern int hot_add_scn_to_nid(unsigned long scn_addr);
#else
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 0821556..2a203cd 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -688,7 +688,7 @@ static unsigned long __init htab_get_table_size(void)
}
#ifdef CONFIG_MEMORY_HOTPLUG
-int create_section_mapping(unsigned long start, unsigned long end)
+int hash__create_section_mapping(unsigned long start, unsigned long end)
{
int rc = htab_bolt_mapping(start, end, __pa(start),
pgprot_val(PAGE_KERNEL), mmu_linear_psize,
@@ -702,7 +702,7 @@ int create_section_mapping(unsigned long start, unsigned long end)
return rc;
}
-int remove_section_mapping(unsigned long start, unsigned long end)
+int hash__remove_section_mapping(unsigned long start, unsigned long end)
{
int rc = htab_remove_mapping(start, end, mmu_linear_psize,
mmu_kernel_ssize);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RFC v2 2/2] powerpc/mm: add radix__{create, remove}_section_mapping()
2016-08-17 15:51 [RFC v2 0/2] powerpc/mm: enable memory hotplug on radix Reza Arbab
2016-08-17 15:51 ` [RFC v2 1/2] powerpc/mm: refactor {create,remove}_section_mapping() Reza Arbab
@ 2016-08-17 15:51 ` Reza Arbab
2016-08-21 16:15 ` [RFC v2 0/2] powerpc/mm: enable memory hotplug on radix Aneesh Kumar K.V
2 siblings, 0 replies; 4+ messages in thread
From: Reza Arbab @ 2016-08-17 15:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Aneesh Kumar K.V, Balbir Singh, linuxppc-dev
Add radix variants of the memory hotplug mapping functions.
Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/book3s/64/radix.h | 5 +++++
arch/powerpc/include/asm/sparsemem.h | 8 ++++++++
arch/powerpc/mm/pgtable-radix.c | 23 +++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h
index df29422..97e71cb 100644
--- a/arch/powerpc/include/asm/book3s/64/radix.h
+++ b/arch/powerpc/include/asm/book3s/64/radix.h
@@ -229,6 +229,11 @@ extern void radix__vmemmap_remove_mapping(unsigned long start,
extern int radix__map_kernel_page(unsigned long ea, unsigned long pa,
pgprot_t flags, unsigned int psz);
+#ifdef CONFIG_MEMORY_HOTPLUG
+int radix__create_section_mapping(unsigned long start, unsigned long end);
+void radix__remove_section_mapping(unsigned long start, unsigned long end);
+#endif /* CONFIG_MEMORY_HOTPLUG */
+
static inline unsigned long radix__get_tree_size(void)
{
unsigned long rts_field;
diff --git a/arch/powerpc/include/asm/sparsemem.h b/arch/powerpc/include/asm/sparsemem.h
index 5014e0d..42fe87e 100644
--- a/arch/powerpc/include/asm/sparsemem.h
+++ b/arch/powerpc/include/asm/sparsemem.h
@@ -19,12 +19,20 @@
static inline int create_section_mapping(unsigned long start,
unsigned long end)
{
+ if (radix_enabled())
+ return radix__create_section_mapping(start, end);
+
return hash__create_section_mapping(start, end);
}
static inline int remove_section_mapping(unsigned long start,
unsigned long end)
{
+ if (radix_enabled()) {
+ radix__remove_section_mapping(start, end);
+ return 0;
+ }
+
return hash__remove_section_mapping(start, end);
}
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index af897d9..ee0286c 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -527,3 +527,26 @@ int radix__has_transparent_hugepage(void)
return 0;
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+int radix__create_section_mapping(unsigned long start, unsigned long end)
+{
+ unsigned long page_size = 1 << mmu_psize_defs[mmu_linear_psize].shift;
+
+ /* Align to the page size of the linear mapping. */
+ start = _ALIGN_DOWN(start, page_size);
+
+ for (; start < end; start += page_size) {
+ int rc = radix__map_kernel_page(start, __pa(start),
+ PAGE_KERNEL, page_size);
+ if (rc)
+ return rc;
+ }
+
+ return 0;
+}
+
+void radix__remove_section_mapping(unsigned long start, unsigned long end)
+{
+}
+#endif /* CONFIG_MEMORY_HOTPLUG */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC v2 0/2] powerpc/mm: enable memory hotplug on radix
2016-08-17 15:51 [RFC v2 0/2] powerpc/mm: enable memory hotplug on radix Reza Arbab
2016-08-17 15:51 ` [RFC v2 1/2] powerpc/mm: refactor {create,remove}_section_mapping() Reza Arbab
2016-08-17 15:51 ` [RFC v2 2/2] powerpc/mm: add radix__{create, remove}_section_mapping() Reza Arbab
@ 2016-08-21 16:15 ` Aneesh Kumar K.V
2 siblings, 0 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2016-08-21 16:15 UTC (permalink / raw)
To: Reza Arbab, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, Balbir Singh, linuxppc-dev
Reza Arbab <arbab@linux.vnet.ibm.com> writes:
> Memory hotplug is leading to hash page table calls, even on radix:
>
> ...
> arch_add_memory
> create_section_mapping
> htab_bolt_mapping
> BUG_ON(!ppc_md.hpte_insert);
>
> Refactor {create,remove}_section_mapping() into hash__ and radix__ variants.
>
> RFC/TODO:
> I wasn't sure what to do in radix__remove_section_mapping(). Its vmemmap
> counterpart radix__vmemmap_remove_mapping() is stubbed as a FIXME. I left it
> empty for now.
For linear mapping and for vmemmap area we should do something equivalent of
static void __meminit
remove_pagetable(unsigned long start, unsigned long end, bool direct)
as done for x86.
-aneesh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-21 16:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-17 15:51 [RFC v2 0/2] powerpc/mm: enable memory hotplug on radix Reza Arbab
2016-08-17 15:51 ` [RFC v2 1/2] powerpc/mm: refactor {create,remove}_section_mapping() Reza Arbab
2016-08-17 15:51 ` [RFC v2 2/2] powerpc/mm: add radix__{create, remove}_section_mapping() Reza Arbab
2016-08-21 16:15 ` [RFC v2 0/2] powerpc/mm: enable memory hotplug on radix Aneesh Kumar K.V
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.