All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
@ 2020-04-08 20:53 Nathan Chancellor
  2020-04-08 21:12 ` Sedat Dilek
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Nathan Chancellor @ 2020-04-08 20:53 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar
  Cc: Karol Herbst, Pekka Paalanen, x86, linux-kernel, nouveau,
	clang-built-linux, Nathan Chancellor, Sedat Dilek

When building with Clang + -Wtautological-compare and
CONFIG_CPUMASK_OFFSTACK unset:

arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
equal to a null pointer is always false [-Wtautological-pointer-compare]
        if (downed_cpus == NULL &&
            ^~~~~~~~~~~    ~~~~
arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
equal to a null pointer is always false [-Wtautological-pointer-compare]
        if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
            ^~~~~~~~~~~    ~~~~
2 warnings generated.

Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
cpumask_available to fix warnings of this nature. Use that here so that
clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.

Link: https://github.com/ClangBuiltLinux/linux/issues/982
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 arch/x86/mm/mmio-mod.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 109325d77b3e..43fd19b3f118 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
 	int cpu;
 	int err;
 
-	if (downed_cpus == NULL &&
+	if (!cpumask_available(downed_cpus) &&
 	    !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
 		pr_notice("Failed to allocate mask\n");
 		goto out;
@@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
 	int cpu;
 	int err;
 
-	if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
+	if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
 		return;
 	pr_notice("Re-enabling CPUs...\n");
 	for_each_cpu(cpu, downed_cpus) {

base-commit: ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25
-- 
2.26.0


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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
  2020-04-08 20:53 [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables Nathan Chancellor
@ 2020-04-08 21:12 ` Sedat Dilek
  2020-04-08 21:36   ` Sedat Dilek
  2020-04-15 13:51   ` Steven Rostedt
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Sedat Dilek @ 2020-04-08 21:12 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Steven Rostedt, Ingo Molnar, Karol Herbst, Pekka Paalanen, x86,
	linux-kernel, nouveau, Clang-Built-Linux ML

On Wed, Apr 8, 2020 at 10:53 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> When building with Clang + -Wtautological-compare and
> CONFIG_CPUMASK_OFFSTACK unset:
>

Hi Nathan,

thanks for the quick patch.

I can confirm I have no CONFIG_CPUMASK_OFFSTACK set.

Regards,
- Sedat -


> arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
> equal to a null pointer is always false [-Wtautological-pointer-compare]
>         if (downed_cpus == NULL &&
>             ^~~~~~~~~~~    ~~~~
> arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
> equal to a null pointer is always false [-Wtautological-pointer-compare]
>         if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
>             ^~~~~~~~~~~    ~~~~
> 2 warnings generated.
>
> Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
> cpumask_available to fix warnings of this nature. Use that here so that
> clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/982
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  arch/x86/mm/mmio-mod.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> index 109325d77b3e..43fd19b3f118 100644
> --- a/arch/x86/mm/mmio-mod.c
> +++ b/arch/x86/mm/mmio-mod.c
> @@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
>         int cpu;
>         int err;
>
> -       if (downed_cpus == NULL &&
> +       if (!cpumask_available(downed_cpus) &&
>             !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
>                 pr_notice("Failed to allocate mask\n");
>                 goto out;
> @@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
>         int cpu;
>         int err;
>
> -       if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> +       if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
>                 return;
>         pr_notice("Re-enabling CPUs...\n");
>         for_each_cpu(cpu, downed_cpus) {
>
> base-commit: ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25
> --
> 2.26.0
>

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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
  2020-04-08 21:12 ` Sedat Dilek
@ 2020-04-08 21:36   ` Sedat Dilek
  2020-04-15 13:58     ` Sedat Dilek
  0 siblings, 1 reply; 13+ messages in thread
From: Sedat Dilek @ 2020-04-08 21:36 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Steven Rostedt, Ingo Molnar, Karol Herbst, Pekka Paalanen, x86,
	linux-kernel, nouveau, Clang-Built-Linux ML

On Wed, Apr 8, 2020 at 11:12 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Wed, Apr 8, 2020 at 10:53 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > When building with Clang + -Wtautological-compare and
> > CONFIG_CPUMASK_OFFSTACK unset:
> >
>
> Hi Nathan,
>
> thanks for the quick patch.
>
> I can confirm I have no CONFIG_CPUMASK_OFFSTACK set.
>

Feel free to add appropriate credits:

   Tested-by: Sedat Dilek <sedat.dilek@gmail.com>

Regards,
- Sedat -

>
> > arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
> > equal to a null pointer is always false [-Wtautological-pointer-compare]
> >         if (downed_cpus == NULL &&
> >             ^~~~~~~~~~~    ~~~~
> > arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
> > equal to a null pointer is always false [-Wtautological-pointer-compare]
> >         if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> >             ^~~~~~~~~~~    ~~~~
> > 2 warnings generated.
> >
> > Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
> > cpumask_available to fix warnings of this nature. Use that here so that
> > clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/982
> > Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  arch/x86/mm/mmio-mod.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> > index 109325d77b3e..43fd19b3f118 100644
> > --- a/arch/x86/mm/mmio-mod.c
> > +++ b/arch/x86/mm/mmio-mod.c
> > @@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
> >         int cpu;
> >         int err;
> >
> > -       if (downed_cpus == NULL &&
> > +       if (!cpumask_available(downed_cpus) &&
> >             !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
> >                 pr_notice("Failed to allocate mask\n");
> >                 goto out;
> > @@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
> >         int cpu;
> >         int err;
> >
> > -       if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> > +       if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
> >                 return;
> >         pr_notice("Re-enabling CPUs...\n");
> >         for_each_cpu(cpu, downed_cpus) {
> >
> > base-commit: ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25
> > --
> > 2.26.0
> >

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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
@ 2020-04-15 13:51   ` Steven Rostedt
  0 siblings, 0 replies; 13+ messages in thread
From: Steven Rostedt @ 2020-04-15 13:51 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Ingo Molnar, Karol Herbst, Pekka Paalanen, x86, linux-kernel,
	nouveau, clang-built-linux, Sedat Dilek

On Wed,  8 Apr 2020 13:53:23 -0700
Nathan Chancellor <natechancellor@gmail.com> wrote:

> When building with Clang + -Wtautological-compare and
> CONFIG_CPUMASK_OFFSTACK unset:
> 
> arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
> equal to a null pointer is always false [-Wtautological-pointer-compare]
>         if (downed_cpus == NULL &&
>             ^~~~~~~~~~~    ~~~~
> arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
> equal to a null pointer is always false [-Wtautological-pointer-compare]
>         if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
>             ^~~~~~~~~~~    ~~~~
> 2 warnings generated.
> 
> Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
> cpumask_available to fix warnings of this nature. Use that here so that
> clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/982
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> 

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
@ 2020-04-15 13:51   ` Steven Rostedt
  0 siblings, 0 replies; 13+ messages in thread
From: Steven Rostedt @ 2020-04-15 13:51 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	x86-DgEjT+Ai2ygdnm+yROfE0A, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	clang-built-linux-/JYPxA39Uh5TLH3MbocFFw, Pekka Paalanen,
	Sedat Dilek, Ingo Molnar

On Wed,  8 Apr 2020 13:53:23 -0700
Nathan Chancellor <natechancellor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> When building with Clang + -Wtautological-compare and
> CONFIG_CPUMASK_OFFSTACK unset:
> 
> arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
> equal to a null pointer is always false [-Wtautological-pointer-compare]
>         if (downed_cpus == NULL &&
>             ^~~~~~~~~~~    ~~~~
> arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
> equal to a null pointer is always false [-Wtautological-pointer-compare]
>         if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
>             ^~~~~~~~~~~    ~~~~
> 2 warnings generated.
> 
> Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
> cpumask_available to fix warnings of this nature. Use that here so that
> clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/982
> Reported-by: Sedat Dilek <sedat.dilek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Nathan Chancellor <natechancellor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> 

Acked-by: Steven Rostedt (VMware) <rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org>

-- Steve

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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
  2020-04-08 21:36   ` Sedat Dilek
@ 2020-04-15 13:58     ` Sedat Dilek
  0 siblings, 0 replies; 13+ messages in thread
From: Sedat Dilek @ 2020-04-15 13:58 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Steven Rostedt, Ingo Molnar, Karol Herbst, Pekka Paalanen, x86,
	linux-kernel, nouveau, Clang-Built-Linux ML

On Wed, Apr 8, 2020 at 11:36 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:

[ ... ]

> Feel free to add appropriate credits:
>
>    Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
>

Re-tested with Linux v5.7-rc1 which shows this warning - with GCC v9.3
and LLVM/Clang v10.0.0 (and snapshot/pre-release of v10.0.1) on
Debian/testing AMD64.

- Sedat -

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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
  2020-04-08 20:53 [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables Nathan Chancellor
  2020-04-08 21:12 ` Sedat Dilek
  2020-04-15 13:51   ` Steven Rostedt
@ 2020-05-18  9:31 ` Nathan Chancellor
  2020-05-18 18:52     ` Nick Desaulniers
  2020-05-19 17:52 ` [tip: x86/urgent] x86/mmiotrace: Use cpumask_available() " tip-bot2 for Nathan Chancellor
  3 siblings, 1 reply; 13+ messages in thread
From: Nathan Chancellor @ 2020-05-18  9:31 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar
  Cc: Karol Herbst, Pekka Paalanen, x86, linux-kernel, nouveau,
	clang-built-linux, Sedat Dilek

On Wed, Apr 08, 2020 at 01:53:23PM -0700, Nathan Chancellor wrote:
> When building with Clang + -Wtautological-compare and
> CONFIG_CPUMASK_OFFSTACK unset:
> 
> arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
> equal to a null pointer is always false [-Wtautological-pointer-compare]
>         if (downed_cpus == NULL &&
>             ^~~~~~~~~~~    ~~~~
> arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
> equal to a null pointer is always false [-Wtautological-pointer-compare]
>         if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
>             ^~~~~~~~~~~    ~~~~
> 2 warnings generated.
> 
> Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
> cpumask_available to fix warnings of this nature. Use that here so that
> clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/982
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  arch/x86/mm/mmio-mod.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> index 109325d77b3e..43fd19b3f118 100644
> --- a/arch/x86/mm/mmio-mod.c
> +++ b/arch/x86/mm/mmio-mod.c
> @@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
>  	int cpu;
>  	int err;
>  
> -	if (downed_cpus == NULL &&
> +	if (!cpumask_available(downed_cpus) &&
>  	    !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
>  		pr_notice("Failed to allocate mask\n");
>  		goto out;
> @@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
>  	int cpu;
>  	int err;
>  
> -	if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> +	if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
>  		return;
>  	pr_notice("Re-enabling CPUs...\n");
>  	for_each_cpu(cpu, downed_cpus) {
> 
> base-commit: ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25
> -- 
> 2.26.0
> 

Gentle ping for acceptance, I am not sure who should take this.

Cheers,
Nathan

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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
  2020-05-18  9:31 ` Nathan Chancellor
@ 2020-05-18 18:52     ` Nick Desaulniers
  0 siblings, 0 replies; 13+ messages in thread
From: Nick Desaulniers @ 2020-05-18 18:52 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Steven Rostedt, Ingo Molnar, Karol Herbst, Pekka Paalanen,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	LKML, nouveau, clang-built-linux, Sedat Dilek

On Mon, May 18, 2020 at 2:31 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Wed, Apr 08, 2020 at 01:53:23PM -0700, Nathan Chancellor wrote:
> > When building with Clang + -Wtautological-compare and
> > CONFIG_CPUMASK_OFFSTACK unset:
> >
> > arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
> > equal to a null pointer is always false [-Wtautological-pointer-compare]
> >         if (downed_cpus == NULL &&
> >             ^~~~~~~~~~~    ~~~~
> > arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
> > equal to a null pointer is always false [-Wtautological-pointer-compare]
> >         if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> >             ^~~~~~~~~~~    ~~~~
> > 2 warnings generated.
> >
> > Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
> > cpumask_available to fix warnings of this nature. Use that here so that
> > clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/982
> > Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Thanks for the patch, sorry I'm falling behind on code review!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> > ---
> >  arch/x86/mm/mmio-mod.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> > index 109325d77b3e..43fd19b3f118 100644
> > --- a/arch/x86/mm/mmio-mod.c
> > +++ b/arch/x86/mm/mmio-mod.c
> > @@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
> >       int cpu;
> >       int err;
> >
> > -     if (downed_cpus == NULL &&
> > +     if (!cpumask_available(downed_cpus) &&
> >           !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
> >               pr_notice("Failed to allocate mask\n");
> >               goto out;
> > @@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
> >       int cpu;
> >       int err;
> >
> > -     if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> > +     if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
> >               return;
> >       pr_notice("Re-enabling CPUs...\n");
> >       for_each_cpu(cpu, downed_cpus) {
> >
> > base-commit: ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25
> > --
> > 2.26.0
> >
>
> Gentle ping for acceptance, I am not sure who should take this.

Looks like Steven or Ingo are the listed maintainers for MMIOTRACE?

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
@ 2020-05-18 18:52     ` Nick Desaulniers
  0 siblings, 0 replies; 13+ messages in thread
From: Nick Desaulniers @ 2020-05-18 18:52 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	LKML, Steven Rostedt, clang-built-linux, Pekka Paalanen,
	Sedat Dilek, Ingo Molnar

On Mon, May 18, 2020 at 2:31 AM Nathan Chancellor
<natechancellor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> On Wed, Apr 08, 2020 at 01:53:23PM -0700, Nathan Chancellor wrote:
> > When building with Clang + -Wtautological-compare and
> > CONFIG_CPUMASK_OFFSTACK unset:
> >
> > arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
> > equal to a null pointer is always false [-Wtautological-pointer-compare]
> >         if (downed_cpus == NULL &&
> >             ^~~~~~~~~~~    ~~~~
> > arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
> > equal to a null pointer is always false [-Wtautological-pointer-compare]
> >         if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> >             ^~~~~~~~~~~    ~~~~
> > 2 warnings generated.
> >
> > Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
> > cpumask_available to fix warnings of this nature. Use that here so that
> > clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/982
> > Reported-by: Sedat Dilek <sedat.dilek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Signed-off-by: Nathan Chancellor <natechancellor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Thanks for the patch, sorry I'm falling behind on code review!
Reviewed-by: Nick Desaulniers <ndesaulniers-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>

> > ---
> >  arch/x86/mm/mmio-mod.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> > index 109325d77b3e..43fd19b3f118 100644
> > --- a/arch/x86/mm/mmio-mod.c
> > +++ b/arch/x86/mm/mmio-mod.c
> > @@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
> >       int cpu;
> >       int err;
> >
> > -     if (downed_cpus == NULL &&
> > +     if (!cpumask_available(downed_cpus) &&
> >           !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
> >               pr_notice("Failed to allocate mask\n");
> >               goto out;
> > @@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
> >       int cpu;
> >       int err;
> >
> > -     if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> > +     if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
> >               return;
> >       pr_notice("Re-enabling CPUs...\n");
> >       for_each_cpu(cpu, downed_cpus) {
> >
> > base-commit: ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25
> > --
> > 2.26.0
> >
>
> Gentle ping for acceptance, I am not sure who should take this.

Looks like Steven or Ingo are the listed maintainers for MMIOTRACE?

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
@ 2020-05-18 22:35       ` Steven Rostedt
  0 siblings, 0 replies; 13+ messages in thread
From: Steven Rostedt @ 2020-05-18 22:35 UTC (permalink / raw)
  To: Nick Desaulniers, Linus Torvalds
  Cc: Nathan Chancellor, Ingo Molnar, Karol Herbst, Pekka Paalanen,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	LKML, nouveau, clang-built-linux, Sedat Dilek

On Mon, 18 May 2020 11:52:47 -0700
Nick Desaulniers <ndesaulniers@google.com> wrote:

> On Mon, May 18, 2020 at 2:31 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > On Wed, Apr 08, 2020 at 01:53:23PM -0700, Nathan Chancellor wrote:  
> > > When building with Clang + -Wtautological-compare and
> > > CONFIG_CPUMASK_OFFSTACK unset:
> > >
> > > arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
> > > equal to a null pointer is always false [-Wtautological-pointer-compare]
> > >         if (downed_cpus == NULL &&
> > >             ^~~~~~~~~~~    ~~~~
> > > arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
> > > equal to a null pointer is always false [-Wtautological-pointer-compare]
> > >         if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> > >             ^~~~~~~~~~~    ~~~~
> > > 2 warnings generated.
> > >
> > > Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
> > > cpumask_available to fix warnings of this nature. Use that here so that
> > > clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/982
> > > Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>  
> 
> Thanks for the patch, sorry I'm falling behind on code review!
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Linus sent me a issue about this failure privately as well, and had two
solutions for it (one being identical to this one, and I shared that with
him, and another one he thought would be better, but had some issues).

Linus,

Are you OK with this patch?

-- Steve


> 
> > > ---
> > >  arch/x86/mm/mmio-mod.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> > > index 109325d77b3e..43fd19b3f118 100644
> > > --- a/arch/x86/mm/mmio-mod.c
> > > +++ b/arch/x86/mm/mmio-mod.c
> > > @@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
> > >       int cpu;
> > >       int err;
> > >
> > > -     if (downed_cpus == NULL &&
> > > +     if (!cpumask_available(downed_cpus) &&
> > >           !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
> > >               pr_notice("Failed to allocate mask\n");
> > >               goto out;
> > > @@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
> > >       int cpu;
> > >       int err;
> > >
> > > -     if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> > > +     if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
> > >               return;
> > >       pr_notice("Re-enabling CPUs...\n");
> > >       for_each_cpu(cpu, downed_cpus) {
> > >
> > > base-commit: ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25
> > > --
> > > 2.26.0
> > >  
> >
> > Gentle ping for acceptance, I am not sure who should take this.  
> 
> Looks like Steven or Ingo are the listed maintainers for MMIOTRACE?
> 


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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
@ 2020-05-18 22:35       ` Steven Rostedt
  0 siblings, 0 replies; 13+ messages in thread
From: Steven Rostedt @ 2020-05-18 22:35 UTC (permalink / raw)
  To: Nick Desaulniers, Linus Torvalds
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	LKML, clang-built-linux, Pekka Paalanen, Sedat Dilek,
	Nathan Chancellor, Ingo Molnar

On Mon, 18 May 2020 11:52:47 -0700
Nick Desaulniers <ndesaulniers-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:

> On Mon, May 18, 2020 at 2:31 AM Nathan Chancellor
> <natechancellor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > On Wed, Apr 08, 2020 at 01:53:23PM -0700, Nathan Chancellor wrote:  
> > > When building with Clang + -Wtautological-compare and
> > > CONFIG_CPUMASK_OFFSTACK unset:
> > >
> > > arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
> > > equal to a null pointer is always false [-Wtautological-pointer-compare]
> > >         if (downed_cpus == NULL &&
> > >             ^~~~~~~~~~~    ~~~~
> > > arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
> > > equal to a null pointer is always false [-Wtautological-pointer-compare]
> > >         if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> > >             ^~~~~~~~~~~    ~~~~
> > > 2 warnings generated.
> > >
> > > Commit f7e30f01a9e2 ("cpumask: Add helper cpumask_available()") added
> > > cpumask_available to fix warnings of this nature. Use that here so that
> > > clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/982
> > > Reported-by: Sedat Dilek <sedat.dilek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > > Signed-off-by: Nathan Chancellor <natechancellor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>  
> 
> Thanks for the patch, sorry I'm falling behind on code review!
> Reviewed-by: Nick Desaulniers <ndesaulniers-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>

Linus sent me a issue about this failure privately as well, and had two
solutions for it (one being identical to this one, and I shared that with
him, and another one he thought would be better, but had some issues).

Linus,

Are you OK with this patch?

-- Steve


> 
> > > ---
> > >  arch/x86/mm/mmio-mod.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> > > index 109325d77b3e..43fd19b3f118 100644
> > > --- a/arch/x86/mm/mmio-mod.c
> > > +++ b/arch/x86/mm/mmio-mod.c
> > > @@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
> > >       int cpu;
> > >       int err;
> > >
> > > -     if (downed_cpus == NULL &&
> > > +     if (!cpumask_available(downed_cpus) &&
> > >           !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
> > >               pr_notice("Failed to allocate mask\n");
> > >               goto out;
> > > @@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
> > >       int cpu;
> > >       int err;
> > >
> > > -     if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
> > > +     if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
> > >               return;
> > >       pr_notice("Re-enabling CPUs...\n");
> > >       for_each_cpu(cpu, downed_cpus) {
> > >
> > > base-commit: ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25
> > > --
> > > 2.26.0
> > >  
> >
> > Gentle ping for acceptance, I am not sure who should take this.  
> 
> Looks like Steven or Ingo are the listed maintainers for MMIOTRACE?
> 

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

* Re: [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
  2020-05-18 22:35       ` Steven Rostedt
  (?)
@ 2020-05-19  0:29       ` Linus Torvalds
  -1 siblings, 0 replies; 13+ messages in thread
From: Linus Torvalds @ 2020-05-19  0:29 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Nick Desaulniers, Nathan Chancellor, Ingo Molnar, Karol Herbst,
	Pekka Paalanen, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	LKML, nouveau, clang-built-linux, Sedat Dilek

On Mon, May 18, 2020 at 3:35 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> Linus,
>
> Are you OK with this patch?

Yup, I don't care deeply either way, as long as we can get rid of the warning.

                Linus

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

* [tip: x86/urgent] x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables
  2020-04-08 20:53 [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables Nathan Chancellor
                   ` (2 preceding siblings ...)
  2020-05-18  9:31 ` Nathan Chancellor
@ 2020-05-19 17:52 ` tip-bot2 for Nathan Chancellor
  3 siblings, 0 replies; 13+ messages in thread
From: tip-bot2 for Nathan Chancellor @ 2020-05-19 17:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sedat Dilek, Nathan Chancellor, Borislav Petkov,
	Nick Desaulniers, Steven Rostedt (VMware),
	x86, LKML

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     d7110a26e5905ec2fe3fc88bc6a538901accb72b
Gitweb:        https://git.kernel.org/tip/d7110a26e5905ec2fe3fc88bc6a538901accb72b
Author:        Nathan Chancellor <natechancellor@gmail.com>
AuthorDate:    Wed, 08 Apr 2020 13:53:23 -07:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Tue, 19 May 2020 19:30:28 +02:00

x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables

When building with Clang + -Wtautological-compare and
CONFIG_CPUMASK_OFFSTACK unset:

  arch/x86/mm/mmio-mod.c:375:6: warning: comparison of array 'downed_cpus'
  equal to a null pointer is always false [-Wtautological-pointer-compare]
          if (downed_cpus == NULL &&
              ^~~~~~~~~~~    ~~~~
  arch/x86/mm/mmio-mod.c:405:6: warning: comparison of array 'downed_cpus'
  equal to a null pointer is always false [-Wtautological-pointer-compare]
          if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
              ^~~~~~~~~~~    ~~~~
  2 warnings generated.

Commit

  f7e30f01a9e2 ("cpumask: Add helper cpumask_available()")

added cpumask_available() to fix warnings of this nature. Use that here
so that clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's
value.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://github.com/ClangBuiltLinux/linux/issues/982
Link: https://lkml.kernel.org/r/20200408205323.44490-1-natechancellor@gmail.com
---
 arch/x86/mm/mmio-mod.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 109325d..43fd19b 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
 	int cpu;
 	int err;
 
-	if (downed_cpus == NULL &&
+	if (!cpumask_available(downed_cpus) &&
 	    !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
 		pr_notice("Failed to allocate mask\n");
 		goto out;
@@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
 	int cpu;
 	int err;
 
-	if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
+	if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
 		return;
 	pr_notice("Re-enabling CPUs...\n");
 	for_each_cpu(cpu, downed_cpus) {

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

end of thread, other threads:[~2020-05-19 17:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 20:53 [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables Nathan Chancellor
2020-04-08 21:12 ` Sedat Dilek
2020-04-08 21:36   ` Sedat Dilek
2020-04-15 13:58     ` Sedat Dilek
2020-04-15 13:51 ` Steven Rostedt
2020-04-15 13:51   ` Steven Rostedt
2020-05-18  9:31 ` Nathan Chancellor
2020-05-18 18:52   ` Nick Desaulniers
2020-05-18 18:52     ` Nick Desaulniers
2020-05-18 22:35     ` Steven Rostedt
2020-05-18 22:35       ` Steven Rostedt
2020-05-19  0:29       ` Linus Torvalds
2020-05-19 17:52 ` [tip: x86/urgent] x86/mmiotrace: Use cpumask_available() " tip-bot2 for Nathan Chancellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.