x86: mmiotrace: Use cpumask_available for cpumask_var_t variables
Subsystems (3)
PATCH 1/1 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.
--- arch/x86/mm/mmio-mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/mmio-mod.c +2 -2
@@ -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
Signature · 1 line
2.26.0
Quoted 4 lines · Nathan Chancellor
When building with Clang + -Wtautological-compare and
CONFIG_CPUMASK_OFFSTACKunset:
Hi Nathan,
thanks for the quick patch.
I can confirm I have no CONFIG_CPUMASK_OFFSTACK set.
Regards,
- Sedat -
Quoted 48 lines
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 helpercpumask_available()") addedcpumask_availableto 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 <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- arch/x86/mm/mmio-mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/mm/mmio-mod.c +2
-2@@ -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
Tested-byQuoted 8 lines · Sedat Dilek
Quoted 4 lines · Nathan Chancellor
When building with Clang + -Wtautological-compare and
CONFIG_CPUMASK_OFFSTACKunset:
Quoted 6 lines
Hi Nathan,
thanks for the quick patch.
I can confirm I have no
CONFIG_CPUMASK_OFFSTACKset.
Feel free to add appropriate credits:
Regards,
- Sedat -
Quoted 49 lines
Quoted 49 lines
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 helpercpumask_available()") addedcpumask_availableto 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 <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- arch/x86/mm/mmio-mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/mm/mmio-mod.c +2
-2@@ -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
On Wed, Apr 8, 2020 at 11:36 PM Sedat Dilek <[email protected]> wrote:
[ ... ]
Quoted 4 lines
Feel free to add appropriate credits:
Tested-by Sedat Dilek <[email protected]>
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 -
Quoted 13 lines · On Wed, 8 Apr 2020 13:53:23 -0700 Nathan Chancellor…
When building with Clang + -Wtautological-compare and
CONFIG_CPUMASK_OFFSTACKunset:
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.
Quoted 9 lines
Commit
f7e30f01a9e2("cpumask: Add helpercpumask_available()") addedcpumask_availableto 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 <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
-- Steve
Quoted 47 lines · Nathan Chancellor
When building with Clang + -Wtautological-compare and
CONFIG_CPUMASK_OFFSTACKunset:
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 helpercpumask_available()") addedcpumask_availableto 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 <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>--- arch/x86/mm/mmio-mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/mm/mmio-mod.c +2
-2@@ -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) {
Quoted 4 lines
base-commit:
ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25Signature · 1 line
2.26.0
Gentle ping for acceptance, I am not sure who should take this.
Cheers,
Nathan
Nick Desaulniers
Reviewed-byQuoted 15 lines · Nathan Chancellor
Quoted 13 lines · Nathan Chancellor
When building with Clang + -Wtautological-compare and
CONFIG_CPUMASK_OFFSTACKunset:
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.
Quoted 7 lines
Quoted 7 lines
Commit
f7e30f01a9e2("cpumask: Add helpercpumask_available()") addedcpumask_availableto 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 <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>
Thanks for the patch, sorry I'm falling behind on code review!
Quoted 27 lines
Quoted 27 lines
--- arch/x86/mm/mmio-mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/mm/mmio-mod.c +2
-2@@ -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) {
Quoted 6 lines
Quoted 4 lines
base-commit:
ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25--
2.26.0Gentle ping for acceptance, I am not sure who should take this.
Looks like Steven or Ingo are the listed maintainers for MMIOTRACE?
Signature · 2 lines
Thanks, ~Nick Desaulniers
Steven Rostedt
maintainerQuoted 21 lines · On Mon, 18 May 2020 11:52:47 -0700 Nick Desaulniers…
Quoted 19 lines · Nathan Chancellor
Quoted 17 lines · Nathan Chancellor
When building with Clang + -Wtautological-compare and
CONFIG_CPUMASK_OFFSTACKunset:
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 helpercpumask_available()") addedcpumask_availableto fix warnings of this nature. Use that here so that clang does not warn regardless of CONFIG_CPUMASK_OFFSTACK's value.
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Reported-by Sedat Dilek <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>Thanks for the patch, sorry I'm falling behind on code review!
Reviewed-by Nick Desaulniers <[email protected]>
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
Quoted 37 lines
Quoted 28 lines
Quoted 28 lines
--- arch/x86/mm/mmio-mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/mm/mmio-mod.c +2
-2@@ -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) {Quoted 6 lines
Quoted 4 lines
base-commit:
ae46d2aa6a7fbe8ca0946f24b061b6ccdc6c3f25--
2.26.0Gentle ping for acceptance, I am not sure who should take this.
Looks like Steven or Ingo are the listed maintainers for MMIOTRACE?
Quoted 4 lines · Steven Rostedt
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
[tip: x86/urgent] x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables
In reply to Nathan ChancellorThe following commit has been merged into the x86/urgent branch of tip:
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 <[email protected]> AuthorDate: Wed, 08 Apr 2020 13:53:23 -07:00 Committer: Borislav Petkov <[email protected]> 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.
--- arch/x86/mm/mmio-mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/mmio-mod.c +2 -2
@@ -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) {