linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib/test_lockup: Rename disable_irq to fix build error
@ 2020-03-17 13:36 Guenter Roeck
  2020-03-17 18:35 ` Konstantin Khlebnikov
  0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2020-03-17 13:36 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Andrew Morton, linux-kernel, Guenter Roeck, Konstantin Khlebnikov

mips:allmodconfig fails to build.

lib/test_lockup.c:87:13: error:
	'disable_irq' redeclared as different kind of symbol
   87 | static bool disable_irq;
      |             ^~~~~~~~~~~
In file included from arch/mips/include/asm/highmem.h:24,
                 from arch/mips/include/asm/pgtable-32.h:22,
                 from arch/mips/include/asm/pgtable.h:14,
                 from include/linux/mm.h:95,
                 from lib/test_lockup.c:15:
include/linux/interrupt.h:237:13: note:
	previous declaration of 'disable_irq' was here
  237 | extern void disable_irq(unsigned int irq);

Rename the variable to fix the problem.

Fixes: 0e86238873f3 ("lib/test_lockup: test module to generate lockups")
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 lib/test_lockup.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/test_lockup.c b/lib/test_lockup.c
index b45afd3ad7cb..83683ec1f429 100644
--- a/lib/test_lockup.c
+++ b/lib/test_lockup.c
@@ -84,8 +84,8 @@ static unsigned long lock_wait_threshold = ULONG_MAX;
 module_param(lock_wait_threshold, ulong, 0400);
 MODULE_PARM_DESC(lock_wait_threshold, "print lock wait time longer than this in nanoseconds, default off");
 
-static bool disable_irq;
-module_param(disable_irq, bool, 0400);
+static bool test_disable_irq;
+module_param_named(disable_irq, test_disable_irq, bool, 0400);
 MODULE_PARM_DESC(disable_irq, "disable interrupts: generate hard-lockups");
 
 static bool disable_softirq;
@@ -179,7 +179,7 @@ static void test_lock(bool master, bool verbose)
 			down_write(&main_task->mm->mmap_sem);
 	}
 
-	if (disable_irq)
+	if (test_disable_irq)
 		local_irq_disable();
 
 	if (disable_softirq)
@@ -252,7 +252,7 @@ static void test_unlock(bool master, bool verbose)
 	if (disable_softirq)
 		local_bh_enable();
 
-	if (disable_irq)
+	if (test_disable_irq)
 		local_irq_enable();
 
 	if (lock_mmap_sem && master) {
@@ -479,8 +479,8 @@ static int __init test_lockup_init(void)
 	if ((wait_state != TASK_RUNNING ||
 	     (call_cond_resched && !reacquire_locks) ||
 	     (alloc_pages_nr && gfpflags_allow_blocking(alloc_pages_gfp))) &&
-	    (disable_irq || disable_softirq || disable_preempt || lock_rcu ||
-	     lock_spinlock_ptr || lock_rwlock_ptr)) {
+	    (test_disable_irq || disable_softirq || disable_preempt ||
+	     lock_rcu || lock_spinlock_ptr || lock_rwlock_ptr)) {
 		pr_err("refuse to sleep in atomic context\n");
 		return -EINVAL;
 	}
@@ -495,7 +495,7 @@ static int __init test_lockup_init(void)
 		  cooldown_secs, cooldown_nsecs, iterations, state,
 		  all_cpus ? "all_cpus " : "",
 		  iowait ? "iowait " : "",
-		  disable_irq ? "disable_irq " : "",
+		  test_disable_irq ? "disable_irq " : "",
 		  disable_softirq ? "disable_softirq " : "",
 		  disable_preempt ? "disable_preempt " : "",
 		  lock_rcu ? "lock_rcu " : "",
-- 
2.17.1


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

* Re: [PATCH] lib/test_lockup: Rename disable_irq to fix build error
  2020-03-17 13:36 [PATCH] lib/test_lockup: Rename disable_irq to fix build error Guenter Roeck
@ 2020-03-17 18:35 ` Konstantin Khlebnikov
  0 siblings, 0 replies; 2+ messages in thread
