Skip to contentSkip to conversation

linux-next: build failure after merge of the final tree (tip/s390 trees related)

PATCH In review Stephen Rothwell 6 participants 26 messages Oct 18, 2012 – Oct 30, 2012

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Anyone have suggested merge fix patches I can apply?

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#1 lore raw
Quoted 13 lines · Stephen Rothwell

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

Quoted 5 lines

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Anyone have suggested merge fix patches I can apply?

See below. There's further MIPS breakage in -next; more on than in a separate email.

Ralf

 arch/mips/include/asm/pgtable.h | 2 ++
 1 file changed, 2 insertions(+)
arch/mips/include/asm/pgtable.h +2 -0
index 252202d..5f7c615 100644
@@ -534,6 +534,8 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
 	return pmd;
 }
 
+#define pmd_pgprot(x) __pgprot(pmd_val(x) & ~_PAGE_CHG_MASK)
+
 static inline pmd_t pmd_mknotpresent(pmd_t pmd)
 {
 	pmd_val(pmd) &= ~(_PAGE_PRESENT | _PAGE_VALID | _PAGE_DIRTY);
#2 lore raw

Hi Ralf,

Quoted 16 lines · On Thu, 18 Oct 2012 16:51:01 +0200 Ralf Baechle <[email protected]> wrote:
Quoted 13 lines · Stephen Rothwell

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

Quoted 7 lines
Quoted 5 lines

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Anyone have suggested merge fix patches I can apply?

See below.

I have added that to linux-next today as a merge fix.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#3 lore raw
In reply to Ralf Baechle
Quoted 19 lines · Ralf Baechle
Quoted 17 lines · Stephen Rothwell

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Quoted 8 lines
Quoted 1 line

Anyone have suggested merge fix patches I can apply?

See below. There's further MIPS breakage in -next; more on than in a separate email.

Ralf

Thanks Ralf! I've applied it, with a changelog and a
Reported-by: Stephen Rothwell line - see the commit below.

Note that I moved the definition slightly up, so that regardless of the order merging the commits don't create a conflict in linux-next. If that fine with you I'll push it out that way.

(Looking at the other MIPS problem as well.)

Thanks,

Ingo

---------------->

Quoted 1 line

From 8cd7680d8b7241941fd51d83302677d58b447223 Mon Sep 17 00:00:00 2001

From: Ralf Baechle <[email protected]>
Date: Thu, 18 Oct 2012 16:51:01 +0200
Subject: [PATCH] MIPS/thp: Add pmd_pgprot() implementation

Resolve the semantic conflict between the new THP code on MIPS and the new NUMA code, in linux-next, by adding the pmd_pgprot() method needed by the NUMA code.

---
 arch/mips/include/asm/pgtable.h | 2 ++
 1 file changed, 2 insertions(+)
arch/mips/include/asm/pgtable.h +2 -0
index c02158b..bbe4cda 100644
@@ -89,6 +89,8 @@ static inline int is_zero_pfn(unsigned long pfn)
 
 extern void paging_init(void);
 
+#define pmd_pgprot(x)		__pgprot(pmd_val(x) & ~_PAGE_CHG_MASK)
+
 /*
  * Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.
#4 lore raw

[tip:numa/core] MIPS/thp: Add pmd_pgprot() implementation

In reply to Ralf Baechle
Commit-ID:  8cd7680d8b7241941fd51d83302677d58b447223
Gitweb:     http://git.kernel.org/tip/8cd7680d8b7241941fd51d83302677d58b447223
Author:     Ralf Baechle <[email protected]>
AuthorDate: Thu, 18 Oct 2012 16:51:01 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 19 Oct 2012 23:46:11 +0200

MIPS/thp: Add pmd_pgprot() implementation

Resolve the semantic conflict between the new THP code on MIPS and the new NUMA code, in linux-next, by adding the pmd_pgprot() method needed by the NUMA code.

---
 arch/mips/include/asm/pgtable.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/mips/include/asm/pgtable.h +2 -0
index c02158b..bbe4cda 100644
@@ -89,6 +89,8 @@ static inline int is_zero_pfn(unsigned long pfn)
 
 extern void paging_init(void);
 
+#define pmd_pgprot(x)		__pgprot(pmd_val(x) & ~_PAGE_CHG_MASK)
+
 /*
  * Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.
#5 lore raw

[tip:numa/core] MIPS/thp: Fix update_mmu_cache() cache call

In reply to Ralf Baechle
Commit-ID:  7fc4d49214dba401f4b92ed62da60a5b257a653a
Gitweb:     http://git.kernel.org/tip/7fc4d49214dba401f4b92ed62da60a5b257a653a
Author:     Ingo Molnar <[email protected]>
AuthorDate: Sat, 20 Oct 2012 00:33:01 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 20 Oct 2012 00:39:02 +0200

MIPS/thp: Fix update_mmu_cache() cache call

As per recent upstream commit:

b113da65785d mm: Add and use update_mmu_cache_pmd() in transparent huge page code.

The call in do_huge_pmd_prot_none() needs to call update_mmu_cache_pmd() as well.

This resolves a MIPS build error triggered on linux-next.

---
 mm/huge_memory.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
mm/huge_memory.c +2 -2
index 8100c01..1068e78 100644
@@ -770,7 +770,7 @@ fixup:
 	/* change back to regular protection */
 	entry = pmd_modify(entry, vma->vm_page_prot);
 	set_pmd_at(mm, haddr, pmd, entry);
-	update_mmu_cache(vma, address, entry);
+	update_mmu_cache_pmd(vma, address, entry);
 
 unlock:
 	spin_unlock(&mm->page_table_lock);
@@ -846,7 +846,7 @@ migrate:
 	page_add_new_anon_rmap(new_page, vma, haddr);
 
 	set_pmd_at(mm, haddr, pmd, entry);
-	update_mmu_cache(vma, address, entry);
+	update_mmu_cache_pmd(vma, address, entry);
 	page_remove_rmap(page);
 	spin_unlock(&mm->page_table_lock);
 
#6 lore raw
In reply to Stephen Rothwell
Quoted 8 lines · Stephen Rothwell

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

The other issue I'm running into is:

CC mm/huge_memory.o
mm/huge_memory.c: In function ‘do_huge_pmd_prot_none’:
mm/huge_memory.c:789:3: error: incompatible type for argument 3 of ‘update_mmu_cache’
In file included from include/linux/mm.h:44:0,
from mm/huge_memory.c:8:
/home/ralf/src/linux/linux-mips/arch/mips/include/asm/pgtable.h:375:91: note: expected ‘struct pte_t *’ but argument is of type ‘pmd_t’ mm/huge_memory.c: In function ‘__split_huge_page_map’:
mm/huge_memory.c:1424:2: error: implicit declaration of function ‘pmd_pgprot’ [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type ‘pgprot_t’ from type ‘int’
cc1: some warnings being treated as errors
make[1]: *** [mm/huge_memory.o] Error 1

which is caused by:

commit a573b4dfcf58f86235d586ea1f82ed54b2b7e620

Author: Peter Zijlstra <[email protected]>
Date:   Tue Jul 17 18:25:14 2012 +0200

mm/mpol: Create special PROT_NONE infrastructure

is adding a update_mmu_cache() call with incorrect arguments to do_huge_pmd_prot_none(). This only shows up where update_mmu_cache() is implemented as a C function; the usual macro implementation is eating everything and the kitchensink as arguments.

Ralf

#7 lore raw
Quoted 3 lines · Ralf Baechle

CC mm/huge_memory.o
mm/huge_memory.c: In function ‘do_huge_pmd_prot_none’:
mm/huge_memory.c:789:3: error: incompatible type for argument 3 of ‘update_mmu_cache’

That appears to have become update_mmu_cache_pmd(), which makes sense given that there's now architectures that care about it.

Acked-by Peter Zijlstra
#8 lore raw
Quoted 8 lines · Peter Zijlstra
Quoted 3 lines · Ralf Baechle

CC mm/huge_memory.o
mm/huge_memory.c: In function ???do_huge_pmd_prot_none???:
mm/huge_memory.c:789:3: error: incompatible type for argument 3 of ???update_mmu_cache???

That appears to have become update_mmu_cache_pmd(), which makes sense given that there's now architectures that care about it.

Ok, I fixed it as per below. Does everyone agree?

Thanks,

Ingo

---------------->

Quoted 1 line

From 6e683978132907ff339e8a01a4d901c75709e62c Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Sat, 20 Oct 2012 00:33:01 +0200
Subject: [PATCH] MIPS/thp: Fix update_mmu_cache() cache call

As per recent upstream commit:

b113da65785d mm: Add and use update_mmu_cache_pmd() in transparent huge page code.

The call in do_huge_pmd_prot_none() needs to call update_mmu_cache_pmd() as well.

This resolves a MIPS build error triggered on linux-next.

---
 mm/huge_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/huge_memory.c +1 -1
index 8100c01..57c5018 100644
@@ -770,7 +770,7 @@ fixup:
 	/* change back to regular protection */
 	entry = pmd_modify(entry, vma->vm_page_prot);
 	set_pmd_at(mm, haddr, pmd, entry);
-	update_mmu_cache(vma, address, entry);
+	update_mmu_cache_pmd(vma, address, entry);
 
 unlock:
 	spin_unlock(&mm->page_table_lock);
Acked-by Peter Zijlstra
#9 lore raw
In reply to Peter Zijlstra

Actually, there's two sites - find the updated patch below.

Thanks,

Ingo

--------------->

Quoted 1 line

From 7fc4d49214dba401f4b92ed62da60a5b257a653a Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Sat, 20 Oct 2012 00:33:01 +0200
Subject: [PATCH] MIPS/thp: Fix update_mmu_cache() cache call

As per recent upstream commit:

b113da65785d mm: Add and use update_mmu_cache_pmd() in transparent huge page code.

The call in do_huge_pmd_prot_none() needs to call update_mmu_cache_pmd() as well.

This resolves a MIPS build error triggered on linux-next.

---
 mm/huge_memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/huge_memory.c +2 -2
index 8100c01..1068e78 100644
@@ -770,7 +770,7 @@ fixup:
 	/* change back to regular protection */
 	entry = pmd_modify(entry, vma->vm_page_prot);
 	set_pmd_at(mm, haddr, pmd, entry);
-	update_mmu_cache(vma, address, entry);
+	update_mmu_cache_pmd(vma, address, entry);
 
 unlock:
 	spin_unlock(&mm->page_table_lock);
@@ -846,7 +846,7 @@ migrate:
 	page_add_new_anon_rmap(new_page, vma, haddr);
 
 	set_pmd_at(mm, haddr, pmd, entry);
-	update_mmu_cache(vma, address, entry);
+	update_mmu_cache_pmd(vma, address, entry);
 	page_remove_rmap(page);
 	spin_unlock(&mm->page_table_lock);
 
#10 lore raw

Hi Ingo,

Quoted 10 lines · On Sat, 20 Oct 2012 00:39:38 +0200 Ingo Molnar <[email protected]> wrote:

From 7fc4d49214dba401f4b92ed62da60a5b257a653a Mon Sep 17 00:00:00 2001
From: Ingo Molnar <[email protected]>
Date: Sat, 20 Oct 2012 00:33:01 +0200
Subject: [PATCH] MIPS/thp: Fix update_mmu_cache() cache call

As per recent upstream commit:

b113da65785d mm: Add and use update_mmu_cache_pmd() in transparent huge page code.

Quoted 7 lines

The call in do_huge_pmd_prot_none() needs to call update_mmu_cache_pmd() as well.

This resolves a MIPS build error triggered on linux-next.

Just a small nit - I didn't actually report this one, just Ralf did.

Thanks for the fixes.

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#11 lore raw
In reply to Stephen Rothwell
Quoted 15 lines · On Thu, 18 Oct 2012 17:22:01 +1100 Stephen Rothwell <[email protected]>…

Hi all,

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

Quoted 5 lines

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Anyone have suggested merge fix patches I can apply?

Subject: [PATCH] s390/thp: implement pmd_pgprot() for s390

git commit "mm/thp: Preserve pgprot across huge page split" in linux-next introduced a pmd_pgprot() function, which is missing on s390, resulting in a compile error when transparent huge pages are enabled. This patch adds an implementation of pmd_pgprot() for s390.

---
 arch/s390/include/asm/pgtable.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/s390/include/asm/pgtable.h +13 -0
index f8887ab..2846920 100644
@@ -1250,6 +1250,19 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 	*pmdp = entry;
 }
 
+static inline pgprot_t pmd_pgprot(pmd_t pmd)
+{
+	pgprot_t prot = PAGE_RW;
+
+	if (pmd_val(pmd) & _SEGMENT_ENTRY_RO) {
+		if (pmd_val(pmd) & _SEGMENT_ENTRY_INV)
+			prot = PAGE_NONE;
+		else
+			prot = PAGE_RO;
+	}
+	return prot;
+}
+
 static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
 {
 	unsigned long pgprot_pmd = 0;
Signature · 1 line
1.7.11.7
#12 lore raw

Hi Gerald,

Quoted 23 lines · On Thu, 18 Oct 2012 18:26:42 +0200 Gerald Schaefer…
Quoted 13 lines · On Thu, 18 Oct 2012 17:22:01 +1100 Stephen Rothwell <[email protected]>…

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

Quoted 5 lines

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Anyone have suggested merge fix patches I can apply?

Quoted 8 lines

Subject: [PATCH] s390/thp: implement pmd_pgprot() for s390

git commit "mm/thp: Preserve pgprot across huge page split" in linux-next introduced a pmd_pgprot() function, which is missing on s390, resulting in a compile error when transparent huge pages are enabled. This patch adds an implementation of pmd_pgprot() for s390.

I have added that to linux-next today as a merge fix.

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#13 lore raw
In reply to Gerald Schaefer
Quoted 18 lines · Gerald Schaefer
Quoted 15 lines · On Thu, 18 Oct 2012 17:22:01 +1100 Stephen Rothwell <[email protected]>…

Hi all,

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

Quoted 7 lines
Quoted 5 lines

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Anyone have suggested merge fix patches I can apply?

Subject: [PATCH] s390/thp: implement pmd_pgprot() for s390

Thanks Gerald! I'll merge this as well so that the semantic conflict disappears from linux-next.

Thanks,

Ingo

#14 lore raw

[tip:numa/core] s390/thp: implement pmd_pgprot() for s390

In reply to Gerald Schaefer
Commit-ID:  ca6cfbe6d25cdf9ed81cbf26c2146eda17a70472
Gitweb:     http://git.kernel.org/tip/ca6cfbe6d25cdf9ed81cbf26c2146eda17a70472
Author:     Gerald Schaefer <[email protected]>
AuthorDate: Thu, 18 Oct 2012 18:26:42 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 19 Oct 2012 23:38:48 +0200

s390/thp: implement pmd_pgprot() for s390

Git commit "mm/thp: Preserve pgprot across huge page split" introduced a pmd_pgprot() function, which is missing on s390, resulting in a compile error in linux-next where THP is enabled on s390 as well.

This patch adds an implementation of pmd_pgprot() for s390.

---
 arch/s390/include/asm/pgtable.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
arch/s390/include/asm/pgtable.h +13 -0
index dd647c9..098fc5a 100644
@@ -1240,6 +1240,19 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 	*pmdp = entry;
 }
 
+static inline pgprot_t pmd_pgprot(pmd_t pmd)
+{
+	pgprot_t prot = PAGE_RW;
+
+	if (pmd_val(pmd) & _SEGMENT_ENTRY_RO) {
+		if (pmd_val(pmd) & _SEGMENT_ENTRY_INV)
+			prot = PAGE_NONE;
+		else
+			prot = PAGE_RO;
+	}
+	return prot;
+}
+
 static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
 {
 	unsigned long pgprot_pmd = 0;
#15 lore raw

PATCH 1/1 s390: Add pmd_mknotpresent()

In reply to Gerald Schaefer

There's a related problem on s390: other THP implementations have pmd_mknotpresent() while s390 not, resulting in:

mm/huge_memory.c:1543:2: error: implicit declaration of function 'pmd_mknotpresent'

The (untested!) patch below adds the s390 version of this method.

Gerald, Martin, did I get the S390 details right?

Thanks,

Ingo

---

arch/s390/include/asm/pgtable.h +6 -0
index 098fc5a..b820ff1 100644
@@ -1310,6 +1310,12 @@ static inline pmd_t pmd_mkyoung(pmd_t pmd)
 	return pmd;
 }
 
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	pmd_val(pmd) &= ~_SEGMENT_ENTRY_ORIGIN;
+	return pmd;
+}
+
 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
 static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
 					    unsigned long address, pmd_t *pmdp)
