linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal
@ 2015-07-03 12:46 Dominik Dingel
  2015-07-03 12:46 ` [PATCH 1/4] Revert "s390/mm: change HPAGE_SHIFT type to int" Dominik Dingel
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dominik Dingel @ 2015-07-03 12:46 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Martin Schwidefsky, Heiko Carstens, linux390, Dominik Dingel,
	Christian Borntraeger, Michael Holzheu, linux-s390, linux-mm,
	Gerald Schaefer

Heiko noticed that the current check for hugepage support on s390 is a little bit to
harsh as systems which do not support will crash.
The reason is that pageblock_order can now get negative when we set HPAGE_SHIFT to 0.
To avoid all this and to avoid opening another can of worms with enabling 
HUGETLB_PAGE_SIZE_VARIABLE I think it would be best to simply allow architectures to
define their own hugepages_supported().

Thanks
    Dominik

Dominik Dingel (4):
  Revert "s390/mm: change HPAGE_SHIFT type to int"
  Revert "s390/mm: make hugepages_supported a boot time decision"
  mm: hugetlb: allow hugepages_supported to be architecture specific
  s390/hugetlb: add hugepages_supported define

 arch/s390/include/asm/hugetlb.h |  1 +
 arch/s390/include/asm/page.h    |  8 ++++----
 arch/s390/kernel/setup.c        |  2 --
 arch/s390/mm/pgtable.c          |  2 --
 include/linux/hugetlb.h         | 17 ++++++++---------
 5 files changed, 13 insertions(+), 17 deletions(-)

-- 
2.3.8

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] Revert "s390/mm: change HPAGE_SHIFT type to int"
  2015-07-03 12:46 [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal Dominik Dingel
@ 2015-07-03 12:46 ` Dominik Dingel
  2015-07-03 12:46 ` [PATCH 2/4] Revert "s390/mm: make hugepages_supported a boot time decision" Dominik Dingel
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Dingel @ 2015-07-03 12:46 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Martin Schwidefsky, Heiko Carstens, linux390, Dominik Dingel,
	Christian Borntraeger, Michael Holzheu, linux-s390, linux-mm,
	Gerald Schaefer

This reverts commit cf54e2fce51c7ad2479fe8cf213a2ed618a8189b.
---
 arch/s390/include/asm/page.h | 2 +-
 arch/s390/mm/pgtable.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index dd34523..0844b78 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -20,7 +20,7 @@
 #include <asm/setup.h>
 #ifndef __ASSEMBLY__
 
-extern int HPAGE_SHIFT;
+extern unsigned int HPAGE_SHIFT;
 #define HPAGE_SIZE	(1UL << HPAGE_SHIFT)
 #define HPAGE_MASK	(~(HPAGE_SIZE - 1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 33082d0..16154720 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -31,7 +31,7 @@
 #define ALLOC_ORDER	2
 #define FRAG_MASK	0x03
 
-int HPAGE_SHIFT;
+unsigned int HPAGE_SHIFT;
 
 unsigned long *crst_table_alloc(struct mm_struct *mm)
 {
-- 
2.3.8

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] Revert "s390/mm: make hugepages_supported a boot time decision"
  2015-07-03 12:46 [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal Dominik Dingel
  2015-07-03 12:46 ` [PATCH 1/4] Revert "s390/mm: change HPAGE_SHIFT type to int" Dominik Dingel
@ 2015-07-03 12:46 ` Dominik Dingel
  2015-07-03 12:46 ` [PATCH 3/4] mm: hugetlb: allow hugepages_supported to be architecture specific Dominik Dingel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Dingel @ 2015-07-03 12:46 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Martin Schwidefsky, Heiko Carstens, linux390, Dominik Dingel,
	Christian Borntraeger, Michael Holzheu, linux-s390, linux-mm,
	Gerald Schaefer

This reverts commit bea41197ead3e03308bdd10c11db3ce91ae5c8ab.
---
 arch/s390/include/asm/page.h | 8 ++++----
 arch/s390/kernel/setup.c     | 2 --
 arch/s390/mm/pgtable.c       | 2 --
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index 0844b78..53eacbd 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -17,10 +17,7 @@
 #define PAGE_DEFAULT_ACC	0
 #define PAGE_DEFAULT_KEY	(PAGE_DEFAULT_ACC << 4)
 
