๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20833

Re: [PATCH net-next] tls: wait for a single RCU grace period in tls_device_down()

#20833
From: Eric Dumazet
Date: Mon, 23 Nov 2026 09:17
49 lines
10387 bytes
Le jeu. 19 nov. 2026 ร  05:08, Jiayuan Chen <jiayuan.chen@linux.dev> a รฉcrit :
>
>
> On 11/19/26 6:47 AM, Eric Dumazet wrote:
> > tls_device_down() calls synchronize_net() for each offloaded context
> > bound to the device going down. As this runs from the NETDEV_DOWN
> > notifier, a device with N offloaded sockets waits for N RCU grace
> > periods while RTNL is held.
> >
> > Split the loop:
> >
> > - First stop the offload for all contexts: switch to the software
> >   fallback, clear ctx->netdev and set TLS_RX_DEV_DEGRADED.
> >
> > - Then call synchronize_net() once, if there is at least one context.
> >
> > - Finally release the driver state and drop the reference of each
> >   context, as before.
> >
> > The contexts are on a private list with a reference held, and the
> > first step only writes to fields of each context. The only change in
> > behavior is that all contexts stop being offloaded before the driver
> > state of the first one is released.
> >
> > Compile tested only, with CONFIG_TLS_DEVICE=y.
>
>
>
> I tested this with the netdevsim TLS offload emulation [1] (changed a little locally): N sockets with
> TX and RX offloaded on one port, then "ip link set down" on it.
>

Thanks for testing !

> sockets    before    after
>     100   12.7 ms   8.6 ms
>    1000   39.1 ms   11.5 ms
>    5000  160.8 ms   19.2 ms
>   20000  577.2 ms   44.1 ms
>
>
> Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
>
> [1] https://lore.kernel.org/netdev/20261117140642.4008-1-jiayuan.chen@linux.dev/
>
Technical Details
Message-ID: <CAL4WiiruW9sj=KsdYHXyJvAaRK8hxP-bm0=AGNrbSt7gEq8rXQ@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369171-linux-kernel-netdev=dewy.ru
References: <20261118224758.1617869-1-edumazet@kernel.org> <9013e41a-302d-4748-b9c7-058307140c3d@linux.dev>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369171-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] tls: wait for a single RCU grace period in tls_device_down()
Date: Mon, 23 Nov 2026 10:17:02 +0100
Organization: Usenet Network
Message-ID: <CAL4WiiruW9sj=KsdYHXyJvAaRK8hxP-bm0=AGNrbSt7gEq8rXQ@mail.gmail.com>
References: <20261118224758.1617869-1-edumazet@kernel.org> <9013e41a-302d-4748-b9c7-058307140c3d@linux.dev>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="3835427"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:5oLgxlxaKyJpHSXzXoSMfCvQ6jk= sha256:NoEPaWojiJhS5IWqIIsscgogj5/to2i5Vt9BbEX+3lw=
	sha1:KPf2drUNymEWWZQAVTTNpj/G/9E= sha256:NuyPrcL5/dG9qBFVtOQWC0Vm0ajo+2KCyMoZGEQ4vCE=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 45D31125D98; Mon, 23 Nov 2026 12:17:38 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id nOQ9D5FkyEGw;
	Mon, 23 Nov 2026 12:17:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369171-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 29A28125D97; Mon, 23 Nov 2026 12:17:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7B08C2785D; Mon, 23 Nov 2026 09:17:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795425435;
	b=spOyYsh1M3yfRfMDhpiJIi6XBFEBe0Hed4OgMY0h6agaOppC5sddbL5tNpxhaYMcOhYd
	 ZYshAv5chjsHRU9bc/N3dQaOs4OZ7GcF605z1DKksnKy2QfReP42DRFZSClSCW3No4iK2
	 CyDPOLubBaXK4NMe2UU1BtM4xNL3hLuArbZgKkKfL8XgFVnAZOlWWuXwd8I+LrcfU1WIn
	 25BBWULaV/llk2NrQqHwWidKyNt9LuYuorEGNeR/QyqPOBE/+x6hm8swPkGAqfOEaxMZb
	 L5e2qtR2cQFVYfVbMwgbhkmknwbrSpNLf4UTT88gjL1aMvDLo7GfUZfaeLOJk8Hczag==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795425435;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=2KIRo0DRE/jyfsT3OmSQz0ASdV76VBtH9uLmWxCW9h4=;
	b=E0+hwsrXAgTmEqMvX9v8C1K7CyTBo7rIsJOYWKSdyG5Gn54vjIiCrEOduGuYP7LDEuso
	 M1TCrqPxDMyky4OQufJ2SHuXX8zdL25WPmEWrfVyDfVW1EAyrsJWiPZdfr4xkvq+DsQu/
	 3/QePyY7Cgk4RAQaMg3ur9qrFwmTv92nhIBAtuVfZQUZ1R7wsMXxWCkUycJ7c6Q/BG3nz
	 FY7VJHZd5l3qepr3bRW5//rhHh2FWvQD0wtW7E8gqzq2RTO3BdGPTA3LlMY0IN2S3CdFN
	 +6jrmD8tLmNJRXD6/T9m2baFZHl10IVoXmv77JYyNTs836QgrG2ZnEN8DRturqVuMCA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hOooB8xn;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 54921606A32C;
	Mon, 23 Nov 2026 09:17:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hOooB8xn
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795425434;
	b=cd5RvSRXqDQuK5Pm8Y1amQ9uzmSwudVWg1sbvT6MM1ypLZ//YBGFOGUKI7O990BFWwkC
	 XmXL/edDGaNxvEjna2ah4P6bqvTnaoRk8fGlFGvDGnoQZwn6yUW9P2tC9pIJ+3DhkLLMj
	 751DAvWVX9fE5wwA9VP2MVIkrQAiACF4vuqrD4I0349TB4bBXBTgEEtJQhFr8wt8Ww7iZ
	 rxqpRJAfK0hnezl63ZAIdBH4tHkV56etWgwEApOaakGogudmdR9KPyAF7pyMmkouVzY/5
	 IgCzDjpK239nKv1Nd2IHdVemA83OH7ygS5ldak00TO/BO+FlzQ/9h4UwUyrA+hO5+Zw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795425434;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
	 From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
	 Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=2KIRo0DRE/jyfsT3OmSQz0ASdV76VBtH9uLmWxCW9h4=;
	b=YcN76IYAGQsQMNId6oP2u1eurO7Wq0cA0QueD07zbp/u/ScA+fB82Y3dkoRWnClQEsOc
	 p8vCXHzqrGlMq2CnT/lfByL9RZk4ju7RZOfs7O4kf4qudlvzeO0DJoLv2+q2Dzqj0re+i
	 V3k1vbPVP6npZxqKjKWenDjpOACf9iY4N5B3DgOsM/zZp3qmOVKO73IuyI6Wxp5NWUd8+
	 V5i10Dt/v53ukvxpy8JNELuMM3N/XBoDJ18yUCLvSIT1rKuxS11CV1IJKEVTfFpSsvJWM
	 jHE9oW3dUXC+ogk9BAXRdqPCemPqrL9AGriFLmTBxfA86A74kJRehjc1DDC1g7JQo4g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hOooB8xn;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 714F4606A31A
	for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 09:17:14 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F186A1F000E0
	for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 09:17:13 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795425434;
	bh=2KIRo0DRE/jyfsT3OmSQz0ASdV76VBtH9uLmWxCW9h4=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=hOooB8xnxn7Ht8+2tpIGOiz01ytHPjuguzuQSg6ZvYAIenVb8vXyMLUX0CuBR9cea
	 AnCUsYI02Jy9In7R1rhqRgyOAvaSu049/ST6X8uc59js1c154eZkAnKJClW1UeFZJK
	 JjRXuJF3B12T5h8YxMq7r5GBwgTznUDSP0Uz4+Z+7liDjc2b7U60oKPl8WgN6Kr9nn
	 +JfA6BpwVCpFvzxRE9a8lSDVua7ME0iMIhUceU0hZJlaHsfLqBoD8sfA2uTkxTPcUC
	 r/gIXrtMb0zWc4c19awO4n+dpFUyHNJmdYRYKmcUvbKqifMEAD1UqELlZBcx40TZFZ
	 AVtEkxpIezy/Q==