#16 lore raw

[tip:numa/core] sched, numa, mm, s390/thp: Add pmd_mknotpresent()

Commit-ID:  9b718e758ac91f28b6cdd354ad5ee9c767daae74
Gitweb:     http://git.kernel.org/tip/9b718e758ac91f28b6cdd354ad5ee9c767daae74
Author:     Ingo Molnar <[email protected]>
AuthorDate: Sun, 28 Oct 2012 14:10:14 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 28 Oct 2012 17:31:21 +0100

sched, numa, mm, s390/thp: Add pmd_mknotpresent()

We'd like to make use of pmd_mknotpresent() in mm/, but not all architectures have it. This patch adds the s390 version.

Cc Stephen Rothwell <[email protected]>
Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Gerald Schaefer <[email protected]>
---
 arch/s390/include/asm/pgtable.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/s390/include/asm/pgtable.h +6 -0
index 098fc5a..b820ff1 100644
@@ -1310,6 +1310,12 @@ static inline pmd_t pmd_mkyoung(pmd_t pmd)
 	return pmd;
 }
 
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	pmd_val(pmd) &= ~_SEGMENT_ENTRY_ORIGIN;
+	return pmd;
+}
+
 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
 static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
 					    unsigned long address, pmd_t *pmdp)
#17 lore raw

