Re: [PATCH bpf-next 1/4] bpf: enable task local storage for tracing programs
From: Martin KaFai Lau <hidden>
Date: 2021-01-12 18:23:07
Also in:
bpf, lkml
On Mon, Jan 11, 2021 at 03:41:26PM -0800, Song Liu wrote:
quoted
On Jan 11, 2021, at 10:56 AM, Martin Lau [off-list ref] wrote: On Fri, Jan 08, 2021 at 03:19:47PM -0800, Song Liu wrote: [ ... ]quoted
diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c index dd5aedee99e73..9bd47ad2b26f1 100644 --- a/kernel/bpf/bpf_local_storage.c +++ b/kernel/bpf/bpf_local_storage.c@@ -140,17 +140,18 @@ static void __bpf_selem_unlink_storage(struct bpf_local_storage_elem *selem){ struct bpf_local_storage *local_storage; bool free_local_storage = false; + unsigned long flags; if (unlikely(!selem_linked_to_storage(selem))) /* selem has already been unlinked from sk */ return; local_storage = rcu_dereference(selem->local_storage); - raw_spin_lock_bh(&local_storage->lock); + raw_spin_lock_irqsave(&local_storage->lock, flags);It will be useful to have a few words in commit message on this change for future reference purpose. Please also remove the in_irq() check from bpf_sk_storage.c to avoid confusion in the future. It probably should be in a separate patch.Do you mean we allow bpf_sk_storage_get_tracing() and bpf_sk_storage_delete_tracing() in irq context? Like
Right. However, after another thought, may be lets skip that for now till a use case comes up and a test can be written.