diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/bpf/core.c | 1 | ||||
-rw-r--r-- | kernel/bpf/helpers.c | 12 | ||||
-rw-r--r-- | kernel/trace/bpf_trace.c | 2 |
3 files changed, 15 insertions, 0 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index aa6d98154106..82a04143368e 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c | |||
@@ -1043,6 +1043,7 @@ const struct bpf_func_proto bpf_map_delete_elem_proto __weak; | |||
1043 | 1043 | ||
1044 | const struct bpf_func_proto bpf_get_prandom_u32_proto __weak; | 1044 | const struct bpf_func_proto bpf_get_prandom_u32_proto __weak; |
1045 | const struct bpf_func_proto bpf_get_smp_processor_id_proto __weak; | 1045 | const struct bpf_func_proto bpf_get_smp_processor_id_proto __weak; |
1046 | const struct bpf_func_proto bpf_get_numa_node_id_proto __weak; | ||
1046 | const struct bpf_func_proto bpf_ktime_get_ns_proto __weak; | 1047 | const struct bpf_func_proto bpf_ktime_get_ns_proto __weak; |
1047 | 1048 | ||
1048 | const struct bpf_func_proto bpf_get_current_pid_tgid_proto __weak; | 1049 | const struct bpf_func_proto bpf_get_current_pid_tgid_proto __weak; |
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 39918402e6e9..045cbe673356 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/rcupdate.h> | 13 | #include <linux/rcupdate.h> |
14 | #include <linux/random.h> | 14 | #include <linux/random.h> |
15 | #include <linux/smp.h> | 15 | #include <linux/smp.h> |
16 | #include <linux/topology.h> | ||
16 | #include <linux/ktime.h> | 17 | #include <linux/ktime.h> |
17 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
18 | #include <linux/uidgid.h> | 19 | #include <linux/uidgid.h> |
@@ -92,6 +93,17 @@ const struct bpf_func_proto bpf_get_smp_processor_id_proto = { | |||
92 | .ret_type = RET_INTEGER, | 93 | .ret_type = RET_INTEGER, |
93 | }; | 94 | }; |
94 | 95 | ||
96 | BPF_CALL_0(bpf_get_numa_node_id) | ||
97 | { | ||
98 | return numa_node_id(); | ||
99 | } | ||
100 | |||
101 | const struct bpf_func_proto bpf_get_numa_node_id_proto = { | ||
102 | .func = bpf_get_numa_node_id, | ||
103 | .gpl_only = false, | ||
104 | .ret_type = RET_INTEGER, | ||
105 | }; | ||
106 | |||
95 | BPF_CALL_0(bpf_ktime_get_ns) | 107 | BPF_CALL_0(bpf_ktime_get_ns) |
96 | { | 108 | { |
97 | /* NMI safe access to clock monotonic */ | 109 | /* NMI safe access to clock monotonic */ |
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 5dcb99281259..fa77311dadb2 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c | |||
@@ -422,6 +422,8 @@ static const struct bpf_func_proto *tracing_func_proto(enum bpf_func_id func_id) | |||
422 | return bpf_get_trace_printk_proto(); | 422 | return bpf_get_trace_printk_proto(); |
423 | case BPF_FUNC_get_smp_processor_id: | 423 | case BPF_FUNC_get_smp_processor_id: |
424 | return &bpf_get_smp_processor_id_proto; | 424 | return &bpf_get_smp_processor_id_proto; |
425 | case BPF_FUNC_get_numa_node_id: | ||
426 | return &bpf_get_numa_node_id_proto; | ||
425 | case BPF_FUNC_perf_event_read: | 427 | case BPF_FUNC_perf_event_read: |
426 | return &bpf_perf_event_read_proto; | 428 | return &bpf_perf_event_read_proto; |
427 | case BPF_FUNC_probe_write_user: | 429 | case BPF_FUNC_probe_write_user: |