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 E66A23F58E9 for ; Mon, 15 Jun 2026 13:56:07 +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=1781531769; cv=none; b=NlG/KIY93mLKZCYI9cMulWayuXMXDS3QWThFYEy43VhK/00JGfQh9FnzgsL/mNeCtttxL5IQERRE7+hbkCDGuIfcmEEUSMjlSgMKtnf5+lYDru/vUbkFB19HZfUnyVfsOnUVoWybdv7YAtvM0e5xZ/TH04LckVf58A10vuLGp7U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781531769; c=relaxed/simple; bh=y75oEhy1DRi4U4yG7RuJWtWzbps1+v/W9t3iBPgp+UQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tTmEj75mvauQwlfaFyji+XFNqLzIOacu7Ov3tUC/o8dyhQGn75SCe6wv5mC7d4JIH1qLcJsv7ZJIICJ1kdVkD2WOioP9k9bN3HAjc93JTzJr0N8ad0jtTvDuDyO/WDz4Dg5TF5pMKqoWEc5m0aQI5lrkrdz0TcLT24QuZlavIQg= 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=ONLJ5C3F; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=AStNdejO; 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="ONLJ5C3F"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="AStNdejO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781531767; 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: in-reply-to:in-reply-to:references:references; bh=TW1Wrsk+zaA+ammSTMdEakEIIxxSSupjdSwowRTMk9g=; b=ONLJ5C3Fk2vcGKh60wRPwFvr401eaviwsOZJ5TGCF1V/ya9m7fWeKvtQMMdLzPKfkWJOno w1lB4skkktSTLQc8a5se/jUHKEIcAztXDC5fQ3s2g9OIA2QCqsgfolv/J3zLmiJ/G6uG2k wxk+yNygkCVWGLjrNf8AcGOv3Nt/UFk= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-421-Alz0L3NpNrKhwz12mREQAA-1; Mon, 15 Jun 2026 09:56:05 -0400 X-MC-Unique: Alz0L3NpNrKhwz12mREQAA-1 X-Mimecast-MFC-AGG-ID: Alz0L3NpNrKhwz12mREQAA_1781531764 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-beeb1713d20so292645766b.1 for ; Mon, 15 Jun 2026 06:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1781531764; x=1782136564; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=TW1Wrsk+zaA+ammSTMdEakEIIxxSSupjdSwowRTMk9g=; b=AStNdejOINK1iu/TfARNMaoV0pF8Wo7JUed7gf10FDRxVoYrfWcBCJ/qviRmF+E7SA 7O6fnTMOq7FNDIjy7cvfkGjFhTD5cFkaWWBqxBtSu2dMcW90w8BbcUPLCoMxUppE4HbA VWVgKTtLQIZdV89AhlbffVRHeukjLft+XeANOGq5xduaEDaR4N2/fgoQUXsYeoJp301d G5ZBXAuHxOXdgoYftGzxgxM+qZgShG1uYdh5q8xktJkLoostppncfR1AWQuW0NhzkFPm DXxc5HClC4smffosSkoDZ7Jjvk58W3ktzwqhNdbPa7GFcVKc8QYE/NOZBkbqDS7E05NZ I9VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781531764; x=1782136564; h=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=TW1Wrsk+zaA+ammSTMdEakEIIxxSSupjdSwowRTMk9g=; b=aVNcsr3dAJ30H29e91Jg2Aze5BTyclUDlYIazqRowuW1j7lpVnUHOwuyrDbl0dQpze SqaX5b9uHDEgiheR2cFPZ2y75s7GnItqM9nPNbBzxFbik4+8YDUudkuozylJWAlidQsA F9DWNpFUADBszEq/aexGs8jAtD7He4aZjtB3pfhs6JjP8ObeVXVBD4bllJRzt/4p+Xb3 2Ydu0RqOPXB9Uvhy+VgMunJ5+vXPKBAa9wEM0TAtt74UFD3ApGO3uinKnEbyqZJS7BdI fBxs5mwjwq0iwvXwbV5qAoq0u7VwG44mNxH1Rsnx5XsR3HrXiGjiDt9zkq/m1/hcFKI8 DTgg== X-Forwarded-Encrypted: i=1; AFNElJ9VBMLaPMPNKJgGxZPNHx4EXb5OwXNlfTD3XQojRJLcQp5dVO/16+J81By5Fv4zNhM0ExID8VvpttOpsMY=@vger.kernel.org X-Gm-Message-State: AOJu0YwlIQnC1/ogFZrGlbLVYxkB7j3hGSGATK1Lg/gTDUtfUpdmlVQH 0cEWg4ShjDq75yyNEhkj1WVzuiiXPbdhgXpDfsvEnEexk9OTBCSV637K6QdBHBaIfW3S5b+MDIz L/20/sEVv0xNSfkARc7P57R57u28wT37eryg1wxQhy9Zv0nBRgGlQy7hSOjHzztzMo7kBIyLwwg == X-Gm-Gg: Acq92OHcFlohlLvZ7/uUqvg79lleSi4BG32JpKCfzwZHe+xruWCBXy+L4Vqt8ilx5zt +GO+20HO+/p3FX30EuvYNUn0Oa68wZ4mdZ5DVKRwoHcgAwCB70NmOv5bTh5h+4yO7HPPE/ZN2+7 YKA+2Gl+0THK1vEnsdVSoqsGjxM6XtQhKFlv2yHi5QYiyJzi0jK11RyAQvPBwc4FUAh0mBshTts 1XWp+tdYAOtCUW4b7wqQUHaYtVphcFHQVLuOyggbZtlfW6QcYp8yWqn94rHoXseHIvEgG3nEuK7 5LMR7yF9FvpxP7KIFBoeonqHHQhazMR7WUdyQXJej/B9wG9Z3fh25onZOU2pAekG67fiUBYH2Xe yuJT18xuOMk3E8F1iiYqHezEPYa6iJkJ48DNf1YrpDLs82ECVl2NvjBwRBSbqwFNqQKM9yw== X-Received: by 2002:a17:906:5193:10b0:bec:64d4:3872 with SMTP id a640c23a62f3a-bff4c6fb2b3mr325818666b.24.1781531763906; Mon, 15 Jun 2026 06:56:03 -0700 (PDT) X-Received: by 2002:a17:906:5193:10b0:bec:64d4:3872 with SMTP id a640c23a62f3a-bff4c6fb2b3mr325815466b.24.1781531763379; Mon, 15 Jun 2026 06:56:03 -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.56.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2026 06:56:02 -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 4/4] net: openvswitch: avoid double-rcu wait period Date: Mon, 15 Jun 2026 15:56:01 +0200 X-Mailer: MailMate (2.0r6292) Message-ID: <1913A0FD-1B8B-408B-8F5A-0612854DB5C6@redhat.com> In-Reply-To: <20260611045817.1302665-5-amorenoz@redhat.com> References: <20260611045817.1302665-1-amorenoz@redhat.com> <20260611045817.1302665-5-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 On 11 Jun 2026, at 6:58, Adrian Moreno wrote: > Avoid waiting for two rcu periods by scheduling the deletion of the > flow_table and all of its referenced structs at the same time. Hi Adrian, One small nit below; the code itself looks fine to me. Cheers, Eelco > Signed-off-by: Adrian Moreno > --- > net/openvswitch/flow_table.c | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) > > diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c > index 3934873a44c3..35232e1af8aa 100644 > --- a/net/openvswitch/flow_table.c > +++ b/net/openvswitch/flow_table.c > @@ -527,30 +527,33 @@ static void table_instance_destroy(struct table_instance *ti, > call_rcu(&ufid_ti->rcu, flow_tbl_destroy_rcu_cb); > } > > -/* No need for locking this function is called from RCU callback. */ > static void ovs_flow_tbl_destroy_rcu(struct rcu_head *rcu) > { > struct flow_table *table = container_of(rcu, struct flow_table, rcu); > > - struct table_instance *ti = rcu_dereference_raw(table->ti); > - struct table_instance *ufid_ti = rcu_dereference_raw(table->ufid_ti); > - struct mask_cache *mc = rcu_dereference_raw(table->mask_cache); > - struct mask_array *ma = rcu_dereference_raw(table->mask_array); > - > - call_rcu(&mc->rcu, mask_cache_rcu_cb); > - call_rcu(&ma->rcu, mask_array_rcu_cb); > - table_instance_destroy(ti, ufid_ti); > mutex_destroy(&table->lock); > kfree(table); > } > > void ovs_flow_tbl_put(struct flow_table *table) > { > + struct table_instance *ufid_ti; > + struct table_instance *ti; > + struct mask_cache *mc; > + struct mask_array *ma; > + > if (refcount_dec_and_test(&table->refcnt)) { > mutex_lock(&table->lock); > - table_instance_flow_flush(table, > - ovs_tbl_dereference(table->ti, table), > - ovs_tbl_dereference(table->ufid_ti, table)); > + ufid_ti = ovs_tbl_dereference(table->ufid_ti, table); > + ti = ovs_tbl_dereference(table->ti, table); > + table_instance_flow_flush(table, ti, ufid_ti); > + table_instance_destroy(ti, ufid_ti); > + > + mc = ovs_tbl_dereference(table->mask_cache, table); > + ma = ovs_tbl_dereference(table->mask_array, table); > + call_rcu(&mc->rcu, mask_cache_rcu_cb); > + call_rcu(&ma->rcu, mask_array_rcu_cb); nit: Would it be cleaner to extract the destruction logic in ovs_flow_tbl_put() into a separate static function, e.g. ovs_flow_tbl_destroy(), to separate the refcount handling from the actual cleanup? > mutex_unlock(&table->lock); > call_rcu(&table->rcu, ovs_flow_tbl_destroy_rcu); > }