linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: add pmd_t initializer __pmd() to work around a GCC bug.
@ 2017-08-03 13:17 Zi Yan
  2017-08-10 14:46 ` Zi Yan
  2017-08-10 22:04 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Zi Yan @ 2017-08-03 13:17 UTC (permalink / raw)
  To: Sam Ravnborg, David S . Miller, linux-kernel, sparclinux; +Cc: Zi Yan

From: Zi Yan <zi.yan@cs.rutgers.edu>

THP migration is added but only supports x86_64 at the moment. For all
other architectures, swp_entry_to_pmd() only returns a zero pmd_t.

Due to a GCC zero initializer bug #53119, the standard (pmd_t){0}
initializer is not accepted by all GCC versions. __pmd() is a feasible
workaround. In addition, sparc32's pmd_t is an array instead of a single
value, so we need (pmd_t){ {0}, } instead of (pmd_t){0}. Thus,
a different __pmd() definition is needed in sparc32.

Signed-off-by: Zi Yan <zi.yan@cs.rutgers.edu>
---
 arch/sparc/include/asm/page_32.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h
index 0efd0583a8c9..6249214148c2 100644
--- a/arch/sparc/include/asm/page_32.h
+++ b/arch/sparc/include/asm/page_32.h
@@ -68,6 +68,7 @@ typedef struct { unsigned long iopgprot; } iopgprot_t;
 #define iopgprot_val(x)	((x).iopgprot)
 
 #define __pte(x)	((pte_t) { (x) } )
+#define __pmd(x)	((pmd_t) { { (x) }, })
 #define __iopte(x)	((iopte_t) { (x) } )
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __ctxd(x)	((ctxd_t) { (x) } )
@@ -95,6 +96,7 @@ typedef unsigned long iopgprot_t;
 #define iopgprot_val(x)	(x)
 
 #define __pte(x)	(x)
+#define __pmd(x)	((pmd_t) { { (x) }, })
 #define __iopte(x)	(x)
 #define __pgd(x)	(x)
 #define __ctxd(x)	(x)
-- 
2.13.2

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

* Re: [PATCH] mm: add pmd_t initializer __pmd() to work around a GCC bug.
  2017-08-03 13:17 [PATCH] mm: add pmd_t initializer __pmd() to work around a GCC bug Zi Yan
@ 2017-08-10 14:46 ` Zi Yan
  2017-08-10 16:28   ` David Miller
  2017-08-10 22:04 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Zi Yan @ 2017-08-10 14:46 UTC (permalink / raw)
  To: Sam Ravnborg, David S . Miller; +Cc: Zi Yan, sparclinux, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2205 bytes --]

Ping. Just wonder what is the status of this patch.

This patch is trivial and I successfully compiled it for sparc32.
swp_entry_to_pmd() will be the only user of __pmd() in sparc32,
returning __pmd(0). Having __pmd() can help replace following
code in include/linux/swapops.h (in linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/include/linux/swapops.h#n224):

static inline pmd_t swp_entry_to_pmd(swp_entry_t entry)
{
	pmd_t e;
	memset(&e, 0, sizeof(pmd_t));
	return e;
}

with:

static inline pmd_t swp_entry_to_pmd(swp_entry_t entry)
{
	return __pmd(0);
}

It makes the code more portable.

Thanks.

--
Best Regards
Yan Zi

On 3 Aug 2017, at 9:17, Zi Yan wrote:

> From: Zi Yan <zi.yan@cs.rutgers.edu>
>
> THP migration is added but only supports x86_64 at the moment. For all
> other architectures, swp_entry_to_pmd() only returns a zero pmd_t.
>
> Due to a GCC zero initializer bug #53119, the standard (pmd_t){0}
> initializer is not accepted by all GCC versions. __pmd() is a feasible
> workaround. In addition, sparc32's pmd_t is an array instead of a single
> value, so we need (pmd_t){ {0}, } instead of (pmd_t){0}. Thus,
> a different __pmd() definition is needed in sparc32.
>
> Signed-off-by: Zi Yan <zi.yan@cs.rutgers.edu>
> ---
>  arch/sparc/include/asm/page_32.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h
> index 0efd0583a8c9..6249214148c2 100644
> --- a/arch/sparc/include/asm/page_32.h
> +++ b/arch/sparc/include/asm/page_32.h
> @@ -68,6 +68,7 @@ typedef struct { unsigned long iopgprot; } iopgprot_t;
>  #define iopgprot_val(x)	((x).iopgprot)
>
>  #define __pte(x)	((pte_t) { (x) } )
> +#define __pmd(x)	((pmd_t) { { (x) }, })
>  #define __iopte(x)	((iopte_t) { (x) } )
>  #define __pgd(x)	((pgd_t) { (x) } )
>  #define __ctxd(x)	((ctxd_t) { (x) } )
> @@ -95,6 +96,7 @@ typedef unsigned long iopgprot_t;
>  #define iopgprot_val(x)	(x)
>
>  #define __pte(x)	(x)
> +#define __pmd(x)	((pmd_t) { { (x) }, })
>  #define __iopte(x)	(x)
>  #define __pgd(x)	(x)
>  #define __ctxd(x)	(x)
> -- 
> 2.13.2

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 496 bytes --]

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

* Re: [PATCH] mm: add pmd_t initializer __pmd() to work around a GCC bug.
  2017-08-10 14:46 ` Zi Yan
