linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm/mm: Convert PUD level pgtable helper macros into functions
@ 2020-11-10  3:36 Anshuman Khandual
  2020-11-20  2:39 ` Anshuman Khandual
  0 siblings, 1 reply; 2+ messages in thread
From: Anshuman Khandual @ 2020-11-10  3:36 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Russell King, Andrew Morton, linux-kernel

Macros used as functions can be problematic from the compiler perspective.
There was a build failure report caused primarily because of non reference
of an argument variable. Hence convert PUD level pgtable helper macros into
functions in order to avoid such problems in the future. In the process, it
fixes the argument variables sequence in set_pud() which probably remained
hidden for being a macro.

https://lore.kernel.org/linux-mm/202011020749.5XQ3Hfzc-lkp@intel.com/
https://lore.kernel.org/linux-mm/5fa49698.Vu2O3r+dU20UoEJ+%25lkp@intel.com/

Cc: Russell King <linux@armlinux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
Only build tested.

 arch/arm/include/asm/pgtable-2level.h | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index 3502c2f..9d4f5ee 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -177,11 +177,28 @@
  * the pud: the pud entry is never bad, always exists, and can't be set or
  * cleared.
  */
-#define pud_none(pud)		(0)
-#define pud_bad(pud)		(0)
-#define pud_present(pud)	(1)
-#define pud_clear(pudp)		do { } while (0)
-#define set_pud(pud,pudp)	do { } while (0)
+static inline int pud_none(pud_t pud)
+{
+	return 0;
+}
+
+static inline int pud_bad(pud_t pud)
+{
+	return 0;
+}
+
+static inline int pud_present(pud_t pud)
+{
+	return 1;
+}
+
+static inline void pud_clear(pud_t *pudp)
+{
+}
+
+static inline void set_pud(pud_t *pudp, pud_t pud)
+{
+}
 
 static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
 {
-- 
2.7.4


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

* Re: [PATCH] arm/mm: Convert PUD level pgtable helper macros into functions
  2020-11-10  3:36 [PATCH] arm/mm: Convert PUD level pgtable helper macros into functions Anshuman Khandual
@ 2020-11-20  2:39 ` Anshuman Khandual
  0 siblings, 0 replies; 2+ messages in thread
From: Anshuman Khandual @ 2020-11-20  2:39 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Russell King, Andrew Morton, linux-kernel, Linus Walleij



On 11/10/20 9:06 AM, Anshuman Khandual wrote:
> Macros used as functions can be problematic from the compiler perspective.
> There was a build failure report caused primarily because of non reference
> of an argument variable. Hence convert PUD level pgtable helper macros into
> functions in order to avoid such problems in the future. In the process, it
> fixes the argument variables sequence in set_pud() which probably remained
> hidden for being a macro.
> 
> https://lore.kernel.org/linux-mm/202011020749.5XQ3Hfzc-lkp@intel.com/
> https://lore.kernel.org/linux-mm/5fa49698.Vu2O3r+dU20UoEJ+%25lkp@intel.com/
> 
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> Only build tested.

Hello Russel,

Any updates on this ? These changes come from an earlier discussion
on the mm list. Wondering if this too can also be submitted in the
arm patch tracking system. Thank you.

- Anshuman

+ Linus Walleij <linus.walleij@linaro.org>

> 
>  arch/arm/include/asm/pgtable-2level.h | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
> index 3502c2f..9d4f5ee 100644
> --- a/arch/arm/include/asm/pgtable-2level.h
> +++ b/arch/arm/include/asm/pgtable-2level.h
> @@ -177,11 +177,28 @@
>   * the pud: the pud entry is never bad, always exists, and can't be set or
>   * cleared.
>   */
> -#define pud_none(pud)		(0)
> -#define pud_bad(pud)		(0)
> -#define pud_present(pud)	(1)
> -#define pud_clear(pudp)		do { } while (0)
> -#define set_pud(pud,pudp)	do { } while (0)
> +static inline int pud_none(pud_t pud)
> +{
> +	return 0;
> +}
> +
> +static inline int pud_bad(pud_t pud)
> +{
> +	return 0;
> +}
> +
> +static inline int pud_present(pud_t pud)
> +{
> +	return 1;
> +}
> +
> +static inline void pud_clear(pud_t *pudp)
> +{
> +}
> +
> +static inline void set_pud(pud_t *pudp, pud_t pud)
> +{
> +}
>  
>  static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
>  {
> 

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

end of thread, other threads:[~2020-11-20  2:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  3:36 [PATCH] arm/mm: Convert PUD level pgtable helper macros into functions Anshuman Khandual
2020-11-20  2:39 ` Anshuman Khandual

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).