Re: [PATCH] s390: Add pmd_mknotpresent()

In reply to Ingo Molnar
Quoted 10 lines · On Sun, 28 Oct 2012 14:10:14 +0100 Ingo Molnar <[email protected]> wrote:

There's a related problem on s390: other THP implementations have pmd_mknotpresent() while s390 not, resulting in:

mm/huge_memory.c:1543:2: error: implicit declaration of function 'pmd_mknotpresent'

The (untested!) patch below adds the s390 version of this method.

Gerald, Martin, did I get the S390 details right?

This won't work I'm afraid. S390 uses invalid bits which need to be set to make an entry not present. Just setting the _SEGMENT_ENTRY_INV bit is not good enough either, there is _HPAGE_TYPE_NONE to consider. The patch to fix this for pmd_none & pmd_present just got added to the s390 tree on kernel.org:
https://git.kernel.org/?p=linux/kernel/git/s390/linux.git;a=shortlog;h=refs/heads/fixes

Now, if pmd_mknotpresent is supposed to make the entry invalid so that pmd_present will return false the function needs to do two things,
1) set the _SEGMENT_ENTRY_INV bit, and 2) clear the _SEGMENT_ENTRY_RO bit.

Quoted 18 lines
arch/s390/include/asm/pgtable.h +6 -0
index 098fc5a..b820ff1 100644
@@ -1310,6 +1310,12 @@ static inline pmd_t pmd_mkyoung(pmd_t pmd)
 	return pmd;
 }
 
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	pmd_val(pmd) &= ~_SEGMENT_ENTRY_ORIGIN;
+	return pmd;
+}
+
 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
 static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
 					    unsigned long address, pmd_t *pmdp)
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#18 lore raw

Re: [PATCH] s390: Add pmd_mknotpresent()

Quoted 21 lines · Martin Schwidefsky
Quoted 10 lines · On Sun, 28 Oct 2012 14:10:14 +0100 Ingo Molnar <[email protected]> wrote:

There's a related problem on s390: other THP implementations have pmd_mknotpresent() while s390 not, resulting in:

mm/huge_memory.c:1543:2: error: implicit declaration of function 'pmd_mknotpresent'

The (untested!) patch below adds the s390 version of this method.

Gerald, Martin, did I get the S390 details right?

This won't work I'm afraid. S390 uses invalid bits which need to be set to make an entry not present. Just setting the _SEGMENT_ENTRY_INV bit is not good enough either, there is _HPAGE_TYPE_NONE to consider. The patch to fix this for pmd_none & pmd_present just got added to the s390 tree on kernel.org:

Quoted 6 lines

https://git.kernel.org/?p=linux/kernel/git/s390/linux.git;a=shortlog;h=refs/heads/fixes

Now, if pmd_mknotpresent is supposed to make the entry invalid so that pmd_present will return false the function needs to do two things, 1) set the _SEGMENT_ENTRY_INV bit, and 2) clear the _SEGMENT_ENTRY_RO bit.

Would be nice if you could send me your suggested
pmd_mknotpresent().

