linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] include/linux/compiler.h: unconditionally define __pmem sparse attribute
@ 2015-07-07 15:41 Nicolai Stange
  2015-07-07 15:45 ` Ross Zwisler
  2015-07-07 15:47 ` Nicolai Stange
  0 siblings, 2 replies; 3+ messages in thread
From: Nicolai Stange @ 2015-07-07 15:41 UTC (permalink / raw)
  To: Christopher Li; +Cc: Ross Zwisler, linux-sparse, linux-kernel

Commit 61031952f4c8 ("arch, x86: pmem api for ensuring durability of
                      persistent memory updates")
defined __pmem in include/linux/compiler.h only for the case
CONFIG_RCU_SPARSE_POINTER=n, probably by accident.

With CONFIG_RCU_SPARSE_POINTER=y a sparse compile gives the error:
  CHECK   init/main.c
  arch/x86/include/asm/io.h:251:27: error: void declaration
  arch/x86/include/asm/io.h:251:27: error: Expected ; at end of declaration
  arch/x86/include/asm/io.h:251:27: error: got *
  arch/x86/include/asm/io.h:255:1: error: Expected ; at the end of
    type declaration
  arch/x86/include/asm/io.h:255:1: error: got }

This happens because the __pmem in
arch/x86/include/asm/io.h:251:
  static inline void __pmem *arch_memremap_pmem([...])
is undefined.

Define __pmem unconditionally in include/linux/compiler.h.

Signed-off-by: Nicolai Stange <nicstange@gmail.com>
---
 include/linux/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 7f8ad95..4f85b58 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -21,8 +21,8 @@
 # define __rcu		__attribute__((noderef, address_space(4)))
 #else
 # define __rcu
-# define __pmem		__attribute__((noderef, address_space(5)))
 #endif
+# define __pmem		__attribute__((noderef, address_space(5)))
 extern void __chk_user_ptr(const volatile void __user *);
 extern void __chk_io_ptr(const volatile void __iomem *);
 #else
-- 
2.4.5


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

* Re: [PATCH] include/linux/compiler.h: unconditionally define __pmem sparse attribute
  2015-07-07 15:41 [PATCH] include/linux/compiler.h: unconditionally define __pmem sparse attribute Nicolai Stange
@ 2015-07-07 15:45 ` Ross Zwisler
  2015-07-07 15:47 ` Nicolai Stange
  1 sibling, 0 replies; 3+ messages in thread
From: Ross Zwisler @ 2015-07-07 15:45 UTC (permalink / raw)
  To: Nicolai Stange; +Cc: Christopher Li, linux-sparse, linux-kernel

On Tue, 2015-07-07 at 17:41 +0200, Nicolai Stange wrote:
> Commit 61031952f4c8 ("arch, x86: pmem api for ensuring durability of
>                       persistent memory updates")
> defined __pmem in include/linux/compiler.h only for the case
> CONFIG_RCU_SPARSE_POINTER=n, probably by accident.
> 
> With CONFIG_RCU_SPARSE_POINTER=y a sparse compile gives the error:
>   CHECK   init/main.c
>   arch/x86/include/asm/io.h:251:27: error: void declaration
>   arch/x86/include/asm/io.h:251:27: error: Expected ; at end of declaration
>   arch/x86/include/asm/io.h:251:27: error: got *
>   arch/x86/include/asm/io.h:255:1: error: Expected ; at the end of
>     type declaration
>   arch/x86/include/asm/io.h:255:1: error: got }
> 
> This happens because the __pmem in
> arch/x86/include/asm/io.h:251:
>   static inline void __pmem *arch_memremap_pmem([...])
> is undefined.
> 
> Define __pmem unconditionally in include/linux/compiler.h.
> 
> Signed-off-by: Nicolai Stange <nicstange@gmail.com>
> ---
>  include/linux/compiler.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index 7f8ad95..4f85b58 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -21,8 +21,8 @@
>  # define __rcu		__attribute__((noderef, address_space(4)))
>  #else
>  # define __rcu
> -# define __pmem		__attribute__((noderef, address_space(5)))
>  #endif
> +# define __pmem		__attribute__((noderef, address_space(5)))
>  extern void __chk_user_ptr(const volatile void __user *);
>  extern void __chk_io_ptr(const volatile void __iomem *);
>  #else

Yep, thank you for the fix.  I think Dan already has a version of this queued
up in his tree for his next pull request:

https://git.kernel.org/cgit/linux/kernel/git/djbw/nvdimm.git/commit/?h=libnvdimm-pending&id=31f02455455d405320e2f749696bef4e02903b35



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

* Re: [PATCH] include/linux/compiler.h: unconditionally define __pmem sparse attribute
  2015-07-07 15:41 [PATCH] include/linux/compiler.h: unconditionally define __pmem sparse attribute Nicolai Stange
  2015-07-07 15:45 ` Ross Zwisler
@ 2015-07-07 15:47 ` Nicolai Stange
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolai Stange @ 2015-07-07 15:47 UTC (permalink / raw)
  To: Nicolai Stange; +Cc: Christopher Li, Ross Zwisler, linux-sparse, linux-kernel

Already fixed in linux-next. Sorry for the noise.

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

end of thread, other threads:[~2015-07-07 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-07 15:41 [PATCH] include/linux/compiler.h: unconditionally define __pmem sparse attribute Nicolai Stange
2015-07-07 15:45 ` Ross Zwisler
2015-07-07 15:47 ` Nicolai Stange

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