Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>,
	Dan Carpenter <dan.carpenter@linaro.org>
Cc: Simon Horman <horms@kernel.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: Weird sparse error WAS( [PATCH net-next v2 3/3] net/sched: act_blockcast: Introduce blockcast tc action
Date: Thu, 24 Aug 2023 16:41:45 +0200	[thread overview]
Message-ID: <4cbd35c1bb2dd8b0a8bea85d32e3d296fac5f715.camel@redhat.com> (raw)
In-Reply-To: <CAM0EoMnXUSkE2XjWusrkUgyQqaokT8BEnt+9_cAeNMXa8fd61w@mail.gmail.com>

On Thu, 2023-08-24 at 10:30 -0400, Jamal Hadi Salim wrote:
> Dan/Simon,
> Can someone help explain this error on the code below:
> 
> ../net/sched/act_blockcast.c:213:9: warning: context imbalance in
> 'tcf_blockcast_init' - different lock contexts for basic block

IIRC sparse is fooled by lock under conditionals, in this case:

       if (exists)
               spin_lock_bh(&p->tcf_lock);

a possible solution would be:

	if (exists) {
		spin_lock_bh(&p->tcf_lock);
		goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
		spin_unlock_bh(&p->tcf_lock);
	} else {
		goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
	}
	
Using some additional helpers the code could be less ugly...

Cheers,

Paolo


  reply	other threads:[~2023-08-24 14:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-19 16:35 [PATCH net-next v2 0/3] net/sched: Introduce tc block ports tracking and use Victor Nogueira
2023-08-19 16:35 ` [PATCH net-next v2 1/3] net/sched: Introduce tc block netdev tracking infra Victor Nogueira
2023-08-21 19:12   ` Vlad Buslov
2023-08-24 14:05     ` Jamal Hadi Salim
2023-08-19 16:35 ` [PATCH net-next v2 2/3] net/sched: cls_api: Expose tc block ports to the datapath Victor Nogueira
2023-08-23 17:33   ` Marcelo Ricardo Leitner
2023-08-24 14:09     ` Jamal Hadi Salim
2023-08-19 16:35 ` [PATCH net-next v2 3/3] net/sched: act_blockcast: Introduce blockcast tc action Victor Nogueira
2023-08-23 17:58   ` Marcelo Ricardo Leitner
2023-08-24 14:19     ` Jamal Hadi Salim
2023-08-24 14:30   ` Weird sparse error WAS( " Jamal Hadi Salim
2023-08-24 14:41     ` Paolo Abeni [this message]
2023-08-24 14:57       ` Jamal Hadi Salim
2023-09-05  9:18     ` Dan Carpenter
2023-08-21 19:07 ` [PATCH net-next v2 0/3] net/sched: Introduce tc block ports tracking and use Vlad Buslov
2023-08-24 13:47   ` Jamal Hadi Salim

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=4cbd35c1bb2dd8b0a8bea85d32e3d296fac5f715.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=dan.carpenter@linaro.org \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.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