🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23135

Re: [RFC PATCH 0/3] Introduce a classic BPF filter cache for seccomp

#23135
From: Xu Kuohai
Date: Thu, 26 Nov 2026 15:02
54 lines
11641 bytes
On 11/21/2026 3:37 AM, Alexei Starovoitov wrote:
> On Thu, Nov 19, 2026 at 10:48 PM Xu Kuohai <xukuohai@huaweicloud.com> wrote:
>> The kernel repeatedly translates and JIT-compiles these same cBPF
>> programs, wasting CPU cycles and slowing down bulk startup of
>> identically sandboxed workloads. cBPF lacks dynamic instruction patching
> 
> There is no VM startup number in the series
> which makes me question the whole thing.
>

The problem comes from an agent sandbox deployment, where
sandboxes are snapshotted to disk and resumed on demand for
each new request.

Below are the Firecracker microVM startup latencies I
measured on a local server at different VM request rates.
Parentheses show the improvement over the base kernel.

VM req/s   base p50   series p50 (gain)    base p95   series p95 (gain)    base p99   series p99 (gain)
400        20.2 ms    19.7 ms  (+2%)       29.2 ms    27.9 ms  (+5%)       34.7 ms    33.3 ms  (+4%)
500        28.2 ms    27.1 ms  (+4%)       96.8 ms    69.4 ms  (+28%)      164.0 ms   107.9 ms (+34%)
600        56.6 ms    45.0 ms  (+21%)      602 ms     154.5 ms (+74%)      831.8 ms   223.6 ms (+73%)
700        65.5 ms    41.1 ms  (+37%)      1.63 s     134.1 ms (+92%)      2.43 s     194.1 ms (+92%)
800        65.4 ms    39.4 ms  (+40%)      2.97 s     113.8 ms (+96%)      4.60 s     167.3 ms (+96%)
900        61.9 ms    35.7 ms  (+42%)      3.04 s     95.2 ms  (+97%)      5.13 s     147.3 ms (+97%)
1000       53.2 ms    32.2 ms  (+39%)      3.38 s     80.0 ms  (+98%)      5.78 s     125.1 ms (+98%)

At 400 VM/s, the two kernels perform similarly. At higher
rates, the base kernel suffers severe tail latency
collapse, while this series keeps p99 below 225 ms,
reducing it by up to 98% at 1000 VM/s.

After further profiling, I found that this collapse is
mainly caused by Firecracker instances queuing on the
global pack_mutex in bpf_prog_pack_alloc(). So a better
approach is to replace the global mutex to per-pack locks.
I will work on that instead.

>> features like tail calls or tracing. Its JITed instructions remain
>> immutable at runtime. This makes it possible to share the same cBPF
>> filter between different processes.
> 
> Immutable is not enough. The image depends on the caps of the task
> that loads the filter.
> Also any task can time seccomp() and learn that somebody has this filter.
> seccomp_get_filter() needs CAP_SYS_ADMIN for that today.
> 
> fork() shares the filter already, see copy_seccomp().
> A launcher can install the common filter once and fork the VMs.
> 
> I don't think we need this.
> 
> pw-bot: cr
Technical Details
Message-ID: <309b8e49-2f9c-4a2f-9b40-8e7e7cce3455@huaweicloud.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-372181-linux-kernel-netdev=dewy.ru
References: <cover.1795139109.git.xukuohai@huaweicloud.com> <DN0AIFQ82CFP.34SDTH6ZFZC1G@gmail.com>

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-372181-linux-kernel-netdev=dewy.ru
From: xukuohai@huaweicloud.com (Xu Kuohai)
Newsgroups: linux.kernel.netdev
Subject: Re: [RFC PATCH 0/3] Introduce a classic BPF filter cache for seccomp
Date: Thu, 26 Nov 2026 23:02:14 +0800
Organization: Usenet Network
Message-ID: <309b8e49-2f9c-4a2f-9b40-8e7e7cce3455@huaweicloud.com>
References: <cover.1795139109.git.xukuohai@huaweicloud.com>
 <DN0AIFQ82CFP.34SDTH6ZFZC1G@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="492608"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0wCvd9yafXICti5hJxvcDU/9DpQ= sha256:66wrNrr88ySxZllj99txPcmBTPxVrez0rmNg65WgWrE=
	sha1:5+V/gagh/tJ48kHj4EDHuqvsLew= sha256:8HlOmDXyChkeR1Z8vGUsdwndXYBAu0F6wK9eiRwc0KM=
Content-Language: en-US
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 8818F125EE1; Thu, 26 Nov 2026 18:02:49 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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-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 7rtrsCdLuHud;
	Thu, 26 Nov 2026 18:02:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-372181-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=huaweicloud.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 1DB08125EE0; Thu, 26 Nov 2026 18:02:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 7C8F52C063; Thu, 26 Nov 2026 15:02:31 +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=1795705350;
	b=EE/3Ft/h5zATTQtXKQIjDqc08KOIwqRTDVUGCR4igkh3xeIOmb8sl0adzION5XfQ2HVv
	 MIjW3uhuPjpv3+cc8e6olmSWhy9lpH7G0yahwfbuMHvbqzuQEG2CQyL8AYSUtnvnHbc6i
	 +RdBTqTBj53mNk9MWfseO4oEkKvZeIT4dhYZSkNAYjW5JSVOuAMDARSoCque+mC0Oxsn7
	 FLVTM72qpr5gKuxGi+d3NlRMUEHxwltarcXPE4Sw2Iek/9k++Kzxlzup9/e4s4hs376zq
	 +fEBZpRNWzBm5F7wb9PqYHmqVqsc4qoJAVFzyV1ThjznHf0nPGAb4gNAMwKaeLxmbvw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795705350;
	h=X-Original-To:Received:DMARC-Filter:Received:Received:Received:
	 Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 User-Agent:Subject:Content-Language:To:Cc:References:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:X-CM-TRANSID:
	 X-Coremail-Antispam:X-CM-SenderInfo;
	bh=Qv+/RlZ3IZV9hggQM88PlxrjkV3JuGKZj3tmAt55rsU=;
	b=mI3jjOxi752qcIOJQ3IBAh78i9AA85sbeCZcA4VT1L2mw9+nS7PUUxgcH9ZA8It9LifK
	 oNC57PjwDJVeP0SSC/X5Zzur3eWhPV8XO5f2NMxvnxPOmMglDMMZUZN0E05tQNt6wrm66
	 1JQYGaMHiFslA/YG44N0NIJbtKpxtobtgb1sahhLupD+B4xSzbd9yOcTHcF5HYynOBw/M
	 e29xfD6b7URV7fwgrMF7vA4h3GpXs9agyG9wySjM+3/yuvy5fRqyVLUIZLLgUP8HYmOBU
	 1gdQ/DKLEreOvoV+B/oF/oHg+V/VuFx7/ewh7OIFChu4snfqyuQYW0+f+It7HFLK0Qw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=huaweicloud.com;
	spf=pass smtp.mailfrom=huaweicloud.com;
	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 9EC24606A32D;
	Thu, 26 Nov 2026 15:02:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=124.71.94.104
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795705344;
	b=N+hUYpSV2y9yAVP9V0j7vNjvuxQdcz1Hce2aHRJ6PAKL4mIz8bfSA/o/UqwX6NvOUPV6
	 +BoqgUEaD6TtaghvmvSiZB3U8EZthjHBP3AYsl9MmW7CSK8WK4Sfz1sZWZ6npodfJtVZZ
	 Caf1FX9zl/GB4rjtaAzhwEPibKmFcZj+rYjN1MxAR9q0KEGY4uMWgAynocsBJtN6drNrH
	 H6F+4M+pgIpszMm0yB31SgskW2TrxPa7olDRI7lkx8aHg5sz1dxfUxckVfFtVYeCnBJz2
	 WeVfK2J0HQxJ74BQYY/aBmcS5l7sYFXwNRI+S0TWKdjJ8dK8L9HKzWNc0IZljimqH4A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795705344;
	h=DMARC-Filter:Received:Received:Received:Message-ID:Date:MIME-Version:
	 User-Agent:Subject:Content-Language:To:Cc:References:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:X-CM-TRANSID:
	 X-Coremail-Antispam:X-CM-SenderInfo;
	bh=Qv+/RlZ3IZV9hggQM88PlxrjkV3JuGKZj3tmAt55rsU=;
	b=DijO6sGy1JmdBDo3lHmmuuR125g9KBE2EacxqmDe0xjHxrXNicfj83qS+UpNWqoJVAiu
	 Cklfn4C+I0hMyzuNXmAag5TzkWZX/FVn0gCi6LjmIyuE5lc8SrWHDhfuhVbO97fymZ+qL
	 xAWEWPP+3qnC702kQSDcovAmb6kniqcDkpKBvnnO9v0oSsFc18ljPAxfPK7lRZuoSi3vD
	 BbNkNkKcvR2kYiLEV2eLxIW3DQ1ozDrqyrlK96T717JnueJTH+7e36dxZ1jCvMTYVNJPC
	 xuOgbZ2G/IRMz2LJut307ZmSHG2nXgKRAeCtgdL2DdcmoKgwwerQ1mnKhu1d8Xip0Ug==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=huaweicloud.com;
	spf=pass smtp.mailfrom=huaweicloud.com;
	arc=none smtp.remote-ip=124.71.94.104
