linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build failure after merge of the modules tree
@ 2015-06-24  1:37 Stephen Rothwell
  2015-06-24 18:18 ` Dan Streetman
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2015-06-24  1:37 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-next, linux-kernel, Dan Streetman

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

Hi Rusty,

After merging the modules tree, today's linux-next build (x86_64
allmodconfig) failed like this:

In file included from include/linux/linkage.h:4:0,
                 from include/linux/kernel.h:6,
                 from kernel/params.c:18:
kernel/params.c: In function 'param_array':
kernel/params.c:32:42: error: dereferencing pointer to incomplete type
 #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : &param_lock)
                                          ^
include/linux/compiler.h:164:42: note: in definition of macro 'unlikely'
 # define unlikely(x) __builtin_expect(!!(x), 0)
                                          ^
kernel/params.c:462:3: note: in expansion of macro 'BUG_ON'
   BUG_ON(!KPARAM_IS_LOCKED(mod));
   ^
kernel/params.c:33:47: note: in expansion of macro 'KPARAM_MUTEX'
 #define KPARAM_IS_LOCKED(mod) mutex_is_locked(KPARAM_MUTEX(mod))
                                               ^
kernel/params.c:462:11: note: in expansion of macro 'KPARAM_IS_LOCKED'
   BUG_ON(!KPARAM_IS_LOCKED(mod));
           ^
kernel/params.c: In function 'param_array_get':
kernel/params.c:32:42: error: dereferencing pointer to incomplete type
 #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : &param_lock)
                                          ^
include/linux/compiler.h:164:42: note: in definition of macro 'unlikely'
 # define unlikely(x) __builtin_expect(!!(x), 0)
                                          ^
kernel/params.c:499:3: note: in expansion of macro 'BUG_ON'
   BUG_ON(!KPARAM_IS_LOCKED(p.mod));
   ^
kernel/params.c:33:47: note: in expansion of macro 'KPARAM_MUTEX'
 #define KPARAM_IS_LOCKED(mod) mutex_is_locked(KPARAM_MUTEX(mod))
                                               ^
kernel/params.c:499:11: note: in expansion of macro 'KPARAM_IS_LOCKED'
   BUG_ON(!KPARAM_IS_LOCKED(p.mod));
           ^
In file included from include/linux/notifier.h:13:0,
                 from include/linux/memory_hotplug.h:6,
                 from include/linux/mmzone.h:789,
                 from include/linux/gfp.h:5,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from kernel/params.c:21:
kernel/params.c: In function 'kernel_param_lock':
kernel/params.c:32:42: error: dereferencing pointer to incomplete type
 #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : &param_lock)
                                          ^
include/linux/mutex.h:146:44: note: in definition of macro 'mutex_lock'
 #define mutex_lock(lock) mutex_lock_nested(lock, 0)
                                            ^
kernel/params.c:621:13: note: in expansion of macro 'KPARAM_MUTEX'
  mutex_lock(KPARAM_MUTEX(mod));
             ^
kernel/params.c: In function 'kernel_param_unlock':
kernel/params.c:32:42: error: dereferencing pointer to incomplete type
 #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : &param_lock)
                                          ^
kernel/params.c:626:15: note: in expansion of macro 'KPARAM_MUTEX'
  mutex_unlock(KPARAM_MUTEX(mod));
               ^

Caused by commit b51d23e4e9fe ("module: add per-module param_lock").

I am not exactly sure why this fails to build.  It may be an
interaction with some other change.

I have used the modules tree from next-20150623 for today.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

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

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

* Re: linux-next: build failure after merge of the modules tree
  2015-06-24  1:37 linux-next: build failure after merge of the modules tree Stephen Rothwell
@ 2015-06-24 18:18 ` Dan Streetman
  2015-06-24 18:31   ` [PATCH] modules: only use mod->param_lock if CONFIG_MODULES Dan Streetman
  2015-06-24 22:57   ` linux-next: build failure after merge of the modules tree Stephen Rothwell
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Streetman @ 2015-06-24 18:18 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Rusty Russell, linux-next, linux-kernel

On Tue, Jun 23, 2015 at 9:37 PM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Hi Rusty,
>
> After merging the modules tree, today's linux-next build (x86_64
> allmodconfig) failed like this:

that's weird.  Are you sure it failed during allmodconfig?  I can see
why it would fail like that if CONFIG_MODULES ins't defined, which
I'll send a patch for...

