> On Feb 23, 2021, at 3:06 AM, Peter Zijlstra <pet...@infradead.org> wrote: > > On Mon, Feb 22, 2021 at 05:20:10PM -0800, Song Liu wrote: >> BPF helpers bpf_task_storage_[get|delete] could hold two locks: >> bpf_local_storage_map_bucket->lock and bpf_local_storage->lock. Calling >> these helpers from fentry/fexit programs on functions in bpf_*_storage.c >> may cause deadlock on either locks. >> >> Prevent such deadlock with a per cpu counter, bpf_task_storage_busy, which >> is similar to bpf_prog_active. We need this counter to be global, because > > So bpf_prog_active is one of the biggest turds around, and now you're > making it worse ?! bpf_prog_active is a distraction here. We are trying to enable task local storage for fentry/fext programs, which do not use bpf_prog_active. bpf_task_storage_busy counter is introduced to protect against a specific pattern of deadlocks (attaching fentry/fexit on bpf_task_storage_[get|delete] helpers, then let the programs call these two helpers again). Thanks, Song
- [PATCH v4 bpf-next 0/6] bpf: enable task local storage ... Song Liu
- [PATCH v4 bpf-next 2/6] bpf: prevent deadlock from... Song Liu
- Re: [PATCH v4 bpf-next 2/6] bpf: prevent deadl... Andrii Nakryiko
- Re: [PATCH v4 bpf-next 2/6] bpf: prevent d... Song Liu
- Re: [PATCH v4 bpf-next 2/6] bpf: preve... Andrii Nakryiko
- Re: [PATCH v4 bpf-next 2/6] bpf: ... Alexei Starovoitov
- Re: [PATCH v4 bpf-next 2/6] bpf: prevent deadl... Peter Zijlstra
- Re: [PATCH v4 bpf-next 2/6] bpf: prevent d... Song Liu
- [PATCH v4 bpf-next 1/6] bpf: enable task local sto... Song Liu
- Re: [PATCH v4 bpf-next 1/6] bpf: enable task l... kernel test robot
- Re: [PATCH v4 bpf-next 1/6] bpf: enable task l... kernel test robot
- Re: [PATCH v4 bpf-next 1/6] bpf: enable task l... Martin KaFai Lau
- [PATCH v4 bpf-next 6/6] bpf: runqslower: use task ... Song Liu
- Re: [PATCH v4 bpf-next 6/6] bpf: runqslower: u... Martin KaFai Lau
- [PATCH v4 bpf-next 4/6] selftests/bpf: test deadlo... Song Liu
- [PATCH v4 bpf-next 3/6] selftests/bpf: add non-BPF... Song Liu
- [PATCH v4 bpf-next 5/6] bpf: runqslower: prefer us... Song Liu