From: Alexei Starovoitov <ast@fb.com>
To: Yonghong Song <yhs@fb.com>, <daniel@iogearbox.net>,
<netdev@vger.kernel.org>
Cc: <kernel-team@fb.com>
Subject: Re: [RFC PATCH bpf-next 2/6] bpf: add bpf_get_stack helper
Date: Sun, 8 Apr 2018 22:02:38 -0700 [thread overview]
Message-ID: <49c15114-c518-b591-470a-b4073a675588@fb.com> (raw)
In-Reply-To: <625de1bb-7cb2-5f9e-01c3-a863cd27b0e6@fb.com>
On 4/8/18 9:53 PM, Yonghong Song wrote:
>>> @@ -1004,7 +1007,8 @@ static void __bpf_prog_put(struct bpf_prog
>>> *prog, bool do_idr_lock)
>>> bpf_prog_kallsyms_del(prog->aux->func[i]);
>>> bpf_prog_kallsyms_del(prog);
>>>
>>> - call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu);
>>> + synchronize_rcu();
>>> + __bpf_prog_put_rcu(&prog->aux->rcu);
>>
>> there should have been lockdep splat.
>> We cannot call synchronize_rcu here, since we cannot sleep
>> in some cases.
>
> Let me double check this. The following is the reason
> why I am using synchronize_rcu().
>
> With call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu) and
> _bpf_prog_put_rcu calls put_callchain_buffers() which
> calls mutex_lock(), the runtime with CONFIG_DEBUG_ATOMIC_SLEEP=y
> will complains since potential sleep inside the call_rcu is not
> allowed.
I see. Indeed. We cannot call put_callchain_buffers() from rcu callback,
but doing synchronize_rcu() here is also not possible.
How about moving put_callchain into bpf_prog_free_deferred() ?
next prev parent reply other threads:[~2018-04-09 5:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-06 21:48 [RFC PATCH bpf-next 0/6] bpf: add bpf_get_stack_helper Yonghong Song
2018-04-06 21:48 ` [RFC PATCH bpf-next 1/6] bpf: change prototype for stack_map_get_build_id_offset Yonghong Song
2018-04-06 21:48 ` [RFC PATCH bpf-next 2/6] bpf: add bpf_get_stack helper Yonghong Song
2018-04-09 3:34 ` Alexei Starovoitov
2018-04-09 4:53 ` Yonghong Song
2018-04-09 5:02 ` Alexei Starovoitov [this message]
2018-04-09 10:01 ` Daniel Borkmann
2018-04-09 16:52 ` Yonghong Song
2018-04-06 21:48 ` [RFC PATCH bpf-next 3/6] tools/bpf: add bpf_get_stack helper to tools headers Yonghong Song
2018-04-06 21:48 ` [RFC PATCH bpf-next 4/6] samples/bpf: move common-purpose perf_event functions to bpf_load.c Yonghong Song
2018-04-06 21:48 ` [RFC PATCH bpf-next 5/6] samples/bpf: add a test for bpf_get_stack helper Yonghong Song
2018-04-06 21:48 ` [RFC PATCH bpf-next 6/6] tools/bpf: add a test case " Yonghong Song
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=49c15114-c518-b591-470a-b4073a675588@fb.com \
--to=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).