(Writing it into the email would be enough, I can turn it into a patch - but a patch would be welcome as well.)

Thanks,

Ingo

#19 lore raw

Re: [PATCH] s390: Add pmd_mknotpresent()

Quoted 31 lines · On Mon, 29 Oct 2012 12:05:19 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 21 lines · Martin Schwidefsky
Quoted 10 lines · On Sun, 28 Oct 2012 14:10:14 +0100 Ingo Molnar <[email protected]> wrote:

There's a related problem on s390: other THP implementations have pmd_mknotpresent() while s390 not, resulting in:

mm/huge_memory.c:1543:2: error: implicit declaration of function 'pmd_mknotpresent'

The (untested!) patch below adds the s390 version of this method.

Gerald, Martin, did I get the S390 details right?

This won't work I'm afraid. S390 uses invalid bits which need to be set to make an entry not present. Just setting the _SEGMENT_ENTRY_INV bit is not good enough either, there is _HPAGE_TYPE_NONE to consider. The patch to fix this for pmd_none & pmd_present just got added to the s390 tree on kernel.org:

Quoted 6 lines

https://git.kernel.org/?p=linux/kernel/git/s390/linux.git;a=shortlog;h=refs/heads/fixes

Now, if pmd_mknotpresent is supposed to make the entry invalid so that pmd_present will return false the function needs to do two things, 1) set the _SEGMENT_ENTRY_INV bit, and 2) clear the _SEGMENT_ENTRY_RO bit.

