* objtool warning in ice_free_prof_mask
@ 2025-04-07 6:20 Oleksandr Natalenko
2025-04-07 9:03 ` Przemek Kitszel
0 siblings, 1 reply; 6+ messages in thread
From: Oleksandr Natalenko @ 2025-04-07 6:20 UTC (permalink / raw)
To: linux-kernel
Cc: netdev, intel-wired-lan, Paolo Abeni, Jakub Kicinski,
Eric Dumazet, David S. Miller, Andrew Lunn, Przemek Kitszel,
Tony Nguyen, Peter Zijlstra, Josh Poimboeuf
[-- Attachment #1: Type: text/plain, Size: 502 bytes --]
Hello.
With v6.15-rc1, CONFIG_OBJTOOL_WERROR=y and gcc 14.2.1 the following happens:
```
drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0() falls through to next function ice_free_flow_profs.cold()
drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0.cold() is missing an ELF size annotation
```
If I mark ice_write_prof_mask_reg() as noinline, this warning disappears.
Any idea what's going wrong?
Thank you.
--
Oleksandr Natalenko, MSE
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: objtool warning in ice_free_prof_mask
2025-04-07 6:20 objtool warning in ice_free_prof_mask Oleksandr Natalenko
@ 2025-04-07 9:03 ` Przemek Kitszel
2025-04-07 9:21 ` Oleksandr Natalenko
0 siblings, 1 reply; 6+ messages in thread
From: Przemek Kitszel @ 2025-04-07 9:03 UTC (permalink / raw)
To: Oleksandr Natalenko, linux-kernel
Cc: netdev, intel-wired-lan, Paolo Abeni, Jakub Kicinski,
Eric Dumazet, David S. Miller, Andrew Lunn, Tony Nguyen,
Peter Zijlstra, Josh Poimboeuf
On 4/7/25 08:20, Oleksandr Natalenko wrote:
> Hello.
>
> With v6.15-rc1, CONFIG_OBJTOOL_WERROR=y and gcc 14.2.1 the following happens:
have you COMPILE_TEST'ed whole kernel and this is the only (new) error?
>
> ```
> drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0() falls through to next function ice_free_flow_profs.cold()
> drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0.cold() is missing an ELF size annotation
> ```
>
> If I mark ice_write_prof_mask_reg() as noinline, this warning disappears.
>
> Any idea what's going wrong?
sorry, no idea
>
> Thank you.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: objtool warning in ice_free_prof_mask
2025-04-07 9:03 ` Przemek Kitszel
@ 2025-04-07 9:21 ` Oleksandr Natalenko
2025-04-07 21:42 ` Josh Poimboeuf
0 siblings, 1 reply; 6+ messages in thread
From: Oleksandr Natalenko @ 2025-04-07 9:21 UTC (permalink / raw)
To: linux-kernel, Przemek Kitszel
Cc: netdev, intel-wired-lan, Paolo Abeni, Jakub Kicinski,
Eric Dumazet, David S. Miller, Andrew Lunn, Tony Nguyen,
Peter Zijlstra, Josh Poimboeuf
[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]
Hello.
On pondělí 7. dubna 2025 11:03:31, středoevropský letní čas Przemek Kitszel wrote:
> On 4/7/25 08:20, Oleksandr Natalenko wrote:
> > Hello.
> >
> > With v6.15-rc1, CONFIG_OBJTOOL_WERROR=y and gcc 14.2.1 the following happens:
>
> have you COMPILE_TEST'ed whole kernel and this is the only (new) error?
It's not a new warning, I've observe it for several recent major kernel releases already.
I do not build with CONFIG_COMPILE_TEST.
I've also realised I see this warning with -O3 only. I know this is unsupported, so feel free to ignore me, but I do -O3 builds for finding out possible loose ends in the code, and this is the only place where it breaks.
> > ```
> > drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0() falls through to next function ice_free_flow_profs.cold()
> > drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0.cold() is missing an ELF size annotation
> > ```
> >
> > If I mark ice_write_prof_mask_reg() as noinline, this warning disappears.
> >
> > Any idea what's going wrong?
>
> sorry, no idea
>
> >
> > Thank you.
--
Oleksandr Natalenko, MSE
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: objtool warning in ice_free_prof_mask
2025-04-07 9:21 ` Oleksandr Natalenko
@ 2025-04-07 21:42 ` Josh Poimboeuf
2025-04-07 21:49 ` Oleksandr Natalenko
0 siblings, 1 reply; 6+ messages in thread
From: Josh Poimboeuf @ 2025-04-07 21:42 UTC (permalink / raw)
To: Oleksandr Natalenko
Cc: linux-kernel, Przemek Kitszel, netdev, intel-wired-lan,
Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
Andrew Lunn, Tony Nguyen, Peter Zijlstra
On Mon, Apr 07, 2025 at 11:21:27AM +0200, Oleksandr Natalenko wrote:
> It's not a new warning, I've observe it for several recent major kernel releases already.
>
> I do not build with CONFIG_COMPILE_TEST.
>
> I've also realised I see this warning with -O3 only. I know this is
> unsupported, so feel free to ignore me, but I do -O3 builds for
> finding out possible loose ends in the code, and this is the only
> place where it breaks.
>
> > > ```
> > > drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0() falls through to next function ice_free_flow_profs.cold()
> > > drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0.cold() is missing an ELF size annotation
> > > ```
> > >
> > > If I mark ice_write_prof_mask_reg() as noinline, this warning disappears.
> > >
> > > Any idea what's going wrong?
This type of error usually means some type of undefined behavior. Can
you share your config? No guarantees since it is -O3 after all, but I
can still take a look to see if it's pointing to a bug of some kind.
--
Josh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: objtool warning in ice_free_prof_mask
2025-04-07 21:42 ` Josh Poimboeuf
@ 2025-04-07 21:49 ` Oleksandr Natalenko
2025-04-08 0:14 ` [Intel-wired-lan] " Josh Poimboeuf
0 siblings, 1 reply; 6+ messages in thread
From: Oleksandr Natalenko @ 2025-04-07 21:49 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: linux-kernel, Przemek Kitszel, netdev, intel-wired-lan,
Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
Andrew Lunn, Tony Nguyen, Peter Zijlstra
[-- Attachment #1: Type: text/plain, Size: 2918 bytes --]
Hello.
On pondělí 7. dubna 2025 23:42:51, středoevropský letní čas Josh Poimboeuf wrote:
> On Mon, Apr 07, 2025 at 11:21:27AM +0200, Oleksandr Natalenko wrote:
> > It's not a new warning, I've observe it for several recent major kernel releases already.
> >
> > I do not build with CONFIG_COMPILE_TEST.
> >
> > I've also realised I see this warning with -O3 only. I know this is
> > unsupported, so feel free to ignore me, but I do -O3 builds for
> > finding out possible loose ends in the code, and this is the only
> > place where it breaks.
> >
> > > > ```
> > > > drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0() falls through to next function ice_free_flow_profs.cold()
> > > > drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0.cold() is missing an ELF size annotation
> > > > ```
> > > >
> > > > If I mark ice_write_prof_mask_reg() as noinline, this warning disappears.
> > > >
> > > > Any idea what's going wrong?
>
> This type of error usually means some type of undefined behavior. Can
> you share your config? No guarantees since it is -O3 after all, but I
> can still take a look to see if it's pointing to a bug of some kind.
Sure, thank you for looking into this.
Here's my recipe to reproduce the issue:
1. expose -O3
```
diff --git a/Makefile b/Makefile
index 38689a0c36052..5ce5b44fa1496 100644
--- a/Makefile
+++ b/Makefile
@@ -858,6 +858,9 @@ KBUILD_CFLAGS += -fno-delete-null-pointer-checks
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
KBUILD_CFLAGS += -O2
KBUILD_RUSTFLAGS += -Copt-level=2
+else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
+KBUILD_CFLAGS += -O3
+KBUILD_RUSTFLAGS += -Copt-level=3
else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
KBUILD_RUSTFLAGS += -Copt-level=s
diff --git a/init/Kconfig b/init/Kconfig
index dd2ea3b9a7992..03b1d768d1a55 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1481,6 +1481,12 @@ config CC_OPTIMIZE_FOR_PERFORMANCE
with the "-O2" compiler flag for best performance and most
helpful compile-time warnings.
+config CC_OPTIMIZE_FOR_PERFORMANCE_O3
+ bool "Optimize more for performance (-O3)"
+ help
+ Choosing this option will pass "-O3" to your compiler to optimize
+ the kernel yet more for performance.
+
config CC_OPTIMIZE_FOR_SIZE
bool "Optimize for size (-Os)"
help
```
2. use this config with v6.15-rc1: https://paste.voidband.net/2BVaYDQS.txt
3. compile:
```
$ make drivers/net/ethernet/intel/ice/ice.o
…
LD [M] drivers/net/ethernet/intel/ice/ice.o
drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0() falls through to next function ice_free_flow_profs.cold()
drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0.cold() is missing an ELF size annotation
…
```
--
Oleksandr Natalenko, MSE
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Intel-wired-lan] objtool warning in ice_free_prof_mask
2025-04-07 21:49 ` Oleksandr Natalenko
@ 2025-04-08 0:14 ` Josh Poimboeuf
0 siblings, 0 replies; 6+ messages in thread
From: Josh Poimboeuf @ 2025-04-08 0:14 UTC (permalink / raw)
To: Oleksandr Natalenko
Cc: linux-kernel, Przemek Kitszel, netdev, intel-wired-lan,
Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
Andrew Lunn, Tony Nguyen, Peter Zijlstra
On Mon, Apr 07, 2025 at 11:49:35PM +0200, Oleksandr Natalenko wrote:
> $ make drivers/net/ethernet/intel/ice/ice.o
> …
> LD [M] drivers/net/ethernet/intel/ice/ice.o
> drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0() falls through to next function ice_free_flow_profs.cold()
> drivers/net/ethernet/intel/ice/ice.o: error: objtool: ice_free_prof_mask.isra.0.cold() is missing an ELF size annotation
Thanks, I was able to recreate.
This is the -O3 optimizer noticing that ice_write_prof_mask_reg() is
only called with ICE_BLK_RSS or ICE_BLK_FD. So it optimizes out the
impossible 'default' case in this switch statement:
switch (blk) {
case ICE_BLK_RSS:
offset = GLQF_HMASK(mask_idx);
val = FIELD_PREP(GLQF_HMASK_MSK_INDEX_M, idx);
val |= FIELD_PREP(GLQF_HMASK_MASK_M, mask);
break;
case ICE_BLK_FD:
offset = GLQF_FDMASK(mask_idx);
val = FIELD_PREP(GLQF_FDMASK_MSK_INDEX_M, idx);
val |= FIELD_PREP(GLQF_FDMASK_MASK_M, mask);
break;
default:
ice_debug(hw, ICE_DBG_PKG, "No profile masks for block %d\n",
blk);
return;
}
Unfortunately, instead of finishing the optimization, it inserts
undefined behavior for the 'default' case by branching off to some
random code.
So there doesn't seem to be any underlying bug, it's just that objtool
doesn't like undefined behavior.
So for building with -O3 I'd recommend just disabling
CONFIG_OBJTOOL_WERROR and ignoring any objtool warnings.
--
Josh
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-04-08 0:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 6:20 objtool warning in ice_free_prof_mask Oleksandr Natalenko
2025-04-07 9:03 ` Przemek Kitszel
2025-04-07 9:21 ` Oleksandr Natalenko
2025-04-07 21:42 ` Josh Poimboeuf
2025-04-07 21:49 ` Oleksandr Natalenko
2025-04-08 0:14 ` [Intel-wired-lan] " Josh Poimboeuf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).