X-Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-53c156ba662so1661324b6e.1
        for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 01:17:13 -0800 (PST)
X-Forwarded-Encrypted: i=1; AL+hErGyy+EnSuZhBYUO7Sjaf4+MNwvaGzUO6eQg/cCWoOiiKQHBIjovwNuXp0u1PNBs7Ovf7aocprI=@vger.kernel.org
X-Gm-Message-State: APuU4Z/ULYq9vGQJ1qL68cVp9kZKYdKnAZZIcnLFPguSzLT/DIrisMSc
	OFZKQIyazmB2k31BY/dUC/2tZV1qwgEbaNgUyw7Lci4tESz9L4lgEQUVzJKv/h7ptPxgXmmb4cm
	muT46OC9cqS36UzcI1q28ROIQFnvXqxQ=
X-Received: by 2002:a05:6808:4fcb:b0:574:524d:f242 with SMTP id
 5614622812f47-57a0b34c96fmr12216631b6e.26.1795425433274; Mon, 23 Nov 2026
 01:17:13 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <9013e41a-302d-4748-b9c7-058307140c3d@linux.dev>
X-Gmail-Original-Message-ID: <CAL4WiiruW9sj=KsdYHXyJvAaRK8hxP-bm0=AGNrbSt7gEq8rXQ@mail.gmail.com>
X-Gm-Features: Aa3M54obqwv3gnptkNfg3cmRkSRl-M0WEsjC8WyKuQCQN5rm8J4C4UJQMDbSS8c
X-Cc: "David S . Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, 
	Paolo Abeni <pabeni@redhat.com>, Willem de Bruijn <willemb@google.com>, Simon Horman <horms@kernel.org>, 
	netdev@vger.kernel.org