>
> In file included from include/linux/linkage.h:4:0,
>                  from include/linux/kernel.h:6,
>                  from kernel/params.c:18:
> kernel/params.c: In function 'param_array':
> kernel/params.c:32:42: error: dereferencing pointer to incomplete type
>  #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : &param_lock)
>                                           ^
> include/linux/compiler.h:164:42: note: in definition of macro 'unlikely'
>  # define unlikely(x) __builtin_expect(!!(x), 0)
>                                           ^
> kernel/params.c:462:3: note: in expansion of macro 'BUG_ON'
>    BUG_ON(!KPARAM_IS_LOCKED(mod));
>    ^
> kernel/params.c:33:47: note: in expansion of macro 'KPARAM_MUTEX'
>  #define KPARAM_IS_LOCKED(mod) mutex_is_locked(KPARAM_MUTEX(mod))
>                                                ^
> kernel/params.c:462:11: note: in expansion of macro 'KPARAM_IS_LOCKED'
>    BUG_ON(!KPARAM_IS_LOCKED(mod));
>            ^
> kernel/params.c: In function 'param_array_get':
> kernel/params.c:32:42: error: dereferencing pointer to incomplete type
>  #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : &param_lock)
>                                           ^
> include/linux/compiler.h:164:42: note: in definition of macro 'unlikely'
>  # define unlikely(x) __builtin_expect(!!(x), 0)
>                                           ^
> kernel/params.c:499:3: note: in expansion of macro 'BUG_ON'
>    BUG_ON(!KPARAM_IS_LOCKED(p.mod));
>    ^
> kernel/params.c:33:47: note: in expansion of macro 'KPARAM_MUTEX'
>  #define KPARAM_IS_LOCKED(mod) mutex_is_locked(KPARAM_MUTEX(mod))
>                                                ^
> kernel/params.c:499:11: note: in expansion of macro 'KPARAM_IS_LOCKED'
>    BUG_ON(!KPARAM_IS_LOCKED(p.mod));
>            ^
> In file included from include/linux/notifier.h:13:0,
>                  from include/linux/memory_hotplug.h:6,
>                  from include/linux/mmzone.h:789,
>                  from include/linux/gfp.h:5,
>                  from include/linux/kmod.h:22,
>                  from include/linux/module.h:13,
>                  from kernel/params.c:21:
> kernel/params.c: In function 'kernel_param_lock':
> kernel/params.c:32:42: error: dereferencing pointer to incomplete type
>  #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : &param_lock)
>                                           ^
> include/linux/mutex.h:146:44: note: in definition of macro 'mutex_lock'
>  #define mutex_lock(lock) mutex_lock_nested(lock, 0)
>                                             ^
> kernel/params.c:621:13: note: in expansion of macro 'KPARAM_MUTEX'
>   mutex_lock(KPARAM_MUTEX(mod));
>              ^
> kernel/params.c: In function 'kernel_param_unlock':
> kernel/params.c:32:42: error: dereferencing pointer to incomplete type
>  #define KPARAM_MUTEX(mod) ((mod) ? &(mod)->param_lock : &param_lock)
>                                           ^
> kernel/params.c:626:15: note: in expansion of macro 'KPARAM_MUTEX'
>   mutex_unlock(KPARAM_MUTEX(mod));
>                ^
>
> Caused by commit b51d23e4e9fe ("module: add per-module param_lock").
>
> I am not exactly sure why this fails to build.  It may be an
> interaction with some other change.
>
> I have used the modules tree from next-20150623 for today.
>
> --
> Cheers,
> Stephen Rothwell                    sfr@canb.auug.org.au

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

