Skip to contentSkip to conversation

Patch "ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS" has been added to the 4.7-stable tree

PATCH [email protected] 1 participant 1 message Sep 5, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS

to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
arc-mm-fix-build-breakage-with-strict_mm_typechecks.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

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: ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Vineet Gupta <[email protected]>

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 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/include/asm/pgtable.h +1 -1
@@ -280,7 +280,7 @@ static inline void pmd_set(pmd_t *pmdp,
 
 #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)

Patches currently in stable-queue which might be from [email protected] are

queue-4.7/arc-elide-redundant-setup-of-dma-callbacks.patch queue-4.7/arc-mm-fix-build-breakage-with-strict_mm_typechecks.patch queue-4.7/arc-call-trace_hardirqs_on-before-enabling-irqs.patch queue-4.7/arc-use-correct-offset-in-pt_regs-for-saving-restoring-user-mode-r25.patch