mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Changwoo Min <changwoo@igalia.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eddy Z <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Tejun Heo <tj@kernel.org>,
	Andrea Righi <arighi@nvidia.com>,
	kernel-dev@igalia.com, bpf <bpf@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next] bpf: Add a retry after refilling the free list when unit_alloc() fails
Date: Sun, 16 Feb 2025 00:16:43 +0900	[thread overview]
Message-ID: <6632e26d-996c-432e-956f-5be178722e5b@igalia.com> (raw)
In-Reply-To: <CAADnVQL5dt7_S-zFSh-ps7uPfL2ofYs0vo1fFuFBwiz0=DV2Vw@mail.gmail.com>

Hello,

On 25. 2. 15. 12:51, Alexei Starovoitov wrote:
 > On Fri, Feb 14, 2025 at 1:24 AM Changwoo Min <changwoo@igalia.com> wrote:
 >>
 >> Hello Alexei,
 >>
 >> Thank you for the comments! I reordered your comments for ease of
 >> explanation.
 >>
 >> On 25. 2. 14. 02:45, Alexei Starovoitov wrote:
 >>> On Wed, Feb 12, 2025 at 12:49 AM Changwoo Min <changwoo@igalia.com> 
wrote:
 >>
 >>> The commit log is too terse to understand what exactly is going on.
 >>> Pls share the call stack. What is the allocation size?
 >>> How many do you do in a sequence?
 >>
 >> The symptom is that an scx scheduler (scx_lavd) fails to load on
 >> an ARM64 platform on its first try. The second try succeeds. In
 >> the failure case, the kernel spits the following messages:
 >>
 >> [   27.431380] sched_ext: BPF scheduler "lavd" disabled (runtime error)
 >> [   27.431396] sched_ext: lavd: ops.init() failed (-12)
 >> [   27.431401]    scx_ops_enable.isra.0+0x838/0xe48
 >> [   27.431413]    bpf_scx_reg+0x18/0x30
 >> [   27.431418]    bpf_struct_ops_link_create+0x144/0x1a0
 >> [   27.431427]    __sys_bpf+0x1560/0x1f98
 >> [   27.431433]    __arm64_sys_bpf+0x2c/0x80
 >> [   27.431439]    do_el0_svc+0x74/0x120
 >> [   27.431446]    el0_svc+0x80/0xb0
 >> [   27.431454]    el0t_64_sync_handler+0x120/0x138
 >> [   27.431460]    el0t_64_sync+0x174/0x178
 >>
 >> The ops.init() failed because the 5th bpf_cpumask_create() calls
 >> failed during the initialization of the BPF scheduler. The exact
 >> point where bpf_cpumask_create() failed is here [1]. That scx
 >> scheduler allocates 5 CPU masks to aid its scheduling decision.
 >
 > ...
 >
 >> In this particular scenario, the IRQ is not disabled. I just
 >
 > since irq-s are not disabled the unit_alloc() should have done:
 >          if (cnt < c->low_watermark)
 >                  irq_work_raise(c);
 >
 > and alloc_bulk() should have started executing after the first
 > calloc_cpumask(&active_cpumask);
 > to refill it from 3 to 64

Is there any possibility that irq_work is not scheduled right away on 
aarch64?

 >
 > What is sizeof(struct bpf_cpumask) in your system?

In my system, sizeof(struct bpf_cpumask) is 1032.

 >
 > Something doesn't add up. irq_work_queue() should be
 > instant when irq-s are not disabled.
 > This is not IRQ_WORK_LAZY.> Are you running PREEMPT_RT ?

No, CONFIG_PREEMPT_RT is not set.

Regards,
Changwoo Min

  reply	other threads:[~2025-02-15 15:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12  8:48 Changwoo Min
2025-02-12 18:33 ` Song Liu
2025-02-13  8:41   ` Changwoo Min
2025-02-13  9:05     ` Kumar Kartikeya Dwivedi
2025-02-13 10:11       ` Changwoo Min
2025-02-13 17:45 ` Alexei Starovoitov
2025-02-14  9:23   ` Changwoo Min
2025-02-15  3:51     ` Alexei Starovoitov
2025-02-15 15:16       ` Changwoo Min [this message]
2025-02-16 16:04         ` Changwoo Min
2025-02-17  2:19           ` Hou Tao

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=6632e26d-996c-432e-956f-5be178722e5b@igalia.com \
    --to=changwoo@igalia.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-dev@igalia.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=tj@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

all inboxes | Powered by JetHome®