From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>,
<Steen.Hegelund@microchip.com>, <lars.povlsen@microchip.com>,
<daniel.machon@microchip.com>, <richardcochran@gmail.com>,
<UNGLinuxDriver@microchip.com>, <olteanv@gmail.com>
Subject: Re: [PATCH net-next v3 1/4] net: microchip: vcap: Add vcap_get_rule
Date: Wed, 7 Dec 2022 09:30:14 +0100 [thread overview]
Message-ID: <20221207083014.mipiiu6dzgpuayz5@soft-dev3-1> (raw)
In-Reply-To: <256f533f019b6392b41701707eb7aa056b2f16c0.camel@redhat.com>
The 12/06/2022 13:31, Paolo Abeni wrote:
>
> Hello,
Hi Paolo,
>
> On Sat, 2022-12-03 at 11:43 +0100, Horatiu Vultur wrote:
> > @@ -632,32 +264,22 @@ static int vcap_show_admin(struct vcap_control *vctrl,
> > struct vcap_admin *admin,
> > struct vcap_output_print *out)
> > {
> > - struct vcap_rule_internal *elem, *ri;
> > + struct vcap_rule_internal *elem;
> > + struct vcap_rule *vrule;
> > int ret = 0;
> >
> > vcap_show_admin_info(vctrl, admin, out);
> > - mutex_lock(&admin->lock);
> > list_for_each_entry(elem, &admin->rules, list) {
>
> Not strictly related to this patch, as the patter is AFAICS already
> there in other places, but I'd like to understand the admin->rules
> locking schema.
According to the commit message that introduced this lock [0] and the
comment to the lock, this lock is used to protect the access to the
admin->rules, admin->enabled and the caches which means the access to
the HW (to read/write the rules).
>
> It looks like addition/removal are protected by admin->lock, but
> traversal is usually lockless, which in turn looks buggy ?!?
Thanks for the observation! You are correct, there seems to be some bugs
regarding the usage of this lock. We will look over this and will send a
patch to fix this.
>
> Note: as this patch does not introduce the mentioned behavior, I'm not
> going to block the series for the above.
[0] 71c9de995260 ("net: microchip: sparx5: Add VCAP locking to protect rules")
>
> Thanks,
>
> Paolo
> > - ri = vcap_dup_rule(elem);
> > - if (IS_ERR(ri)) {
> > - ret = PTR_ERR(ri);
> > - goto err_unlock;
> > + vrule = vcap_get_rule(vctrl, elem->data.id);
> > + if (IS_ERR_OR_NULL(vrule)) {
> > + ret = PTR_ERR(vrule);
> > + break;
> > }
> > - /* Read data from VCAP */
> > - ret = vcap_read_rule(ri);
> > - if (ret)
> > - goto err_free_rule;
> > +
> > out->prf(out->dst, "\n");
> > - vcap_show_admin_rule(vctrl, admin, out, ri);
> > - vcap_free_rule((struct vcap_rule *)ri);
> > + vcap_show_admin_rule(vctrl, admin, out, to_intrule(vrule));
> > + vcap_free_rule(vrule);
> > }
> > - mutex_unlock(&admin->lock);
> > - return 0;
> > -
> > -err_free_rule:
> > - vcap_free_rule((struct vcap_rule *)ri);
> > -err_unlock:
> > - mutex_unlock(&admin->lock);
> > return ret;
> > }
>
--
/Horatiu
_______________________________________________
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:[~2022-12-07 8:26 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-03 10:43 [PATCH net-next v3 0/4] net: lan966x: Enable PTP on bridge interfaces Horatiu Vultur
2022-12-03 10:43 ` [PATCH net-next v3 1/4] net: microchip: vcap: Add vcap_get_rule Horatiu Vultur
2022-12-06 12:31 ` Paolo Abeni
2022-12-07 8:30 ` Horatiu Vultur [this message]
2022-12-03 10:43 ` [PATCH net-next v3 2/4] net: microchip: vcap: Add vcap_mod_rule Horatiu Vultur
2022-12-03 10:43 ` [PATCH net-next v3 3/4] net: microchip: vcap: Add vcap_rule_get_key_u32 Horatiu Vultur
2022-12-03 10:43 ` [PATCH net-next v3 4/4] net: lan966x: Add ptp trap rules Horatiu Vultur
2022-12-08 9:25 ` Michael Walle
2022-12-08 9:27 ` Michael Walle
2022-12-08 13:04 ` Horatiu Vultur
2022-12-08 13:18 ` Michael Walle
2022-12-09 9:29 ` Horatiu Vultur
2022-12-09 12:10 ` Michael Walle
2022-12-09 12:58 ` Horatiu Vultur
2022-12-09 12:56 ` Vladimir Oltean
2022-12-09 14:05 ` Michael Walle
2022-12-09 14:14 ` Vladimir Oltean
2022-12-09 14:20 ` Horatiu Vultur
2022-12-09 14:23 ` Michael Walle
2022-12-09 14:54 ` Horatiu Vultur
2022-12-09 14:43 ` Vladimir Oltean
2022-12-09 14:47 ` Vladimir Oltean
2022-12-09 14:57 ` Horatiu Vultur
2022-12-09 14:56 ` Vladimir Oltean
2022-12-09 15:30 ` Horatiu Vultur
2022-12-09 15:27 ` Vladimir Oltean
2022-12-09 23:03 ` Jakub Kicinski
2022-12-12 14:27 ` Horatiu Vultur
2022-12-12 14:20 ` Horatiu Vultur
2023-01-05 15:09 ` Michael Walle
2023-01-05 21:55 ` Horatiu Vultur
2022-12-06 12:40 ` [PATCH net-next v3 0/4] net: lan966x: Enable PTP on bridge interfaces 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=20221207083014.mipiiu6dzgpuayz5@soft-dev3-1 \
--to=horatiu.vultur@microchip.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lars.povlsen@microchip.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@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).