From: Simon Horman <horms@kernel.org>
To: Jisheng Zhang <jszhang@kernel.org>
Cc: "Giuseppe Cavallaro" <peppe.cavallaro@st.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Jose Abreu" <joabreu@synopsys.com>,
"David S . Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Chen-Yu Tsai" <wens@csie.org>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Samuel Holland" <samuel@sholland.org>,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev,
linux-stm32@st-md-mailman.stormreply.com,
johannes@sipsolutions.net,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH] net: stmmac: fix incorrect rxq|txq_stats reference
Date: Sat, 16 Sep 2023 17:47:37 +0200 [thread overview]
Message-ID: <20230916154737.GG1125562@kernel.org> (raw)
In-Reply-To: <20230915005316.592-1-jszhang@kernel.org>
On Fri, Sep 15, 2023 at 08:53:16AM +0800, Jisheng Zhang wrote:
> commit 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics
> where necessary") caused one regression as found by Uwe, the backtrace
> looks like:
>
> INFO: trying to register non-static key.
> The code is fine but needs lockdep annotation, or maybe
> you didn't initialize this object before use?
> turning off the locking correctness validator.
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.5.0-rc1-00449-g133466c3bbe1-dirty #21
> Hardware name: STM32 (Device Tree Support)
> unwind_backtrace from show_stack+0x18/0x1c
> show_stack from dump_stack_lvl+0x60/0x90
> dump_stack_lvl from register_lock_class+0x98c/0x99c
> register_lock_class from __lock_acquire+0x74/0x293c
> __lock_acquire from lock_acquire+0x134/0x398
> lock_acquire from stmmac_get_stats64+0x2ac/0x2fc
> stmmac_get_stats64 from dev_get_stats+0x44/0x130
> dev_get_stats from rtnl_fill_stats+0x38/0x120
> rtnl_fill_stats from rtnl_fill_ifinfo+0x834/0x17f4
> rtnl_fill_ifinfo from rtmsg_ifinfo_build_skb+0xc0/0x144
> rtmsg_ifinfo_build_skb from rtmsg_ifinfo+0x50/0x88
> rtmsg_ifinfo from __dev_notify_flags+0xc0/0xec
> __dev_notify_flags from dev_change_flags+0x50/0x5c
> dev_change_flags from ip_auto_config+0x2f4/0x1260
> ip_auto_config from do_one_initcall+0x70/0x35c
> do_one_initcall from kernel_init_freeable+0x2ac/0x308
> kernel_init_freeable from kernel_init+0x1c/0x138
> kernel_init from ret_from_fork+0x14/0x2c
>
> The reason is the rxq|txq_stats structures are not what expected
> because stmmac_open() -> __stmmac_open() the structure is overwritten
> by "memcpy(&priv->dma_conf, dma_conf, sizeof(*dma_conf));"
> This causes the well initialized syncp member of rxq|txq_stats is
> overwritten unexpectedly as pointed out by Johannes and Uwe.
>
> Fix this issue by moving rxq|txq_stats back to stmmac_extra_stats. For
> SMP cache friendly, we also mark stmmac_txq_stats and stmmac_rxq_stats
> as ____cacheline_aligned_in_smp.
>
> Fixes: 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics where necessary")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Hi Jisheng Zhang,
as a fix for Networking code this should be based targeted at the net tree.
Subject: [PATCH net] ...
Unfortunately it doesn't apply cleanly against net.
Please consider rebasing and reposting.
--
pw-bot: changes-requested
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Jisheng Zhang <jszhang@kernel.org>
Cc: "Giuseppe Cavallaro" <peppe.cavallaro@st.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Jose Abreu" <joabreu@synopsys.com>,
"David S . Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Chen-Yu Tsai" <wens@csie.org>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Samuel Holland" <samuel@sholland.org>,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev,
linux-stm32@st-md-mailman.stormreply.com,
johannes@sipsolutions.net,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH] net: stmmac: fix incorrect rxq|txq_stats reference
Date: Sat, 16 Sep 2023 17:47:37 +0200 [thread overview]
Message-ID: <20230916154737.GG1125562@kernel.org> (raw)
In-Reply-To: <20230915005316.592-1-jszhang@kernel.org>
On Fri, Sep 15, 2023 at 08:53:16AM +0800, Jisheng Zhang wrote:
> commit 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics
> where necessary") caused one regression as found by Uwe, the backtrace
> looks like:
>
> INFO: trying to register non-static key.
> The code is fine but needs lockdep annotation, or maybe
> you didn't initialize this object before use?
> turning off the locking correctness validator.
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.5.0-rc1-00449-g133466c3bbe1-dirty #21
> Hardware name: STM32 (Device Tree Support)
> unwind_backtrace from show_stack+0x18/0x1c
> show_stack from dump_stack_lvl+0x60/0x90
> dump_stack_lvl from register_lock_class+0x98c/0x99c
> register_lock_class from __lock_acquire+0x74/0x293c
> __lock_acquire from lock_acquire+0x134/0x398
> lock_acquire from stmmac_get_stats64+0x2ac/0x2fc
> stmmac_get_stats64 from dev_get_stats+0x44/0x130
> dev_get_stats from rtnl_fill_stats+0x38/0x120
> rtnl_fill_stats from rtnl_fill_ifinfo+0x834/0x17f4
> rtnl_fill_ifinfo from rtmsg_ifinfo_build_skb+0xc0/0x144
> rtmsg_ifinfo_build_skb from rtmsg_ifinfo+0x50/0x88
> rtmsg_ifinfo from __dev_notify_flags+0xc0/0xec
> __dev_notify_flags from dev_change_flags+0x50/0x5c
> dev_change_flags from ip_auto_config+0x2f4/0x1260
> ip_auto_config from do_one_initcall+0x70/0x35c
> do_one_initcall from kernel_init_freeable+0x2ac/0x308
> kernel_init_freeable from kernel_init+0x1c/0x138
> kernel_init from ret_from_fork+0x14/0x2c
>
> The reason is the rxq|txq_stats structures are not what expected
> because stmmac_open() -> __stmmac_open() the structure is overwritten
> by "memcpy(&priv->dma_conf, dma_conf, sizeof(*dma_conf));"
> This causes the well initialized syncp member of rxq|txq_stats is
> overwritten unexpectedly as pointed out by Johannes and Uwe.
>
> Fix this issue by moving rxq|txq_stats back to stmmac_extra_stats. For
> SMP cache friendly, we also mark stmmac_txq_stats and stmmac_rxq_stats
> as ____cacheline_aligned_in_smp.
>
> Fixes: 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics where necessary")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Hi Jisheng Zhang,
as a fix for Networking code this should be based targeted at the net tree.
Subject: [PATCH net] ...
Unfortunately it doesn't apply cleanly against net.
Please consider rebasing and reposting.
--
pw-bot: changes-requested
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-09-16 15:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 0:53 [PATCH] net: stmmac: fix incorrect rxq|txq_stats reference Jisheng Zhang
2023-09-15 0:53 ` Jisheng Zhang
2023-09-16 15:47 ` Simon Horman [this message]
2023-09-16 15:47 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230916154737.GG1125562@kernel.org \
--to=horms@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jernej.skrabec@gmail.com \
--cc=joabreu@synopsys.com \
--cc=johannes@sipsolutions.net \
--cc=jszhang@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=samuel@sholland.org \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.