mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eelco Chaudron <echaudro@redhat.com>
To: Adrian Moreno <amorenoz@redhat.com>
Cc: netdev@vger.kernel.org, aconole@redhat.com, pabeni@redhat.com,
	Ilya Maximets <i.maximets@ovn.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
	"open list:OPENVSWITCH" <dev@openvswitch.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v4 2/4] net: openvswitch: add per-flow_table lockdep checks
Date: Mon, 15 Jun 2026 15:55:55 +0200	[thread overview]
Message-ID: <FE904B6B-A82F-4657-A323-2EDB59FA0979@redhat.com> (raw)
In-Reply-To: <20260611045817.1302665-3-amorenoz@redhat.com>

On 11 Jun 2026, at 6:58, Adrian Moreno wrote:

> A future patch will introduce a per-flow_table mutex that will protect
> flow operations independently. In preparation for that, this patch
> introduces a flow_table lockdep macro, and modifies some function
> signatures to allow lockdep assertions to run.
>
> For now, the actual lockdep check logic is a no-op, but adding the
> infrastructure helps reduce the size of the upcoming patch.
>
> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>

Hi Adrian,

See some comments below, and maybe address the Sashiko comment in the
commit message.

Cheers,

Eelco

[...]

> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index e78c28dd5d9d..72ad3ed12675 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -840,15 +840,16 @@ static size_t ovs_flow_cmd_msg_size(const struct sw_flow_actions *acts,
>  		+ nla_total_size_64bit(8); /* OVS_FLOW_ATTR_USED */
>  }
>
> -/* Called with ovs_mutex or RCU read lock. */
> +/* Called with table->lock or RCU read lock. */
>  static int ovs_flow_cmd_fill_stats(const struct sw_flow *flow,
> +				   const struct flow_table *table,

Should 'table' come before 'flow' to be consistent with
ovs_flow_tbl_insert() and ovs_flow_tbl_remove()? This applies
to all functions in this patch adding the 'table' parameter.

>  				   struct sk_buff *skb)
>  {
>  	struct ovs_flow_stats stats;
>  	__be16 tcp_flags;
>  	unsigned long used;

[...]

> diff --git a/net/openvswitch/flow_table.h b/net/openvswitch/flow_table.h
> index 6211bcc72655..3e5e9845c28a 100644
> --- a/net/openvswitch/flow_table.h
> +++ b/net/openvswitch/flow_table.h
> @@ -72,6 +72,22 @@ struct flow_table {
>
>  extern struct kmem_cache *flow_stats_cache;
>
> +static inline int lockdep_ovs_tbl_is_held(const struct flow_table *table
> +					  __always_unused)
> +{
> +	return 1;
> +}
> +
> +#define ASSERT_OVS_TBL(tbl)   WARN_ON(!lockdep_ovs_tbl_is_held(tbl))
> +
> +/* Lock-protected update-allowed dereferences.*/
> +#define ovs_tbl_dereference(p, tbl)	\
> +	rcu_dereference_protected(p, lockdep_ovs_tbl_is_held(tbl))
> +
> +/* Read dereferences can be protected by either RCU, table lock. */

nit; This comment reads odd, maybe;

/* Read dereferences can be protected by either RCU or table lock. */

> +#define rcu_dereference_ovs_tbl(p, tbl) \
> +	rcu_dereference_check(p, lockdep_ovs_tbl_is_held(tbl))
> +
>  int ovs_flow_init(void);
>  void ovs_flow_exit(void);


  reply	other threads:[~2026-06-15 13:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11  4:58 [PATCH net-next v4 0/4] net: openvswitch: Decouple flow operations from RTNL Adrian Moreno
2026-06-11  4:58 ` [PATCH net-next v4 1/4] net: openvswitch: make flow_table an rcu pointer Adrian Moreno
2026-06-12 12:32   ` Eelco Chaudron
2026-06-11  4:58 ` [PATCH net-next v4 2/4] net: openvswitch: add per-flow_table lockdep checks Adrian Moreno
2026-06-15 13:55   ` Eelco Chaudron [this message]
2026-06-11  4:58 ` [PATCH net-next v4 3/4] net: openvswitch: decouple flow_table from ovs_mutex Adrian Moreno
2026-06-15 13:55   ` Eelco Chaudron
2026-06-11  4:58 ` [PATCH net-next v4 4/4] net: openvswitch: avoid double-rcu wait period Adrian Moreno
2026-06-15 13:56   ` Eelco Chaudron

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=FE904B6B-A82F-4657-A323-2EDB59FA0979@redhat.com \
    --to=echaudro@redhat.com \
    --cc=aconole@redhat.com \
    --cc=amorenoz@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=i.maximets@ovn.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®