BPF List
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: imran.f.khan@oracle.com
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 0/6] workqueue: introduce BPF iterators for workqueues, worker pools and pending work
Date: Mon, 10 Aug 2026 09:44:34 -1000	[thread overview]
Message-ID: <anoqInQifh6cCxp3@slm.duckdns.org> (raw)
In-Reply-To: <53158355-f12f-4efe-a480-1c375f8583ff@oracle.com>

Hello,

On Thu, Aug 06, 2026 at 04:41:01PM +0800, imran.f.khan@oracle.com wrote:
...
> When a bio exceeds the threshold it walks the open-coded
> worker_pool and workqueue iterators and prints what it finds:
> 
>   fio-2409 [003] 1246.736278: STALL: dm-crypt bio took 950434 us; sampling workqueue state now (cpu3)
>   fio-2409 [003] 1246.736282:    pool 10 cpu 2: no progress for 935 ms, work_waiting=1, running=0 idle=3/3
>   fio-2409 [003] 1246.736285:    pool 22 cpu 5: no progress for 934 ms, work_waiting=1, running=0 idle=3/3
>   fio-2409 [003] 1246.736299:    wq kcryptd_i: max_active=1 flags=0x148
>   fio-2409 [003] 1246.736300:    wq kcryptd-2: max_active=1 flags=0x168
> 
> In order to reproduce the issue easily I had RT threads hogging the CPUs and
> thus preventing timely run of workers.
> 
> Another limitation with drgn and traces is that often the production systems
> don't have drgn and/or debuginfo installed and sometimes the systems are itself
> in such a bad shape that running drgn becomes challenging.
> For such cases as well, a quick look into the bpffs to find pending works
> (like shown below) helps:
> 
> cat /sys/fs/bpf/dm_pending
>   pool=2   work=0xffff9987afc27c48 func=delayed_vfree_work+0x0/0x50
>   pool=6   work=0xffff9987afc67560 func=vmstat_update+0x0/0x50
>   pool=14  work=0xffff998484b39e20 func=kcryptd_crypt+0x0/0x310 [dm_crypt]
>   pool=22  work=0xffff9987afd67560 func=vmstat_update+0x0/0x50
>   pool=26  work=0xffff9987afda7560 func=vmstat_update+0x0/0x50
>   pool=30  work=0xffff9987afde7560 func=vmstat_update+0x0/0x50
> 
> If the issue happens randomly in short windows of few secs, collecting
> the traces for long intervals and looking for data of that short window is
> not easy.
> 
> These are the use cases/limitation I had in mind. Could you please let
> me know your thoughts?

I feel a bit conflicted because this is something only useful for debugging
and doing this subsystem-by-subsystem would mean hard coding data structure
iterators and accessors into every subsystem, when there already is a
generic, albeit with different trade-offs, way to access about the same data
through debug info and vmcore (ie. drgn).

Even in the example you gave, if you had a standing drgn script running and
trigger it on timeout threshold, it'd be able to produce the same data
that's needed. It's more cumbersome but it's also more generic and flexible.
If you really want to do it in BPF, it's not *that* difficult to write an
adhoc iterator with bpf_core_read() and friends either.

So, my concern mostly is that the use cases seem to restricted. There's no
"production" usefulness where e.g. performance or overhead matters which I
think makes the full-on iterators somewhat over-engineered.

Thanks.

-- 
tejun

      reply	other threads:[~2026-08-10 19:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28  6:55 [PATCH bpf-next 0/6] workqueue: introduce BPF iterators for workqueues, worker pools and pending work Imran Khan
2026-07-28  6:55 ` [PATCH bpf-next 1/6] workqueue: introduce a BPF open-coded iterator for traversing workqueues list Imran Khan
2026-07-28  6:55 ` [PATCH bpf-next 2/6] workqueue: introduce a seq_file form for the workqueue iterator Imran Khan
2026-07-28  6:55 ` [PATCH bpf-next 3/6] workqueue: introduce open-coded BPF iterator for worker pools Imran Khan
2026-07-28  6:55 ` [PATCH bpf-next 4/6] workqueue: introduce seq_file form of the worker_pool iterator Imran Khan
2026-07-28  6:55 ` [PATCH bpf-next 5/6] workqueue: introduce BPF iterator for pending work items Imran Khan
2026-07-28  6:55 ` [PATCH bpf-next 6/6] selftests/bpf: add tests for the workqueue BPF iterators Imran Khan
2026-08-02  2:59 ` [PATCH bpf-next 0/6] workqueue: introduce BPF iterators for workqueues, worker pools and pending work Tejun Heo
2026-08-06  8:41   ` imran.f.khan
2026-08-10 19:44     ` Tejun Heo [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=anoqInQifh6cCxp3@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=imran.f.khan@oracle.com \
    /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