On 2/9/21 2:43 PM, KP Singh wrote:
On Tue, Feb 9, 2021 at 11:32 PM Alexei Starovoitov <ast@xxxxxx> wrote:
On 2/9/21 1:12 PM, KP Singh wrote:
On Tue, Feb 9, 2021 at 9:57 PM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
From: Alexei Starovoitov <ast@xxxxxxxxxx>
Since sleepable programs are now executing under migrate_disable
the per-cpu maps are safe to use.
The map-in-map were ok to use in sleepable from the time sleepable
progs were introduced.
Note that non-preallocated maps are still not safe, since there is
no rcu_read_lock yet in sleepable programs and dynamically allocated
map elements are relying on rcu protection. The sleepable programs
have rcu_read_lock_trace instead. That limitation will be addresses
in the future.
Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
Acked-by: KP Singh <kpsingh@xxxxxxxxxx>
Thanks! I actually tested out some of our logic which uses per-cpu maps by
switching the programs to their sleepable counterparts
You mean after applying this set, right?
migrate_disable is the key.
It will be difficult to backport to your kernels though.
The bpf change to enable per-cpu is easy, but backporting
sched support is a different game.
Yes after applying the whole set.
Also, I think I also got it to work on 5.10 by (I am little less sure
of this one though)
- Backporting https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=12fa97c64dce2f3c2e6eed5dc618bb9046e40bf0
- Backporting https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=74d862b682f51e45d25b95b1ecf212428a4967b0
- And, backporting this set (I initially missed
https://lore.kernel.org/bpf/20210209194856.24269-3-alexei.starovoitov@xxxxxxxxx
where you add the
calls and ran into issues).
and the whole machinery that it depends on.