mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: wusamuel@google.com,rafael@kernel.org,lenb@kernel.org,pavel@kernel.org,gregkh@linuxfoundation.org,dakr@kernel.org,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,martin.lau@linux.dev,eddyz87@gmail.com,song@kernel.org,yonghong.song@linux.dev,john.fastabend@gmail.com,kpsingh@kernel.org,sdf@fomichev.me,haoluo@google.com,jolsa@kernel.org,shuah@kernel.org
Cc: wusamuel@google.com,kernel-team@android.com,linux-kernel@vger.kernel.org,linux-pm@vger.kernel.org,bpf@vger.kernel.org,linux-kselftest@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v3 2/3] bpf: Add wakeup_source iterator
Date: Sat, 24 Jan 2026 01:50:37 +0000 (UTC)	[thread overview]
Message-ID: <baead0e0a77a98f1f54703a05fcc861f40d8f9eec0a24f96cf26df249dd1cd1f@mail.kernel.org> (raw)
In-Reply-To: <20260124012133.2451708-3-wusamuel@google.com>

[-- Attachment #1: Type: text/plain, Size: 1548 bytes --]

> diff --git a/kernel/bpf/wakeup_source_iter.c b/kernel/bpf/wakeup_source_iter.c
> new file mode 100644
> index 000000000000..ab83d212a1f9
> --- /dev/null
> +++ b/kernel/bpf/wakeup_source_iter.c

[ ... ]

> +static void wakeup_source_iter_seq_stop(struct seq_file *seq, void *v)
> +{
> +	int *srcuidx = seq->private;
> +
> +	if (*srcuidx >= 0)
> +		wakeup_sources_read_unlock(*srcuidx);
> +	*srcuidx = -1;
> +}

Should this function call __wakeup_source_seq_show(seq, v, true) when v is
NULL to notify the BPF program that iteration has completed?

Looking at other BPF iterators like map_iter, prog_iter, link_iter,
task_iter, and kmem_cache_iter, they all invoke the BPF program with
in_stop=true when the stop callback receives a NULL pointer. For example,
map_iter does:

    static void bpf_map_seq_stop(struct seq_file *seq, void *v)
    {
        if (!v)
            (void)__bpf_map_seq_show(seq, v, true);
        ...
    }

The bpf_seq_read() function in kernel/bpf/bpf_iter.c has this comment at
the stop label: "/* bpf program called if !p */", which suggests this
callback is expected.

The __wakeup_source_seq_show() function already accepts an in_stop
parameter but is never called with true. Without this callback, BPF
programs using this iterator cannot detect when iteration has finished.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21306880863

  reply	other threads:[~2026-01-24  1:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-24  1:21 [PATCH bpf-next v3 0/3] Add wakeup_source iterators Samuel Wu
2026-01-24  1:21 ` [PATCH bpf-next v3 1/3] PM: wakeup: Handle empty list in wakeup_sources_walk Samuel Wu
2026-01-27 16:15   ` Rafael J. Wysocki
2026-02-02 20:23     ` Samuel Wu
2026-02-02 20:40       ` Rafael J. Wysocki
2026-01-24  1:21 ` [PATCH bpf-next v3 2/3] bpf: Add wakeup_source iterator Samuel Wu
2026-01-24  1:50   ` bot+bpf-ci [this message]
2026-02-02 20:33     ` Samuel Wu
2026-01-24  1:21 ` [PATCH bpf-next v3 3/3] selftests/bpf: Add tests for wakeup_sources Samuel Wu
2026-01-24  1:50   ` bot+bpf-ci
2026-02-02 20:27     ` Samuel Wu

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=baead0e0a77a98f1f54703a05fcc861f40d8f9eec0a24f96cf26df249dd1cd1f@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=dakr@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haoluo@google.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@android.com \
    --cc=kpsingh@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=wusamuel@google.com \
    --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

all inboxes | Powered by JetHome®