Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Browse files Browse the repository at this point in the history
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: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 9, 2019
2 parents 36096f2 + 3ef4641 commit 15192f2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Documentation/bpf/btf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)

3.4 BPF_{PROG,MAP}_GET_NEXT_ID
==============================

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.
Expand All @@ -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.

3.5 BPF_{PROG,MAP}_GET_FD_BY_ID
===============================

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.
Expand Down
13 changes: 12 additions & 1 deletion drivers/net/ethernet/netronome/nfp/bpf/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,18 @@ __emit_shf(struct nfp_prog *nfp_prog, u16 dst, enum alu_dst_ab dst_ab,
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;

insn = OP_SHF_BASE |
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static int libbpf_debug_print(enum libbpf_print_level level,
static int check_load(const char *file)
{
struct bpf_prog_load_attr attr;
struct bpf_object *obj;
struct bpf_object *obj = NULL;
int err, prog_fd;

memset(&attr, 0, sizeof(struct bpf_prog_load_attr));
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/prog_tests/task_fd_query_tp.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static void test_task_fd_query_tp_core(const char *probe_name,
struct perf_event_attr attr = {};
__u64 probe_offset, probe_addr;
__u32 len, prog_id, fd_type;
struct bpf_object *obj;
struct bpf_object *obj = NULL;
__u32 duration = 0;
char buf[256];

Expand Down
3 changes: 3 additions & 0 deletions tools/testing/selftests/bpf/prog_tests/tp_attach_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ void test_tp_attach_query(void)
struct bpf_prog_info prog_info;
char buf[256];

for (i = 0; i < num_progs; i++)
obj[i] = NULL;

snprintf(buf, sizeof(buf),
"/sys/kernel/debug/tracing/events/sched/sched_switch/id");
efd = open(buf, O_RDONLY, 0);
Expand Down

0 comments on commit 15192f2

Please sign in to comment.