From: Konstantin Khlebnikov @ 2020-03-17 18:35 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Stephen Rothwell, Andrew Morton, Linux Kernel Mailing List,
	Konstantin Khlebnikov

On Tue, Mar 17, 2020 at 4:37 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> mips:allmodconfig fails to build.
>
> lib/test_lockup.c:87:13: error:
>         'disable_irq' redeclared as different kind of symbol
>    87 | static bool disable_irq;
>       |             ^~~~~~~~~~~
> In file included from arch/mips/include/asm/highmem.h:24,
>                  from arch/mips/include/asm/pgtable-32.h:22,
>                  from arch/mips/include/asm/pgtable.h:14,
>                  from include/linux/mm.h:95,
>                  from lib/test_lockup.c:15:
> include/linux/interrupt.h:237:13: note:
>         previous declaration of 'disable_irq' was here
>   237 | extern void disable_irq(unsigned int irq);
>
> Rename the variable to fix the problem.

Looks good. Thank you.

>
> Fixes: 0e86238873f3 ("lib/test_lockup: test module to generate lockups")
> Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  lib/test_lockup.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/lib/test_lockup.c b/lib/test_lockup.c
> index b45afd3ad7cb..83683ec1f429 100644
> --- a/lib/test_lockup.c
> +++ b/lib/test_lockup.c
> @@ -84,8 +84,8 @@ static unsigned long lock_wait_threshold = ULONG_MAX;
>  module_param(lock_wait_threshold, ulong, 0400);
>  MODULE_PARM_DESC(lock_wait_threshold, "print lock wait time longer than this in nanoseconds, default off");
>
> -static bool disable_irq;
> -module_param(disable_irq, bool, 0400);
> +static bool test_disable_irq;
> +module_param_named(disable_irq, test_disable_irq, bool, 0400);
>  MODULE_PARM_DESC(disable_irq, "disable interrupts: generate hard-lockups");
>
>  static bool disable_softirq;
> @@ -179,7 +179,7 @@ static void test_lock(bool master, bool verbose)
>                         down_write(&main_task->mm->mmap_sem);
>         }
>
> -       if (disable_irq)
> +       if (test_disable_irq)
>                 local_irq_disable();
>
>         if (disable_softirq)
> @@ -252,7 +252,7 @@ static void test_unlock(bool master, bool verbose)
>         if (disable_softirq)
>                 local_bh_enable();
>
> -       if (disable_irq)
> +       if (test_disable_irq)
>                 local_irq_enable();
>
>         if (lock_mmap_sem && master) {
> @@ -479,8 +479,8 @@ static int __init test_lockup_init(void)
>         if ((wait_state != TASK_RUNNING ||
>              (call_cond_resched && !reacquire_locks) ||
>              (alloc_pages_nr && gfpflags_allow_blocking(alloc_pages_gfp))) &&
> -           (disable_irq || disable_softirq || disable_preempt || lock_rcu ||
> -            lock_spinlock_ptr || lock_rwlock_ptr)) {
> +           (test_disable_irq || disable_softirq || disable_preempt ||
> +            lock_rcu || lock_spinlock_ptr || lock_rwlock_ptr)) {
>                 pr_err("refuse to sleep in atomic context\n");
>                 return -EINVAL;
>         }
> @@ -495,7 +495,7 @@ static int __init test_lockup_init(void)
>                   cooldown_secs, cooldown_nsecs, iterations, state,
>                   all_cpus ? "all_cpus " : "",
>                   iowait ? "iowait " : "",
> -                 disable_irq ? "disable_irq " : "",
> +                 test_disable_irq ? "disable_irq " : "",
>                   disable_softirq ? "disable_softirq " : "",
>                   disable_preempt ? "disable_preempt " : "",
>                   lock_rcu ? "lock_rcu " : "",
> --
> 2.17.1
>

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

end of thread, other threads:[~2020-03-17 18:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 13:36 [PATCH] lib/test_lockup: Rename disable_irq to fix build error Guenter Roeck
2020-03-17 18:35 ` Konstantin Khlebnikov

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