* [PATCH] modules: only use mod->param_lock if CONFIG_MODULES
  2015-06-24 18:18 ` Dan Streetman
@ 2015-06-24 18:31   ` Dan Streetman
  2015-06-24 22:57   ` linux-next: build failure after merge of the modules tree Stephen Rothwell
  1 sibling, 0 replies; 5+ messages in thread
From: Dan Streetman @ 2015-06-24 18:31 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Stephen Rothwell, linux-next, linux-kernel, Dan Streetman

Simplify params.c by replacing KPARAM_MUTEX() with an inline function
__param_lock(), and replacing KPARAM_IS_LOCKED() with direct calls to
mutex_is_locked().  Inside __param_lock(), only (conditionally) return
mod->param_lock #ifdef CONFIG_MODULES; if there are no modules just
return the built-in param_lock.

Since "struct module" isn't defined if !CONFIG_MODULES, we must leave
out the code that returns mod->param_lock if there are no modules.

Signed-off-by: Dan Streetman <ddstreet@ieee.org>
---
 kernel/params.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/kernel/params.c b/kernel/params.c
index 8890d0b..9c955cd 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -29,8 +29,14 @@
 static DEFINE_MUTEX(param_lock);
 
 /* Use the module's mutex, or if built-in use the built-in mutex */
-#define KPARAM_MUTEX(mod)	((mod) ? &(mod)->param_lock : &param_lock)
-#define KPARAM_IS_LOCKED(mod)	mutex_is_locked(KPARAM_MUTEX(mod))
+static inline struct mutex *__param_lock(struct module *mod)
+{
+#ifdef CONFIG_MODULES
+	return mod ? &mod->param_lock : &param_lock;
+#else
+	return &param_lock;
+#endif
+}
 
 /* This just allows us to keep track of which parameters are kmalloced. */
 struct kmalloced_param {
@@ -459,7 +465,7 @@ static int param_array(struct module *mod,
 		/* nul-terminate and parse */
 		save = val[len];
 		((char *)val)[len] = '\0';
-		BUG_ON(!KPARAM_IS_LOCKED(mod));
+		BUG_ON(!mutex_is_locked(__param_lock(mod)));
 		ret = set(val, &kp);
 
 		if (ret != 0)
@@ -496,7 +502,7 @@ static int param_array_get(char *buffer, const struct kernel_param *kp)
 		if (i)
 			buffer[off++] = ',';
 		p.arg = arr->elem + arr->elemsize * i;
-		BUG_ON(!KPARAM_IS_LOCKED(p.mod));
+		BUG_ON(!mutex_is_locked(__param_lock(p.mod)));
 		ret = arr->ops->get(buffer + off, &p);
 		if (ret < 0)
 			return ret;
@@ -618,12 +624,12 @@ static ssize_t param_attr_store(struct module_attribute *mattr,
 
 void kernel_param_lock(struct module *mod)
 {
-	mutex_lock(KPARAM_MUTEX(mod));
+	mutex_lock(__param_lock(mod));
 }
 
 void kernel_param_unlock(struct module *mod)
 {
-	mutex_unlock(KPARAM_MUTEX(mod));
+	mutex_unlock(__param_lock(mod));
 }
 
 #ifdef CONFIG_SYSFS
-- 
2.1.0

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

* Re: linux-next: build failure after merge of the modules tree
  2015-06-24 18:18 ` Dan Streetman
  2015-06-24 18:31   ` [PATCH] modules: only use mod->param_lock if CONFIG_MODULES Dan Streetman
@ 2015-06-24 22:57   ` Stephen Rothwell
  2015-06-25  1:50     ` Stephen Rothwell
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2015-06-24 22:57 UTC (permalink / raw)
  To: Dan Streetman; +Cc: Rusty Russell, linux-next, linux-kernel

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

Hi Dan,

On Wed, 24 Jun 2015 14:18:44 -0400 Dan Streetman <ddstreet@ieee.org> wrote:
>
> On Tue, Jun 23, 2015 at 9:37 PM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > After merging the modules tree, today's linux-next build (x86_64
> > allmodconfig) failed like this:
> 
> that's weird.  Are you sure it failed during allmodconfig?  I can see
> why it would fail like that if CONFIG_MODULES ins't defined, which
> I'll send a patch for...

Pretty sure - and, in any case, I don't do any CONFIG_MODULES=n builds
between tree merges (only later in the day).  That is why I couldn't
figure out what went wrong.

I will apply your patch today and see if that helps.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

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

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

* Re: linux-next: build failure after merge of the modules tree
  2015-06-24 22:57   ` linux-next: build failure after merge of the modules tree Stephen Rothwell
@ 2015-06-25  1:50     ` Stephen Rothwell
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Rothwell @ 2015-06-25  1:50 UTC (permalink / raw)
  To: Dan Streetman; +Cc: Rusty Russell, linux-next, linux-kernel

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

Hi Dan,

On Thu, 25 Jun 2015 08:57:06 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> On Wed, 24 Jun 2015 14:18:44 -0400 Dan Streetman <ddstreet@ieee.org> wrote:
> >
> > On Tue, Jun 23, 2015 at 9:37 PM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > >
> > > After merging the modules tree, today's linux-next build (x86_64
> > > allmodconfig) failed like this:
> > 
> > that's weird.  Are you sure it failed during allmodconfig?  I can see
> > why it would fail like that if CONFIG_MODULES ins't defined, which
> > I'll send a patch for...
> 
> Pretty sure - and, in any case, I don't do any CONFIG_MODULES=n builds
> between tree merges (only later in the day).  That is why I couldn't
> figure out what went wrong.
> 
> I will apply your patch today and see if that helps.

I built without your patch and it failed again, but applying your patch fixes it.

Rusty, you can consider this

Tested-by: Stephen Rothwell <sfr@canb.auug.org.au>

for "[PATCH] modules: only use mod->param_lock if CONFIG_MODULES"
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

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

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

end of thread, other threads:[~2015-06-25  1:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-24  1:37 linux-next: build failure after merge of the modules tree Stephen Rothwell
2015-06-24 18:18 ` Dan Streetman
2015-06-24 18:31   ` [PATCH] modules: only use mod->param_lock if CONFIG_MODULES Dan Streetman
2015-06-24 22:57   ` linux-next: build failure after merge of the modules tree Stephen Rothwell
2015-06-25  1:50     ` Stephen Rothwell

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