From: Jakub Kicinski <kuba@kernel.org>
To: Jinjian Song <jinjian.song@fibocom.com>
Cc: andrew+netdev@lunn.ch, angelogioacchino.delregno@collabora.com,
chandrashekar.devegowda@intel.com,
chiranjeevi.rapolu@linux.intel.com, corbet@lwn.net,
danielwinkler@google.com, davem@davemloft.net,
edumazet@google.com, haijun.liu@mediatek.com, helgaas@kernel.org,
horms@kernel.org, johannes@sipsolutions.net,
linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
loic.poulain@linaro.org, m.chetan.kumar@linux.intel.com,
matthias.bgg@gmail.com, netdev@vger.kernel.org,
pabeni@redhat.com, ricardo.martinez@linux.intel.com,
ryazanov.s.a@gmail.com
Subject: Re: [net v1] net: wwan: t7xx: Fix napi rx poll issue
Date: Fri, 16 May 2025 08:48:42 -0700 [thread overview]
Message-ID: <20250516084842.26c80cb5@kernel.org> (raw)
In-Reply-To: <20250515175251.58b5123f@kernel.org>
On Fri, 16 May 2025 15:30:38 +0800 Jinjian Song wrote:
> It seems that a judgment is made every time ccmni_inst[x] is used in the driver,
> and the synchronization on the 2 way might have been done when NAPI triggers
> polling by napi_schedule and when WWAN trigger dellink.
Synchronization is about ensuring that the condition validating
by the if() remains true for as long as necessary.
You need to wrap the read with READ_ONCE() and write with WRITE_ONCE().
The rest if fine because netdev unregister sync against NAPIs in flight.
WARNING: multiple messages have this Message-ID (diff)
From: Jinjian Song <jinjian.song@fibocom.com>
To: kuba@kernel.org
Cc: andrew+netdev@lunn.ch, angelogioacchino.delregno@collabora.com,
chandrashekar.devegowda@intel.com,
chiranjeevi.rapolu@linux.intel.com, corbet@lwn.net,
danielwinkler@google.com, davem@davemloft.net,
edumazet@google.com, haijun.liu@mediatek.com, helgaas@kernel.org,
horms@kernel.org, jinjian.song@fibocom.com,
johannes@sipsolutions.net, linux-arm-kernel@lists.infradead.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mediatek@lists.infradead.org, loic.poulain@linaro.org,
m.chetan.kumar@linux.intel.com, matthias.bgg@gmail.com,
netdev@vger.kernel.org, pabeni@redhat.com,
ricardo.martinez@linux.intel.com, ryazanov.s.a@gmail.com,
liuqf@fibocom.com
Subject: Re: [net v1] net: wwan: t7xx: Fix napi rx poll issue
Date: Tue, 20 May 2025 15:05:34 +0800 [thread overview]
Message-ID: <20250516084842.26c80cb5@kernel.org> (raw)
Message-ID: <20250520070534.1oUA0bV-tYQJcBqo26IFITRR0AUqa3Ri2TNPBChlzVE@z> (raw)
In-Reply-To: <20250516084842.26c80cb5@kernel.org>
>On Fri, 16 May 2025 15:30:38 +0800 Jinjian Song wrote:
>> It seems that a judgment is made every time ccmni_inst[x] is used in the driver,
>> and the synchronization on the 2 way might have been done when NAPI triggers
>> polling by napi_schedule and when WWAN trigger dellink.
>
>Synchronization is about ensuring that the condition validating
>by the if() remains true for as long as necessary.
>You need to wrap the read with READ_ONCE() and write with WRITE_ONCE().
>The rest if fine because netdev unregister sync against NAPIs in flight.
>
Hi Jakub,
I think I got your point.
I can use the atomic_t usage in struct t7xx_ccmni to synchronization.
static void t7xx_ccmni_wwan_dellink(...) {
[...]
if (WARN_ON(ctlb->ccmni_inst[if_id] != ccmni))
return;
unregister_netdevice(dev);
//Add here use this variable(ccmnii->usage) to synchronization
if (atomic_read(&ccmni->usage) == 0)
ccmni == NULL;
}
How about this modify?
Thanks.
Jinjian,
Best Regards.
next prev parent reply other threads:[~2025-05-16 15:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 3:17 [net v1] net: wwan: t7xx: Fix napi rx poll issue Jinjian Song
2025-05-16 0:52 ` Jakub Kicinski
2025-05-16 7:30 ` Jinjian Song
2025-05-16 15:48 ` Jakub Kicinski [this message]
2025-05-20 7:05 ` Jinjian Song
2025-05-20 22:39 ` Jakub Kicinski
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=20250516084842.26c80cb5@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chandrashekar.devegowda@intel.com \
--cc=chiranjeevi.rapolu@linux.intel.com \
--cc=corbet@lwn.net \
--cc=danielwinkler@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=haijun.liu@mediatek.com \
--cc=helgaas@kernel.org \
--cc=horms@kernel.org \
--cc=jinjian.song@fibocom.com \
--cc=johannes@sipsolutions.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=loic.poulain@linaro.org \
--cc=m.chetan.kumar@linux.intel.com \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ricardo.martinez@linux.intel.com \
--cc=ryazanov.s.a@gmail.com \
/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 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).