X-Received: from dggmsgout13.his.huawei.com (dggmsgout13.his.huawei.com [124.71.94.104])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB45A606A331;
	Thu, 26 Nov 2026 15:02:22 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BB45A606A331
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com
X-Received: from mail.maildlp.com (unknown [172.19.163.170])
	by dggmsgout13.his.huawei.com (SkyGuard) with ESMTP id 4jb0Bq0Fvnz1rr2v;
	Thu, 26 Nov 2026 23:02:11 +0800 (CST)
X-Received: from mail02.huawei.com (unknown [10.116.40.75])
	by mail.maildlp.com (Postfix) with ESMTP id 493BF4056D;
	Thu, 26 Nov 2026 23:02:16 +0800 (CST)
X-Received: from [10.67.111.192] (unknown [10.67.111.192])
	by APP2 (Coremail) with UTF8SMTPA id Syh0CgDXW_H2SQhr6+xRFw--.58962S2;
	Thu, 26 Nov 2026 23:02:16 +0800 (CST)
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-User-Agent: Mozilla Thunderbird
X-Cc: Kees Cook <kees@kernel.org>, Andy Lutomirski <luto@amacapital.net>,
 Will Drewry <wad@chromium.org>, Daniel Borkmann <daniel@iogearbox.net>,
 Stanislav Fomichev <sdf@fomichev.me>, "David S . Miller"
 <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>,
 Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
 Jens Axboe <axboe@kernel.dk>
X-In-Reply-To: <DN0AIFQ82CFP.34SDTH6ZFZC1G@gmail.com>
X-CM-TRANSID: Syh0CgDXW_H2SQhr6+xRFw--.58962S2
X-Coremail-Antispam: 1UD129KBjvJXoW7Wry3KFy8Gr18ZF18Jr13Jwb_yoW8KF15pF
	W3Gw4Ykr4DJw4rAwn7Xw4UuFy2vFs5JwsxCrn8Kws7try5KrWDKw4IgrWFga15Cry0g340
	vr4jq3s8Ja10v3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDU0xBIdaVrnRJUUUkEb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2
	6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4
	vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7Cj
	xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxV
	AFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2
	j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7x
	kEbVWUJVW8JwACjcxG0xvEwIxGrwACI402YVCY1x02628vn2kIc2xKxwCY1x0262kKe7AK
	xVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F4
	0E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFyl
	IxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxV
	AFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j
	6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07UAwI
	DUUUUU=
X-CM-SenderInfo: 50xn30hkdlqx5xdzvxpfor3voofrz/