Quoted 5 lines

Would be nice if you could send me your suggested
pmd_mknotpresent().

(Writing it into the email would be enough, I can turn it into a patch - but a patch would be welcome as well.)

This would look like the following, the patch should apply to all recent kernel version.
--
Subject: [PATCH] s390,mm: add pmd_mknotpresent

Fix the following build problem in huge_memory:

mm/huge_memory.c:1543:2: error: implicit declaration of function 'pmd_mknotpresent'

---
 arch/s390/include/asm/pgtable.h | 7 +++++++
 1 file changed, 7 insertions(+)
arch/s390/include/asm/pgtable.h +7 -0
index 335b601..4a84431 100644
@@ -1326,6 +1326,13 @@ static inline pmd_t pmd_mkyoung(pmd_t pmd)
 	return pmd;
 }
 
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	pmd_val(pmd) |= _SEGMENT_ENTRY_INV;
+	pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO;
+	return pmd;
+}
+
 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
 static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
 					    unsigned long address, pmd_t *pmdp)
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#20 lore raw

Re: [PATCH] s390: Add pmd_mknotpresent()

In reply to Ingo Molnar
Quoted 10 lines · On Sun, 28 Oct 2012 14:10:14 +0100 Ingo Molnar <[email protected]> wrote:

There's a related problem on s390: other THP implementations have pmd_mknotpresent() while s390 not, resulting in:

mm/huge_memory.c:1543:2: error: implicit declaration of function 'pmd_mknotpresent'

The (untested!) patch below adds the s390 version of this method.

Gerald, Martin, did I get the S390 details right?

The upstream thp patches for s390 fixed that by adding pmdp_invalidate() and replacing the pmd_mknotpresent() in mm/huge_memory.c, see git commit 46dcde73. The pmdp_invalidate() is already included linux-next, so it should be ok to just change mm/huge_memory.c similar to upstream:

mm/huge_memory.c +1 -2
index f1c2679..842b6df 100644
@@ -1537,8 +1537,7 @@ static int __split_huge_page_map(struct page *page,
 	 * complete. The ptl also protects against concurrent faults due to
 	 * making the pmd not-present.
 	 */
-	set_pmd_at(mm, address, pmd, pmd_mknotpresent(*pmd));
-	flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
+	pmdp_invalidate(vma, address, pmd);
 	pmd_populate(mm, pmd, pgtable);
 	ret = 1;
 

With this, s390 does not need a pmd_mknotpresent(), and using set_pmd_at(..., pmd_mknotpresent()) would be wrong on s390 anyway because we need a flushing operation to change a valid pmd.

Quoted 25 lines

Thanks,

Ingo

---

arch/s390/include/asm/pgtable.h +6 -0
index 098fc5a..b820ff1 100644
@@ -1310,6 +1310,12 @@ static inline pmd_t pmd_mkyoung(pmd_t pmd)
 	return pmd;
 }
 
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	pmd_val(pmd) &= ~_SEGMENT_ENTRY_ORIGIN;
+	return pmd;
+}
+
 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
 static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
 					    unsigned long address, pmd_t *pmdp)
#21 lore raw

Re: [PATCH] s390: Add pmd_mknotpresent()

Quoted 33 lines · Gerald Schaefer
Quoted 10 lines · On Sun, 28 Oct 2012 14:10:14 +0100 Ingo Molnar <[email protected]> wrote:

There's a related problem on s390: other THP implementations have pmd_mknotpresent() while s390 not, resulting in:

mm/huge_memory.c:1543:2: error: implicit declaration of function 'pmd_mknotpresent'