@ 2017-08-10 16:28   ` David Miller
  2017-08-10 16:40     ` Zi Yan
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2017-08-10 16:28 UTC (permalink / raw)
  To: zi.yan; +Cc: sam, sparclinux, linux-kernel

From: "Zi Yan" <zi.yan@cs.rutgers.edu>
Date: Thu, 10 Aug 2017 10:46:08 -0400

> Ping. Just wonder what is the status of this patch.

You never need to ask this question.

Your patch is queued up in SPARC patchwork:

	http://patchwork.ozlabs.org/patch/797215/

And is in "Under Review" state.

There is nothing for you to do but simply be patient.

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

* Re: [PATCH] mm: add pmd_t initializer __pmd() to work around a GCC bug.
  2017-08-10 16:28   ` David Miller
@ 2017-08-10 16:40     ` Zi Yan
  0 siblings, 0 replies; 5+ messages in thread
From: Zi Yan @ 2017-08-10 16:40 UTC (permalink / raw)
  To: David Miller; +Cc: sam, sparclinux, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

Thanks for you reply.

Sorry. I did not know there is a patchwork to track the state.

--
Best Regards
Yan Zi

On 10 Aug 2017, at 12:28, David Miller wrote:

> From: "Zi Yan" <zi.yan@cs.rutgers.edu>
> Date: Thu, 10 Aug 2017 10:46:08 -0400
>
>> Ping. Just wonder what is the status of this patch.
>
> You never need to ask this question.
>
> Your patch is queued up in SPARC patchwork:
>
> 	https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fpatch%2F797215%2F&data=02%7C01%7Czi.yan%40cs.rutgers.edu%7Cb6b46ebffe834baa4a6b08d4e00ce693%7Cb92d2b234d35447093ff69aca6632ffe%7C1%7C0%7C636379793396189447&sdata=djcs5GYNIQsRLfg5F6rEyd3t%2Bsak9sDDIhg23sj3ZlA%3D&reserved=0
>
> And is in "Under Review" state.
>
> There is nothing for you to do but simply be patient.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 496 bytes --]

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

* Re: [PATCH] mm: add pmd_t initializer __pmd() to work around a GCC bug.
  2017-08-03 13:17 [PATCH] mm: add pmd_t initializer __pmd() to work around a GCC bug Zi Yan
  2017-08-10 14:46 ` Zi Yan
@ 2017-08-10 22:04 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2017-08-10 22:04 UTC (permalink / raw)
  To: zi.yan; +Cc: sam, linux-kernel, sparclinux, zi.yan

From: Zi Yan <zi.yan@sent.com>
Date: Thu,  3 Aug 2017 09:17:21 -0400

> From: Zi Yan <zi.yan@cs.rutgers.edu>
> 
> THP migration is added but only supports x86_64 at the moment. For all
> other architectures, swp_entry_to_pmd() only returns a zero pmd_t.
> 
> Due to a GCC zero initializer bug #53119, the standard (pmd_t){0}
> initializer is not accepted by all GCC versions. __pmd() is a feasible
> workaround. In addition, sparc32's pmd_t is an array instead of a single
> value, so we need (pmd_t){ {0}, } instead of (pmd_t){0}. Thus,
> a different __pmd() definition is needed in sparc32.
> 
> Signed-off-by: Zi Yan <zi.yan@cs.rutgers.edu>

Applied.

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

end of thread, other threads:[~2017-08-10 22:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-03 13:17 [PATCH] mm: add pmd_t initializer __pmd() to work around a GCC bug Zi Yan
2017-08-10 14:46 ` Zi Yan
2017-08-10 16:28   ` David Miller
2017-08-10 16:40     ` Zi Yan
2017-08-10 22:04 ` David Miller

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