bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC v1 PATCH 5/7] bpf: Use bpf prog locking in trampoline code.
@ 2019-12-08  0:04 David Miller
  0 siblings, 0 replies; only message in thread
From: David Miller @ 2019-12-08  0:04 UTC (permalink / raw)
  To: bpf, netdev; +Cc: ast, daniel, tglx


Instead of preemption disable/enable.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 kernel/bpf/trampoline.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c
index 7e89f1f49d77..52e39892fec4 100644
--- a/kernel/bpf/trampoline.c
+++ b/kernel/bpf/trampoline.c
@@ -195,8 +195,8 @@ void bpf_trampoline_put(struct bpf_trampoline *tr)
 	mutex_unlock(&trampoline_mutex);
 }
 
-/* The logic is similar to BPF_PROG_RUN, but with explicit rcu and preempt that
- * are needed for trampoline. The macro is split into
+/* The logic is similar to BPF_PROG_RUN, but with explicit rcu and bpf
+ * prog lock that are needed for trampoline. The macro is split into
  * call _bpf_prog_enter
  * call prog->bpf_func
  * call __bpf_prog_exit
@@ -206,7 +206,7 @@ u64 notrace __bpf_prog_enter(void)
 	u64 start = 0;
 
 	rcu_read_lock();
-	preempt_disable();
+	bpf_prog_lock();
 	if (static_branch_unlikely(&bpf_stats_enabled_key))
 		start = sched_clock();
 	return start;
@@ -229,7 +229,7 @@ void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start)
 		stats->nsecs += sched_clock() - start;
 		u64_stats_update_end(&stats->syncp);
 	}
-	preempt_enable();
+	bpf_prog_unlock();
 	rcu_read_unlock();
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-08  0:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-08  0:04 [RFC v1 PATCH 5/7] bpf: Use bpf prog locking in trampoline code David Miller

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).