The (untested!) patch below adds the s390 version of this method.

Gerald, Martin, did I get the S390 details right?

The upstream thp patches for s390 fixed that by adding pmdp_invalidate() and replacing the pmd_mknotpresent() in mm/huge_memory.c, see git commit 46dcde73. The pmdp_invalidate() is already included linux-next, so it should be ok to just change mm/huge_memory.c similar to upstream:

mm/huge_memory.c +1 -2
index f1c2679..842b6df 100644
@@ -1537,8 +1537,7 @@ static int __split_huge_page_map(struct page *page,
 	 * complete. The ptl also protects against concurrent faults due to
 	 * making the pmd not-present.
 	 */
-	set_pmd_at(mm, address, pmd, pmd_mknotpresent(*pmd));
-	flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
+	pmdp_invalidate(vma, address, pmd);
 	pmd_populate(mm, pmd, pgtable);
 	ret = 1;
 
Quoted 4 lines

With this, s390 does not need a pmd_mknotpresent(), and using set_pmd_at(..., pmd_mknotpresent()) would be wrong on s390 anyway because we need a flushing operation to change a valid pmd.

Ok, great - so to me it seems that once the two trees are merged there's no extra change needed for s390 - so I dropped the patch.

Thanks,

Ingo

#22 lore raw
In reply to Stephen Rothwell
Quoted 15 lines · Stephen Rothwell

Hi all,

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

Quoted 5 lines

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Anyone have suggested merge fix patches I can apply?

Resolved it for now by excluding those changes, will put them back in once they are fixed.

Thanks,

Ingo

#23 lore raw

Hi Ingo,

Quoted 16 lines · On Thu, 18 Oct 2012 20:29:53 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 14 lines · Stephen Rothwell

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

Quoted 8 lines
Quoted 5 lines

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Anyone have suggested merge fix patches I can apply?

Resolved it for now by excluding those changes, will put them back in once they are fixed.

It looks as though you have not gone back far enough - you removed a couple of merges of sched/numa, but there are more. I have two of the problems resolved with merge patches that supply pmd_pgprot() for s390 and mips, but there is another problem with mips (see Ralf's other email).

Also, I suspect that if you do exclude all the sched/numa changes it will make a mess of Andrew's mmotm (as it basically sits on top of linux-next).

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#24 lore raw
Quoted 25 lines · Stephen Rothwell

Hi Ingo,

Quoted 22 lines · On Thu, 18 Oct 2012 20:29:53 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 19 lines · Stephen Rothwell

After merging the final tree, today's linux-next build (s390 allyesconfig) failed like this:

mm/huge_memory.c:1424:2: error: implicit declaration of function 'pmd_pgprot' [-Werror=implicit-function-declaration] mm/huge_memory.c:1424:7: error: incompatible types when assigning to type 'pgprot_t' from type 'int'

(see http://kisskb.ellerman.id.au/kisskb/buildresult/7383823/)

Caused by commit 35d3d3427314 ("s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE") from the s390 tree interacting with commit 93c9d633bd9e ("mm/thp: Preserve pgprot across huge page split") from the tip tree.

N.B. Mips also selects HAVE_ARCH_TRANSPARENT_HUGEPAGE as of commit e21a828a1bba ("MIPS: Transparent Huge Pages support") from the mips tree and so will be broken in some configs now as well.

Anyone have suggested merge fix patches I can apply?

Quoted 8 lines
Quoted 2 lines

Resolved it for now by excluding those changes, will put them back in once they are fixed.

It looks as though you have not gone back far enough - you removed a couple of merges of sched/numa, but there are more. I have two of the problems resolved with merge patches that supply pmd_pgprot() for s390 and mips, but there is another problem with mips (see Ralf's other email).

Yeah. All of this should be resolved now in principle. Next time you'll integrate linux-next is on Monday, right?

Thanks,

Ingo

#25 lore raw

Hi Ingo,

Quoted 11 lines · On Sat, 20 Oct 2012 00:43:45 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 5 lines · Stephen Rothwell

It looks as though you have not gone back far enough - you removed a couple of merges of sched/numa, but there are more. I have two of the problems resolved with merge patches that supply pmd_pgprot() for s390 and mips, but there is another problem with mips (see Ralf's other email).

Yeah. All of this should be resolved now in principle. Next time you'll integrate linux-next is on Monday, right?

Excellent, thanks. Yes, the next linux-next will be Monday (my time).

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]