Skip to contentSkip to conversation

FAILED: patch "[PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS" failed to apply to 4.4-stable tree

PATCH In review [email protected] 2 participants 11 messages Sep 5, 2016 – Sep 13, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 1c3c909303924d30145601f47b6c058fdd2cbc2e Mon Sep 17 00:00:00 2001

From: Vineet Gupta <[email protected]>
Date: Tue, 16 Aug 2016 18:27:07 -0700
Subject: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

arch/arc/include/asm/pgtable.h +1 -1
index 0f92d97432a2..89eeb3720051 100644
@@ -280,7 +280,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define pte_page(pte)		pfn_to_page(pte_pfn(pte))
 #define mk_pte(page, prot)	pfn_pte(page_to_pfn(page), prot)
-#define pfn_pte(pfn, prot)	(__pte(((pte_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)))
+#define pfn_pte(pfn, prot)	__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
 
 /* Don't use virt_to_pfn for macros below: could cause truncations for PAE40*/
 #define pte_pfn(pte)		(pte_val(pte) >> PAGE_SHIFT)
#1 lore raw
Quoted 8 lines · On 09/05/2016 06:05 AM, [email protected] wrote:

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

There were 2 commits after 4.4 which prevent a clean backport. Reworked patch below. Please apply.

---------------->
rom 54607da05b9c3d4c5ee23ce0f21d7f91b83b6c34 Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Tue, 16 Aug 2016 18:27:07 -0700
Subject: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

---
 arch/arc/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/include/asm/pgtable.h +1 -2
index 3cab04255ae0..e5fec320f158 100644
@@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define mk_pte(page, prot)    pfn_pte(page_to_pfn(page), prot)
 #define pte_pfn(pte)        (pte_val(pte) >> PAGE_SHIFT)
