BPF List
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Peilin Ye <yepeilin@google.com>
Cc: Eduard Zingerman <eddyz87@gmail.com>, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	kernel-patches-bot@fb.com,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Josh Don <joshdon@google.com>, Barret Rhoden <brho@google.com>
Subject: Re: [PATCH bpf-next v2 1/2] bpf: Reject bpf_timer for PREEMPT_RT
Date: Wed, 10 Sep 2025 10:02:23 +0800	[thread overview]
Message-ID: <cad23151-7039-4a7f-b4ea-030ec161b2ba@linux.dev> (raw)
In-Reply-To: <CAADnVQ+G4u1vM7OUUKaos+jyG6FF8-72t8rMKyqRoa7nuF8xFA@mail.gmail.com>



On 10/9/25 06:49, Alexei Starovoitov wrote:
> On Mon, Sep 8, 2025 at 3:42 PM Peilin Ye <yepeilin@google.com> wrote:
>>
>> Hi all,
>>
>>>>> [   35.955287] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
>>
>> FWIW, I was able to reproduce this pr_err() after enabling
>> CONFIG_PREEMPT_RT and CONFIG_DEBUG_ATOMIC_SLEEP.
>>
>> On Mon, Sep 08, 2025 at 12:29:42PM -0700, Eduard Zingerman wrote:
>>> On Mon, 2025-09-08 at 12:20 -0700, Eduard Zingerman wrote:
>>>> On Mon, 2025-09-08 at 12:40 +0800, Leon Hwang wrote:
>>>>> When enable CONFIG_PREEMPT_RT, the kernel will panic when run timer
>>>>> selftests by './test_progs -t timer':
>>>
>>> Related discussions:
>>
>> [1]
>>> - https://lore.kernel.org/bpf/b634rejnvxqu6knjqlijosxrcnxbbpagt4de4pl6env6dwldz2@hoofqufparh5/T/
>>> - https://lore.kernel.org/bpf/lhmdi6npaxqeuaumjhmq24ckpul7ufopwzxjbsezhepguqkxag@wolz4r2fazu2/T/
>>
>> [...]
>>
>>>> The error is reported because of the kmalloc call in the __bpf_async_init, right?
>>>> Instead of disabling timers for PREEMPT_RT, would it be possible to
>>>> switch implementation to use kernel/bpf/memalloc.c:bpf_mem_alloc() instead?
>>
>> Just in case - actually there was a patch that does this:
>>
>> [2] https://lore.kernel.org/bpf/20250905061919.439648-1-yepeilin@google.com/
> 
> Though switch to bpf_mem_alloc() kinda fixes it,
> it's too late for this release and it's not a complete fix for RT,
> so I think it's better to disable it in the verifier like this patch does.
> 
> Leon, pls respin targeting bpf tree.

My original intention for targeting the bpf-next tree was to ensure that
the new 'timer_interrupt' selftest is skipped when PREEMPT_RT is enabled.

If I respin the patch for the bpf tree, I have to drop the part that
skips the timer_interrupt test case. Should I?

> Also trim the commit log. It's too verbose and not quite correct.
> "kernel will panic"
> That's true only if you have panic-on-warn set.
> Just say that the kernel will warn.
> 

Sure.

I’ll make it more concise and clarify that "the kernel will warn",
rather than saying it will always panic.

Thanks,
Leon


  reply	other threads:[~2025-09-10  2:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08  4:40 [PATCH bpf-next v2 0/2] bpf: Reject bpf_timer for PREEMPT_RT Leon Hwang
2025-09-08  4:40 ` [PATCH bpf-next v2 1/2] " Leon Hwang
2025-09-08 19:20   ` Eduard Zingerman
2025-09-08 19:29     ` Eduard Zingerman
2025-09-08 22:42       ` Peilin Ye
2025-09-08 22:51         ` Alexei Starovoitov
2025-09-09  9:00           ` Peilin Ye
2025-09-09 15:59             ` Alexei Starovoitov
2025-09-09 22:49         ` Alexei Starovoitov
2025-09-10  2:02           ` Leon Hwang [this message]
2025-09-10  2:06             ` Alexei Starovoitov
2025-09-11 16:38               ` Alexei Starovoitov
2025-09-12  2:20                 ` Leon Hwang
2025-09-08  4:40 ` [PATCH bpf-next v2 2/2] selftests/bpf: Skip timer cases when bpf_timer is not supported Leon Hwang

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=cad23151-7039-4a7f-b4ea-030ec161b2ba@linux.dev \
    --to=leon.hwang@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brho@google.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=joshdon@google.com \
    --cc=kernel-patches-bot@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=song@kernel.org \
    --cc=yepeilin@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