Re: [PATCH v2 17/17] arch, x86: pmem api for ensuring durability of persistent memory updates

From: Williams, Dan J
Date: Tue Jun 30 2015 - 12:23:55 EST


On Tue, 2015-06-30 at 13:21 +0300, Dan Carpenter wrote:
> On Thu, Jun 25, 2015 at 05:37:49AM -0400, Dan Williams wrote:
> > diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> > index 867722591be2..9a528d945498 100644
> > --- a/include/linux/compiler.h
> > +++ b/include/linux/compiler.h
> > @@ -21,6 +21,7 @@
> > # define __rcu __attribute__((noderef, address_space(4)))
>
> On this side of the #ifdef CONFIG_SPARSE_RCU_POINTER statement then
> __pmem isn't defined so it leads to a build error running a CHECKER on
> today's linux-next.
>
> I would define __pmem away, but I don't understand why __pmem and
> CONFIG_SPARSE_RCU_POINTER are related at all. Maybe it should be
> outside the if statement?
>

Yes it should be outside the if...

8<----
Subject: sparse: fix misplaced __pmem definition

From: Dan Williams <dan.j.williams@xxxxxxxxx>

Move the definition of __pmem outside of CONFIG_SPARSE_RCU_POINTER to fix:

drivers/nvdimm/pmem.c:198:17: sparse: too many arguments for function __builtin_expect
drivers/nvdimm/pmem.c:36:33: sparse: expected ; at end of declaration
drivers/nvdimm/pmem.c:48:21: sparse: void declaration

...due to __pmem failing to be defined in some configurations when
CONFIG_SPARSE_RCU_POINTER=y.

Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
---
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 26fc8bc77f85..d8fbd500330e 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -17,11 +17,11 @@
# define __release(x) __context__(x,-1)
# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
# define __percpu __attribute__((noderef, address_space(3)))
+# define __pmem __attribute__((noderef, address_space(5)))
#ifdef CONFIG_SPARSE_RCU_POINTER
# define __rcu __attribute__((noderef, address_space(4)))
#else
# define __rcu
-# define __pmem __attribute__((noderef, address_space(5)))
#endif
extern void __chk_user_ptr(const volatile void __user *);
extern void __chk_io_ptr(const volatile void __iomem *);