From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Yafang Shao <laoar.shao@gmail.com>,
David Vernet <void@manifault.com>, Tejun Heo <tj@kernel.org>
Subject: [PATCH bpf-next v2 0/2] Transfer RCU lock state across subprog calls
Date: Mon, 5 Feb 2024 05:56:44 +0000 [thread overview]
Message-ID: <20240205055646.1112186-1-memxor@gmail.com> (raw)
David suggested during the discussion in [0] that we should handle RCU
locks in a similar fashion to spin locks where the verifier understands
when a lock held in a caller is released in callee, or lock taken in
callee is released in a caller, or the callee is called within a lock
critical section. This set extends the same semantics to RCU read locks
and adds a few selftests to verify correct behavior. This issue has also
come up for sched-ext programs.
This would now allow static subprog calls to be made without errors
within RCU read sections, for subprogs to release RCU locks of callers
and return to them, or for subprogs to take RCU lock which is later
released in the caller.
[0]: https://lore.kernel.org/bpf/20240204120206.796412-1-memxor@gmail.com
Changelog:
----------
v1 -> v2:
v1: https://lore.kernel.org/bpf/20240204230231.1013964-1-memxor@gmail.com
* Add tests for global subprog behaviour (Yafang)
* Add Acks, Tested-by (Yonghong, Yafang)
Kumar Kartikeya Dwivedi (2):
bpf: Transfer RCU lock state between subprog calls
selftests/bpf: Add tests for RCU lock transfer between subprogs
kernel/bpf/verifier.c | 3 +-
.../selftests/bpf/prog_tests/rcu_read_lock.c | 6 +
.../selftests/bpf/progs/rcu_read_lock.c | 120 ++++++++++++++++++
3 files changed, 127 insertions(+), 2 deletions(-)
base-commit: 2a79690eae953daaac232f93e6c5ac47ac539f2d
--
2.40.1
next reply other threads:[~2024-02-05 5:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 5:56 Kumar Kartikeya Dwivedi [this message]
2024-02-05 5:56 ` [PATCH bpf-next v2 1/2] bpf: Transfer RCU lock state between subprog calls Kumar Kartikeya Dwivedi
2024-02-05 15:14 ` David Vernet
2024-02-05 5:56 ` [PATCH bpf-next v2 2/2] selftests/bpf: Add tests for RCU lock transfer between subprogs Kumar Kartikeya Dwivedi
2024-02-05 12:55 ` Yafang Shao
2024-02-05 15:14 ` David Vernet
2024-02-06 4:10 ` [PATCH bpf-next v2 0/2] Transfer RCU lock state across subprog calls patchwork-bot+netdevbpf
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=20240205055646.1112186-1-memxor@gmail.com \
--to=memxor@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=laoar.shao@gmail.com \
--cc=martin.lau@kernel.org \
--cc=tj@kernel.org \
--cc=void@manifault.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