Skip to contentSkip to conversation

arm/mm: fix compiler warning in pmdp_invalidate() (in -next)

PATCH In review Andre Przywara 4 participants 5 messages Jan 29, 2015 – Feb 11, 2015 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/mm: fix compiler warning in pmdp_invalidate() (in -next)

Commit ff61d185f4e7 ("mm: convert p[te|md]_mknonnuma and remaining page table manipulations") removed a check in mm/pgtable-generic.c:pmdp_invalidate(), which leaves the pmd_mknotpresent macro the only user of the entry variable. For ARM/LPAE we use a constant 0 without referencing the argument to mark this condition, so the entry variable is no longer used here:

mm/pgtable-generic.c: In function 'pmdp_invalidate':
mm/pgtable-generic.c:195:8: warning: unused variable 'entry' [-Wunused-variable]

  pmd_t entry = *pmdp;
        ^

Replace the ARM macro implementation with a static inline function to get rid of this warning.

---
 arch/arm/include/asm/pgtable-3level.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/include/asm/pgtable-3level.h +4 -1
index 370684d..0e51fbe 100644
@@ -259,7 +259,10 @@ PMD_BIT_FUNC(mkyoung,   |= PMD_SECT_AF);
 #define mk_pmd(page,prot)	pfn_pmd(page_to_pfn(page),prot)
 
 /* represent a notpresent pmd by zero, this is used by pmdp_invalidate */
-#define pmd_mknotpresent(pmd)	(__pmd(0))
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	return 0;
+}
 
 static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
 {
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 9 lines · Andre Przywara

Commit ff61d185f4e7 ("mm: convert p[te|md]_mknonnuma and remaining page table manipulations") removed a check in mm/pgtable-generic.c:pmdp_invalidate(), which leaves the pmd_mknotpresent macro the only user of the entry variable. For ARM/LPAE we use a constant 0 without referencing the argument to mark this condition, so the entry variable is no longer used here:

mm/pgtable-generic.c: In function 'pmdp_invalidate':
mm/pgtable-generic.c:195:8: warning: unused variable 'entry' [-Wunused-variable]

Quoted 7 lines
  pmd_t entry = *pmdp;
        ^

Replace the ARM macro implementation with a static inline function to get rid of this warning.

Patch looks fine to me but this is against a mmotm patch that is included in mmotm. The commit ID is not going to last. This should be sent to Andrew Morton with a note saying it's a fix to the mmotm patch mm-convert-p_mknonnuma-and-remaining-page-table-manipulations.patch . He'll then fold your fix into the original patch so that bisection works correctly when merged to mainline. Do you mind doing that please?

Signature · 2 lines
Mel Gorman
SUSE Labs
#2 lore raw

PATCH 1/1 arm/mm: fix compiler warning in pmdp_invalidate() (in -next)

Commit ff61d185f4e7 ("mm: convert p[te|md]_mknonnuma and remaining page table manipulations") removed a check in mm/pgtable-generic.c:pmdp_invalidate(), which leaves the pmd_mknotpresent macro the only user of the entry variable. For ARM/LPAE we use a constant 0 without referencing the argument to mark this condition, so the entry variable is no longer used here:

mm/pgtable-generic.c: In function 'pmdp_invalidate':
mm/pgtable-generic.c:195:8: warning: unused variable 'entry' [-Wunused-variable]

  pmd_t entry = *pmdp;
        ^

Replace the ARM macro implementation with a static inline function to get rid of this warning.

---
Hi Andrew,

Mel mentioned that I should send that simple fix below to you to merge it with his original mmotm patch:
mm-convert-p_mknonnuma-and-remaining-page-table-manipulations.patch The commit message above contains the mmotm-reference to this patch, which will break when it hits mainline.

Can you consider this? Given that's only a warning fix I am also happy with resending it after -rc1, if you reckon that this arch/arm change should not go via mmotm.

Quoted 6 lines · Mel Gorman

Patch looks fine to me but this is against a mmotm patch that is included in mmotm. The commit ID is not going to last. This should be sent to Andrew Morton with a note saying it's a fix to the mmotm patch mm-convert-p_mknonnuma-and-remaining-page-table-manipulations.patch . He'll then fold your fix into the original patch so that bisection works correctly when merged to mainline. Do you mind doing that please?

Cheers,
Andre

 arch/arm/include/asm/pgtable-3level.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/include/asm/pgtable-3level.h +4 -1
index 370684d..0e51fbe 100644
@@ -259,7 +259,10 @@ PMD_BIT_FUNC(mkyoung,   |= PMD_SECT_AF);
 #define mk_pmd(page,prot)	pfn_pmd(page_to_pfn(page),prot)
 
 /* represent a notpresent pmd by zero, this is used by pmdp_invalidate */
-#define pmd_mknotpresent(pmd)	(__pmd(0))
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	return 0;
+}
 
 static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
 {
Signature · 1 line
1.7.9.5
#3 lore raw
Quoted 25 lines · Andre Przywara

Commit ff61d185f4e7 ("mm: convert p[te|md]_mknonnuma and remaining page table manipulations") removed a check in mm/pgtable-generic.c:pmdp_invalidate(), which leaves the pmd_mknotpresent macro the only user of the entry variable. For ARM/LPAE we use a constant 0 without referencing the argument to mark this condition, so the entry variable is no longer used here:

mm/pgtable-generic.c: In function 'pmdp_invalidate':
mm/pgtable-generic.c:195:8: warning: unused variable 'entry' [-Wunused-variable]

  pmd_t entry = *pmdp;
        ^

Replace the ARM macro implementation with a static inline function to get rid of this warning.

---
Hi Andrew,

Mel mentioned that I should send that simple fix below to you to merge it with his original mmotm patch:
mm-convert-p_mknonnuma-and-remaining-page-table-manipulations.patch The commit message above contains the mmotm-reference to this patch, which will break when it hits mainline.

Quoted 3 lines

Can you consider this? Given that's only a warning fix I am also happy with resending it after -rc1, if you reckon that this arch/arm change should not go via mmotm.

This isn't correct though.

arch/arm/include/asm/pgtable-3level.h PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF); · line 265

