mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-11-14 06:42:47 +00:00
81 lines
2.3 KiB
Diff
81 lines
2.3 KiB
Diff
From: David Miller <davem@davemloft.net>
|
|
Date: Mon, 24 Feb 2020 15:01:46 +0100
|
|
Subject: [PATCH 15/22] bpf: Use migrate_disable/enable in array macros and
|
|
cgroup/lirc code.
|
|
|
|
Replace the preemption disable/enable with migrate_disable/enable() to
|
|
reflect the actual requirement and to allow PREEMPT_RT to substitute it
|
|
with an actual migration disable mechanism which does not disable
|
|
preemption.
|
|
|
|
Including the code paths that go via __bpf_prog_run_save_cb().
|
|
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
---
|
|
include/linux/bpf.h | 8 ++++----
|
|
include/linux/filter.h | 5 +++--
|
|
2 files changed, 7 insertions(+), 6 deletions(-)
|
|
|
|
--- a/include/linux/bpf.h
|
|
+++ b/include/linux/bpf.h
|
|
@@ -541,7 +541,7 @@ int bpf_prog_array_copy(struct bpf_prog_
|
|
struct bpf_prog *_prog; \
|
|
struct bpf_prog_array *_array; \
|
|
u32 _ret = 1; \
|
|
- preempt_disable(); \
|
|
+ migrate_disable(); \
|
|
rcu_read_lock(); \
|
|
_array = rcu_dereference(array); \
|
|
if (unlikely(check_non_null && !_array))\
|
|
@@ -554,7 +554,7 @@ int bpf_prog_array_copy(struct bpf_prog_
|
|
} \
|
|
_out: \
|
|
rcu_read_unlock(); \
|
|
- preempt_enable(); \
|
|
+ migrate_enable(); \
|
|
_ret; \
|
|
})
|
|
|
|
@@ -588,7 +588,7 @@ int bpf_prog_array_copy(struct bpf_prog_
|
|
u32 ret; \
|
|
u32 _ret = 1; \
|
|
u32 _cn = 0; \
|
|
- preempt_disable(); \
|
|
+ migrate_disable(); \
|
|
rcu_read_lock(); \
|
|
_array = rcu_dereference(array); \
|
|
_item = &_array->items[0]; \
|
|
@@ -600,7 +600,7 @@ int bpf_prog_array_copy(struct bpf_prog_
|
|
_item++; \
|
|
} \
|
|
rcu_read_unlock(); \
|
|
- preempt_enable(); \
|
|
+ migrate_enable(); \
|
|
if (_ret) \
|
|
_ret = (_cn ? NET_XMIT_CN : NET_XMIT_SUCCESS); \
|
|
else \
|
|
--- a/include/linux/filter.h
|
|
+++ b/include/linux/filter.h
|
|
@@ -669,6 +669,7 @@ static inline u8 *bpf_skb_cb(struct sk_b
|
|
return qdisc_skb_cb(skb)->data;
|
|
}
|
|
|
|
+/* Must be invoked with migration disabled */
|
|
static inline u32 __bpf_prog_run_save_cb(const struct bpf_prog *prog,
|
|
struct sk_buff *skb)
|
|
{
|
|
@@ -694,9 +695,9 @@ static inline u32 bpf_prog_run_save_cb(c
|
|
{
|
|
u32 res;
|
|
|
|
- preempt_disable();
|
|
+ migrate_disable();
|
|
res = __bpf_prog_run_save_cb(prog, skb);
|
|
- preempt_enable();
|
|
+ migrate_enable();
|
|
return res;
|
|
}
|
|
|