-#define pfn_pte(pfn, prot)    (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-                 pgprot_val(prot)))
+#define pfn_pte(pfn, prot)    (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 #define __pte_index(addr)    (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
 /*
Signature · 1 line
2.7.4
author maintainer
#2 lore raw
Quoted 62 lines · Vineet Gupta
Quoted 8 lines · On 09/05/2016 06:05 AM, [email protected] wrote:

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

There were 2 commits after 4.4 which prevent a clean backport. Reworked patch below. Please apply.

---------------->
rom 54607da05b9c3d4c5ee23ce0f21d7f91b83b6c34 Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Tue, 16 Aug 2016 18:27:07 -0700
Subject: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

---
 arch/arc/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/include/asm/pgtable.h +0 -0
index 3cab04255ae0..e5fec320f158 100644

arch/arc/include/asm/pgtable.h static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) · line 283

Quoted 9 lines
arch/arc/include/asm/pgtable.h +1 -2
@@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define mk_pte(page, prot)    pfn_pte(page_to_pfn(page), prot)
 #define pte_pfn(pte)        (pte_val(pte) >> PAGE_SHIFT)
-#define pfn_pte(pfn, prot)    (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-                 pgprot_val(prot)))
+#define pfn_pte(pfn, prot)    (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 #define __pte_index(addr)    (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
 /*

This doesn't apply either :(

#3 lore raw
Quoted 70 lines · On 09/09/2016 07:19 AM, [email protected] wrote:
Quoted 69 lines · Vineet Gupta
Quoted 8 lines · On 09/05/2016 06:05 AM, [email protected] wrote:

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

There were 2 commits after 4.4 which prevent a clean backport. Reworked patch below. Please apply.

---------------->
rom 54607da05b9c3d4c5ee23ce0f21d7f91b83b6c34 Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Tue, 16 Aug 2016 18:27:07 -0700
Subject: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

---
 arch/arc/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/include/asm/pgtable.h +1 -2
index 3cab04255ae0..e5fec320f158 100644
@@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define mk_pte(page, prot)    pfn_pte(page_to_pfn(page), prot)
 #define pte_pfn(pte)        (pte_val(pte) >> PAGE_SHIFT)
-#define pfn_pte(pfn, prot)    (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-                 pgprot_val(prot)))
+#define pfn_pte(pfn, prot)    (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 #define __pte_index(addr)    (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
Quoted 2 lines

arch/arc/include/asm/pgtable.h static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) · line 283

Quoted 1 line
arch/arc/include/asm/pgtable.h +0 -0
 /*

This doesn't apply either :(

Sorry about that. I did verify that the patch was fine, I just clipped the leading 'F' when pasting in mailer.
Can you please retry below - patch itself it is same as before

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

Quoted 1 line

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

From: Vineet Gupta <[email protected]>
Date: Tue, 16 Aug 2016 18:27:07 -0700
Subject: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

---
 arch/arc/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/include/asm/pgtable.h +1 -2
index 3cab04255ae0..e5fec320f158 100644
@@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define mk_pte(page, prot)    pfn_pte(page_to_pfn(page), prot)
 #define pte_pfn(pte)        (pte_val(pte) >> PAGE_SHIFT)
-#define pfn_pte(pfn, prot)    (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-                 pgprot_val(prot)))
+#define pfn_pte(pfn, prot)    (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 #define __pte_index(addr)    (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
 /*
Signature · 1 line
2.7.4
author maintainer
#4 lore raw
Quoted 138 lines · Vineet Gupta
Quoted 70 lines · On 09/09/2016 07:19 AM, [email protected] wrote:
Quoted 69 lines · Vineet Gupta
Quoted 8 lines · On 09/05/2016 06:05 AM, [email protected] wrote:

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

There were 2 commits after 4.4 which prevent a clean backport. Reworked patch below. Please apply.

---------------->
rom 54607da05b9c3d4c5ee23ce0f21d7f91b83b6c34 Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Tue, 16 Aug 2016 18:27:07 -0700
Subject: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

---
 arch/arc/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/include/asm/pgtable.h +1 -2
index 3cab04255ae0..e5fec320f158 100644
@@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define mk_pte(page, prot)    pfn_pte(page_to_pfn(page), prot)
 #define pte_pfn(pte)        (pte_val(pte) >> PAGE_SHIFT)
-#define pfn_pte(pfn, prot)    (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-                 pgprot_val(prot)))
+#define pfn_pte(pfn, prot)    (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 #define __pte_index(addr)    (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
Quoted 2 lines

arch/arc/include/asm/pgtable.h static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) · line 283

Quoted 1 line
arch/arc/include/asm/pgtable.h +0 -0
 /*

This doesn't apply either :(

Sorry about that. I did verify that the patch was fine, I just clipped the leading 'F' when pasting in mailer.
Can you please retry below - patch itself it is same as before

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

Quoted 1 line

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

From: Vineet Gupta <[email protected]>
Date: Tue, 16 Aug 2016 18:27:07 -0700
Subject: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

---
 arch/arc/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/include/asm/pgtable.h +1 -2
index 3cab04255ae0..e5fec320f158 100644
@@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define mk_pte(page, prot)    pfn_pte(page_to_pfn(page), prot)
 #define pte_pfn(pte)        (pte_val(pte) >> PAGE_SHIFT)
-#define pfn_pte(pfn, prot)    (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-                 pgprot_val(prot)))
+#define pfn_pte(pfn, prot)    (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 #define __pte_index(addr)    (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
 /*
Signature · 1 line
2.7.4

This patch still fails to apply, I think you are corrupting whitespace, look closely...

greg k-h

#5 lore raw

PATCH 1/1 ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS

|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

---
 arch/arc/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/include/asm/pgtable.h +1 -2
index 3cab04255ae0..e5fec320f158 100644
@@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define mk_pte(page, prot)	pfn_pte(page_to_pfn(page), prot)
 #define pte_pfn(pte)		(pte_val(pte) >> PAGE_SHIFT)
-#define pfn_pte(pfn, prot)	(__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-				 pgprot_val(prot)))
+#define pfn_pte(pfn, prot)	(__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 #define __pte_index(addr)	(((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
 /*
Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS

Quoted 51 lines · Vineet Gupta
|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

---
 arch/arc/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/include/asm/pgtable.h +1 -2
index 3cab04255ae0..e5fec320f158 100644
@@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define mk_pte(page, prot)	pfn_pte(page_to_pfn(page), prot)
 #define pte_pfn(pte)		(pte_val(pte) >> PAGE_SHIFT)
-#define pfn_pte(pfn, prot)	(__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-				 pgprot_val(prot)))
+#define pfn_pte(pfn, prot)	(__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 #define __pte_index(addr)	(((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
 /*
Signature · 1 line
2.7.4

Whitespace is correct this time, thanks. You can't cut-and-paste in a web email client...

But, you forgot to say what the git commit id is for this patch :(

Can you resend it with that info?

thanks,

greg k-h

#7 lore raw

PATCH 1/1 ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS

commit 1c3c909303924d30145601f47b6c058fdd2cbc2e upstream.

|  CC      mm/memory.o
| In file included from ../mm/memory.c:53:0:
| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
|  return pfn_pte(pfn_t_to_pfn(pfn), pgprot);

With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code forces a cast which ends up shifting a struct and hence the gcc warning.

Note that in recent past some of the arches (aarch64, s390) made STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly worse generated code, given ARC ABI definition of returning structs (which pte_t would become)

Quoting from ARC ABI...

"Results of type struct are returned in a caller-supplied temporary variable whose address is passed in r0.
For such functions, the arguments are shifted so that they are passed in r1 and up."

So
- struct to be returned would be allocated on stack requiring extra code at call sites
- callee updates stack memory to facilitate the return (vs. simple MOV into return reg r0)

Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC

---
 arch/arc/include/asm/pgtable.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/include/asm/pgtable.h +1 -2
index 3cab04255ae0..e5fec320f158 100644
@@ -277,8 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 
 #define mk_pte(page, prot)	pfn_pte(page_to_pfn(page), prot)
 #define pte_pfn(pte)		(pte_val(pte) >> PAGE_SHIFT)
-#define pfn_pte(pfn, prot)	(__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-				 pgprot_val(prot)))
+#define pfn_pte(pfn, prot)	(__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 #define __pte_index(addr)	(((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
 /*
Signature · 1 line
2.7.4
#8 lore raw

Re: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS

In reply to gregkh @ linuxfoundation . org
Quoted 2 lines · On 09/12/2016 10:33 AM, gregkh @ linuxfoundation . org wrote:

Whitespace is correct this time, thanks. You can't cut-and-paste in a web email client...

I use Thunderbird so it's not as bad as a true web email client. What's weird is that same copy/paste seems to work fine for diffstat in ARC pull requests to Linus
- or is he just being too nice to me :-)

Quoted 3 lines

But, you forgot to say what the git commit id is for this patch :(

Can you resend it with that info?

Did that.

Thx,
-Vineet

author maintainer
#9 lore raw

Re: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS

Quoted 7 lines · Vineet Gupta
Quoted 2 lines · On 09/12/2016 10:33 AM, gregkh @ linuxfoundation . org wrote:

Whitespace is correct this time, thanks. You can't cut-and-paste in a web email client...

I use Thunderbird so it's not as bad as a true web email client. What's weird is that same copy/paste seems to work fine for diffstat in ARC pull requests to Linus
- or is he just being too nice to me :-)

A pull request doesn't require the whitespace (tabs vs. spaces) to be correct, compared to a patch, so that's why this is probably working...

Quoted 5 lines
Quoted 3 lines

But, you forgot to say what the git commit id is for this patch :(

Can you resend it with that info?

Did that.

Thanks, I'll queue it up in the next round of stable updates after these current ones get released in a few days.

greg k-h

#10 lore raw

Re: [PATCH] ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS

Quoted 2 lines · On 09/12/2016 11:12 PM, [email protected] wrote:

Thanks, I'll queue it up in the next round of stable updates after these current ones get released in a few days.

Awesome, many thanks.

-Vineet