Quoted 6 lines

/* represent a notpresent pmd by zero, this is used by pmdp_invalidate */

arch/arm/include/asm/pgtable-3level.h +4 -1
-#define pmd_mknotpresent(pmd)	(__pmd(0))
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	return 0;
+}

typedef struct { pmdval_t pmd; } pmd_t;

typedef u32 pmdval_t;

"0" is not compatible with pmd_t when STRICT_MM_TYPECHECKS is enabled.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#4 lore raw
Quoted 41 lines · On Fri, 30 Jan 2015 16:40:15 +0000 Russell King - ARM Linux…
Quoted 25 lines · Andre Przywara

Commit ff61d185f4e7 ("mm: convert p[te|md]_mknonnuma and remaining page table manipulations") removed a check in mm/pgtable-generic.c:pmdp_invalidate(), which leaves the pmd_mknotpresent macro the only user of the entry variable. For ARM/LPAE we use a constant 0 without referencing the argument to mark this condition, so the entry variable is no longer used here:

mm/pgtable-generic.c: In function 'pmdp_invalidate':
mm/pgtable-generic.c:195:8: warning: unused variable 'entry' [-Wunused-variable]

  pmd_t entry = *pmdp;
        ^

Replace the ARM macro implementation with a static inline function to get rid of this warning.

---
Hi Andrew,

Mel mentioned that I should send that simple fix below to you to merge it with his original mmotm patch:
mm-convert-p_mknonnuma-and-remaining-page-table-manipulations.patch The commit message above contains the mmotm-reference to this patch, which will break when it hits mainline.

Quoted 3 lines

Can you consider this? Given that's only a warning fix I am also happy with resending it after -rc1, if you reckon that this arch/arm change should not go via mmotm.

This isn't correct though.

Review

Quoted 6 lines

/* represent a notpresent pmd by zero, this is used by pmdp_invalidate */

(quoted diff) +4 -1
-#define pmd_mknotpresent(pmd)	(__pmd(0))
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	return 0;
+}

typedef struct { pmdval_t pmd; } pmd_t;

Quoted 3 lines

typedef u32 pmdval_t;

"0" is not compatible with pmd_t when STRICT_MM_TYPECHECKS is enabled.

This?

arch/arm/include/asm/pgtable-3level.h renamed from arch/arm/include/asm/pgtable-3level.h~mm-convert-p_mknonnuma-and-remaining-page-table-manipulations-fix-fix +1 -1
@@ -259,7 +259,7 @@ PMD_BIT_FUNC(mkyoung,   |= PMD_SECT_AF);
 /* represent a notpresent pmd by zero, this is used by pmdp_invalidate */
 static inline pmd_t pmd_mknotpresent(pmd_t pmd)
 {
-	return 0;
+	return __pmd(0);
 }
 
 static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)