Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
The BTF conflicts were simple overlapping changes. The virtio_net conflict was an overlap of a fix of statistics counter, happening alongisde a move over to a bonafide statistics structure rather than counting value on the stack. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -158,6 +158,15 @@ struct bpf_map_def {
|
||||
unsigned int numa_node;
|
||||
};
|
||||
|
||||
#define BPF_ANNOTATE_KV_PAIR(name, type_key, type_val) \
|
||||
struct ____btf_map_##name { \
|
||||
type_key key; \
|
||||
type_val value; \
|
||||
}; \
|
||||
struct ____btf_map_##name \
|
||||
__attribute__ ((section(".maps." #name), used)) \
|
||||
____btf_map_##name = { }
|
||||
|
||||
static int (*bpf_skb_load_bytes)(void *ctx, int off, void *to, int len) =
|
||||
(void *) BPF_FUNC_skb_load_bytes;
|
||||
static int (*bpf_skb_store_bytes)(void *ctx, int off, void *from, int len, int flags) =
|
||||
|
@@ -247,6 +247,34 @@ static struct btf_raw_test raw_tests[] = {
|
||||
.max_entries = 4,
|
||||
},
|
||||
|
||||
{
|
||||
.descr = "struct test #3 Invalid member offset",
|
||||
.raw_types = {
|
||||
/* int */ /* [1] */
|
||||
BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
|
||||
/* int64 */ /* [2] */
|
||||
BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 64, 8),
|
||||
|
||||
/* struct A { */ /* [3] */
|
||||
BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 2), 16),
|
||||
BTF_MEMBER_ENC(NAME_TBD, 1, 64), /* int m; */
|
||||
BTF_MEMBER_ENC(NAME_TBD, 2, 0), /* int64 n; */
|
||||
/* } */
|
||||
BTF_END_RAW,
|
||||
},
|
||||
.str_sec = "\0A\0m\0n\0",
|
||||
.str_sec_size = sizeof("\0A\0m\0n\0"),
|
||||
.map_type = BPF_MAP_TYPE_ARRAY,
|
||||
.map_name = "struct_test3_map",
|
||||
.key_size = sizeof(int),
|
||||
.value_size = 16,
|
||||
.key_type_id = 1,
|
||||
.value_type_id = 3,
|
||||
.max_entries = 4,
|
||||
.btf_load_err = true,
|
||||
.err_str = "Invalid member bits_offset",
|
||||
},
|
||||
|
||||
/* Test member exceeds the size of struct.
|
||||
*
|
||||
* struct A {
|
||||
@@ -479,7 +507,7 @@ static struct btf_raw_test raw_tests[] = {
|
||||
.key_size = sizeof(int),
|
||||
.value_size = sizeof(void *) * 4,
|
||||
.key_type_id = 1,
|
||||
.value_type_id = 4,
|
||||
.value_type_id = 5,
|
||||
.max_entries = 4,
|
||||
},
|
||||
|
||||
@@ -1264,6 +1292,88 @@ static struct btf_raw_test raw_tests[] = {
|
||||
.err_str = "type != 0",
|
||||
},
|
||||
|
||||
{
|
||||
.descr = "arraymap invalid btf key (a bit field)",
|
||||
.raw_types = {
|
||||
/* int */ /* [1] */
|
||||
BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
|
||||
/* 32 bit int with 32 bit offset */ /* [2] */
|
||||
BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 32, 32, 8),
|
||||
BTF_END_RAW,
|
||||
},
|
||||
.str_sec = "",
|
||||
.str_sec_size = sizeof(""),
|
||||
.map_type = BPF_MAP_TYPE_ARRAY,
|
||||
.map_name = "array_map_check_btf",
|
||||
.key_size = sizeof(int),
|
||||
.value_size = sizeof(int),
|
||||
.key_type_id = 2,
|
||||
.value_type_id = 1,
|
||||
.max_entries = 4,
|
||||
.map_create_err = true,
|
||||
},
|
||||
|
||||
{
|
||||
.descr = "arraymap invalid btf key (!= 32 bits)",
|
||||
.raw_types = {
|
||||
/* int */ /* [1] */
|
||||
BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
|
||||
/* 16 bit int with 0 bit offset */ /* [2] */
|
||||
BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 16, 2),
|
||||
BTF_END_RAW,
|
||||
},
|
||||
.str_sec = "",
|
||||
.str_sec_size = sizeof(""),
|
||||
.map_type = BPF_MAP_TYPE_ARRAY,
|
||||
.map_name = "array_map_check_btf",
|
||||
.key_size = sizeof(int),
|
||||
.value_size = sizeof(int),
|
||||
.key_type_id = 2,
|
||||
.value_type_id = 1,
|
||||
.max_entries = 4,
|
||||
.map_create_err = true,
|
||||
},
|
||||
|
||||
{
|
||||
.descr = "arraymap invalid btf value (too small)",
|
||||
.raw_types = {
|
||||
/* int */ /* [1] */
|
||||
BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
|
||||
BTF_END_RAW,
|
||||
},
|
||||
.str_sec = "",
|
||||
.str_sec_size = sizeof(""),
|
||||
.map_type = BPF_MAP_TYPE_ARRAY,
|
||||
.map_name = "array_map_check_btf",
|
||||
.key_size = sizeof(int),
|
||||
/* btf_value_size < map->value_size */
|
||||
.value_size = sizeof(__u64),
|
||||
.key_type_id = 1,
|
||||
.value_type_id = 1,
|
||||
.max_entries = 4,
|
||||
.map_create_err = true,
|
||||
},
|
||||
|
||||
{
|
||||
.descr = "arraymap invalid btf value (too big)",
|
||||
.raw_types = {
|
||||
/* int */ /* [1] */
|
||||
BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),
|
||||
BTF_END_RAW,
|
||||
},
|
||||
.str_sec = "",
|
||||
.str_sec_size = sizeof(""),
|
||||
.map_type = BPF_MAP_TYPE_ARRAY,
|
||||
.map_name = "array_map_check_btf",
|
||||
.key_size = sizeof(int),
|
||||
/* btf_value_size > map->value_size */
|
||||
.value_size = sizeof(__u16),
|
||||
.key_type_id = 1,
|
||||
.value_type_id = 1,
|
||||
.max_entries = 4,
|
||||
.map_create_err = true,
|
||||
},
|
||||
|
||||
}; /* struct btf_raw_test raw_tests[] */
|
||||
|
||||
static const char *get_next_str(const char *start, const char *end)
|
||||
@@ -2023,7 +2133,7 @@ static struct btf_raw_test pprint_test = {
|
||||
BTF_ENUM_ENC(NAME_TBD, 2),
|
||||
BTF_ENUM_ENC(NAME_TBD, 3),
|
||||
/* struct pprint_mapv */ /* [16] */
|
||||
BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 8), 28),
|
||||
BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 8), 32),
|
||||
BTF_MEMBER_ENC(NAME_TBD, 11, 0), /* uint32_t ui32 */
|
||||
BTF_MEMBER_ENC(NAME_TBD, 10, 32), /* uint16_t ui16 */
|
||||
BTF_MEMBER_ENC(NAME_TBD, 12, 64), /* int32_t si32 */
|
||||
|
@@ -10,11 +10,6 @@ struct ipv_counts {
|
||||
unsigned int v6;
|
||||
};
|
||||
|
||||
typedef int btf_map_key;
|
||||
typedef struct ipv_counts btf_map_value;
|
||||
btf_map_key dumm_key;
|
||||
btf_map_value dummy_value;
|
||||
|
||||
struct bpf_map_def SEC("maps") btf_map = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(int),
|
||||
@@ -22,6 +17,8 @@ struct bpf_map_def SEC("maps") btf_map = {
|
||||
.max_entries = 4,
|
||||
};
|
||||
|
||||
BPF_ANNOTATE_KV_PAIR(btf_map, int, struct ipv_counts);
|
||||
|
||||
struct dummy_tracepoint_args {
|
||||
unsigned long long pad;
|
||||
struct sock *sock;
|
||||
|
28
tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc
Normal file
28
tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# description: Snapshot and tracing setting
|
||||
# flags: instance
|
||||
|
||||
[ ! -f snapshot ] && exit_unsupported
|
||||
|
||||
echo "Set tracing off"
|
||||
echo 0 > tracing_on
|
||||
|
||||
echo "Allocate and take a snapshot"
|
||||
echo 1 > snapshot
|
||||
|
||||
# Since trace buffer is empty, snapshot is also empty, but allocated
|
||||
grep -q "Snapshot is allocated" snapshot
|
||||
|
||||
echo "Ensure keep tracing off"
|
||||
test `cat tracing_on` -eq 0
|
||||
|
||||
echo "Set tracing on"
|
||||
echo 1 > tracing_on
|
||||
|
||||
echo "Take a snapshot again"
|
||||
echo 1 > snapshot
|
||||
|
||||
echo "Ensure keep tracing on"
|
||||
test `cat tracing_on` -eq 1
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user