-#include <asm/setup.h>
-#ifndef __ASSEMBLY__
-
-extern unsigned int HPAGE_SHIFT;
+#define HPAGE_SHIFT	20
 #define HPAGE_SIZE	(1UL << HPAGE_SHIFT)
 #define HPAGE_MASK	(~(HPAGE_SIZE - 1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
@@ -30,6 +27,9 @@ extern unsigned int HPAGE_SHIFT;
 #define ARCH_HAS_PREPARE_HUGEPAGE
 #define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH
 
+#include <asm/setup.h>
+#ifndef __ASSEMBLY__
+
 static inline void storage_key_init_range(unsigned long start, unsigned long end)
 {
 #if PAGE_DEFAULT_KEY
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index f7f027c..ca070d2 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -885,8 +885,6 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	setup_hwcaps();
 
-	HPAGE_SHIFT = MACHINE_HAS_HPAGE ? 20 : 0;
-
 	/*
 	 * Create kernel page tables and switch to virtual addressing.
 	 */
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 16154720..b33f661 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -31,8 +31,6 @@
 #define ALLOC_ORDER	2
 #define FRAG_MASK	0x03
 
-unsigned int HPAGE_SHIFT;
-
 unsigned long *crst_table_alloc(struct mm_struct *mm)
 {
 	struct page *page = alloc_pages(GFP_KERNEL, ALLOC_ORDER);
-- 
2.3.8

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] mm: hugetlb: allow hugepages_supported to be architecture specific
  2015-07-03 12:46 [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal Dominik Dingel
  2015-07-03 12:46 ` [PATCH 1/4] Revert "s390/mm: change HPAGE_SHIFT type to int" Dominik Dingel
  2015-07-03 12:46 ` [PATCH 2/4] Revert "s390/mm: make hugepages_supported a boot time decision" Dominik Dingel
@ 2015-07-03 12:46 ` Dominik Dingel
  2015-07-03 12:46 ` [PATCH 4/4] s390/hugetlb: add hugepages_supported define Dominik Dingel
  2015-07-06  8:05 ` [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal Martin Schwidefsky
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Dingel @ 2015-07-03 12:46 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Martin Schwidefsky, Heiko Carstens, linux390, Dominik Dingel,
	Christian Borntraeger, Michael Holzheu, linux-s390, linux-mm,
	Gerald Schaefer

s390 has a constant hugepage size, by setting HPAGE_SHIFT we also
change e.g. the pageblock_order, which should be independent in
respect to hugepage support.

With this patch every architecture is free to define how to check
for hugepage support.

Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
---
 include/linux/hugetlb.h | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 2050261..d891f94 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -460,15 +460,14 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
 	return &mm->page_table_lock;
 }
 
-static inline bool hugepages_supported(void)
-{
-	/*
-	 * Some platform decide whether they support huge pages at boot
-	 * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when
-	 * there is no such support
-	 */
-	return HPAGE_SHIFT != 0;
-}
+#ifndef hugepages_supported
+/*
+ * Some platform decide whether they support huge pages at boot
+ * time. Some of them, such as powerpc, set HPAGE_SHIFT to 0
+ * when there is no such support
+ */
+#define hugepages_supported() (HPAGE_SHIFT != 0)
+#endif
 
 #else	/* CONFIG_HUGETLB_PAGE */
 struct hstate {};
-- 
2.3.8

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] s390/hugetlb: add hugepages_supported define
  2015-07-03 12:46 [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal Dominik Dingel
                   ` (2 preceding siblings ...)
  2015-07-03 12:46 ` [PATCH 3/4] mm: hugetlb: allow hugepages_supported to be architecture specific Dominik Dingel
@ 2015-07-03 12:46 ` Dominik Dingel
  2015-07-06  8:05 ` [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal Martin Schwidefsky
  4 siblings, 0 replies; 6+ messages in thread
From: Dominik Dingel @ 2015-07-03 12:46 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel
  Cc: Martin Schwidefsky, Heiko Carstens, linux390, Dominik Dingel,
	Christian Borntraeger, Michael Holzheu, linux-s390, linux-mm,
	Gerald Schaefer

On s390 we only can enable hugepages if the underlying hardware/hypervisor
also does support this. Common code now would assume this to be signaled
by setting HPAGE_SHIFT to 0. But on s390, where we only support one
hugepage size, there is a link between HPAGE_SHIFT and pageblock_order.

So instead of setting HPAGE_SHIFT to 0, we will implement the check for the
hardware capability.

Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
---
 arch/s390/include/asm/hugetlb.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
index 0130d03..d9be7c0 100644
--- a/arch/s390/include/asm/hugetlb.h
+++ b/arch/s390/include/asm/hugetlb.h
@@ -14,6 +14,7 @@
 
 #define is_hugepage_only_range(mm, addr, len)	0
 #define hugetlb_free_pgd_range			free_pgd_range
+#define hugepages_supported()			(MACHINE_HAS_HPAGE)
 
 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
 		     pte_t *ptep, pte_t pte);
-- 
2.3.8

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal
  2015-07-03 12:46 [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal Dominik Dingel
                   ` (3 preceding siblings ...)
  2015-07-03 12:46 ` [PATCH 4/4] s390/hugetlb: add hugepages_supported define Dominik Dingel
@ 2015-07-06  8:05 ` Martin Schwidefsky
  4 siblings, 0 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2015-07-06  8:05 UTC (permalink / raw)
  To: Dominik Dingel
  Cc: Andrew Morton, linux-kernel, Heiko Carstens, linux390,
	Christian Borntraeger, Michael Holzheu, linux-s390, linux-mm,
	Gerald Schaefer

On Fri,  3 Jul 2015 14:46:05 +0200
Dominik Dingel <dingel@linux.vnet.ibm.com> wrote:

> Heiko noticed that the current check for hugepage support on s390 is a little bit to
> harsh as systems which do not support will crash.
> The reason is that pageblock_order can now get negative when we set HPAGE_SHIFT to 0.
> To avoid all this and to avoid opening another can of worms with enabling 
> HUGETLB_PAGE_SIZE_VARIABLE I think it would be best to simply allow architectures to
> define their own hugepages_supported().
> 
> Thanks
>     Dominik
> 
> Dominik Dingel (4):
>   Revert "s390/mm: change HPAGE_SHIFT type to int"
>   Revert "s390/mm: make hugepages_supported a boot time decision"
>   mm: hugetlb: allow hugepages_supported to be architecture specific
>   s390/hugetlb: add hugepages_supported define
> 
>  arch/s390/include/asm/hugetlb.h |  1 +
>  arch/s390/include/asm/page.h    |  8 ++++----
>  arch/s390/kernel/setup.c        |  2 --
>  arch/s390/mm/pgtable.c          |  2 --
>  include/linux/hugetlb.h         | 17 ++++++++---------
>  5 files changed, 13 insertions(+), 17 deletions(-)
 
To have an architecture override for hugepages_supported is imho the
cleaner approach compared to the HPAGE_SHIFT tricks. I would have
preferred to use a __weak function but the #ifndef solution is fine
with me as well.

Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-06  8:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-03 12:46 [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal Dominik Dingel
2015-07-03 12:46 ` [PATCH 1/4] Revert "s390/mm: change HPAGE_SHIFT type to int" Dominik Dingel
2015-07-03 12:46 ` [PATCH 2/4] Revert "s390/mm: make hugepages_supported a boot time decision" Dominik Dingel
2015-07-03 12:46 ` [PATCH 3/4] mm: hugetlb: allow hugepages_supported to be architecture specific Dominik Dingel
2015-07-03 12:46 ` [PATCH 4/4] s390/hugetlb: add hugepages_supported define Dominik Dingel
2015-07-06  8:05 ` [PATCH 0/4] s390/mm: Fixup hugepage sw-emulated code removal Martin Schwidefsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).