From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2108E3F58FC for ; Mon, 15 Jun 2026 13:56:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781531764; cv=none; b=D3khsDa879Axb8VJmQs2GAb9kmUHvqdL+T3o13olQTtEeE+aziFULoLZ9QF2+Ghc82FpDU1ZGX9GOpK05km8iYpJUbAYjbKxehTWJC2tPiDvTcJGfEs6za2tdxaxqORocCgj+vDC78+iAAC7sSSikn5NXQCSbnOsRC+aGbw5qBQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781531764; c=relaxed/simple; bh=azPHeJ6RdZ6MYg3yN5YCdVKMCdOR3cGIJZpIxCTg1u0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D+DqUhVyYduPdXjLI261YOiT1eeyH8cPHZdTM1sLpqHdPwfrbIW+oJw2abBqlhoreqeMUpkI9MGXsllZFNQeZvBwALw2xVQpYX8/tGeWDJB4r56f9oMnZPHGMMDTn0JdBKpFdIDD3X2TnF/yAtynrvSYYzuD5EM2mXIIz+wIm2Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HpU4vpSB; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=DllrCIKz; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HpU4vpSB"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="DllrCIKz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781531762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YPckBN/w9iQXsyyujFhuNAKZOopC9y7aQZ4NPid9/sA=; b=HpU4vpSBPahZeDxqR++geSFeGh8+/toI5rwePocrndWN+h3ASOnlfbzHfAm8Fy2t2LNkjk kYQPjpKo/nN0Lg4j8ya2AI/ubkV6LMF5+QR+QEx+zF6uGz3J5VyuVStmVlzYOkPs30VaQg bfeyXTVWAdQ/VqvrNYH1R+0SND65HtU= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-SqxdBthOM7WbJmj2mL87Zg-1; Mon, 15 Jun 2026 09:55:58 -0400 X-MC-Unique: SqxdBthOM7WbJmj2mL87Zg-1 X-Mimecast-MFC-AGG-ID: SqxdBthOM7WbJmj2mL87Zg_1781531758 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-68f148093e6so3138621a12.1 for ; Mon, 15 Jun 2026 06:55:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1781531757; x=1782136557; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YPckBN/w9iQXsyyujFhuNAKZOopC9y7aQZ4NPid9/sA=; b=DllrCIKz4+C6GWqfdsAPxm12vPFHmLsu5gAHu+DQfnESa/FmSJ+ukAKCpw1BSTD2kT UPc+FLgkkicj8lajnPOx3jTsBxRDgb1ypVFCAaoFI2yGp6bsw1RZlq0JUfI+KtH5I02/ QsPG9CS+gvhjsfoB+PZGcEsWBpcIK2jZZ02SBWAP34IqZkw2j3RU5nEJWQiaInvqD+EX fHxns0vQD8iTFrqDItYv8e0mrYHgdqf8rcbOIPO6kTko/Enq+YMAyZs4rrjzOTewu5sg 9Vordw3+VGH6vb5cFxinnViqQNaOi1Uv6IObtR1aqdTsJPgMPpcPM6PcZGtiTbzTbwxI PIQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781531757; x=1782136557; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YPckBN/w9iQXsyyujFhuNAKZOopC9y7aQZ4NPid9/sA=; b=rhW8huCK8ZPzs3M5Stmbva1IboLQ2QgGiLgvCcWT4Mrz7NqgYUxu7QWR0MB0vOxfzb yd65Q5xdi3U6d6uQABc2mLuDJHlEp4P1Dvcw7ASDNwS/4rdTtZBaNWquMqS9J0JXmPWz S6dx6U7PFmMw5PslYsaLc3ObFuMXhG96UsoxwpWDt5Fwiygp1hpqsB7uX2vEYvCDHJmR LCwkeeOgbUDbggH3y+REa43EfRGS8z69PO4DpGpzjtop1rl3BPwcXvL41SpCG777x1xS q4uerQjIyqHsDtTSsoHiHC7cFLgfqURXQzkMVzfd8Vjyn2Ye2Wu/vagLVw1kPU0JDHjp d6Xw== X-Forwarded-Encrypted: i=1; AFNElJ8xQTLsI82FvGQQX+WjF7hlsRU8SSbcEvYjNAF/+dLE89xRmBwFznRQ/UWoI5whMa8xu6nukLflybdWGAM=@vger.kernel.org X-Gm-Message-State: AOJu0YyARBwzVA88DoOPU7/RBfFi0vf9wfWBw8E5zlmZyLtKthRvFo7g zO+TvWYEHeo79YwcgJZaW4zME9Jlkx2NfqW+lOh3mv8gX46ZS3BySZrj/SCqxgV5LZfbg0MFLhE T5VoSA4tSEPNJaRE0Viyf/UReNIzLx1Fnl85gGGl0WbjNNvkNzcr2uN+WY7Qe5wgWzw== X-Gm-Gg: Acq92OGrGEXnR66u2KA4ErKa2NVkjlyzklBES2QV0T/RszsYCGVPZ4P7XYo4liZvxvR koKu3vlRsBh/L7JNnqZn0cLs/ushRALJvMuYvANw+nmvjG7/txeMB67fL+uHPN4gDxB5+dSttO7 zMPHmIs8QD97JczRSlFf/rUMm4aINnfbJ7ZzPT7+eBhtLPdvYXrXYepbY4Ro7XZkwBpvOErPURR +KamTLWESmYY82HhPn0h/Pgc5+MT4seSzVk1OpPTotKVF34giOsIKIhwgnAJ0tjork3kRzz6WWM mBWlL/X4kIP8n5TIRRiqzG/cENCe01YU1sN9ycR1gJKsYY0cbQeCTaw5gJm6wTXg0wR5fHK3oIX vwui67QYe6cZVIYZnj9RXBZB5+4aBxPyIkQkwNTnh9l2MrzgeHgqJy4j3Ckvf/LiThDTHFQ== X-Received: by 2002:a05:6402:350c:b0:687:9c0f:5897 with SMTP id 4fb4d7f45d1cf-693c6a16992mr4050526a12.9.1781531757548; Mon, 15 Jun 2026 06:55:57 -0700 (PDT) X-Received: by 2002:a05:6402:350c:b0:687:9c0f:5897 with SMTP id 4fb4d7f45d1cf-693c6a16992mr4050500a12.9.1781531757036; Mon, 15 Jun 2026 06:55:57 -0700 (PDT) Received: from [10.44.33.51] (5920ab7b.static.cust.trined.nl. [89.32.171.123]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-693ab54e6e5sm2952596a12.1.2026.06.15.06.55.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2026 06:55:56 -0700 (PDT) From: Eelco Chaudron To: Adrian Moreno Cc: netdev@vger.kernel.org, aconole@redhat.com, pabeni@redhat.com, Ilya Maximets , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Simon Horman , "open list:OPENVSWITCH" , open list 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 X-Mailer: MailMate (2.0r6292) Message-ID: In-Reply-To: <20260611045817.1302665-3-amorenoz@redhat.com> References: <20260611045817.1302665-1-amorenoz@redhat.com> <20260611045817.1302665-3-amorenoz@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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 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 *tab= le > + __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);