From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Song Liu <songliubraving@meta.com>,
Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Song Liu <song@kernel.org>, bpf <bpf@vger.kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@kernel.org>,
Kernel Team <kernel-team@meta.com>, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH v2 bpf-next] bpf: Avoid unnecessary -EBUSY from htab_lock_bucket
Date: Mon, 09 Oct 2023 16:58:13 +0200 [thread overview]
Message-ID: <004a3768499f51b630cc2c4f561d051a7d891535.camel@linux.ibm.com> (raw)
In-Reply-To: <92BDCF92-3219-4EDA-A6F8-1EA8D88BEE41@fb.com>
On Fri, 2023-10-06 at 01:15 +0000, Song Liu wrote:
> > On Oct 4, 2023, at 6:50 PM, Song Liu <songliubraving@meta.com>
> > wrote:
> > > On Oct 4, 2023, at 5:11 PM, Song Liu <songliubraving@meta.com>
> > > wrote:
>
> [...]
>
> > > > > >
> > > > > > > diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
> > > > > > > index a8c7e1c5abfa..fd8d4b0addfc 100644
> > > > > > > --- a/kernel/bpf/hashtab.c
> > > > > > > +++ b/kernel/bpf/hashtab.c
> > > > > > > @@ -155,13 +155,15 @@ static inline int
> > > > > > > htab_lock_bucket(const struct bpf_htab *htab,
> > > > > > > hash = hash & min_t(u32, HASHTAB_MAP_LOCK_MASK,
> > > > > > > htab->n_buckets - 1);
> > > > > > >
> > > > > > > preempt_disable();
> > > > > > > + local_irq_save(flags);
> > > > > > > if (unlikely(__this_cpu_inc_return(*(htab-
> > > > > > > >map_locked[hash])) != 1)) {
> > > > > > > __this_cpu_dec(*(htab->map_locked[hash]));
> > > > > > > + local_irq_restore(flags);
> > > > > > > preempt_enable();
> > > > > > > return -EBUSY;
> > > > > > > }
> > > > > > >
> > > > > > > - raw_spin_lock_irqsave(&b->raw_lock, flags);
> > > > > > > + raw_spin_lock(&b->raw_lock);
> > > > >
> > > > > Song,
> > > > >
> > > > > take a look at s390 crash in BPF CI.
> > > > > I suspect this patch is causing it.
> > > >
> > > > It indeed looks like triggered by this patch. But I haven't
> > > > figured
> > > > out why it happens. v1 seems ok for the same tests.
>
> Update my findings today:
>
> I tried to reproduce the issue locally with qemu on my server
> (x86_64).
> I got the following artifacts:
>
> 1. bzImage and selftests from CI: (need to login to GitHub)
> https://github.com/kernel-patches/bpf/suites/16885416280/artifacts/964765766
>
> 2. cross compiler:
> https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-s390-linux.tar.gz
>
> 3. root image:
> https://libbpf-ci.s3.us-west-1.amazonaws.com/libbpf-vmtest-rootfs-2022.10.23-bullseye-s390x.tar.zst
>
> With bzImage compiled in CI, I can reproduce the issue with qemu.
> However, if I compile the kernel locally with the cross compiler
> (with .config from CI, and then olddefconfig), the issue cannot
> be reproduced. I have attached the two .config files here. They
> look very similar, except the compiler version:
>
> -CONFIG_CC_VERSION_TEXT="gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
> +CONFIG_CC_VERSION_TEXT="s390-linux-gcc (GCC) 13.2.0"
>
> So far, I still think v2 is the right patch. But I really cannot
> explain the issue on the bzImage from the CI. I cannot make much
> sense out of the s390 assembly code either. (TIL: gdb on my x86
> server can disassem s390 binary).
>
> Ilya,
>
> Could you please take a look at this?
>
> Thanks,
> Song
>
> PS: the root image from the CI is not easy to use. Hopefully you
> have something better than that.
Hi,
sorry for the long silence, I was traveling and then sick.
I'll look into this ASAP.
Best regards,
Ilya
next prev parent reply other threads:[~2023-10-09 15:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 0:43 [PATCH v2 bpf-next] bpf: Avoid unnecessary -EBUSY from htab_lock_bucket Song Liu
2023-10-04 3:08 ` Andrii Nakryiko
2023-10-04 3:33 ` Alexei Starovoitov
2023-10-04 16:18 ` Song Liu
2023-10-05 0:11 ` Song Liu
2023-10-05 1:50 ` Song Liu
2023-10-06 1:15 ` Song Liu
2023-10-09 14:58 ` Ilya Leoshkevich [this message]
2023-10-10 20:48 ` Ilya Leoshkevich
2023-10-10 22:13 ` Song Liu
2023-10-12 0:42 ` Andrii Nakryiko
2023-10-12 6:01 ` Song Liu
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=004a3768499f51b630cc2c4f561d051a7d891535.camel@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
--cc=song@kernel.org \
--cc=songliubraving@meta.com \
--cc=tj@kernel.org \
/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