* [PATCH net v2] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout()
@ 2026-11-16 4:45 Nathan Chancellor
2026-11-16 10:37 ` Stefan Wahren
2026-11-16 18:17 ` Nick Desaulniers
0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2026-11-16 4:45 UTC (permalink / raw)
To: Stefan Wahren, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, llvm, stable, Nathan Chancellor
After a recent improvement in clang to warn on unsequenced accesses to
volatile variables [1], an instance appears in
qcaspi_netdev_tx_timeout(), which can break the build with
CONFIG_WERROR=y / W=e:
drivers/net/ethernet/qualcomm/qca_spi.c:805:16: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
805 | jiffies, jiffies - dev_trans_start(dev));
| ~~~~~~~ ^
Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11
6.5.2, unsequenced side effects on the same scalar object are undefined
behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a
function call is indeterminately sequenced, meaning any side effects in
the arguments are unsequenced.
Printing jiffies on its own is not that useful for debugging transmit
timeouts, so get rid of it to clear up the warning.
Cc: stable@vger.kernel.org
Fixes: 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
Closes: https://github.com/ClangBuiltLinux/linux/issues/2197
Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Changes in v2:
- Eliminate printing jiffies entirely rather than using a local variable
(Stefan)
- Link to v1: https://patch.msgid.link/20261114-qca_spi-wunsequenced-v1-1-6b219b906db7@kernel.org
---
drivers/net/ethernet/qualcomm/qca_spi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 38a779f4b866..249b4b549a12 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -801,8 +801,8 @@ qcaspi_netdev_tx_timeout(struct net_device *dev, unsigned int txqueue)
{
struct qcaspi *qca = netdev_priv(dev);
- netdev_info(qca->net_dev, "Transmit timeout at %ld, latency %ld\n",
- jiffies, jiffies - dev_trans_start(dev));
+ netdev_info(qca->net_dev, "Transmit timeout, latency %ld\n",
+ jiffies - dev_trans_start(dev));
qca->net_dev->stats.tx_errors++;
/* Trigger tx queue flush and QCA7000 reset */
set_bit(SPI_RESET, &qca->flags);
---
base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4
change-id: 20261114-qca_spi-wunsequenced-a81e54616844
Best regards,
--
Cheers,
Nathan
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net v2] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout()
2026-11-16 4:45 [PATCH net v2] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout() Nathan Chancellor
@ 2026-11-16 10:37 ` Stefan Wahren
2026-11-16 18:17 ` Nick Desaulniers
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Wahren @ 2026-11-16 10:37 UTC (permalink / raw)
To: Nathan Chancellor, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, llvm, stable
Am 16.11.26 um 05:45 schrieb Nathan Chancellor:
> After a recent improvement in clang to warn on unsequenced accesses to
> volatile variables [1], an instance appears in
> qcaspi_netdev_tx_timeout(), which can break the build with
> CONFIG_WERROR=y / W=e:
>
> drivers/net/ethernet/qualcomm/qca_spi.c:805:16: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
> 805 | jiffies, jiffies - dev_trans_start(dev));
> | ~~~~~~~ ^
>
> Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11
> 6.5.2, unsequenced side effects on the same scalar object are undefined
> behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a
> function call is indeterminately sequenced, meaning any side effects in
> the arguments are unsequenced.
>
> Printing jiffies on its own is not that useful for debugging transmit
> timeouts, so get rid of it to clear up the warning.
>
> Cc: stable@vger.kernel.org
> Fixes: 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2197
> Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Stefan Wahren <wahrenst@gmx.net>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net v2] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout()
2026-11-16 4:45 [PATCH net v2] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout() Nathan Chancellor
2026-11-16 10:37 ` Stefan Wahren
@ 2026-11-16 18:17 ` Nick Desaulniers
1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2026-11-16 18:17 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Stefan Wahren, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, llvm, stable
On Sun, Nov 15, 2026 at 09:45:22PM -0700, Nathan Chancellor wrote:
> After a recent improvement in clang to warn on unsequenced accesses to
> volatile variables [1], an instance appears in
> qcaspi_netdev_tx_timeout(), which can break the build with
> CONFIG_WERROR=y / W=e:
>
> drivers/net/ethernet/qualcomm/qca_spi.c:805:16: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
> 805 | jiffies, jiffies - dev_trans_start(dev));
> | ~~~~~~~ ^
>
> Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11
> 6.5.2, unsequenced side effects on the same scalar object are undefined
> behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a
> function call is indeterminately sequenced, meaning any side effects in
> the arguments are unsequenced.
>
> Printing jiffies on its own is not that useful for debugging transmit
> timeouts, so get rid of it to clear up the warning.
>
> Cc: stable@vger.kernel.org
> Fixes: 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2197
Just hit a handful of these last week; thanks for getting issues filed
per (I thought it was just one instance; having one issue per makes its
clearer this is flagging a few more cases. Thanks for sending fixes for
these, too).
> Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Changes in v2:
> - Eliminate printing jiffies entirely rather than using a local variable
> (Stefan)
> - Link to v1: https://patch.msgid.link/20261114-qca_spi-wunsequenced-v1-1-6b219b906db7@kernel.org
> ---
> drivers/net/ethernet/qualcomm/qca_spi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
> index 38a779f4b866..249b4b549a12 100644
> --- a/drivers/net/ethernet/qualcomm/qca_spi.c
> +++ b/drivers/net/ethernet/qualcomm/qca_spi.c
> @@ -801,8 +801,8 @@ qcaspi_netdev_tx_timeout(struct net_device *dev, unsigned int txqueue)
> {
> struct qcaspi *qca = netdev_priv(dev);
>
> - netdev_info(qca->net_dev, "Transmit timeout at %ld, latency %ld\n",
> - jiffies, jiffies - dev_trans_start(dev));
> + netdev_info(qca->net_dev, "Transmit timeout, latency %ld\n",
> + jiffies - dev_trans_start(dev));
> qca->net_dev->stats.tx_errors++;
> /* Trigger tx queue flush and QCA7000 reset */
> set_bit(SPI_RESET, &qca->flags);
>
> ---
> base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4
> change-id: 20261114-qca_spi-wunsequenced-a81e54616844
>
> Best regards,
> --
> Cheers,
> Nathan
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-16 18:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 4:45 [PATCH net v2] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout() Nathan Chancellor
2026-11-16 10:37 ` Stefan Wahren
2026-11-16 18:17 ` Nick Desaulniers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox