Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	 linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net-next] net: ethernet: mtk_wed: annotate RCU release in attach()
Date: Fri, 25 Apr 2025 12:22:46 +0200	[thread overview]
Message-ID: <da41cb80e0acb08fd25c38876a29156b69322249.camel@sipsolutions.net> (raw)
In-Reply-To: <20250425102050.GO3042781@horms.kernel.org>

On Fri, 2025-04-25 at 11:20 +0100, Simon Horman wrote:
> On Wed, Apr 23, 2025 at 05:08:08PM +0200, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> > 
> > There are some sparse warnings in wifi, and it seems that
> > it's actually possible to annotate a function pointer with
> > __releases(), making the sparse warnings go away. In a way
> > that also serves as documentation that rcu_read_unlock()
> > must be called in the attach method, so add that annotation.
> > 
> > Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> 
> Reviewed-by: Simon Horman <horms@kernel.org>

Thanks :) Looks like Jakub already applied it, FWIW.

> Thinking out loud:
> 
> * Without this patch I see the following, but with this patch I do not.
> 
>   .../mt7915/mmio.c:636:5: warning: context imbalance in 'mt7915_mmio_wed_init' - wrong count at exit
>   .../mt7996/mmio.c:302:5: warning: context imbalance in 'mt7996_mmio_wed_init' - wrong count at exit

Right, that's what I was trying to get rid of.

> * The only implementation of this callback I found is mtk_wed_attach
>   which is already annotated as __releases(RCU);

Indeed, but sparse doesn't check that for function pointer
compatibility.

> * The only caller of this callback I could find is mtk_wed_device_attach()
>   which takes rcu_read_unlock(). And the the callback needs to release it
>   to avoid imbalance.
> 

Right, pretty sure that's all intentional (though I don't understand
it), hence this change to document it a bit better and get rid of the
warnings.

johannes


  reply	other threads:[~2025-04-25 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 15:08 [PATCH net-next] net: ethernet: mtk_wed: annotate RCU release in attach() Johannes Berg
2025-04-25 10:20 ` Simon Horman
2025-04-25 10:22   ` Johannes Berg [this message]
2025-04-25 19:01 ` patchwork-bot+netdevbpf

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=da41cb80e0acb08fd25c38876a29156b69322249.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=horms@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox