Re: v7.4-rc2 kernel build failure when using the upstream LLVM 24 with -Wunsequenced-volatile
From: Nathan Chancellor
Date: Sat Nov 21 2026 - 18:39:48 EST
On Sat, Nov 21, 2026 at 09:13:58PM +0300, Никита Терентьев wrote:
> By standard UB occur for unsequenced order, not unspecified.
Ah fair, I had conflated those.
> But despite the fact that this is not UB - fields a and b really may
> be different, moreover, according to the standard there is no
> guarantee that a less than is equal to b, and this is most likely not
> the expected result. So I would say that this is incorrect wording
> but this is a correctly issued warning.
Yeah, I think it is definitely ambiguous what someone might be expecting
there: are they expecting the same value or are they okay with the two
separate accesses being different values? It is not always obvious if
the variable is marked as volatile or not.
> I'm not sure whether it's worth changing the wording or turning off
> the warning in this case still.
Maybe a note could be attached to the warning explaining the accesses
may result in different values and offering a small hint how to silence
it?
I do think this is a good warning and I would love to avoid turning it
off, even temporarily. I sent 11 patches for the instances that appeared
in the kernel tree.
Five have been merged into mainline:
https://git.kernel.org/linus/c3f98ff6309a29979e1867bc3c9d4172755ca122 ("rcu/nocb: Avoid unsequenced accesses to jiffies in show_rcu_nocb_state()")
https://git.kernel.org/linus/728a2abd15a767f662a44030931ea7b2959b4e88 ("mptcp: Avoid unsequenced accesses to jiffies in mptcp_reset_tout_timer()")
https://git.kernel.org/linus/5ec918f8d66a0311c52cc767ade67e7019beb176 ("net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx()")
https://git.kernel.org/linus/695d0824cb6b27ff1a1cdeabb2d5138f00b15251 ("qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout()")
https://git.kernel.org/linus/9ea01307e6c824eb0b8934d95d52bbacae17887d ("powerpc/xmon: Avoid unsequenced accesses to tsk in show_task()")
Two are pending in maintainers trees:
https://git.kernel.org/axboe/c/ae1171f38098098e88c13c38e462d27babb50038 ("blk-throttle: Avoid unsequenced accesses to jiffies in throtl_schedule_pending_timer()")
https://github.com/evdenis/linux-floppy/commit/c1a8feb71ba8613108b212c705a48e0e136d8c3a ("floppy: Avoid unsequenced accesses to jiffies in show_floppy()")
Four are pending on the mailing list:
https://lore.kernel.org/20261116-topology-wunsequenced-v2-1-54611119172b@xxxxxxxxxx/ ("sched/topology: Avoid unsequenced accesses to jiffies in sd_init()")
https://lore.kernel.org/20261114-lkdtm-bugs-wunsequenced-v1-1-b24f15ce1328@xxxxxxxxxx/ ("lkdtm/bugs: Remove volatile from element_count")
https://lore.kernel.org/20261114-lkdtm-usercopy-wunsequenced-v1-1-d9f288701932@xxxxxxxxxx/ ("lkdtm/usercopy: Avoid unsequenced accesses to cache_size in lkdtm_usercopy_init()")
https://lore.kernel.org/20261115-ceph-wunsequenced-v1-1-6910c560ba9b@xxxxxxxxxx/ ("libceph: Avoid unsequenced accesses to jiffies in dump_linger_request()")
If the four linger for too long, we can consider moving the warning to
W=1 but it will still bother a decent number of people, so it would be
better to just get them fixed quickly.
--
Cheers,
Nathan