From: Roman Gushchin <guro@fb.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Tejun Heo <tj@kernel.org>, Kernel Team <Kernel-team@fb.com>,
"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>,
"Yonghong Song" <yhs@fb.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 bpf-next 0/4] cgroup bpf auto-detachment
Date: Fri, 24 May 2019 21:40:39 +0000 [thread overview]
Message-ID: <20190524214032.GA15067@castle> (raw)
In-Reply-To: <20190524210321.tzpt7ilaasaagtou@ast-mbp.dhcp.thefacebook.com>
On Fri, May 24, 2019 at 02:03:23PM -0700, Alexei Starovoitov wrote:
> On Thu, May 23, 2019 at 12:45:28PM -0700, Roman Gushchin wrote:
> > This patchset implements a cgroup bpf auto-detachment functionality:
> > bpf programs are detached as soon as possible after removal of the
> > cgroup, without waiting for the release of all associated resources.
>
> The idea looks great, but doesn't quite work:
>
> $ ./test_cgroup_attach
> #override:PASS
> [ 66.475219] BUG: sleeping function called from invalid context at ../include/linux/percpu-rwsem.h:34
> [ 66.476095] in_atomic(): 1, irqs_disabled(): 0, pid: 21, name: ksoftirqd/2
> [ 66.476706] CPU: 2 PID: 21 Comm: ksoftirqd/2 Not tainted 5.2.0-rc1-00211-g1861420d0162 #1564
> [ 66.477595] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
> [ 66.478360] Call Trace:
> [ 66.478591] dump_stack+0x5b/0x8b
> [ 66.478892] ___might_sleep+0x22f/0x290
> [ 66.479230] cpus_read_lock+0x18/0x50
> [ 66.479550] static_key_slow_dec+0x41/0x70
> [ 66.479914] cgroup_bpf_release+0x1a6/0x400
> [ 66.480285] percpu_ref_switch_to_atomic_rcu+0x203/0x330
> [ 66.480754] rcu_core+0x475/0xcc0
> [ 66.481047] ? switch_mm_irqs_off+0x684/0xa40
> [ 66.481422] ? rcu_note_context_switch+0x260/0x260
> [ 66.481842] __do_softirq+0x1cf/0x5ff
> [ 66.482174] ? takeover_tasklets+0x5f0/0x5f0
> [ 66.482542] ? smpboot_thread_fn+0xab/0x780
> [ 66.482911] run_ksoftirqd+0x1a/0x40
> [ 66.483225] smpboot_thread_fn+0x3ad/0x780
> [ 66.483583] ? sort_range+0x20/0x20
> [ 66.483894] ? __kthread_parkme+0xb0/0x190
> [ 66.484253] ? sort_range+0x20/0x20
> [ 66.484562] ? sort_range+0x20/0x20
> [ 66.484878] kthread+0x2e2/0x3e0
> [ 66.485166] ? kthread_create_worker_on_cpu+0xb0/0xb0
> [ 66.485620] ret_from_fork+0x1f/0x30
>
> Same test runs fine before the patches.
>
Ouch, static_branch_dec() might block, so it's not possible to call it from
percpu ref counter release callback. It's not what I expected, tbh.
Good catch, thanks!
prev parent reply other threads:[~2019-05-24 21:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 19:45 [PATCH v3 bpf-next 0/4] cgroup bpf auto-detachment Roman Gushchin
2019-05-23 19:45 ` Roman Gushchin
2019-05-23 19:45 ` [PATCH v3 bpf-next 1/4] bpf: decouple the lifetime of cgroup_bpf from cgroup itself Roman Gushchin
2019-05-23 19:45 ` [PATCH v3 bpf-next 2/4] selftests/bpf: convert test_cgrp2_attach2 example into kselftest Roman Gushchin
2019-05-23 19:45 ` Roman Gushchin
2019-05-23 19:45 ` [PATCH v3 bpf-next 3/4] selftests/bpf: enable all available cgroup v2 controllers Roman Gushchin
2019-05-23 19:45 ` Roman Gushchin
2019-05-23 19:45 ` [PATCH v3 bpf-next 4/4] selftests/bpf: add auto-detach test Roman Gushchin
2019-05-23 19:45 ` Roman Gushchin
2019-05-23 23:09 ` Yonghong Song
2019-05-23 23:43 ` Roman Gushchin
2019-05-23 23:49 ` Roman Gushchin
2019-05-24 21:03 ` [PATCH v3 bpf-next 0/4] cgroup bpf auto-detachment Alexei Starovoitov
2019-05-24 21:40 ` Roman Gushchin [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=20190524214032.GA15067@castle \
--to=guro@fb.com \
--cc=Kernel-team@fb.com \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sdf@fomichev.me \
--cc=tj@kernel.org \
--cc=yhs@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.