Commit 15192f25 authored by David S. Miller's avatar David S. Miller

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

Alexei Starovoitov says:

====================
pull-request: bpf 2019-05-09

The following pull-request contains BPF updates for your *net* tree.

The main changes are:

1) three small fixes from Gary, Jiong and Lorenz.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 36096f2f 3ef4641f
...@@ -578,6 +578,7 @@ For line_info, the line number and column number are defined as below: ...@@ -578,6 +578,7 @@ For line_info, the line number and column number are defined as below:
#define BPF_LINE_INFO_LINE_COL(line_col) ((line_col) & 0x3ff) #define BPF_LINE_INFO_LINE_COL(line_col) ((line_col) & 0x3ff)
3.4 BPF_{PROG,MAP}_GET_NEXT_ID 3.4 BPF_{PROG,MAP}_GET_NEXT_ID
==============================
In kernel, every loaded program, map or btf has a unique id. The id won't In kernel, every loaded program, map or btf has a unique id. The id won't
change during the lifetime of a program, map, or btf. change during the lifetime of a program, map, or btf.
...@@ -587,6 +588,7 @@ each command, to user space, for bpf program or maps, respectively, so an ...@@ -587,6 +588,7 @@ each command, to user space, for bpf program or maps, respectively, so an
inspection tool can inspect all programs and maps. inspection tool can inspect all programs and maps.
3.5 BPF_{PROG,MAP}_GET_FD_BY_ID 3.5 BPF_{PROG,MAP}_GET_FD_BY_ID
===============================
An introspection tool cannot use id to get details about program or maps. An introspection tool cannot use id to get details about program or maps.
A file descriptor needs to be obtained first for reference-counting purpose. A file descriptor needs to be obtained first for reference-counting purpose.
......
...@@ -328,7 +328,18 @@ __emit_shf(struct nfp_prog *nfp_prog, u16 dst, enum alu_dst_ab dst_ab, ...@@ -328,7 +328,18 @@ __emit_shf(struct nfp_prog *nfp_prog, u16 dst, enum alu_dst_ab dst_ab,
return; return;
} }
if (sc == SHF_SC_L_SHF) /* NFP shift instruction has something special. If shift direction is
* left then shift amount of 1 to 31 is specified as 32 minus the amount
* to shift.
*
* But no need to do this for indirect shift which has shift amount be
* 0. Even after we do this subtraction, shift amount 0 will be turned
* into 32 which will eventually be encoded the same as 0 because only
* low 5 bits are encoded, but shift amount be 32 will fail the
* FIELD_PREP check done later on shift mask (0x1f), due to 32 is out of
* mask range.
*/
if (sc == SHF_SC_L_SHF && shift)
shift = 32 - shift; shift = 32 - shift;
insn = OP_SHF_BASE | insn = OP_SHF_BASE |
......
...@@ -15,7 +15,7 @@ static int libbpf_debug_print(enum libbpf_print_level level, ...@@ -15,7 +15,7 @@ static int libbpf_debug_print(enum libbpf_print_level level,
static int check_load(const char *file) static int check_load(const char *file)
{ {
struct bpf_prog_load_attr attr; struct bpf_prog_load_attr attr;
struct bpf_object *obj; struct bpf_object *obj = NULL;
int err, prog_fd; int err, prog_fd;
memset(&attr, 0, sizeof(struct bpf_prog_load_attr)); memset(&attr, 0, sizeof(struct bpf_prog_load_attr));
......
...@@ -9,7 +9,7 @@ static void test_task_fd_query_tp_core(const char *probe_name, ...@@ -9,7 +9,7 @@ static void test_task_fd_query_tp_core(const char *probe_name,
struct perf_event_attr attr = {}; struct perf_event_attr attr = {};
__u64 probe_offset, probe_addr; __u64 probe_offset, probe_addr;
__u32 len, prog_id, fd_type; __u32 len, prog_id, fd_type;
struct bpf_object *obj; struct bpf_object *obj = NULL;
__u32 duration = 0; __u32 duration = 0;
char buf[256]; char buf[256];
......
...@@ -13,6 +13,9 @@ void test_tp_attach_query(void) ...@@ -13,6 +13,9 @@ void test_tp_attach_query(void)
struct bpf_prog_info prog_info; struct bpf_prog_info prog_info;
char buf[256]; char buf[256];
for (i = 0; i < num_progs; i++)
obj[i] = NULL;
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"/sys/kernel/debug/tracing/events/sched/sched_switch/id"); "/sys/kernel/debug/tracing/events/sched/sched_switch/id");
efd = open(buf, O_RDONLY, 0); efd = open(buf, O_RDONLY, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment