The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jakub Sitnicki <jakub@cloudflare.com>
To: Kenneth Lee <kennethbwlee@snu.ac.kr>
Cc: andrii@kernel.org,  ast@kernel.org,  bpf@vger.kernel.org,
	daniel@iogearbox.net,  eddyz87@gmail.com,
	 john.fastabend@gmail.com, jolsa@kernel.org,
	 linux-kernel@vger.kernel.org,  martin.lau@linux.dev,
	memxor@gmail.com,  rhkrqnwk98@gmail.com,  sdf@fomichev.me,
	song@kernel.org,  yonghong.song@linux.dev
Subject: Re: BUG: bpf: task hung in lock_sock_nested during sockmap free
Date: Thu, 20 Aug 2026 17:12:00 +0200	[thread overview]
Message-ID: <87ecfsvnb3.fsf@cloudflare.com> (raw)
In-Reply-To: <20260820022848.1408056-1-kennethbwlee@snu.ac.kr> (Kenneth Lee's message of "Thu, 20 Aug 2026 11:28:48 +0900")

On Thu, Aug 20, 2026 at 11:28 AM +09, Kenneth Lee wrote:
> After further analysis, we found that this report is triggered by an
> SK_MSG BPF program repeatedly calling bpf_msg_apply_bytes(msg, 1).
>
> For a message of about 557 KiB, this results in approximately 557,000
> one-byte verdict and push iterations. The TCP BPF send path keeps the
> socket lock while processing these iterations, so deferred
> sock_map_free() waits for the same socket lock.
>
> This appears to be a long lock-held processing path triggered by a valid
> but very unrealistic msg_apply_bytes(1) workload. We believe this behavior
> is benign, but let us know if other behavior is expected.

Thanks for the follow up.

Perhaps that is a convoluted scenario but what caught my attention is
that if you got the hung task notification after ~120 seconds, and it
took ~500k prog runs to trigger it, then something seems quite slow
because we're talking ~240 usec/prog run.

If you have the repro still at hand, it might be worth to take a look at
the CPU trace [1] or a Flamegraph [2] to see where the CPU time goes.

-jkbs

[1] https://perfetto.dev/docs/getting-started/system-tracing
[2] https://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html

      reply	other threads:[~2026-08-20 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12  5:07 BUG: bpf: task hung in lock_sock_nested during sockmap free Kenneth Lee
2026-08-20  2:28 ` Kenneth Lee
2026-08-20 15:12   ` Jakub Sitnicki [this message]

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=87ecfsvnb3.fsf@cloudflare.com \
    --to=jakub@cloudflare.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kennethbwlee@snu.ac.kr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=rhkrqnwk98@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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