Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wuninitialized in drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c #220

Closed
nathanchance opened this issue Oct 15, 2018 · 9 comments
Closed
Assignees
Labels
-Wuninitialized [ARCH] x86_64 This bug impacts ARCH=x86_64 [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LINUX] 5.1 This bug was fixed in Linux 5.1

Comments

@nathanchance
Copy link
Member

drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c:350:34: error: variable 'wq' is uninitialized when used within its own initialization [-Werror,-Wuninitialized]
        DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
                                        ^~
./include/linux/wait.h:74:63: note: expanded from macro 'DECLARE_WAIT_QUEUE_HEAD_ONSTACK'
        struct wait_queue_head name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name)
                               ~~~~                                  ^~~~
./include/linux/wait.h:72:33: note: expanded from macro '__WAIT_QUEUE_HEAD_INIT_ONSTACK'
        ({ init_waitqueue_head(&name); name; })
                                       ^~~~
1 error generated.

allyesconfig on x86_64

@nathanchance nathanchance added [BUG] Untriaged Something isn't working [ARCH] x86_64 This bug impacts ARCH=x86_64 -Wuninitialized labels Oct 15, 2018
@nathanchance
Copy link
Member Author

Ah I see what's going on here.

-Wuninitialized is disabled in scripts/Makefile.extrawarn when W= is not provided to make but drivers/gpu/drm/i915/Makefile calls -Wall after, which re-enables it.

/usr/bin/ccache clang -Wp,-MD,drivers/gpu/drm/i915/.intel_uc.o.d  -nostdinc -isystem /home/nathan/toolchains/clang-8.x/lib/clang/8.0.344477/include -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Qunused-arguments -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -no-integrated-as -fno-PIE -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -mno-80387 -mstack-alignment=8 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mretpoline-external-thunk -DRETPOLINE -Wa,arch/x86/kernel/macros.s -D__BPF_TRACING__ -fno-delete-null-pointer-checks -O2 -fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu -Wno-address-of-packed-member -Wno-tautological-compare -Wno-switch -mno-global-merge -Wno-unused-const-variable -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants -fno-stack-check -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Wno-constant-conversion -Wno-empty-body -Wno-initializer-overrides -Wno-unused-value -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-uninitialized -Werror -Wall -Wextra -Wno-unused-parameter -Wno-type-limits -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-sign-compare -Wno-sometimes-uninitialized -Wno-initializer-overrides -DCONFIG_AS_MOVNTDQA -Idrivers/gpu/drm/i915 -Idrivers/gpu/drm/i915/gvt    -fsanitize=kernel-address -mllvm -asan-mapping-offset=0xdffffc0000000000  -mllvm -asan-globals=1  -mllvm -asan-instrumentation-with-call-threshold=0  -mllvm -asan-stack=1  -mllvm -asan-use-after-scope=1   --param asan-instrument-allocas=1   -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp    -DKBUILD_BASENAME='"intel_uc"' -DKBUILD_MODNAME='"i915"' -c -o drivers/gpu/drm/i915/.tmp_intel_uc.o drivers/gpu/drm/i915/intel_uc.c

Not sure if the warning should be fixed or hidden again.

@nickdesaulniers
Copy link
Member

Probably hidden again. I think I had sent the i915 folks a patch like this before (about -Wall re-enabling things that were disabled).

@nickdesaulniers nickdesaulniers added [BUG] linux A bug that should be fixed in the mainline kernel. low priority This bug is not critical and not a priority and removed [BUG] Untriaged Something isn't working labels Oct 25, 2018
@nathanchance
Copy link
Member Author

Will send it shortly then, thanks!

@nathanchance
Copy link
Member Author

@nickdesaulniers
Copy link
Member

@nathanchance can you please send a v2 disabling the warning for the whole subdir?

@nathanchance
Copy link
Member Author

@nathanchance
Copy link
Member Author

@nathanchance nathanchance added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Jan 26, 2019
@nickdesaulniers
Copy link
Member

The patch was so nice, I reviewed it twice! 🥁

@nathanchance
Copy link
Member Author

Merged into mainline: https://git.kernel.org/torvalds/c/c5627461490e4b913e8747d3b06541e5264a50d7

@nathanchance nathanchance added [FIXED][LINUX] 5.1 This bug was fixed in Linux 5.1 and removed [PATCH] Accepted A submitted patch has been accepted upstream low priority This bug is not critical and not a priority labels Mar 8, 2019
fengguang pushed a commit to 0day-ci/linux that referenced this issue Feb 16, 2021
-Wunintialized was disabled in commit c562746 ("drm/i915: Disable
-Wuninitialized") because there were two warnings that were false
positives. The first was due to DECLARE_WAIT_QUEUE_HEAD_ONSTACK, which
was fixed in LLVM 9.0.0. The second was in busywait_stop, which was
fixed in LLVM 10.0.0 (issue 415). The kernel's minimum version for LLVM
is 10.0.1 so this warning can be safely enabled, where it has already
caught a couple bugs.

Link: ClangBuiltLinux#220
Link: ClangBuiltLinux#415
Link: ClangBuiltLinux#499
Link: llvm/llvm-project@2e04039
Link: llvm/llvm-project@c667cdc
Fixes: c562746 ("drm/i915: Disable -Wuninitialized")
References: 2ea4a7b ("drm/i915/gt: Avoid uninitialized use of rpcurupei in frequency_show")
References: 2034c21 ("drm/i915/display: Ensure that ret is always initialized in icl_combo_phy_verify_state")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
sys-oak pushed a commit to intel/linux-intel-lts that referenced this issue Mar 16, 2021
-Wunintialized was disabled in commit c562746 ("drm/i915: Disable
-Wuninitialized") because there were two warnings that were false
positives. The first was due to DECLARE_WAIT_QUEUE_HEAD_ONSTACK, which
was fixed in LLVM 9.0.0. The second was in busywait_stop, which was
fixed in LLVM 10.0.0 (issue 415). The kernel's minimum version for LLVM
is 10.0.1 so this warning can be safely enabled, where it has already
caught a couple bugs.

Link: ClangBuiltLinux/linux#220
Link: ClangBuiltLinux/linux#415
Link: ClangBuiltLinux/linux#499
Link: llvm/llvm-project@2e04039
Link: llvm/llvm-project@c667cdc
Fixes: c562746 ("drm/i915: Disable -Wuninitialized")
References: 2ea4a7b ("drm/i915/gt: Avoid uninitialized use of rpcurupei in frequency_show")
References: 2034c21 ("drm/i915/display: Ensure that ret is always initialized in icl_combo_phy_verify_state")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20210216212953.24458-1-nathan@kernel.org
(cherry picked from commit b242318)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wuninitialized [ARCH] x86_64 This bug impacts ARCH=x86_64 [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LINUX] 5.1 This bug was fixed in Linux 5.1
Projects
None yet
Development

No branches or pull requests

2 participants