mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xu Kuohai <xukuohai@huaweicloud.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	io-uring@vger.kernel.org, netdev@vger.kernel.org
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>
Subject: Re: [RFC PATCH 0/3] Introduce a classic BPF filter cache for seccomp
Date: Thu, 26 Nov 2026 23:02:14 +0800	[thread overview]
Message-ID: <309b8e49-2f9c-4a2f-9b40-8e7e7cce3455@huaweicloud.com> (raw)
In-Reply-To: <DN0AIFQ82CFP.34SDTH6ZFZC1G@gmail.com>

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


  reply	other threads:[~2026-11-26 15:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  6:48 Xu Kuohai
2026-11-20  6:48 ` [RFC PATCH 1/3] bpf: Introduce classic BPF filter cache Xu Kuohai
2026-11-20  6:48 ` [RFC PATCH 2/3] seccomp: Use the " Xu Kuohai
2026-11-20  6:48 ` [RFC PATCH 3/3] selftests/bpf: Add benchmark for seccomp filter install Xu Kuohai
2026-11-20 19:37 ` [RFC PATCH 0/3] Introduce a classic BPF filter cache for seccomp Alexei Starovoitov
2026-11-26 15:02   ` Xu Kuohai [this message]
2026-11-26 20:17     ` Alexei Starovoitov
2026-11-23  2:47 ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=309b8e49-2f9c-4a2f-9b40-8e7e7cce3455@huaweicloud.com \
    --to=xukuohai@huaweicloud.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=io-uring@vger.kernel.org \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=wad@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®