From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796106854; b=uKrCK5ht9Tb99osHZaHRO4YIDNbX1G9Hcl3E19AU49k2Aa5UB4ftPefIxvd6ADvMv+jK PlnjCZvgS0p3qWLMMxOwB1w0rxoVIxy343JbTzq8bvKq47lL2x769sVj9AR2QM6StvqWy szP7lcoHFVEgapY6zjdOIdbhbGuaKH9JBe91VI9m3GyVgIBJK6ZlY8UwpPqs5rWc+77CP lQ9FG44OzJ04yw2mXs9rEXBLf9SXIukM6T5NB/AOfSrq7+S9GMDEqyIpwAQ2ENVWlAUK3 heBtQM+mPpMjHvvijbIpRTuqtWqgLQUIazNgN8FuBvl7xF0LkmU80erPhIdLjZHI1Bg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796106854; h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter: DKIM-Signature:Received:Received:Date:From:To:CC:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To: X-ClientProxiedBy; bh=pyomz7cvIis/0SRS9dz/f13GNBmgxNCQ7sqOUFUNT0Q=; b=RmUsQULQ8Uc+juHqJ+YRU3F1uBLjl4i7/aeT42hDoHLbGqGRuyTyAd0tTDNgZxibwC/c 4RRN4R8ecDj/80Tk1mMYozrIeZNBvY9SadZ+wS0NqtT0WcBWNx9Lor/gxNoYykzPF2h+b BhAvzQHnngurzYuxRSYgHtxV8FFhd/59Q5DR5dLlqWYA0ZcAvK2Entdud2/5OPARiG9Zz Cz6YugABRj75WCZTXfueYL9UNFOkJ6kzKcS5qQWGNNbpcM2WMJh9WsSWBnToqsAISqlgz Ohv5Ol0KfivJgic9aiZSDTvPZ4BdhiKApokoFGKrh8qfAt2v2+OhjEDvoY6ly+gYp3w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=H10IGVgl; arc=none smtp.remote-ip=62.96.220.36 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1350606A32A; Tue, 1 Dec 2026 06:34:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A1350606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=H10IGVgl Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 6F492207FC; Tue, 1 Dec 2026 07:34:04 +0100 (CET) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qqKPWc0TAs9X; Tue, 1 Dec 2026 07:34:03 +0100 (CET) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id 79F7920853; Tue, 1 Dec 2026 07:34:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 79F7920853 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1796106843; bh=pyomz7cvIis/0SRS9dz/f13GNBmgxNCQ7sqOUFUNT0Q=; h=Date:From:To:CC:Subject:References:In-Reply-To:From; b=H10IGVglwfsUJHONAb0qES4TZbB34TN1zDhTbwXWJHQh7RKskKavzIBdociAosUyj vP+PnM43BIuEOW3RUXTdev+6mGoqwYg7TT3tsMxAiHeUK9MwYhJavcQJ+U/RrfU9Ak jh5sDXpiOjDhx13C0PCGMSAD11Z7TXqj7BOFlGKOhIr4729lMi9lcp3HSOOyrsodHR cencM/WmjAhR6iX7cJONiE+UnCBzpLbnmYzALZew2Wyyi3hd5nN8x5y3FlPcAkKpoi bu9EKzSJJRFVxbtCjIUIsE3wvgd4xEpbWZ5jgLQVhAAukkugQXzhLzPSECHagmWfra LDHj8czc2drcQ== Received: from gauss4 (10.182.7.102) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Tue, 1 Dec 2026 07:34:03 +0100 Received: (nullmailer pid 778590 invoked by uid 1000); Tue, 01 Dec 2026 06:34:02 -0000 Date: Tue, 1 Dec 2026 07:34:02 +0100 From: Steffen Klassert To: Jianbo Liu CC: , , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Florian Westphal , Subject: Re: [PATCH ipsec 0/4] xfrm: Fix device state teardown races Message-ID: References: <20261125013412.1123866-1-jianbol@nvidia.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20261125013412.1123866-1-jianbol@nvidia.com> X-ClientProxiedBy: EXCH-02.secunet.de (10.32.0.172) To EXCH-01.secunet.de (10.32.0.171) On Wed, Nov 25, 2026 at 03:34:08AM +0200, Jianbo Liu wrote: > Three fixes for the teardown of xfrm device offload state and one > revert, for ipsec. > > xfrm_dev_state_free() runs for the same state from the state GC, from > the device flush and from xfrm_state_find(). Commit 89fefad9f971 > ("xfrm: serialize state GC with device state flush") serializes the > first two with a mutex, but xfrm_state_find() runs under RCU and > still races with the flush. > > Let only one caller free the device state of an SA, hold a state > reference in the flush and wait for an RCU grace period before the > free. The mutex is not needed after that, so revert that commit. > > 1. xfrm: Give GC list nodes their own storage > Stop sharing the GC list nodes with the bydst and bysrc hash nodes. > Patch 2 uses gclist on states that RCU readers may still walk. > > 2. xfrm: Serialize device state teardown > Let only one caller free the device state of an SA. > > 3. xfrm: Wait for an RCU grace period before freeing device state > Let RCU readers of the driver state finish before the free. > > 4. Revert "xfrm: serialize state GC with device state flush" > Remove the mutex that the fixes above make redundant. > > Jianbo Liu (4): > xfrm: Give GC list nodes their own storage > xfrm: Serialize device state teardown > xfrm: Wait for an RCU grace period before freeing device state > Revert "xfrm: serialize state GC with device state flush" > > include/net/xfrm.h | 10 +++---- > net/xfrm/xfrm_device.c | 4 +-- > net/xfrm/xfrm_state.c | 61 ++++++++++++++++++++++++++---------------- > 3 files changed, 44 insertions(+), 31 deletions(-) Series applied, thanks a lot Jianbo!