Nathan Chancellor
2020-Apr-08  20:53 UTC
[Nouveau] [PATCH] 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.
Link: https://github.com/ClangBuiltLinux/linux/issues/982
Reported-by: Sedat Dilek <sedat.dilek at gmail.com>
Signed-off-by: Nathan Chancellor <natechancellor at 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
Sedat Dilek
2020-Apr-08  21:12 UTC
[Nouveau] [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
On Wed, Apr 8, 2020 at 10:53 PM Nathan Chancellor <natechancellor at 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 at gmail.com> > Signed-off-by: Nathan Chancellor <natechancellor at 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 >
Sedat Dilek
2020-Apr-08  21:37 UTC
[Nouveau] [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
On Wed, Apr 8, 2020 at 11:12 PM Sedat Dilek <sedat.dilek at gmail.com> wrote:> > On Wed, Apr 8, 2020 at 10:53 PM Nathan Chancellor > <natechancellor at 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 at 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 at gmail.com> > > Signed-off-by: Nathan Chancellor <natechancellor at 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 > >
Steven Rostedt
2020-Apr-15  13:51 UTC
[Nouveau] [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
On Wed, 8 Apr 2020 13:53:23 -0700 Nathan Chancellor <natechancellor at 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 at gmail.com> > Signed-off-by: Nathan Chancellor <natechancellor at gmail.com> > --- >Acked-by: Steven Rostedt (VMware) <rostedt at goodmis.org> -- Steve
Nathan Chancellor
2020-May-18  09:31 UTC
[Nouveau] [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
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 at gmail.com> > Signed-off-by: Nathan Chancellor <natechancellor at 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
Nick Desaulniers
2020-May-18  18:52 UTC
[Nouveau] [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
On Mon, May 18, 2020 at 2:31 AM Nathan Chancellor <natechancellor at 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 at gmail.com> > > Signed-off-by: Nathan Chancellor <natechancellor at gmail.com>Thanks for the patch, sorry I'm falling behind on code review! Reviewed-by: Nick Desaulniers <ndesaulniers at 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
Possibly Parallel Threads
- [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
- [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
- [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
- [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
- [PATCH] x86: mmiotrace: Use cpumask_available for cpumask_var_t variables