* [PATCH] drm/xe: Fix warning on unreachable statement
@ 2024-07-19 19:15 Lucas De Marchi
2024-07-19 19:20 ` ✓ CI.Patch_applied: success for " Patchwork
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Lucas De Marchi @ 2024-07-19 19:15 UTC (permalink / raw)
To: intel-xe; +Cc: Lucas De Marchi, Michal Wajdeczko
eu_type_to_str() relies on -Wswitch to warn (and -Werror) to make sure
it handles all enum values. However it's perfectly legal to pass an int
to that function so in the end that function may happen to return
nothing. A smart compiler could notice eu_type is never assigned to
anything other than those values.
Trying to reproduce this issue, none of gcc-9, gcc-10 and gcc-13
triggered for me, but this was reported in a different system with
gcc-10:
drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_gt_topology_init()
Since that is not really possible, just take the simple approach and
return NULL.
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
drivers/gpu/drm/xe/xe_gt_topology.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
index 5a1559edf3e9..0662f71c6ede 100644
--- a/drivers/gpu/drm/xe/xe_gt_topology.c
+++ b/drivers/gpu/drm/xe/xe_gt_topology.c
@@ -233,7 +233,7 @@ static const char *eu_type_to_str(enum xe_gt_eu_type eu_type)
return "simd8";
}
- unreachable();
+ return NULL;
}
void
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* ✓ CI.Patch_applied: success for drm/xe: Fix warning on unreachable statement
2024-07-19 19:15 [PATCH] drm/xe: Fix warning on unreachable statement Lucas De Marchi
@ 2024-07-19 19:20 ` Patchwork
2024-07-19 19:20 ` ✓ CI.checkpatch: " Patchwork
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2024-07-19 19:20 UTC (permalink / raw)
To: Lucas De Marchi; +Cc: intel-xe
== Series Details ==
Series: drm/xe: Fix warning on unreachable statement
URL : https://patchwork.freedesktop.org/series/136300/
State : success
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: eb6045a759ea drm-tip: 2024y-07m-19d-11h-07m-10s UTC integration manifest
=== git am output follows ===
Applying: drm/xe: Fix warning on unreachable statement
^ permalink raw reply [flat|nested] 9+ messages in thread
* ✓ CI.checkpatch: success for drm/xe: Fix warning on unreachable statement
2024-07-19 19:15 [PATCH] drm/xe: Fix warning on unreachable statement Lucas De Marchi
2024-07-19 19:20 ` ✓ CI.Patch_applied: success for " Patchwork
@ 2024-07-19 19:20 ` Patchwork
2024-07-19 19:21 ` ✗ CI.KUnit: failure " Patchwork
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2024-07-19 19:20 UTC (permalink / raw)
To: Lucas De Marchi; +Cc: intel-xe
== Series Details ==
Series: drm/xe: Fix warning on unreachable statement
URL : https://patchwork.freedesktop.org/series/136300/
State : success
== Summary ==
+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt
Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master
5ce3e132caaa5b45e5e50201b574a097d130967c
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit beca55580ad2404a7fc936b4336ffeb260c47798
Author: Lucas De Marchi <lucas.demarchi@intel.com>
Date: Fri Jul 19 12:15:34 2024 -0700
drm/xe: Fix warning on unreachable statement
eu_type_to_str() relies on -Wswitch to warn (and -Werror) to make sure
it handles all enum values. However it's perfectly legal to pass an int
to that function so in the end that function may happen to return
nothing. A smart compiler could notice eu_type is never assigned to
anything other than those values.
Trying to reproduce this issue, none of gcc-9, gcc-10 and gcc-13
triggered for me, but this was reported in a different system with
gcc-10:
drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_gt_topology_init()
Since that is not really possible, just take the simple approach and
return NULL.
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
+ /mt/dim checkpatch eb6045a759ea13e8d159bdaea423e904b9e3717b drm-intel
beca55580ad2 drm/xe: Fix warning on unreachable statement
^ permalink raw reply [flat|nested] 9+ messages in thread
* ✗ CI.KUnit: failure for drm/xe: Fix warning on unreachable statement
2024-07-19 19:15 [PATCH] drm/xe: Fix warning on unreachable statement Lucas De Marchi
2024-07-19 19:20 ` ✓ CI.Patch_applied: success for " Patchwork
2024-07-19 19:20 ` ✓ CI.checkpatch: " Patchwork
@ 2024-07-19 19:21 ` Patchwork
2024-07-19 19:59 ` [PATCH] " Matthew Brost
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2024-07-19 19:21 UTC (permalink / raw)
To: Lucas De Marchi; +Cc: intel-xe
== Series Details ==
Series: drm/xe: Fix warning on unreachable statement
URL : https://patchwork.freedesktop.org/series/136300/
State : failure
== Summary ==
+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig
ERROR:root:In file included from ../drivers/gpu/drm/drm_atomic.c:46:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_atomic_uapi.c:43:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_blend.c:36:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_bridge.c:38:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_displayid.c:9:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_client.c:23:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_client_modeset.c:26:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_color_mgmt.c:32:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_crtc.c:52:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_connector.c:41:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_dumb_buffers.c:31:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_eld.c:11:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_drv.c:50:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_edid.c:49:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_encoder.c:32:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_file.c:48:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_framebuffer.c:38:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_ioctl.c:43:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_lease.c:15:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_mode_config.c:34:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_mode_object.c:33:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_modes.c:50:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_plane.c:36:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_property.c:33:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_sysfs.c:34:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
156 | u64 ioread64_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
163 | u64 ioread64_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
170 | u64 ioread64be_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
178 | u64 ioread64be_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_debugfs.c:45:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_atomic_helper.c:48:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/gpu/drm/drm_fb_helper.c:47:
../drivers/gpu/drm/drm_crtc_internal.h:322:6: warning: no previous prototype for ‘drm_panic_is_enabled’ [-Wmissing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
| ^~~~~~~~~~~~~~~~~~~~
ld: drivers/gpu/drm/drm_atomic_uapi.o: in function `drm_panic_is_enabled':
drm_atomic_uapi.c:(.text+0x1120): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_blend.o: in function `drm_panic_is_enabled':
drm_blend.c:(.text+0x890): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_bridge.o: in function `drm_panic_is_enabled':
drm_bridge.c:(.text+0x1270): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_client.o: in function `drm_panic_is_enabled':
drm_client.c:(.text+0xbd0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_client_modeset.o: in function `drm_panic_is_enabled':
drm_client_modeset.c:(.text+0x2bb0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_color_mgmt.o: in function `drm_panic_is_enabled':
drm_color_mgmt.c:(.text+0x520): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_connector.o: in function `drm_panic_is_enabled':
drm_connector.c:(.text+0x2ae0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_crtc.o: in function `drm_panic_is_enabled':
drm_crtc.c:(.text+0xd50): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_displayid.o: in function `drm_panic_is_enabled':
drm_displayid.c:(.text+0x0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_drv.o: in function `drm_panic_is_enabled':
drm_drv.c:(.text+0x1500): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_dumb_buffers.o: in function `drm_panic_is_enabled':
drm_dumb_buffers.c:(.text+0x0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_edid.o: in function `drm_panic_is_enabled':
drm_edid.c:(.text+0x7fb0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_eld.o: in function `drm_panic_is_enabled':
drm_eld.c:(.text+0xa0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_encoder.o: in function `drm_panic_is_enabled':
drm_encoder.c:(.text+0x620): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_file.o: in function `drm_panic_is_enabled':
drm_file.c:(.text+0xc20): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_framebuffer.o: in function `drm_panic_is_enabled':
drm_framebuffer.c:(.text+0xc30): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_ioctl.o: in function `drm_panic_is_enabled':
drm_ioctl.c:(.text+0x1080): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_lease.o: in function `drm_panic_is_enabled':
drm_lease.c:(.text+0x210): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_mode_config.o: in function `drm_panic_is_enabled':
drm_mode_config.c:(.text+0xfe0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_mode_object.o: in function `drm_panic_is_enabled':
drm_mode_object.c:(.text+0x8b0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_modes.o: in function `drm_panic_is_enabled':
drm_modes.c:(.text+0x2e10): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_plane.o: in function `drm_panic_is_enabled':
drm_plane.c:(.text+0x20a0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_property.o: in function `drm_panic_is_enabled':
drm_property.c:(.text+0xe10): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_sysfs.o: in function `drm_panic_is_enabled':
drm_sysfs.c:(.text+0x8b0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_debugfs.o: in function `drm_panic_is_enabled':
drm_debugfs.c:(.text+0x1370): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_atomic_helper.o: in function `drm_panic_is_enabled':
drm_atomic_helper.c:(.text+0x69c0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_panic_is_enabled':
drm_fb_helper.c:(.text+0x2ea0): multiple definition of `drm_panic_is_enabled'; drivers/gpu/drm/drm_atomic.o:drm_atomic.c:(.text+0x3130): first defined here
make[3]: *** [../scripts/Makefile.vmlinux_o:62: vmlinux.o] Error 1
make[2]: *** [/kernel/Makefile:1152: vmlinux_o] Error 2
make[1]: *** [/kernel/Makefile:240: __sub-make] Error 2
make: *** [Makefile:240: __sub-make] Error 2
[19:20:44] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[19:20:48] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/xe: Fix warning on unreachable statement
2024-07-19 19:15 [PATCH] drm/xe: Fix warning on unreachable statement Lucas De Marchi
` (2 preceding siblings ...)
2024-07-19 19:21 ` ✗ CI.KUnit: failure " Patchwork
@ 2024-07-19 19:59 ` Matthew Brost
2024-07-19 20:38 ` Lucas De Marchi
2024-07-19 21:59 ` Michal Wajdeczko
2024-07-21 19:25 ` Nathan Chancellor
5 siblings, 1 reply; 9+ messages in thread
From: Matthew Brost @ 2024-07-19 19:59 UTC (permalink / raw)
To: Lucas De Marchi; +Cc: intel-xe, Michal Wajdeczko
On Fri, Jul 19, 2024 at 12:15:34PM -0700, Lucas De Marchi wrote:
> eu_type_to_str() relies on -Wswitch to warn (and -Werror) to make sure
> it handles all enum values. However it's perfectly legal to pass an int
> to that function so in the end that function may happen to return
> nothing. A smart compiler could notice eu_type is never assigned to
> anything other than those values.
>
> Trying to reproduce this issue, none of gcc-9, gcc-10 and gcc-13
> triggered for me, but this was reported in a different system with
> gcc-10:
>
> drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_gt_topology_init()
>
> Since that is not really possible, just take the simple approach and
> return NULL.
>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_topology.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
> index 5a1559edf3e9..0662f71c6ede 100644
> --- a/drivers/gpu/drm/xe/xe_gt_topology.c
> +++ b/drivers/gpu/drm/xe/xe_gt_topology.c
> @@ -233,7 +233,7 @@ static const char *eu_type_to_str(enum xe_gt_eu_type eu_type)
> return "simd8";
Typically elsewhere in the KMD issue done this:
default:
drm_warn(&xe->drm, "NOT POSSIBLE");
Never really agreed on approach but this is used in a lot of places.
Should we do this here?
Matt
> }
>
> - unreachable();
> + return NULL;
> }
>
> void
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/xe: Fix warning on unreachable statement
2024-07-19 19:59 ` [PATCH] " Matthew Brost
@ 2024-07-19 20:38 ` Lucas De Marchi
0 siblings, 0 replies; 9+ messages in thread
From: Lucas De Marchi @ 2024-07-19 20:38 UTC (permalink / raw)
To: Matthew Brost; +Cc: intel-xe, Michal Wajdeczko
On Fri, Jul 19, 2024 at 07:59:21PM GMT, Matthew Brost wrote:
>On Fri, Jul 19, 2024 at 12:15:34PM -0700, Lucas De Marchi wrote:
>> eu_type_to_str() relies on -Wswitch to warn (and -Werror) to make sure
>> it handles all enum values. However it's perfectly legal to pass an int
>> to that function so in the end that function may happen to return
>> nothing. A smart compiler could notice eu_type is never assigned to
>> anything other than those values.
>>
>> Trying to reproduce this issue, none of gcc-9, gcc-10 and gcc-13
>> triggered for me, but this was reported in a different system with
>> gcc-10:
>>
>> drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_gt_topology_init()
>>
>> Since that is not really possible, just take the simple approach and
>> return NULL.
>>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_gt_topology.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
>> index 5a1559edf3e9..0662f71c6ede 100644
>> --- a/drivers/gpu/drm/xe/xe_gt_topology.c
>> +++ b/drivers/gpu/drm/xe/xe_gt_topology.c
>> @@ -233,7 +233,7 @@ static const char *eu_type_to_str(enum xe_gt_eu_type eu_type)
>> return "simd8";
>
>Typically elsewhere in the KMD issue done this:
>
> default:
> drm_warn(&xe->drm, "NOT POSSIBLE");
>
>Never really agreed on approach but this is used in a lot of places.
which defeats the purpose of -Wswitch (enabled by default on
semi-recent compilers with -Wall). We'd have to start using -Wswitch-enum
to get a build warning with default case. Kernel has -Wswitch-enums
for tools in tools/scripts/Makefile.include, but even then some tools opt
out ... it's often too strict and I don't see we enabling it for kernel
any time soon..
It seems entirely bogus to trade the buil time warning to a runtime one.
And if we have it in build-time, then I don't see why we need one in
runtime. In this case.
>
>Should we do this here?
I don't think so. Some other cases may have a good reason to do a
switch() in something that is not an enum, then resort to default for
that. But when we are handling all the values for an enum var, I think
this pattern is better than using a default case.
Lucas De Marchi
>
>Matt
>
>> }
>>
>> - unreachable();
>> + return NULL;
>> }
>>
>> void
>> --
>> 2.43.0
>>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/xe: Fix warning on unreachable statement
2024-07-19 19:15 [PATCH] drm/xe: Fix warning on unreachable statement Lucas De Marchi
` (3 preceding siblings ...)
2024-07-19 19:59 ` [PATCH] " Matthew Brost
@ 2024-07-19 21:59 ` Michal Wajdeczko
2024-07-21 19:25 ` Nathan Chancellor
5 siblings, 0 replies; 9+ messages in thread
From: Michal Wajdeczko @ 2024-07-19 21:59 UTC (permalink / raw)
To: Lucas De Marchi, intel-xe
On 19.07.2024 21:15, Lucas De Marchi wrote:
> eu_type_to_str() relies on -Wswitch to warn (and -Werror) to make sure
> it handles all enum values. However it's perfectly legal to pass an int
> to that function so in the end that function may happen to return
> nothing. A smart compiler could notice eu_type is never assigned to
> anything other than those values.
>
> Trying to reproduce this issue, none of gcc-9, gcc-10 and gcc-13
> triggered for me, but this was reported in a different system with
> gcc-10:
>
> drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_gt_topology_init()
>
> Since that is not really possible, just take the simple approach and
> return NULL.
>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_topology.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
> index 5a1559edf3e9..0662f71c6ede 100644
> --- a/drivers/gpu/drm/xe/xe_gt_topology.c
> +++ b/drivers/gpu/drm/xe/xe_gt_topology.c
> @@ -233,7 +233,7 @@ static const char *eu_type_to_str(enum xe_gt_eu_type eu_type)
> return "simd8";
> }
>
> - unreachable();
> + return NULL;
> }
>
> void
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/xe: Fix warning on unreachable statement
2024-07-19 19:15 [PATCH] drm/xe: Fix warning on unreachable statement Lucas De Marchi
` (4 preceding siblings ...)
2024-07-19 21:59 ` Michal Wajdeczko
@ 2024-07-21 19:25 ` Nathan Chancellor
2024-07-22 16:39 ` Lucas De Marchi
5 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2024-07-21 19:25 UTC (permalink / raw)
To: Lucas De Marchi; +Cc: intel-xe, Michal Wajdeczko, llvm
Hi Lucas,
On Fri, Jul 19, 2024 at 12:15:34PM -0700, Lucas De Marchi wrote:
> eu_type_to_str() relies on -Wswitch to warn (and -Werror) to make sure
> it handles all enum values. However it's perfectly legal to pass an int
> to that function so in the end that function may happen to return
> nothing. A smart compiler could notice eu_type is never assigned to
> anything other than those values.
Well that assignment happens in load_eu_mask(), which is obviously
called before xe_gt_topology_dump() in xe_gt_topology_init(), but I
don't see how the compiler could assume that eu_type is always one of
those two values when xe_gt_topology_dump() is not static and could be
called from anywhere (i.e., when eu_type is potentially some other
value)? I might be missing something though.
> Trying to reproduce this issue, none of gcc-9, gcc-10 and gcc-13
> triggered for me, but this was reported in a different system with
> gcc-10:
>
> drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_gt_topology_init()
I have been seeing similar warnings with clang as well, such as:
drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump+0x77: sibling call from callable instruction with modified stack frame
drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_dss_mask_group_ffs()
drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump+0x77: can't find jump dest instruction at .text.xe_gt_topology_dump+0xc0
The final warning happens when LTO and CFI are enabled and I see a CFI
failure that appears to be a result of that.
[ +0.008116] Missing ENDBR: __cfi_init_module+0x0/0x10 [xe]
[ +0.000226] ------------[ cut here ]------------
[ +0.000001] kernel BUG at arch/x86/kernel/cet.c:102!
[ +0.000014] Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[ +0.000004] CPU: 3 PID: 335 Comm: (udev-worker) Not tainted 6.10.0-rc3-debug-01858-g7108b4a589cd #1 6163aa9290b9c012af9bc3cd405d04758721ac11
[ +0.000005] Hardware name: AZW MINI S/MINI S, BIOS ADLNV105 12/12/2023
...
[ +0.000002] ? __cfi_init_module+0x10/0x10 [xe 257ff34a29c86b7d55c1c838833ff13eec5c3393]
[ +0.000167] ? xe_hw_fence_module_init+0x40/0x40 [xe 257ff34a29c86b7d55c1c838833ff13eec5c3393]
[ +0.000171] ? __cfi_init_module+0x10/0x10 [xe 257ff34a29c86b7d55c1c838833ff13eec5c3393]
[ +0.000174] ? do_one_initcall+0x147/0x350
> Since that is not really possible, just take the simple approach and
> return NULL.
Indeed, bare unreachable() is generally considered harmful and can introduce
undefined behavior. Commits
d652d5f1eeeb ("drm/edid: fix objtool warning in drm_cvt_modes()")
and
3764647b255a ("bcachefs: Remove undefined behavior in bch2_dev_buckets_reserved()")
come to mind as instances like this.
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
This change resolves all the issues I have noted above, so thank you!
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/gpu/drm/xe/xe_gt_topology.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
> index 5a1559edf3e9..0662f71c6ede 100644
> --- a/drivers/gpu/drm/xe/xe_gt_topology.c
> +++ b/drivers/gpu/drm/xe/xe_gt_topology.c
> @@ -233,7 +233,7 @@ static const char *eu_type_to_str(enum xe_gt_eu_type eu_type)
> return "simd8";
> }
>
> - unreachable();
> + return NULL;
> }
>
> void
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/xe: Fix warning on unreachable statement
2024-07-21 19:25 ` Nathan Chancellor
@ 2024-07-22 16:39 ` Lucas De Marchi
0 siblings, 0 replies; 9+ messages in thread
From: Lucas De Marchi @ 2024-07-22 16:39 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: intel-xe, Michal Wajdeczko, llvm
On Sun, Jul 21, 2024 at 12:25:34PM GMT, Nathan Chancellor wrote:
>Hi Lucas,
>
>On Fri, Jul 19, 2024 at 12:15:34PM -0700, Lucas De Marchi wrote:
>> eu_type_to_str() relies on -Wswitch to warn (and -Werror) to make sure
>> it handles all enum values. However it's perfectly legal to pass an int
>> to that function so in the end that function may happen to return
>> nothing. A smart compiler could notice eu_type is never assigned to
>> anything other than those values.
>
>Well that assignment happens in load_eu_mask(), which is obviously
>called before xe_gt_topology_dump() in xe_gt_topology_init(), but I
>don't see how the compiler could assume that eu_type is always one of
>those two values when xe_gt_topology_dump() is not static and could be
>called from anywhere (i.e., when eu_type is potentially some other
>value)? I might be missing something though.
True, it's not an easy check by the compiler/linker as I originally thought
as it depends on some additional knowledge:
- eu_type is only ever assigned in one place
- it's never allocated from the stack
- it's only ever used in a zero-initialized object and 0 is a
valid value.
>
>> Trying to reproduce this issue, none of gcc-9, gcc-10 and gcc-13
>> triggered for me, but this was reported in a different system with
>> gcc-10:
>>
>> drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_gt_topology_init()
>
>I have been seeing similar warnings with clang as well, such as:
>
> drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump+0x77: sibling call from callable instruction with modified stack frame
>
> drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_dss_mask_group_ffs()
>
> drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump+0x77: can't find jump dest instruction at .text.xe_gt_topology_dump+0xc0
>
>The final warning happens when LTO and CFI are enabled and I see a CFI
>failure that appears to be a result of that.
>
>[ +0.008116] Missing ENDBR: __cfi_init_module+0x0/0x10 [xe]
>[ +0.000226] ------------[ cut here ]------------
>[ +0.000001] kernel BUG at arch/x86/kernel/cet.c:102!
>[ +0.000014] Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
>[ +0.000004] CPU: 3 PID: 335 Comm: (udev-worker) Not tainted 6.10.0-rc3-debug-01858-g7108b4a589cd #1 6163aa9290b9c012af9bc3cd405d04758721ac11
>[ +0.000005] Hardware name: AZW MINI S/MINI S, BIOS ADLNV105 12/12/2023
>...
>[ +0.000002] ? __cfi_init_module+0x10/0x10 [xe 257ff34a29c86b7d55c1c838833ff13eec5c3393]
>[ +0.000167] ? xe_hw_fence_module_init+0x40/0x40 [xe 257ff34a29c86b7d55c1c838833ff13eec5c3393]
>[ +0.000171] ? __cfi_init_module+0x10/0x10 [xe 257ff34a29c86b7d55c1c838833ff13eec5c3393]
>[ +0.000174] ? do_one_initcall+0x147/0x350
>
>> Since that is not really possible, just take the simple approach and
>> return NULL.
>
>Indeed, bare unreachable() is generally considered harmful and can introduce
>undefined behavior. Commits
>
> d652d5f1eeeb ("drm/edid: fix objtool warning in drm_cvt_modes()")
>
>and
>
> 3764647b255a ("bcachefs: Remove undefined behavior in bch2_dev_buckets_reserved()")
>
>come to mind as instances like this.
>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>
>This change resolves all the issues I have noted above, so thank you!
>
>Reviewed-by: Nathan Chancellor <nathan@kernel.org>
>Tested-by: Nathan Chancellor <nathan@kernel.org>
thanks. I will amend the commit message with additional note on clang
and push to drm-xe-next.
Lucas De Marchi
>
>> ---
>> drivers/gpu/drm/xe/xe_gt_topology.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
>> index 5a1559edf3e9..0662f71c6ede 100644
>> --- a/drivers/gpu/drm/xe/xe_gt_topology.c
>> +++ b/drivers/gpu/drm/xe/xe_gt_topology.c
>> @@ -233,7 +233,7 @@ static const char *eu_type_to_str(enum xe_gt_eu_type eu_type)
>> return "simd8";
>> }
>>
>> - unreachable();
>> + return NULL;
>> }
>>
>> void
>> --
>> 2.43.0
>>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-07-22 16:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-19 19:15 [PATCH] drm/xe: Fix warning on unreachable statement Lucas De Marchi
2024-07-19 19:20 ` ✓ CI.Patch_applied: success for " Patchwork
2024-07-19 19:20 ` ✓ CI.checkpatch: " Patchwork
2024-07-19 19:21 ` ✗ CI.KUnit: failure " Patchwork
2024-07-19 19:59 ` [PATCH] " Matthew Brost
2024-07-19 20:38 ` Lucas De Marchi
2024-07-19 21:59 ` Michal Wajdeczko
2024-07-21 19:25 ` Nathan Chancellor
2024-07-22 16:39 ` Lucas De Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox