Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next] devlink: Add WARN_ON to catch errors of not cleaning devlink objects
From: David Ahern @ 2019-02-08 17:30 UTC (permalink / raw)
  To: Parav Pandit, netdev, davem
In-Reply-To: <1549642921-11196-1-git-send-email-parav@mellanox.com>

On 2/8/19 8:22 AM, Parav Pandit wrote:
> Add WARN_ON to make sure that all sub objects of a devlink device are
> cleanedup before freeing the devlink device.
> This helps to catch any driver bugs.
> 
> Signed-off-by: Parav Pandit <parav@mellanox.com>
> Acked-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  net/core/devlink.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/net/core/devlink.c b/net/core/devlink.c
> index cd0d393..5e2ef5a 100644
> --- a/net/core/devlink.c
> +++ b/net/core/devlink.c
> @@ -4229,6 +4229,13 @@ void devlink_unregister(struct devlink *devlink)
>   */
>  void devlink_free(struct devlink *devlink)
>  {
> +	WARN_ON(!list_empty(&devlink->port_list));
> +	WARN_ON(!list_empty(&devlink->sb_list));
> +	WARN_ON(!list_empty(&devlink->dpipe_table_list));
> +	WARN_ON(!list_empty(&devlink->resource_list));
> +	WARN_ON(!list_empty(&devlink->param_list));
> +	WARN_ON(!list_empty(&devlink->region_list));
> +
>  	kfree(devlink);
>  }
>  EXPORT_SYMBOL_GPL(devlink_free);
> 

reporter_list was just added which brings up the maintenance question:
If you are going to do this you might want a comment in
include/net/devlink.h to remind folks to update this function as relevant.

^ permalink raw reply

* Re: [PATCH v3 bpf-next 4/4] tools/bpf: remove btf__get_strings superseded() by raw data API
From: Song Liu @ 2019-02-08 17:31 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Alexei Starovoitov, Andrii Nakryiko, Yonghong Song,
	Alexei Starovoitov, Martin Lau, netdev@vger.kernel.org,
	Kernel Team, daniel@iogearbox.net
In-Reply-To: <20190208025555.4027769-5-andriin@fb.com>



> On Feb 7, 2019, at 6:55 PM, Andrii Nakryiko <andriin@fb.com> wrote:
> 
> Now that we have btf__get_raw_data() it's trivial for tests to iterate
> over all strings for testing purposes, which eliminates the need for
> btf__get_strings() API.
> 
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---
> tools/lib/bpf/btf.c                    |  7 -----
> tools/lib/bpf/btf.h                    |  2 --
> tools/testing/selftests/bpf/test_btf.c | 39 +++++++++++++++++---------
> 3 files changed, 26 insertions(+), 22 deletions(-)
> 
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index c87cc3d71b9f..a986dc28f17d 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -447,13 +447,6 @@ const void *btf__get_raw_data(const struct btf *btf, __u32 *size)
> 	return btf->data;
> }
> 
> -void btf__get_strings(const struct btf *btf, const char **strings,
> -		      __u32 *str_len)
> -{
> -	*strings = btf->strings;
> -	*str_len = btf->hdr->str_len;
> -}
> -
> const char *btf__name_by_offset(const struct btf *btf, __u32 offset)
> {
> 	if (offset < btf->hdr->str_len)
> diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
> index ad9f648260c2..6179291f2cec 100644
> --- a/tools/lib/bpf/btf.h
> +++ b/tools/lib/bpf/btf.h
> @@ -67,8 +67,6 @@ LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
> LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id);
> LIBBPF_API int btf__fd(const struct btf *btf);
> LIBBPF_API const void *btf__get_raw_data(const struct btf *btf, __u32 *size);
> -LIBBPF_API void btf__get_strings(const struct btf *btf, const char **strings,
> -				 __u32 *str_len);

I guess we need to update libbpf.map with this? 

> LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
> LIBBPF_API int btf__get_from_id(__u32 id, struct btf **btf);
> LIBBPF_API int btf__get_map_kv_tids(const struct btf *btf, const char *map_name,
> diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c
> index 447acc34db94..bbcacba39590 100644
> --- a/tools/testing/selftests/bpf/test_btf.c
> +++ b/tools/testing/selftests/bpf/test_btf.c
> @@ -5882,15 +5882,17 @@ static void dump_btf_strings(const char *strs, __u32 len)
> static int do_test_dedup(unsigned int test_num)
> {
> 	const struct btf_dedup_test *test = &dedup_tests[test_num - 1];
> -	int err = 0, i;
> -	__u32 test_nr_types, expect_nr_types, test_str_len, expect_str_len;
> -	void *raw_btf;
> -	unsigned int raw_btf_size;
> +	__u32 test_nr_types, expect_nr_types, test_btf_size, expect_btf_size;
> +	const struct btf_header *test_hdr, *expect_hdr;
> 	struct btf *test_btf = NULL, *expect_btf = NULL;
> +	const void *test_btf_data, *expect_btf_data;
> 	const char *ret_test_next_str, *ret_expect_next_str;
> 	const char *test_strs, *expect_strs;
> 	const char *test_str_cur, *test_str_end;
> 	const char *expect_str_cur, *expect_str_end;
> +	unsigned int raw_btf_size;
> +	void *raw_btf;
> +	int err = 0, i;
> 
> 	fprintf(stderr, "BTF dedup test[%u] (%s):", test_num, test->descr);
> 
> @@ -5927,23 +5929,34 @@ static int do_test_dedup(unsigned int test_num)
> 		goto done;
> 	}
> 
> -	btf__get_strings(test_btf, &test_strs, &test_str_len);
> -	btf__get_strings(expect_btf, &expect_strs, &expect_str_len);
> -	if (CHECK(test_str_len != expect_str_len,
> -		  "test_str_len:%u != expect_str_len:%u",
> -		  test_str_len, expect_str_len)) {
> +	test_btf_data = btf__get_raw_data(test_btf, &test_btf_size);
> +	expect_btf_data = btf__get_raw_data(expect_btf, &expect_btf_size);
> +	if (CHECK(test_btf_size != expect_btf_size,
> +		  "test_btf_size:%u != expect_btf_size:%u",
> +		  test_btf_size, expect_btf_size)) {
> +		err = -1;
> +		goto done;
> +	}
> +
> +	test_hdr = test_btf_data;
> +	test_strs = test_btf_data + test_hdr->str_off;
> +	expect_hdr = expect_btf_data;
> +	expect_strs = expect_btf_data + expect_hdr->str_off;
> +	if (CHECK(test_hdr->str_len != expect_hdr->str_len,
> +		  "test_hdr->str_len:%u != expect_hdr->str_len:%u",
> +		  test_hdr->str_len, expect_hdr->str_len)) {
> 		fprintf(stderr, "\ntest strings:\n");
> -		dump_btf_strings(test_strs, test_str_len);
> +		dump_btf_strings(test_strs, test_hdr->str_len);
> 		fprintf(stderr, "\nexpected strings:\n");
> -		dump_btf_strings(expect_strs, expect_str_len);
> +		dump_btf_strings(expect_strs, expect_hdr->str_len);
> 		err = -1;
> 		goto done;
> 	}
> 
> 	test_str_cur = test_strs;
> -	test_str_end = test_strs + test_str_len;
> +	test_str_end = test_strs + test_hdr->str_len;
> 	expect_str_cur = expect_strs;
> -	expect_str_end = expect_strs + expect_str_len;
> +	expect_str_end = expect_strs + expect_hdr->str_len;
> 	while (test_str_cur < test_str_end && expect_str_cur < expect_str_end) {
> 		size_t test_len, expect_len;
> 
> -- 
> 2.17.1
> 


^ permalink raw reply

* [PATCH 13/19] net: split out functions related to registering inflight socket files
From: Jens Axboe @ 2019-02-08 17:34 UTC (permalink / raw)
  To: linux-aio, linux-block, linux-api
  Cc: hch, jmoyer, avi, jannh, viro, Jens Axboe, netdev,
	David S . Miller
In-Reply-To: <20190208173423.27014-1-axboe@kernel.dk>

We need this functionality for the io_uring file registration, but
we cannot rely on it since CONFIG_UNIX can be modular. Move the helpers
to a separate file, that's always builtin to the kernel if CONFIG_UNIX is
m/y.

No functional changes in this patch, just moving code around.

Cc: netdev@vger.kernel.org
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 include/net/af_unix.h |   1 +
 net/unix/Kconfig      |   5 ++
 net/unix/Makefile     |   2 +
 net/unix/af_unix.c    |  63 +-----------------
 net/unix/garbage.c    |  71 +-------------------
 net/unix/scm.c        | 146 ++++++++++++++++++++++++++++++++++++++++++
 net/unix/scm.h        |  10 +++
 7 files changed, 168 insertions(+), 130 deletions(-)
 create mode 100644 net/unix/scm.c
 create mode 100644 net/unix/scm.h

diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index ddbba838d048..3426d6dacc45 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -10,6 +10,7 @@
 
 void unix_inflight(struct user_struct *user, struct file *fp);
 void unix_notinflight(struct user_struct *user, struct file *fp);
+void unix_destruct_scm(struct sk_buff *skb);
 void unix_gc(void);
 void wait_for_unix_gc(void);
 struct sock *unix_get_socket(struct file *filp);
diff --git a/net/unix/Kconfig b/net/unix/Kconfig
index 8b31ab85d050..3b9e450656a4 100644
--- a/net/unix/Kconfig
+++ b/net/unix/Kconfig
@@ -19,6 +19,11 @@ config UNIX
 
 	  Say Y unless you know what you are doing.
 
+config UNIX_SCM
+	bool
+	depends on UNIX
+	default y
+
 config UNIX_DIAG
 	tristate "UNIX: socket monitoring interface"
 	depends on UNIX
diff --git a/net/unix/Makefile b/net/unix/Makefile
index ffd0a275c3a7..54e58cc4f945 100644
--- a/net/unix/Makefile
+++ b/net/unix/Makefile
@@ -10,3 +10,5 @@ unix-$(CONFIG_SYSCTL)	+= sysctl_net_unix.o
 
 obj-$(CONFIG_UNIX_DIAG)	+= unix_diag.o
 unix_diag-y		:= diag.o
+
+obj-$(CONFIG_UNIX_SCM)	+= scm.o
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 74d1eed7cbd4..2ce32dbb2feb 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -119,6 +119,8 @@
 #include <linux/freezer.h>
 #include <linux/file.h>
 
+#include "scm.h"
+
 struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE];
 EXPORT_SYMBOL_GPL(unix_socket_table);
 DEFINE_SPINLOCK(unix_table_lock);
@@ -1486,67 +1488,6 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int peer)
 	return err;
 }
 
-static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb)
-{
-	int i;
-
-	scm->fp = UNIXCB(skb).fp;
-	UNIXCB(skb).fp = NULL;
-
-	for (i = scm->fp->count-1; i >= 0; i--)
-		unix_notinflight(scm->fp->user, scm->fp->fp[i]);
-}
-
-static void unix_destruct_scm(struct sk_buff *skb)
-{
-	struct scm_cookie scm;
-	memset(&scm, 0, sizeof(scm));
-	scm.pid  = UNIXCB(skb).pid;
-	if (UNIXCB(skb).fp)
-		unix_detach_fds(&scm, skb);
-
-	/* Alas, it calls VFS */
-	/* So fscking what? fput() had been SMP-safe since the last Summer */
-	scm_destroy(&scm);
-	sock_wfree(skb);
-}
-
-/*
- * The "user->unix_inflight" variable is protected by the garbage
- * collection lock, and we just read it locklessly here. If you go
- * over the limit, there might be a tiny race in actually noticing
- * it across threads. Tough.
- */
-static inline bool too_many_unix_fds(struct task_struct *p)
-{
-	struct user_struct *user = current_user();
-
-	if (unlikely(user->unix_inflight > task_rlimit(p, RLIMIT_NOFILE)))
-		return !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN);
-	return false;
-}
-
-static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
-{
-	int i;
-
-	if (too_many_unix_fds(current))
-		return -ETOOMANYREFS;
-
-	/*
-	 * Need to duplicate file references for the sake of garbage
-	 * collection.  Otherwise a socket in the fps might become a
-	 * candidate for GC while the skb is not yet queued.
-	 */
-	UNIXCB(skb).fp = scm_fp_dup(scm->fp);
-	if (!UNIXCB(skb).fp)
-		return -ENOMEM;
-
-	for (i = scm->fp->count - 1; i >= 0; i--)
-		unix_inflight(scm->fp->user, scm->fp->fp[i]);
-	return 0;
-}
-
 static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds)
 {
 	int err = 0;
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index f81854d74c7d..8bbe1b8e4ff7 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -86,80 +86,13 @@
 #include <net/scm.h>
 #include <net/tcp_states.h>
 
+#include "scm.h"
+
 /* Internal data structures and random procedures: */
 
-static LIST_HEAD(gc_inflight_list);
 static LIST_HEAD(gc_candidates);
-static DEFINE_SPINLOCK(unix_gc_lock);
 static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait);
 
-unsigned int unix_tot_inflight;
-
-struct sock *unix_get_socket(struct file *filp)
-{
-	struct sock *u_sock = NULL;
-	struct inode *inode = file_inode(filp);
-
-	/* Socket ? */
-	if (S_ISSOCK(inode->i_mode) && !(filp->f_mode & FMODE_PATH)) {
-		struct socket *sock = SOCKET_I(inode);
-		struct sock *s = sock->sk;
-
-		/* PF_UNIX ? */
-		if (s && sock->ops && sock->ops->family == PF_UNIX)
-			u_sock = s;
-	} else {
-		/* Could be an io_uring instance */
-		u_sock = io_uring_get_socket(filp);
-	}
-	return u_sock;
-}
-
-/* Keep the number of times in flight count for the file
- * descriptor if it is for an AF_UNIX socket.
- */
-
-void unix_inflight(struct user_struct *user, struct file *fp)
-{
-	struct sock *s = unix_get_socket(fp);
-
-	spin_lock(&unix_gc_lock);
-
-	if (s) {
-		struct unix_sock *u = unix_sk(s);
-
-		if (atomic_long_inc_return(&u->inflight) == 1) {
-			BUG_ON(!list_empty(&u->link));
-			list_add_tail(&u->link, &gc_inflight_list);
-		} else {
-			BUG_ON(list_empty(&u->link));
-		}
-		unix_tot_inflight++;
-	}
-	user->unix_inflight++;
-	spin_unlock(&unix_gc_lock);
-}
-
-void unix_notinflight(struct user_struct *user, struct file *fp)
-{
-	struct sock *s = unix_get_socket(fp);
-
-	spin_lock(&unix_gc_lock);
-
-	if (s) {
-		struct unix_sock *u = unix_sk(s);
-
-		BUG_ON(!atomic_long_read(&u->inflight));
-		BUG_ON(list_empty(&u->link));
-
-		if (atomic_long_dec_and_test(&u->inflight))
-			list_del_init(&u->link);
-		unix_tot_inflight--;
-	}
-	user->unix_inflight--;
-	spin_unlock(&unix_gc_lock);
-}
-
 static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *),
 			  struct sk_buff_head *hitlist)
 {
diff --git a/net/unix/scm.c b/net/unix/scm.c
new file mode 100644
index 000000000000..ed1624588934
--- /dev/null
+++ b/net/unix/scm.c
@@ -0,0 +1,146 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/socket.h>
+#include <linux/net.h>
+#include <linux/fs.h>
+#include <net/af_unix.h>
+#include <net/scm.h>
+#include <linux/init.h>
+
+#include "scm.h"
+
+unsigned int unix_tot_inflight;
+
+LIST_HEAD(gc_inflight_list);
+DEFINE_SPINLOCK(unix_gc_lock);
+
+struct sock *unix_get_socket(struct file *filp)
+{
+	struct sock *u_sock = NULL;
+	struct inode *inode = file_inode(filp);
+
+	/* Socket ? */
+	if (S_ISSOCK(inode->i_mode) && !(filp->f_mode & FMODE_PATH)) {
+		struct socket *sock = SOCKET_I(inode);
+		struct sock *s = sock->sk;
+
+		/* PF_UNIX ? */
+		if (s && sock->ops && sock->ops->family == PF_UNIX)
+			u_sock = s;
+	} else {
+		/* Could be an io_uring instance */
+		u_sock = io_uring_get_socket(filp);
+	}
+	return u_sock;
+}
+EXPORT_SYMBOL(unix_get_socket);
+
+/* Keep the number of times in flight count for the file
+ * descriptor if it is for an AF_UNIX socket.
+ */
+void unix_inflight(struct user_struct *user, struct file *fp)
+{
+	struct sock *s = unix_get_socket(fp);
+
+	spin_lock(&unix_gc_lock);
+
+	if (s) {
+		struct unix_sock *u = unix_sk(s);
+
+		if (atomic_long_inc_return(&u->inflight) == 1) {
+			BUG_ON(!list_empty(&u->link));
+			list_add_tail(&u->link, &gc_inflight_list);
+		} else {
+			BUG_ON(list_empty(&u->link));
+		}
+		unix_tot_inflight++;
+	}
+	user->unix_inflight++;
+	spin_unlock(&unix_gc_lock);
+}
+
+void unix_notinflight(struct user_struct *user, struct file *fp)
+{
+	struct sock *s = unix_get_socket(fp);
+
+	spin_lock(&unix_gc_lock);
+
+	if (s) {
+		struct unix_sock *u = unix_sk(s);
+
+		BUG_ON(!atomic_long_read(&u->inflight));
+		BUG_ON(list_empty(&u->link));
+
+		if (atomic_long_dec_and_test(&u->inflight))
+			list_del_init(&u->link);
+		unix_tot_inflight--;
+	}
+	user->unix_inflight--;
+	spin_unlock(&unix_gc_lock);
+}
+
+/*
+ * The "user->unix_inflight" variable is protected by the garbage
+ * collection lock, and we just read it locklessly here. If you go
+ * over the limit, there might be a tiny race in actually noticing
+ * it across threads. Tough.
+ */
+static inline bool too_many_unix_fds(struct task_struct *p)
+{
+	struct user_struct *user = current_user();
+
+	if (unlikely(user->unix_inflight > task_rlimit(p, RLIMIT_NOFILE)))
+		return !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN);
+	return false;
+}
+
+int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
+{
+	int i;
+
+	if (too_many_unix_fds(current))
+		return -ETOOMANYREFS;
+
+	/*
+	 * Need to duplicate file references for the sake of garbage
+	 * collection.  Otherwise a socket in the fps might become a
+	 * candidate for GC while the skb is not yet queued.
+	 */
+	UNIXCB(skb).fp = scm_fp_dup(scm->fp);
+	if (!UNIXCB(skb).fp)
+		return -ENOMEM;
+
+	for (i = scm->fp->count - 1; i >= 0; i--)
+		unix_inflight(scm->fp->user, scm->fp->fp[i]);
+	return 0;
+}
+EXPORT_SYMBOL(unix_attach_fds);
+
+void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb)
+{
+	int i;
+
+	scm->fp = UNIXCB(skb).fp;
+	UNIXCB(skb).fp = NULL;
+
+	for (i = scm->fp->count-1; i >= 0; i--)
+		unix_notinflight(scm->fp->user, scm->fp->fp[i]);
+}
+EXPORT_SYMBOL(unix_detach_fds);
+
+void unix_destruct_scm(struct sk_buff *skb)
+{
+	struct scm_cookie scm;
+
+	memset(&scm, 0, sizeof(scm));
+	scm.pid  = UNIXCB(skb).pid;
+	if (UNIXCB(skb).fp)
+		unix_detach_fds(&scm, skb);
+
+	/* Alas, it calls VFS */
+	/* So fscking what? fput() had been SMP-safe since the last Summer */
+	scm_destroy(&scm);
+	sock_wfree(skb);
+}
diff --git a/net/unix/scm.h b/net/unix/scm.h
new file mode 100644
index 000000000000..5a255a477f16
--- /dev/null
+++ b/net/unix/scm.h
@@ -0,0 +1,10 @@
+#ifndef NET_UNIX_SCM_H
+#define NET_UNIX_SCM_H
+
+extern struct list_head gc_inflight_list;
+extern spinlock_t unix_gc_lock;
+
+int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb);
+void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb);
+
+#endif
-- 
2.17.1


^ permalink raw reply related

* [PATCH bpf-next 1/3] selftests: bpf: add "alu32" to .gitignore
From: Jiong Wang @ 2019-02-08 17:41 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549647681-13818-1-git-send-email-jiong.wang@netronome.com>

"alu32" is a build dir and contains various files for BPF sub-register
code-gen testing.

This patch tells git to ignore it.

Suggested-by: Yonghong Song <yhs@fb.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
 tools/testing/selftests/bpf/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
index dd093bd..e47168d 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -29,3 +29,4 @@ test_netcnt
 test_section_names
 test_tcpnotify_user
 test_libbpf
+alu32
-- 
2.7.4


^ permalink raw reply related

* [PATCH bpf-next 2/3] selftests: bpf: extend sub-register mode compilation to all bpf object files
From: Jiong Wang @ 2019-02-08 17:41 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549647681-13818-1-git-send-email-jiong.wang@netronome.com>

At the moment, we only do extra sub-register mode compilation on bpf object
files used by "test_progs". These object files are really loaded and
executed.

This patch further extends sub-register mode compilation to all bpf object
files, even those without corresponding runtime tests. Because this could
help testing LLVM sub-register code-gen, kernel bpf selftest has much more
C testcases with reasonable size and complexity compared with LLVM
testsuite which only contains unit tests.

There were some file duplication inside BPF_OBJ_FILES_DUAL_COMPILE which
is removed now.

Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
 tools/testing/selftests/bpf/Makefile | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 383d2ff..70b2570 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -35,20 +35,15 @@ BPF_OBJ_FILES = \
 	sendmsg4_prog.o sendmsg6_prog.o test_lirc_mode2_kern.o \
 	get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
 	test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
-	xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o
-
-# Objects are built with default compilation flags and with sub-register
-# code-gen enabled.
-BPF_OBJ_FILES_DUAL_COMPILE = \
-	test_pkt_access.o test_pkt_access.o test_xdp.o test_adjust_tail.o \
-	test_l4lb.o test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
+	xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
+	test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
+	test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
 	test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
-	test_stacktrace_map.o test_stacktrace_map.o test_stacktrace_build_id.o \
-	test_stacktrace_build_id.o test_get_stack_rawtp.o \
-	test_get_stack_rawtp.o test_tracepoint.o test_sk_lookup_kern.o \
-	test_queue_map.o test_stack_map.o
+	test_stacktrace_map.o test_stacktrace_build_id.o \
+	test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
+	test_stack_map.o
 
-TEST_GEN_FILES = $(BPF_OBJ_FILES) $(BPF_OBJ_FILES_DUAL_COMPILE)
+TEST_GEN_FILES = $(BPF_OBJ_FILES)
 
 # Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
 # support which is the first version to contain both ALU32 and JMP32
@@ -58,7 +53,7 @@ SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
 			$(LLC) -mattr=+alu32 -mcpu=probe 2>&1 | \
 			grep 'if w')
 ifneq ($(SUBREG_CODEGEN),)
-TEST_GEN_FILES += $(patsubst %.o,alu32/%.o, $(BPF_OBJ_FILES_DUAL_COMPILE))
+TEST_GEN_FILES += $(patsubst %.o,alu32/%.o, $(BPF_OBJ_FILES))
 endif
 
 # Order correspond to 'make run_tests' order
-- 
2.7.4


^ permalink raw reply related

* [PATCH bpf-next 0/3] selftests: bpf: improve bpf object file rules
From: Jiong Wang @ 2019-02-08 17:41 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang

This set improves bpf object file related rules in selftests Makefile.
  - tell git to ignore the build dir "alu32".
  - extend sub-register mode compilation to all bpf object files to give
    LLVM compiler bpf back-end more exercise.
  - auto-generate bpf kernel object file list.

Jiong Wang (3):
  selftests: bpf: add "alu32" to .gitignore
  selftests: bpf: extend sub-register mode compilation to all bpf object
    files
  selftests: bpf: centre kernel bpf objects under new subdir
    "kern_progs"

 tools/testing/selftests/bpf/.gitignore             |  1 +
 tools/testing/selftests/bpf/Makefile               | 35 +++++-----------------
 .../selftests/bpf/{ => kern_progs}/bpf_flow.c      |  0
 .../selftests/bpf/{ => kern_progs}/connect4_prog.c |  0
 .../selftests/bpf/{ => kern_progs}/connect6_prog.c |  0
 .../selftests/bpf/{ => kern_progs}/dev_cgroup.c    |  0
 .../bpf/{ => kern_progs}/get_cgroup_id_kern.c      |  0
 .../selftests/bpf/{ => kern_progs}/netcnt_prog.c   |  0
 .../bpf/{ => kern_progs}/sample_map_ret0.c         |  0
 .../selftests/bpf/{ => kern_progs}/sample_ret0.c   |  0
 .../selftests/bpf/{ => kern_progs}/sendmsg4_prog.c |  0
 .../selftests/bpf/{ => kern_progs}/sendmsg6_prog.c |  0
 .../bpf/{ => kern_progs}/socket_cookie_prog.c      |  0
 .../bpf/{ => kern_progs}/sockmap_parse_prog.c      |  0
 .../bpf/{ => kern_progs}/sockmap_tcp_msg_prog.c    |  0
 .../bpf/{ => kern_progs}/sockmap_verdict_prog.c    |  0
 .../bpf/{ => kern_progs}/test_adjust_tail.c        |  0
 .../bpf/{ => kern_progs}/test_btf_haskv.c          |  0
 .../selftests/bpf/{ => kern_progs}/test_btf_nokv.c |  0
 .../bpf/{ => kern_progs}/test_get_stack_rawtp.c    |  0
 .../selftests/bpf/{ => kern_progs}/test_l4lb.c     |  0
 .../bpf/{ => kern_progs}/test_l4lb_noinline.c      |  0
 .../bpf/{ => kern_progs}/test_lirc_mode2_kern.c    |  0
 .../bpf/{ => kern_progs}/test_lwt_seg6local.c      |  0
 .../bpf/{ => kern_progs}/test_map_in_map.c         |  0
 .../selftests/bpf/{ => kern_progs}/test_map_lock.c |  0
 .../selftests/bpf/{ => kern_progs}/test_obj_id.c   |  0
 .../bpf/{ => kern_progs}/test_pkt_access.c         |  0
 .../bpf/{ => kern_progs}/test_pkt_md_access.c      |  0
 .../bpf/{ => kern_progs}/test_queue_map.c          |  0
 .../{ => kern_progs}/test_select_reuseport_kern.c  |  0
 .../bpf/{ => kern_progs}/test_sk_lookup_kern.c     |  0
 .../bpf/{ => kern_progs}/test_skb_cgroup_id_kern.c |  0
 .../bpf/{ => kern_progs}/test_sockhash_kern.c      |  0
 .../bpf/{ => kern_progs}/test_sockmap_kern.c       |  0
 .../bpf/{ => kern_progs}/test_spin_lock.c          |  0
 .../bpf/{ => kern_progs}/test_stack_map.c          |  0
 .../{ => kern_progs}/test_stacktrace_build_id.c    |  0
 .../bpf/{ => kern_progs}/test_stacktrace_map.c     |  0
 .../bpf/{ => kern_progs}/test_tcp_estats.c         |  0
 .../bpf/{ => kern_progs}/test_tcpbpf_kern.c        |  0
 .../bpf/{ => kern_progs}/test_tcpnotify_kern.c     |  0
 .../bpf/{ => kern_progs}/test_tracepoint.c         |  0
 .../bpf/{ => kern_progs}/test_tunnel_kern.c        |  0
 .../selftests/bpf/{ => kern_progs}/test_xdp.c      |  0
 .../selftests/bpf/{ => kern_progs}/test_xdp_meta.c |  0
 .../bpf/{ => kern_progs}/test_xdp_noinline.c       |  0
 .../bpf/{ => kern_progs}/test_xdp_redirect.c       |  0
 .../selftests/bpf/{ => kern_progs}/test_xdp_vlan.c |  0
 .../selftests/bpf/{ => kern_progs}/xdp_dummy.c     |  0
 50 files changed, 8 insertions(+), 28 deletions(-)
 rename tools/testing/selftests/bpf/{ => kern_progs}/bpf_flow.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/connect4_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/connect6_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/dev_cgroup.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/get_cgroup_id_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/netcnt_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sample_map_ret0.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sample_ret0.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sendmsg4_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sendmsg6_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/socket_cookie_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sockmap_parse_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sockmap_tcp_msg_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sockmap_verdict_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_adjust_tail.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_btf_haskv.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_btf_nokv.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_get_stack_rawtp.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_l4lb.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_l4lb_noinline.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_lirc_mode2_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_lwt_seg6local.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_map_in_map.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_map_lock.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_obj_id.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_pkt_access.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_pkt_md_access.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_queue_map.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_select_reuseport_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_sk_lookup_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_skb_cgroup_id_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_sockhash_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_sockmap_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_spin_lock.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_stack_map.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_stacktrace_build_id.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_stacktrace_map.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tcp_estats.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tcpbpf_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tcpnotify_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tracepoint.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tunnel_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp_meta.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp_noinline.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp_redirect.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp_vlan.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/xdp_dummy.c (100%)

-- 
2.7.4


^ permalink raw reply

* [PATCH bpf-next 3/3] selftests: bpf: centre kernel bpf objects under new subdir "kern_progs"
From: Jiong Wang @ 2019-02-08 17:41 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549647681-13818-1-git-send-email-jiong.wang@netronome.com>

At the moment, all kernel bpf objects are listed under BPF_OBJ_FILES.
Listing them manually sometimes causing patch conflict when people are
adding new testcases simultaneously.

It is better to centre all the related source files under a subdir
"kern_progs", then auto-generate the object file list.

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
 tools/testing/selftests/bpf/Makefile               | 26 +++++-----------------
 .../selftests/bpf/{ => kern_progs}/bpf_flow.c      |  0
 .../selftests/bpf/{ => kern_progs}/connect4_prog.c |  0
 .../selftests/bpf/{ => kern_progs}/connect6_prog.c |  0
 .../selftests/bpf/{ => kern_progs}/dev_cgroup.c    |  0
 .../bpf/{ => kern_progs}/get_cgroup_id_kern.c      |  0
 .../selftests/bpf/{ => kern_progs}/netcnt_prog.c   |  0
 .../bpf/{ => kern_progs}/sample_map_ret0.c         |  0
 .../selftests/bpf/{ => kern_progs}/sample_ret0.c   |  0
 .../selftests/bpf/{ => kern_progs}/sendmsg4_prog.c |  0
 .../selftests/bpf/{ => kern_progs}/sendmsg6_prog.c |  0
 .../bpf/{ => kern_progs}/socket_cookie_prog.c      |  0
 .../bpf/{ => kern_progs}/sockmap_parse_prog.c      |  0
 .../bpf/{ => kern_progs}/sockmap_tcp_msg_prog.c    |  0
 .../bpf/{ => kern_progs}/sockmap_verdict_prog.c    |  0
 .../bpf/{ => kern_progs}/test_adjust_tail.c        |  0
 .../bpf/{ => kern_progs}/test_btf_haskv.c          |  0
 .../selftests/bpf/{ => kern_progs}/test_btf_nokv.c |  0
 .../bpf/{ => kern_progs}/test_get_stack_rawtp.c    |  0
 .../selftests/bpf/{ => kern_progs}/test_l4lb.c     |  0
 .../bpf/{ => kern_progs}/test_l4lb_noinline.c      |  0
 .../bpf/{ => kern_progs}/test_lirc_mode2_kern.c    |  0
 .../bpf/{ => kern_progs}/test_lwt_seg6local.c      |  0
 .../bpf/{ => kern_progs}/test_map_in_map.c         |  0
 .../selftests/bpf/{ => kern_progs}/test_map_lock.c |  0
 .../selftests/bpf/{ => kern_progs}/test_obj_id.c   |  0
 .../bpf/{ => kern_progs}/test_pkt_access.c         |  0
 .../bpf/{ => kern_progs}/test_pkt_md_access.c      |  0
 .../bpf/{ => kern_progs}/test_queue_map.c          |  0
 .../{ => kern_progs}/test_select_reuseport_kern.c  |  0
 .../bpf/{ => kern_progs}/test_sk_lookup_kern.c     |  0
 .../bpf/{ => kern_progs}/test_skb_cgroup_id_kern.c |  0
 .../bpf/{ => kern_progs}/test_sockhash_kern.c      |  0
 .../bpf/{ => kern_progs}/test_sockmap_kern.c       |  0
 .../bpf/{ => kern_progs}/test_spin_lock.c          |  0
 .../bpf/{ => kern_progs}/test_stack_map.c          |  0
 .../{ => kern_progs}/test_stacktrace_build_id.c    |  0
 .../bpf/{ => kern_progs}/test_stacktrace_map.c     |  0
 .../bpf/{ => kern_progs}/test_tcp_estats.c         |  0
 .../bpf/{ => kern_progs}/test_tcpbpf_kern.c        |  0
 .../bpf/{ => kern_progs}/test_tcpnotify_kern.c     |  0
 .../bpf/{ => kern_progs}/test_tracepoint.c         |  0
 .../bpf/{ => kern_progs}/test_tunnel_kern.c        |  0
 .../selftests/bpf/{ => kern_progs}/test_xdp.c      |  0
 .../selftests/bpf/{ => kern_progs}/test_xdp_meta.c |  0
 .../bpf/{ => kern_progs}/test_xdp_noinline.c       |  0
 .../bpf/{ => kern_progs}/test_xdp_redirect.c       |  0
 .../selftests/bpf/{ => kern_progs}/test_xdp_vlan.c |  0
 .../selftests/bpf/{ => kern_progs}/xdp_dummy.c     |  0
 49 files changed, 5 insertions(+), 21 deletions(-)
 rename tools/testing/selftests/bpf/{ => kern_progs}/bpf_flow.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/connect4_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/connect6_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/dev_cgroup.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/get_cgroup_id_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/netcnt_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sample_map_ret0.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sample_ret0.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sendmsg4_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sendmsg6_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/socket_cookie_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sockmap_parse_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sockmap_tcp_msg_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/sockmap_verdict_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_adjust_tail.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_btf_haskv.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_btf_nokv.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_get_stack_rawtp.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_l4lb.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_l4lb_noinline.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_lirc_mode2_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_lwt_seg6local.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_map_in_map.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_map_lock.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_obj_id.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_pkt_access.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_pkt_md_access.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_queue_map.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_select_reuseport_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_sk_lookup_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_skb_cgroup_id_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_sockhash_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_sockmap_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_spin_lock.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_stack_map.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_stacktrace_build_id.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_stacktrace_map.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tcp_estats.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tcpbpf_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tcpnotify_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tracepoint.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_tunnel_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp_meta.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp_noinline.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp_redirect.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/test_xdp_vlan.c (100%)
 rename tools/testing/selftests/bpf/{ => kern_progs}/xdp_dummy.c (100%)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 70b2570..2965855 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -25,24 +25,7 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
 	test_socket_cookie test_cgroup_storage test_select_reuseport test_section_names \
 	test_netcnt test_tcpnotify_user
 
-BPF_OBJ_FILES = \
-	test_xdp_redirect.o test_xdp_meta.o sockmap_parse_prog.o \
-	sockmap_verdict_prog.o dev_cgroup.o sample_ret0.o \
-	test_tcpnotify_kern.o sample_map_ret0.o test_tcpbpf_kern.o \
-	sockmap_tcp_msg_prog.o connect4_prog.o connect6_prog.o \
-	test_btf_haskv.o test_btf_nokv.o test_sockmap_kern.o \
-	test_tunnel_kern.o test_sockhash_kern.o test_lwt_seg6local.o \
-	sendmsg4_prog.o sendmsg6_prog.o test_lirc_mode2_kern.o \
-	get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
-	test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
-	xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
-	test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
-	test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
-	test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
-	test_stacktrace_map.o test_stacktrace_build_id.o \
-	test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
-	test_stack_map.o
-
+BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard kern_progs/*.c)))
 TEST_GEN_FILES = $(BPF_OBJ_FILES)
 
 # Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
@@ -183,7 +166,8 @@ $(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(ALU32_BUILD_DIR) \
 	$(CC) $(CFLAGS) -o $(ALU32_BUILD_DIR)/test_progs_32 $< \
 		trace_helpers.c $(OUTPUT)/libbpf.a $(LDLIBS)
 
-$(ALU32_BUILD_DIR)/%.o: %.c $(ALU32_BUILD_DIR) $(ALU32_BUILD_DIR)/test_progs_32
+$(ALU32_BUILD_DIR)/%.o: kern_progs/%.c $(ALU32_BUILD_DIR) \
+					$(ALU32_BUILD_DIR)/test_progs_32
 	$(CLANG) $(CLANG_FLAGS) \
 		 -O2 -target bpf -emit-llvm -c $< -o - |      \
 	$(LLC) -march=bpf -mattr=+alu32 -mcpu=$(CPU) $(LLC_FLAGS) \
@@ -195,7 +179,7 @@ endif
 
 # Have one program compiled without "-target bpf" to test whether libbpf loads
 # it successfully
-$(OUTPUT)/test_xdp.o: test_xdp.c
+$(OUTPUT)/test_xdp.o: kern_progs/test_xdp.c
 	$(CLANG) $(CLANG_FLAGS) \
 		-O2 -emit-llvm -c $< -o - | \
 	$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
@@ -203,7 +187,7 @@ ifeq ($(DWARF2BTF),y)
 	$(BTF_PAHOLE) -J $@
 endif
 
-$(OUTPUT)/%.o: %.c
+$(OUTPUT)/%.o: kern_progs/%.c
 	$(CLANG) $(CLANG_FLAGS) \
 		 -O2 -target bpf -emit-llvm -c $< -o - |      \
 	$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
diff --git a/tools/testing/selftests/bpf/bpf_flow.c b/tools/testing/selftests/bpf/kern_progs/bpf_flow.c
similarity index 100%
rename from tools/testing/selftests/bpf/bpf_flow.c
rename to tools/testing/selftests/bpf/kern_progs/bpf_flow.c
diff --git a/tools/testing/selftests/bpf/connect4_prog.c b/tools/testing/selftests/bpf/kern_progs/connect4_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/connect4_prog.c
rename to tools/testing/selftests/bpf/kern_progs/connect4_prog.c
diff --git a/tools/testing/selftests/bpf/connect6_prog.c b/tools/testing/selftests/bpf/kern_progs/connect6_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/connect6_prog.c
rename to tools/testing/selftests/bpf/kern_progs/connect6_prog.c
diff --git a/tools/testing/selftests/bpf/dev_cgroup.c b/tools/testing/selftests/bpf/kern_progs/dev_cgroup.c
similarity index 100%
rename from tools/testing/selftests/bpf/dev_cgroup.c
rename to tools/testing/selftests/bpf/kern_progs/dev_cgroup.c
diff --git a/tools/testing/selftests/bpf/get_cgroup_id_kern.c b/tools/testing/selftests/bpf/kern_progs/get_cgroup_id_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/get_cgroup_id_kern.c
rename to tools/testing/selftests/bpf/kern_progs/get_cgroup_id_kern.c
diff --git a/tools/testing/selftests/bpf/netcnt_prog.c b/tools/testing/selftests/bpf/kern_progs/netcnt_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/netcnt_prog.c
rename to tools/testing/selftests/bpf/kern_progs/netcnt_prog.c
diff --git a/tools/testing/selftests/bpf/sample_map_ret0.c b/tools/testing/selftests/bpf/kern_progs/sample_map_ret0.c
similarity index 100%
rename from tools/testing/selftests/bpf/sample_map_ret0.c
rename to tools/testing/selftests/bpf/kern_progs/sample_map_ret0.c
diff --git a/tools/testing/selftests/bpf/sample_ret0.c b/tools/testing/selftests/bpf/kern_progs/sample_ret0.c
similarity index 100%
rename from tools/testing/selftests/bpf/sample_ret0.c
rename to tools/testing/selftests/bpf/kern_progs/sample_ret0.c
diff --git a/tools/testing/selftests/bpf/sendmsg4_prog.c b/tools/testing/selftests/bpf/kern_progs/sendmsg4_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sendmsg4_prog.c
rename to tools/testing/selftests/bpf/kern_progs/sendmsg4_prog.c
diff --git a/tools/testing/selftests/bpf/sendmsg6_prog.c b/tools/testing/selftests/bpf/kern_progs/sendmsg6_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sendmsg6_prog.c
rename to tools/testing/selftests/bpf/kern_progs/sendmsg6_prog.c
diff --git a/tools/testing/selftests/bpf/socket_cookie_prog.c b/tools/testing/selftests/bpf/kern_progs/socket_cookie_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/socket_cookie_prog.c
rename to tools/testing/selftests/bpf/kern_progs/socket_cookie_prog.c
diff --git a/tools/testing/selftests/bpf/sockmap_parse_prog.c b/tools/testing/selftests/bpf/kern_progs/sockmap_parse_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sockmap_parse_prog.c
rename to tools/testing/selftests/bpf/kern_progs/sockmap_parse_prog.c
diff --git a/tools/testing/selftests/bpf/sockmap_tcp_msg_prog.c b/tools/testing/selftests/bpf/kern_progs/sockmap_tcp_msg_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sockmap_tcp_msg_prog.c
rename to tools/testing/selftests/bpf/kern_progs/sockmap_tcp_msg_prog.c
diff --git a/tools/testing/selftests/bpf/sockmap_verdict_prog.c b/tools/testing/selftests/bpf/kern_progs/sockmap_verdict_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sockmap_verdict_prog.c
rename to tools/testing/selftests/bpf/kern_progs/sockmap_verdict_prog.c
diff --git a/tools/testing/selftests/bpf/test_adjust_tail.c b/tools/testing/selftests/bpf/kern_progs/test_adjust_tail.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_adjust_tail.c
rename to tools/testing/selftests/bpf/kern_progs/test_adjust_tail.c
diff --git a/tools/testing/selftests/bpf/test_btf_haskv.c b/tools/testing/selftests/bpf/kern_progs/test_btf_haskv.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_btf_haskv.c
rename to tools/testing/selftests/bpf/kern_progs/test_btf_haskv.c
diff --git a/tools/testing/selftests/bpf/test_btf_nokv.c b/tools/testing/selftests/bpf/kern_progs/test_btf_nokv.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_btf_nokv.c
rename to tools/testing/selftests/bpf/kern_progs/test_btf_nokv.c
diff --git a/tools/testing/selftests/bpf/test_get_stack_rawtp.c b/tools/testing/selftests/bpf/kern_progs/test_get_stack_rawtp.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_get_stack_rawtp.c
rename to tools/testing/selftests/bpf/kern_progs/test_get_stack_rawtp.c
diff --git a/tools/testing/selftests/bpf/test_l4lb.c b/tools/testing/selftests/bpf/kern_progs/test_l4lb.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_l4lb.c
rename to tools/testing/selftests/bpf/kern_progs/test_l4lb.c
diff --git a/tools/testing/selftests/bpf/test_l4lb_noinline.c b/tools/testing/selftests/bpf/kern_progs/test_l4lb_noinline.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_l4lb_noinline.c
rename to tools/testing/selftests/bpf/kern_progs/test_l4lb_noinline.c
diff --git a/tools/testing/selftests/bpf/test_lirc_mode2_kern.c b/tools/testing/selftests/bpf/kern_progs/test_lirc_mode2_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_lirc_mode2_kern.c
rename to tools/testing/selftests/bpf/kern_progs/test_lirc_mode2_kern.c
diff --git a/tools/testing/selftests/bpf/test_lwt_seg6local.c b/tools/testing/selftests/bpf/kern_progs/test_lwt_seg6local.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_lwt_seg6local.c
rename to tools/testing/selftests/bpf/kern_progs/test_lwt_seg6local.c
diff --git a/tools/testing/selftests/bpf/test_map_in_map.c b/tools/testing/selftests/bpf/kern_progs/test_map_in_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_map_in_map.c
rename to tools/testing/selftests/bpf/kern_progs/test_map_in_map.c
diff --git a/tools/testing/selftests/bpf/test_map_lock.c b/tools/testing/selftests/bpf/kern_progs/test_map_lock.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_map_lock.c
rename to tools/testing/selftests/bpf/kern_progs/test_map_lock.c
diff --git a/tools/testing/selftests/bpf/test_obj_id.c b/tools/testing/selftests/bpf/kern_progs/test_obj_id.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_obj_id.c
rename to tools/testing/selftests/bpf/kern_progs/test_obj_id.c
diff --git a/tools/testing/selftests/bpf/test_pkt_access.c b/tools/testing/selftests/bpf/kern_progs/test_pkt_access.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_pkt_access.c
rename to tools/testing/selftests/bpf/kern_progs/test_pkt_access.c
diff --git a/tools/testing/selftests/bpf/test_pkt_md_access.c b/tools/testing/selftests/bpf/kern_progs/test_pkt_md_access.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_pkt_md_access.c
rename to tools/testing/selftests/bpf/kern_progs/test_pkt_md_access.c
diff --git a/tools/testing/selftests/bpf/test_queue_map.c b/tools/testing/selftests/bpf/kern_progs/test_queue_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_queue_map.c
rename to tools/testing/selftests/bpf/kern_progs/test_queue_map.c
diff --git a/tools/testing/selftests/bpf/test_select_reuseport_kern.c b/tools/testing/selftests/bpf/kern_progs/test_select_reuseport_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_select_reuseport_kern.c
rename to tools/testing/selftests/bpf/kern_progs/test_select_reuseport_kern.c
diff --git a/tools/testing/selftests/bpf/test_sk_lookup_kern.c b/tools/testing/selftests/bpf/kern_progs/test_sk_lookup_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sk_lookup_kern.c
rename to tools/testing/selftests/bpf/kern_progs/test_sk_lookup_kern.c
diff --git a/tools/testing/selftests/bpf/test_skb_cgroup_id_kern.c b/tools/testing/selftests/bpf/kern_progs/test_skb_cgroup_id_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_skb_cgroup_id_kern.c
rename to tools/testing/selftests/bpf/kern_progs/test_skb_cgroup_id_kern.c
diff --git a/tools/testing/selftests/bpf/test_sockhash_kern.c b/tools/testing/selftests/bpf/kern_progs/test_sockhash_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sockhash_kern.c
rename to tools/testing/selftests/bpf/kern_progs/test_sockhash_kern.c
diff --git a/tools/testing/selftests/bpf/test_sockmap_kern.c b/tools/testing/selftests/bpf/kern_progs/test_sockmap_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sockmap_kern.c
rename to tools/testing/selftests/bpf/kern_progs/test_sockmap_kern.c
diff --git a/tools/testing/selftests/bpf/test_spin_lock.c b/tools/testing/selftests/bpf/kern_progs/test_spin_lock.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_spin_lock.c
rename to tools/testing/selftests/bpf/kern_progs/test_spin_lock.c
diff --git a/tools/testing/selftests/bpf/test_stack_map.c b/tools/testing/selftests/bpf/kern_progs/test_stack_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_stack_map.c
rename to tools/testing/selftests/bpf/kern_progs/test_stack_map.c
diff --git a/tools/testing/selftests/bpf/test_stacktrace_build_id.c b/tools/testing/selftests/bpf/kern_progs/test_stacktrace_build_id.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_stacktrace_build_id.c
rename to tools/testing/selftests/bpf/kern_progs/test_stacktrace_build_id.c
diff --git a/tools/testing/selftests/bpf/test_stacktrace_map.c b/tools/testing/selftests/bpf/kern_progs/test_stacktrace_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_stacktrace_map.c
rename to tools/testing/selftests/bpf/kern_progs/test_stacktrace_map.c
diff --git a/tools/testing/selftests/bpf/test_tcp_estats.c b/tools/testing/selftests/bpf/kern_progs/test_tcp_estats.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tcp_estats.c
rename to tools/testing/selftests/bpf/kern_progs/test_tcp_estats.c
diff --git a/tools/testing/selftests/bpf/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/kern_progs/test_tcpbpf_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tcpbpf_kern.c
rename to tools/testing/selftests/bpf/kern_progs/test_tcpbpf_kern.c
diff --git a/tools/testing/selftests/bpf/test_tcpnotify_kern.c b/tools/testing/selftests/bpf/kern_progs/test_tcpnotify_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tcpnotify_kern.c
rename to tools/testing/selftests/bpf/kern_progs/test_tcpnotify_kern.c
diff --git a/tools/testing/selftests/bpf/test_tracepoint.c b/tools/testing/selftests/bpf/kern_progs/test_tracepoint.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tracepoint.c
rename to tools/testing/selftests/bpf/kern_progs/test_tracepoint.c
diff --git a/tools/testing/selftests/bpf/test_tunnel_kern.c b/tools/testing/selftests/bpf/kern_progs/test_tunnel_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tunnel_kern.c
rename to tools/testing/selftests/bpf/kern_progs/test_tunnel_kern.c
diff --git a/tools/testing/selftests/bpf/test_xdp.c b/tools/testing/selftests/bpf/kern_progs/test_xdp.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp.c
rename to tools/testing/selftests/bpf/kern_progs/test_xdp.c
diff --git a/tools/testing/selftests/bpf/test_xdp_meta.c b/tools/testing/selftests/bpf/kern_progs/test_xdp_meta.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_meta.c
rename to tools/testing/selftests/bpf/kern_progs/test_xdp_meta.c
diff --git a/tools/testing/selftests/bpf/test_xdp_noinline.c b/tools/testing/selftests/bpf/kern_progs/test_xdp_noinline.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_noinline.c
rename to tools/testing/selftests/bpf/kern_progs/test_xdp_noinline.c
diff --git a/tools/testing/selftests/bpf/test_xdp_redirect.c b/tools/testing/selftests/bpf/kern_progs/test_xdp_redirect.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_redirect.c
rename to tools/testing/selftests/bpf/kern_progs/test_xdp_redirect.c
diff --git a/tools/testing/selftests/bpf/test_xdp_vlan.c b/tools/testing/selftests/bpf/kern_progs/test_xdp_vlan.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_vlan.c
rename to tools/testing/selftests/bpf/kern_progs/test_xdp_vlan.c
diff --git a/tools/testing/selftests/bpf/xdp_dummy.c b/tools/testing/selftests/bpf/kern_progs/xdp_dummy.c
similarity index 100%
rename from tools/testing/selftests/bpf/xdp_dummy.c
rename to tools/testing/selftests/bpf/kern_progs/xdp_dummy.c
-- 
2.7.4


^ permalink raw reply related

* Re: [iproute PATCH] ip-link: Fix listing of alias interfaces
From: David Ahern @ 2019-02-08 17:50 UTC (permalink / raw)
  To: Michal Kubecek, netdev; +Cc: Phil Sutter, Stephen Hemminger, Roopa Prabhu
In-Reply-To: <20190208120903.GC7035@unicorn.suse.cz>

On 2/8/19 4:09 AM, Michal Kubecek wrote:
> Not only that, other ip link subcommands also use ioctl for interface
> lookup so that e.g. "ip link del dummy1:x" deletes dummy1 without any
> complaint.
> 
> But as I mentioned earlier in http://patchwork.ozlabs.org/patch/1037934/
> I'm not sure this behaviour is really desirable.

I sent a patch some time ago to convert ll_name_to_index to use an
netlink message first and only fallback to if_nametoindex if it fails.
That should fix the problem you mentioned

^ permalink raw reply

* Re: [iproute PATCH] ip-link: Fix listing of alias interfaces
From: Stephen Hemminger @ 2019-02-08 17:56 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netdev, Roopa Prabhu
In-Reply-To: <20190207130527.9439-1-phil@nwl.cc>

On Thu,  7 Feb 2019 14:05:27 +0100
Phil Sutter <phil@nwl.cc> wrote:

> Commit 50b9950dd9011 ("link dump filter") accidentally broke listing of
> links in the old alias interface notation:
> 
> | % ip link show eth0:1
> | RTNETLINK answers: No such device
> | Cannot send link get request: No such device
> 
> Prior to the above commit, link lookup was performed via ifindex
> returned by if_nametoindex(). The latter uses SIOCGIFINDEX ioctl call
> which on kernel side causes the colon-suffix to be dropped before doing
> the interface lookup. Netlink API though doesn't care about that at all.
> To keep things backward compatible, mimick ioctl API behaviour and drop
> the colon-suffix prior to sending the RTM_GETLINK request.
> 
> Fixes: 50b9950dd9011 ("link dump filter")
> Signed-off-by: Phil Sutter <phil@nwl.cc>

It is a regression, but the original code was kind of broken.
iproute2 doesn't need or want the old style alias interface notation.

^ permalink raw reply

* RE: [PATCH net-next] devlink: Add WARN_ON to catch errors of not cleaning devlink objects
From: Parav Pandit @ 2019-02-08 18:01 UTC (permalink / raw)
  To: David Ahern, netdev@vger.kernel.org, davem@davemloft.net
In-Reply-To: <dcd9b51a-1916-a947-7384-aa24f3d25cf3@gmail.com>



> -----Original Message-----
> From: David Ahern <dsahern@gmail.com>
> Sent: Friday, February 8, 2019 11:30 AM
> To: Parav Pandit <parav@mellanox.com>; netdev@vger.kernel.org;
> davem@davemloft.net
> Subject: Re: [PATCH net-next] devlink: Add WARN_ON to catch errors of not
> cleaning devlink objects
> 
> On 2/8/19 8:22 AM, Parav Pandit wrote:
> > Add WARN_ON to make sure that all sub objects of a devlink device are
> > cleanedup before freeing the devlink device.
> > This helps to catch any driver bugs.
> >
> > Signed-off-by: Parav Pandit <parav@mellanox.com>
> > Acked-by: Jiri Pirko <jiri@mellanox.com>
> > ---
> >  net/core/devlink.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/net/core/devlink.c b/net/core/devlink.c index
> > cd0d393..5e2ef5a 100644
> > --- a/net/core/devlink.c
> > +++ b/net/core/devlink.c
> > @@ -4229,6 +4229,13 @@ void devlink_unregister(struct devlink *devlink)
> >   */
> >  void devlink_free(struct devlink *devlink)  {
> > +	WARN_ON(!list_empty(&devlink->port_list));
> > +	WARN_ON(!list_empty(&devlink->sb_list));
> > +	WARN_ON(!list_empty(&devlink->dpipe_table_list));
> > +	WARN_ON(!list_empty(&devlink->resource_list));
> > +	WARN_ON(!list_empty(&devlink->param_list));
> > +	WARN_ON(!list_empty(&devlink->region_list));
> > +
> >  	kfree(devlink);
> >  }
> >  EXPORT_SYMBOL_GPL(devlink_free);
> >
> 
> reporter_list was just added which brings up the maintenance question:
> If you are going to do this you might want a comment in
> include/net/devlink.h to remind folks to update this function as relevant.
I see. Make sense. Adding reporter_list and updating devlink.h, too for comment in v1.

^ permalink raw reply

* Re: [PATCH iproute2] tc: use bits not mbits/sec in rate percent
From: Stephen Hemminger @ 2019-02-08 18:01 UTC (permalink / raw)
  To: Marcos Antonio Moraes; +Cc: netdev
In-Reply-To: <20190207152954.11036-1-marcos.antonio@digirati.com.br>

On Thu,  7 Feb 2019 13:29:54 -0200
Marcos Antonio Moraes <marcos.antonio@digirati.com.br> wrote:

> As /sys/class/net/<iface>/speed indicates a value in Mbits/sec, the
> conversion is necessary to create the correct limits.
> 
> This guarantees the same result for the following commands in an
> 1000Mbit/sec device:
> 
> tc class add ... htb rate 500Mbit
> tc class add ... htb rate 50%
> 
> Fixes: 927e3cfb52b5 ("tc: B.W limits can now be specified in %.")
> Signed-off-by: Marcos Antonio Moraes <marcos.antonio@digirati.com.br>

Sure applied.



^ permalink raw reply

* Re: [iproute PATCH] ip-link: Fix listing of alias interfaces
From: Phil Sutter @ 2019-02-08 18:04 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Roopa Prabhu
In-Reply-To: <20190208095647.047abca3@hermes.lan>

Hi Stephen,

On Fri, Feb 08, 2019 at 09:56:47AM -0800, Stephen Hemminger wrote:
> On Thu,  7 Feb 2019 14:05:27 +0100
> Phil Sutter <phil@nwl.cc> wrote:
> 
> > Commit 50b9950dd9011 ("link dump filter") accidentally broke listing of
> > links in the old alias interface notation:
> > 
> > | % ip link show eth0:1
> > | RTNETLINK answers: No such device
> > | Cannot send link get request: No such device
> > 
> > Prior to the above commit, link lookup was performed via ifindex
> > returned by if_nametoindex(). The latter uses SIOCGIFINDEX ioctl call
> > which on kernel side causes the colon-suffix to be dropped before doing
> > the interface lookup. Netlink API though doesn't care about that at all.
> > To keep things backward compatible, mimick ioctl API behaviour and drop
> > the colon-suffix prior to sending the RTM_GETLINK request.
> > 
> > Fixes: 50b9950dd9011 ("link dump filter")
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> 
> It is a regression, but the original code was kind of broken.
> iproute2 doesn't need or want the old style alias interface notation.

Thanks for your clarification!

Cheers, Phil

^ permalink raw reply

* Re: [PATCH v3 bpf-next 4/4] tools/bpf: remove btf__get_strings superseded() by raw data API
From: Andrii Nakryiko @ 2019-02-08 18:11 UTC (permalink / raw)
  To: Song Liu
  Cc: Andrii Nakryiko, Alexei Starovoitov, Yonghong Song,
	Alexei Starovoitov, Martin Lau, netdev@vger.kernel.org,
	Kernel Team, daniel@iogearbox.net
In-Reply-To: <0E831E04-241E-44F8-800B-63346080E9F3@fb.com>

On Fri, Feb 8, 2019 at 9:31 AM Song Liu <songliubraving@fb.com> wrote:
>
>
>
> > On Feb 7, 2019, at 6:55 PM, Andrii Nakryiko <andriin@fb.com> wrote:
> >
> > Now that we have btf__get_raw_data() it's trivial for tests to iterate
> > over all strings for testing purposes, which eliminates the need for
> > btf__get_strings() API.
> >
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> > ---
> > tools/lib/bpf/btf.c                    |  7 -----
> > tools/lib/bpf/btf.h                    |  2 --
> > tools/testing/selftests/bpf/test_btf.c | 39 +++++++++++++++++---------
> > 3 files changed, 26 insertions(+), 22 deletions(-)
> >
> > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> > index c87cc3d71b9f..a986dc28f17d 100644
> > --- a/tools/lib/bpf/btf.c
> > +++ b/tools/lib/bpf/btf.c
> > @@ -447,13 +447,6 @@ const void *btf__get_raw_data(const struct btf *btf, __u32 *size)
> >       return btf->data;
> > }
> >
> > -void btf__get_strings(const struct btf *btf, const char **strings,
> > -                   __u32 *str_len)
> > -{
> > -     *strings = btf->strings;
> > -     *str_len = btf->hdr->str_len;
> > -}
> > -
> > const char *btf__name_by_offset(const struct btf *btf, __u32 offset)
> > {
> >       if (offset < btf->hdr->str_len)
> > diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
> > index ad9f648260c2..6179291f2cec 100644
> > --- a/tools/lib/bpf/btf.h
> > +++ b/tools/lib/bpf/btf.h
> > @@ -67,8 +67,6 @@ LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
> > LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id);
> > LIBBPF_API int btf__fd(const struct btf *btf);
> > LIBBPF_API const void *btf__get_raw_data(const struct btf *btf, __u32 *size);
> > -LIBBPF_API void btf__get_strings(const struct btf *btf, const char **strings,
> > -                              __u32 *str_len);
>
> I guess we need to update libbpf.map with this?

Definitely! I must have lost it during rebase, fixing.

>
> > LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
> > LIBBPF_API int btf__get_from_id(__u32 id, struct btf **btf);
> > LIBBPF_API int btf__get_map_kv_tids(const struct btf *btf, const char *map_name,
> > diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c
> > index 447acc34db94..bbcacba39590 100644
> > --- a/tools/testing/selftests/bpf/test_btf.c
> > +++ b/tools/testing/selftests/bpf/test_btf.c
> > @@ -5882,15 +5882,17 @@ static void dump_btf_strings(const char *strs, __u32 len)
> > static int do_test_dedup(unsigned int test_num)
> > {
> >       const struct btf_dedup_test *test = &dedup_tests[test_num - 1];
> > -     int err = 0, i;
> > -     __u32 test_nr_types, expect_nr_types, test_str_len, expect_str_len;
> > -     void *raw_btf;
> > -     unsigned int raw_btf_size;
> > +     __u32 test_nr_types, expect_nr_types, test_btf_size, expect_btf_size;
> > +     const struct btf_header *test_hdr, *expect_hdr;
> >       struct btf *test_btf = NULL, *expect_btf = NULL;
> > +     const void *test_btf_data, *expect_btf_data;
> >       const char *ret_test_next_str, *ret_expect_next_str;
> >       const char *test_strs, *expect_strs;
> >       const char *test_str_cur, *test_str_end;
> >       const char *expect_str_cur, *expect_str_end;
> > +     unsigned int raw_btf_size;
> > +     void *raw_btf;
> > +     int err = 0, i;
> >
> >       fprintf(stderr, "BTF dedup test[%u] (%s):", test_num, test->descr);
> >
> > @@ -5927,23 +5929,34 @@ static int do_test_dedup(unsigned int test_num)
> >               goto done;
> >       }
> >
> > -     btf__get_strings(test_btf, &test_strs, &test_str_len);
> > -     btf__get_strings(expect_btf, &expect_strs, &expect_str_len);
> > -     if (CHECK(test_str_len != expect_str_len,
> > -               "test_str_len:%u != expect_str_len:%u",
> > -               test_str_len, expect_str_len)) {
> > +     test_btf_data = btf__get_raw_data(test_btf, &test_btf_size);
> > +     expect_btf_data = btf__get_raw_data(expect_btf, &expect_btf_size);
> > +     if (CHECK(test_btf_size != expect_btf_size,
> > +               "test_btf_size:%u != expect_btf_size:%u",
> > +               test_btf_size, expect_btf_size)) {
> > +             err = -1;
> > +             goto done;
> > +     }
> > +
> > +     test_hdr = test_btf_data;
> > +     test_strs = test_btf_data + test_hdr->str_off;
> > +     expect_hdr = expect_btf_data;
> > +     expect_strs = expect_btf_data + expect_hdr->str_off;
> > +     if (CHECK(test_hdr->str_len != expect_hdr->str_len,
> > +               "test_hdr->str_len:%u != expect_hdr->str_len:%u",
> > +               test_hdr->str_len, expect_hdr->str_len)) {
> >               fprintf(stderr, "\ntest strings:\n");
> > -             dump_btf_strings(test_strs, test_str_len);
> > +             dump_btf_strings(test_strs, test_hdr->str_len);
> >               fprintf(stderr, "\nexpected strings:\n");
> > -             dump_btf_strings(expect_strs, expect_str_len);
> > +             dump_btf_strings(expect_strs, expect_hdr->str_len);
> >               err = -1;
> >               goto done;
> >       }
> >
> >       test_str_cur = test_strs;
> > -     test_str_end = test_strs + test_str_len;
> > +     test_str_end = test_strs + test_hdr->str_len;
> >       expect_str_cur = expect_strs;
> > -     expect_str_end = expect_strs + expect_str_len;
> > +     expect_str_end = expect_strs + expect_hdr->str_len;
> >       while (test_str_cur < test_str_end && expect_str_cur < expect_str_end) {
> >               size_t test_len, expect_len;
> >
> > --
> > 2.17.1
> >
>

^ permalink raw reply

* Re: Waiting for vrf to become free on rmmod of bridge...
From: Ben Greear @ 2019-02-08 18:12 UTC (permalink / raw)
  To: David Ahern, netdev
In-Reply-To: <bb4c7049-9f5a-6f2b-840f-3eb42b9307f5@gmail.com>

On 2/6/19 5:50 PM, David Ahern wrote:
> On 2/6/19 3:20 PM, Ben Greear wrote:
>> Hello,
>>
>> I just saw this warning on a system running a hacked 4.20.2+ kernel.
>> Any known bugs
>> of this nature in this (upstream) kernel?  The command that is blocked is:
>> 'rmmod bridge llc'
>>
>> [17069.299135] unregister_netdevice: waiting for _vrf13 to become free.
>> Usage count = 1
>> [17079.306438] unregister_netdevice: waiting for _vrf13 to become free.
>> Usage count = 1
>> [17089.314656] unregister_netdevice: waiting for _vrf13 to become free.
>> Usage count = 1
>> [17099.322870] unregister_netdevice: waiting for _vrf13 to become free.
>> Usage count = 1
>>
>> Thanks,
>> Ben
>>
> 
> No known refcount issues with vrf.
> 
> I use namespaces for testing which creates devices, adds routes, runs
> traffic and deletes the device and namespace. That series in the tests
> has been known to trigger refcount problems in the past.

I'm not using namespaces in my test, but it is fairly convoluted.  If I
figure out how to reproduce the issue I'll let you know.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* Re: [PATCH net-next] net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg
From: Heiner Kallweit @ 2019-02-08 18:16 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: Florian Fainelli, David Miller, netdev@vger.kernel.org
In-Reply-To: <20190208140206.GE26594@lunn.ch>

On 08.02.2019 15:02, Andrew Lunn wrote:
> On Fri, Feb 08, 2019 at 08:12:47AM +0100, Heiner Kallweit wrote:
>> Bit 0 in register 1.5 doesn't represent a device but is a flag that
>> Clause 22 registers are present. Therefore disregard this bit when
>> populating the device list. If code needs this information it
>> should read register 1.5 directly instead of accessing the device
>> list. Because this bit doesn't represent a device I didn't add a
>> MDIO_MMD_C22PRESENT constant or similar.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/net/phy/phy_device.c | 3 ++-
>>  include/uapi/linux/mdio.h    | 1 +
>>  2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
>> index 9369e1323..c2316a117 100644
>> --- a/drivers/net/phy/phy_device.c
>> +++ b/drivers/net/phy/phy_device.c
>> @@ -682,7 +682,8 @@ static int get_phy_c45_devs_in_pkg(struct mii_bus *bus, int addr, int dev_addr,
>>  	phy_reg = mdiobus_read(bus, addr, reg_addr);
>>  	if (phy_reg < 0)
>>  		return -EIO;
>> -	*devices_in_package |= (phy_reg & 0xffff);
>> +	/* Bit 0 doesn't represent a device, it indicates c22 regs presence */
>> +	*devices_in_package |= (phy_reg & 0xfffe);
> 
> Hi Heiner
> 
> Just for readability, can we use BIT(0) in there somehow?
> 
You think 0xfffe together with the comment is still not clear enough?
But sure, I can make it more explicit.

>>  
>>  	return 0;
>>  }
>> diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h
>> index 2e6e309f0..0e012b168 100644
>> --- a/include/uapi/linux/mdio.h
>> +++ b/include/uapi/linux/mdio.h
>> @@ -115,6 +115,7 @@
>>  
>>  /* Device present registers. */
>>  #define MDIO_DEVS_PRESENT(devad)	(1 << (devad))
>> +#define MDIO_DEVS_C22PRESENT		MDIO_DEVS_PRESENT(0)
> 
> Err. The commit message says you did not add this...
> 
Maybe I'm not clear enough in the commit message. Typically we have two
constants for a device:

MDIO_MMD_XXX (for the device)
MDIO_DEVS_XXX (for the bit of the device in the device list bitmap)

For the C22PRESENT flag I don't define the first one (because it's
not a device) but the second one (because it uses a bit in the device
list bitmap).

>      Andrew
> 
Heiner

^ permalink raw reply

* RE: [PATCH net-next 1/4] dpaa2-eth: Use a single page per Rx buffer
From: Ioana Ciornei @ 2019-02-08 18:19 UTC (permalink / raw)
  To: Jesper Dangaard Brouer, Ioana Ciocoi Radulescu
  Cc: Ilias Apalodimas, netdev@vger.kernel.org, davem@davemloft.net
In-Reply-To: <20190206204956.533326c2@carbon>

> Subject: Re: [PATCH net-next 1/4] dpaa2-eth: Use a single page per Rx buffer
> 
> 
> On Wed, 6 Feb 2019 15:36:33 +0000 Ioana Ciocoi Radulescu
> <ruxandra.radulescu@nxp.com> wrote:
> 
> > > From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > >
> > > Can you share any results on XDP (XDP_DROP is usually useful for the
> > > hardware capabilities).
> >
> > XDP numbers are pretty much the same as before this patch:
> >
> > On a LS2088A with A72 cores @2GHz (numbers in Mpps):
> > 				1core		8cores
> > -------------------------------------------------------------------------
> > XDP_DROP (no touching data)	5.37		29.6 (linerate)
> > XDP_DROP (xdp1 sample)	3.14		24.22
> 
> It is interesting/problematic to see that the cost of touching the data is so high
> 5.37Mpps -> 3.14Mpps.  The Intel CPUs have solved this in hardware with DDIO,
> which delivers frame in L3-cache. I have some ideas on how to improve this on
> ARM (or CPUs without DDIO).  I've previous implemented this as RFC on mlx4
> tested on a CPU without DDIO, with great success 10mpps -> 20Mpps (but it was
> shutdown, as newer Intel HW solved the issue).  The basic idea is to have an
> array of frames, that you start an L2/L3-prefetch on, before going "back" and
> process them for XDP or netstack. (p.s. this is the same DPDK does)

Thanks for the hint. We are currently investigating what our options are.
We'll come back with a more detailed answer once we figure out.

Ioana C

^ permalink raw reply

* [PATCH v2 net-next] net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg
From: Heiner Kallweit @ 2019-02-08 18:25 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org

Bit 0 in register 1.5 doesn't represent a device but is a flag that
Clause 22 registers are present. Therefore disregard this bit when
populating the device list. If code needs this information it
should read register 1.5 directly instead of accessing the device
list.
Because this bit doesn't represent a device don't define a
MDIO_MMD_XYZ constant, just define a MDIO_DEVS_XYZ constant for
the flag in the device list bitmap.

v2:
- make masking of bit 0 more explicit
- improve commit message

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy_device.c | 3 +++
 include/uapi/linux/mdio.h    | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 9369e1323..d4fc1fd8a 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -684,6 +684,9 @@ static int get_phy_c45_devs_in_pkg(struct mii_bus *bus, int addr, int dev_addr,
 		return -EIO;
 	*devices_in_package |= (phy_reg & 0xffff);
 
+	/* Bit 0 doesn't represent a device, it indicates c22 regs presence */
+	*devices_in_package &= ~BIT(0);
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h
index 2e6e309f0..0e012b168 100644
--- a/include/uapi/linux/mdio.h
+++ b/include/uapi/linux/mdio.h
@@ -115,6 +115,7 @@
 
 /* Device present registers. */
 #define MDIO_DEVS_PRESENT(devad)	(1 << (devad))
+#define MDIO_DEVS_C22PRESENT		MDIO_DEVS_PRESENT(0)
 #define MDIO_DEVS_PMAPMD		MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)
 #define MDIO_DEVS_WIS			MDIO_DEVS_PRESENT(MDIO_MMD_WIS)
 #define MDIO_DEVS_PCS			MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH net-next] net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg
From: Andrew Lunn @ 2019-02-08 18:27 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Florian Fainelli, David Miller, netdev@vger.kernel.org
In-Reply-To: <467d5d6b-86d9-2f81-836c-52e17f28bc6c@gmail.com>

> >> -	*devices_in_package |= (phy_reg & 0xffff);
> >> +	/* Bit 0 doesn't represent a device, it indicates c22 regs presence */
> >> +	*devices_in_package |= (phy_reg & 0xfffe);
> > 
> > Hi Heiner
> > 
> > Just for readability, can we use BIT(0) in there somehow?
> > 
> You think 0xfffe together with the comment is still not clear enough?

Hi Heiner

It is more i was wondering why the 0xffff was there in the first
place. PHY registers are 16 bits. Is this because of a compiler
warning? If the use of 0xffff is not obvious, why would 0xfffe be any
better.

> >>  /* Device present registers. */
> >>  #define MDIO_DEVS_PRESENT(devad)	(1 << (devad))
> >> +#define MDIO_DEVS_C22PRESENT		MDIO_DEVS_PRESENT(0)
> > 
> > Err. The commit message says you did not add this...
> > 
> Maybe I'm not clear enough in the commit message. Typically we have two
> constants for a device:
> 
> MDIO_MMD_XXX (for the device)
> MDIO_DEVS_XXX (for the bit of the device in the device list bitmap)
> 
> For the C22PRESENT flag I don't define the first one (because it's
> not a device) but the second one (because it uses a bit in the device
> list bitmap).

This would be better as a separate patch. It is not used here, and the
explanation can then be made clearer.

	    Andrew

^ permalink raw reply

* Linux 5.0 regression: rtl8169 / kernel BUG at lib/dynamic_queue_limits.c:27!
From: Sander Eikelenboom @ 2019-02-08 18:29 UTC (permalink / raw)
  To: Realtek linux nic maintainers, Heiner Kallweit
  Cc: Linus Torvalds, linux-kernel, netdev

L.S.,

While testing a linux 5.0-rc5 kernel (with some patches on top but they don't seem related) under Xen i the nasty splat below, 
that I haven encountered with Linux 4.20.x.

Unfortunately I haven't got a clear reproducer for this and bisecting could be nasty due to another (networking related) kernel bug.

If you need more info, want me to run a debug patch etc., please feel free to ask.

--
Sander


[ 6466.554866] kernel BUG at lib/dynamic_queue_limits.c:27!
[ 6466.571425] invalid opcode: 0000 [#1] SMP NOPTI
[ 6466.585890] CPU: 3 PID: 7057 Comm: as Not tainted 5.0.0-rc5-20190208-thp-net-florian-doflr+ #1
[ 6466.598693] Hardware name: MSI MS-7640/890FXA-GD70 (MS-7640)  , BIOS V1.8B1 09/13/2010
[ 6466.611579] RIP: e030:dql_completed+0x126/0x140
[ 6466.624339] Code: 2b 47 54 ba 00 00 00 00 c7 47 54 ff ff ff ff 0f 48 c2 48 8b 15 7b 39 4a 01 48 89 57 58 e9 48 ff ff ff 44 89 c0 e9 40 ff ff ff <0f> 0b 8b 47 50 29 e8 41 0f 48 c3 eb 9f 90 90 90 90 90 90 90 90 90
[ 6466.648130] RSP: e02b:ffff88807d4c3e78 EFLAGS: 00010297
[ 6466.659616] RAX: 0000000000000042 RBX: ffff8880049cf800 RCX: 0000000000000000
[ 6466.672835] RDX: 0000000000000001 RSI: 0000000000000042 RDI: ffff8880049cf8c0
[ 6466.684521] RBP: ffff888077df7260 R08: 0000000000000001 R09: 0000000000000000
[ 6466.696824] R10: 00000000387c2336 R11: 00000000387c2336 R12: 0000000010000000
[ 6466.709953] R13: ffff888077df6898 R14: ffff888077df75c0 R15: 0000000000454677
[ 6466.722165] FS:  00007fd869147200(0000) GS:ffff88807d4c0000(0000) knlGS:0000000000000000
[ 6466.733228] CS:  e030 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6466.746581] CR2: 00007fd867dfd000 CR3: 0000000074884000 CR4: 0000000000000660
[ 6466.758366] Call Trace:
[ 6466.768118]  <IRQ>
[ 6466.778214]  rtl8169_poll+0x4f4/0x640
[ 6466.789198]  net_rx_action+0x23d/0x370
[ 6466.798467]  __do_softirq+0xed/0x229
[ 6466.807039]  irq_exit+0xb7/0xc0
[ 6466.815471]  xen_evtchn_do_upcall+0x27/0x40
[ 6466.826647]  xen_do_hypervisor_callback+0x29/0x40
[ 6466.835902]  </IRQ>
[ 6466.845361] RIP: e030:xen_hypercall_mmu_update+0xa/0x20
[ 6466.853390] Code: 51 41 53 b8 00 00 00 00 0f 05 41 5b 59 c3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 51 41 53 b8 01 00 00 00 0f 05 <41> 5b 59 c3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
[ 6466.874031] RSP: e02b:ffffc90003c0bdd0 EFLAGS: 00000246
[ 6466.883452] RAX: 0000000000000000 RBX: 000000041f83bfe8 RCX: ffffffff8100102a
[ 6466.891986] RDX: deadbeefdeadf00d RSI: deadbeefdeadf00d RDI: deadbeefdeadf00d
[ 6466.903402] RBP: 0000000000000fe8 R08: 000000000000000b R09: 0000000000000000
[ 6466.911201] R10: deadbeefdeadf00d R11: 0000000000000246 R12: 800000050c346067
[ 6466.918491] R13: ffff8880607c4fe8 R14: ffff888005082800 R15: 0000000000000000
[ 6466.926647]  ? xen_hypercall_mmu_update+0xa/0x20
[ 6466.938195]  ? xen_set_pte_at+0x78/0xe0
[ 6466.947046]  ? __handle_mm_fault+0xc43/0x1060
[ 6466.955772]  ? do_mmap+0x44b/0x5b0
[ 6466.964410]  ? handle_mm_fault+0xf8/0x200
[ 6466.973290]  ? __do_page_fault+0x231/0x4a0
[ 6466.981973]  ? page_fault+0x8/0x30
[ 6466.990904]  ? page_fault+0x1e/0x30
[ 6466.999585] Modules linked in:
[ 6467.007533] ---[ end trace 94bec01608fe4061 ]---
[ 6467.016751] RIP: e030:dql_completed+0x126/0x140
[ 6467.024271] Code: 2b 47 54 ba 00 00 00 00 c7 47 54 ff ff ff ff 0f 48 c2 48 8b 15 7b 39 4a 01 48 89 57 58 e9 48 ff ff ff 44 89 c0 e9 40 ff ff ff <0f> 0b 8b 47 50 29 e8 41 0f 48 c3 eb 9f 90 90 90 90 90 90 90 90 90
[ 6467.039726] RSP: e02b:ffff88807d4c3e78 EFLAGS: 00010297
[ 6467.047243] RAX: 0000000000000042 RBX: ffff8880049cf800 RCX: 0000000000000000
[ 6467.054202] RDX: 0000000000000001 RSI: 0000000000000042 RDI: ffff8880049cf8c0
[ 6467.062000] RBP: ffff888077df7260 R08: 0000000000000001 R09: 0000000000000000
[ 6467.069664] R10: 00000000387c2336 R11: 00000000387c2336 R12: 0000000010000000
[ 6467.077715] R13: ffff888077df6898 R14: ffff888077df75c0 R15: 0000000000454677
[ 6467.084916] FS:  00007fd869147200(0000) GS:ffff88807d4c0000(0000) knlGS:0000000000000000
[ 6467.093352] CS:  e030 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6467.101492] CR2: 00007fd867dfd000 CR3: 0000000074884000 CR4: 0000000000000660
[ 6467.110542] Kernel panic - not syncing: Fatal exception in interrupt
[ 6467.118166] Kernel Offset: disabled
(XEN) [2019-02-08 18:04:48.854] Hardware Dom0 crashed: rebooting machine in 5 seconds.

^ permalink raw reply

* Re: [PATCH net-next] net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg
From: Heiner Kallweit @ 2019-02-08 18:34 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: Florian Fainelli, David Miller, netdev@vger.kernel.org
In-Reply-To: <20190208182750.GH1853@lunn.ch>

On 08.02.2019 19:27, Andrew Lunn wrote:
>>>> -	*devices_in_package |= (phy_reg & 0xffff);
>>>> +	/* Bit 0 doesn't represent a device, it indicates c22 regs presence */
>>>> +	*devices_in_package |= (phy_reg & 0xfffe);
>>>
>>> Hi Heiner
>>>
>>> Just for readability, can we use BIT(0) in there somehow?
>>>
>> You think 0xfffe together with the comment is still not clear enough?
> 
> Hi Heiner
> 
> It is more i was wondering why the 0xffff was there in the first
> place. PHY registers are 16 bits. Is this because of a compiler
> warning? If the use of 0xffff is not obvious, why would 0xfffe be any
> better.
> 
I think there are more places where this masking is used, most likely
to make clearer that we care about the lower 16 bits of the int only.
And I also wondered when seeing such code whether it's technically
needed.

>>>>  /* Device present registers. */
>>>>  #define MDIO_DEVS_PRESENT(devad)	(1 << (devad))
>>>> +#define MDIO_DEVS_C22PRESENT		MDIO_DEVS_PRESENT(0)
>>>
>>> Err. The commit message says you did not add this...
>>>
>> Maybe I'm not clear enough in the commit message. Typically we have two
>> constants for a device:
>>
>> MDIO_MMD_XXX (for the device)
>> MDIO_DEVS_XXX (for the bit of the device in the device list bitmap)
>>
>> For the C22PRESENT flag I don't define the first one (because it's
>> not a device) but the second one (because it uses a bit in the device
>> list bitmap).
> 
> This would be better as a separate patch. It is not used here, and the
> explanation can then be made clearer.
> 
OK. Definition of this constant is more meant as a favor to developers
who may want to check this flag in the future.

> 	    Andrew
> 
Heiner

^ permalink raw reply

* [PATCH net-next] veth: Mark expected switch fall-throughs
From: Gustavo A. R. Silva @ 2019-02-08 18:37 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, linux-kernel, Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/veth.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index f412ea1cef18..fbf890ebbeae 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -540,8 +540,10 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq,
 			goto xdp_xmit;
 		default:
 			bpf_warn_invalid_xdp_action(act);
+			/* fall through */
 		case XDP_ABORTED:
 			trace_xdp_exception(rq->dev, xdp_prog, act);
+			/* fall through */
 		case XDP_DROP:
 			goto err_xdp;
 		}
@@ -661,8 +663,10 @@ static struct sk_buff *veth_xdp_rcv_skb(struct veth_rq *rq, struct sk_buff *skb,
 		goto xdp_xmit;
 	default:
 		bpf_warn_invalid_xdp_action(act);
+		/* fall through */
 	case XDP_ABORTED:
 		trace_xdp_exception(rq->dev, xdp_prog, act);
+		/* fall through */
 	case XDP_DROP:
 		goto drop;
 	}
-- 
2.20.1


^ permalink raw reply related

* [PATCH][next] can: at91_can: mark expected switch fall-throughs
From: Gustavo A. R. Silva @ 2019-02-08 18:44 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel,
	Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

Notice that, in this particular case, the /* fall through */
comments are placed at the bottom of the case statement, which
is what GCC is expecting to find.

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/can/at91_can.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index d98c69045b17..1718c20f9c99 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -902,7 +902,8 @@ static void at91_irq_err_state(struct net_device *dev,
 				CAN_ERR_CRTL_TX_WARNING :
 				CAN_ERR_CRTL_RX_WARNING;
 		}
-	case CAN_STATE_ERROR_WARNING:	/* fallthrough */
+		/* fall through */
+	case CAN_STATE_ERROR_WARNING:
 		/*
 		 * from: ERROR_ACTIVE, ERROR_WARNING
 		 * to  : ERROR_PASSIVE, BUS_OFF
@@ -951,7 +952,8 @@ static void at91_irq_err_state(struct net_device *dev,
 		netdev_dbg(dev, "Error Active\n");
 		cf->can_id |= CAN_ERR_PROT;
 		cf->data[2] = CAN_ERR_PROT_ACTIVE;
-	case CAN_STATE_ERROR_WARNING:	/* fallthrough */
+		/* fall through */
+	case CAN_STATE_ERROR_WARNING:
 		reg_idr = AT91_IRQ_ERRA | AT91_IRQ_WARN | AT91_IRQ_BOFF;
 		reg_ier = AT91_IRQ_ERRP;
 		break;
-- 
2.20.1


^ permalink raw reply related

* Re: Linux 5.0 regression: rtl8169 / kernel BUG at lib/dynamic_queue_limits.c:27!
From: Heiner Kallweit @ 2019-02-08 18:52 UTC (permalink / raw)
  To: Sander Eikelenboom, Realtek linux nic maintainers
  Cc: Linus Torvalds, linux-kernel, netdev
In-Reply-To: <6c389fde-4c8d-300b-8c3c-300d6105c30a@eikelenboom.it>

On 08.02.2019 19:29, Sander Eikelenboom wrote:
> L.S.,
> 
> While testing a linux 5.0-rc5 kernel (with some patches on top but they don't seem related) under Xen i the nasty splat below, 
> that I haven encountered with Linux 4.20.x.
> 
> Unfortunately I haven't got a clear reproducer for this and bisecting could be nasty due to another (networking related) kernel bug.
> 
> If you need more info, want me to run a debug patch etc., please feel free to ask.
> 
Thanks for the report. However I see no change in the r8169 driver between
4.20 and 5.0 with regard to BQL code. Having said that the root cause could
be somewhere else. Therefore I'm afraid a bisect will be needed.

> --
> Sander
> 
Heiner

> 
> [ 6466.554866] kernel BUG at lib/dynamic_queue_limits.c:27!
> [ 6466.571425] invalid opcode: 0000 [#1] SMP NOPTI
> [ 6466.585890] CPU: 3 PID: 7057 Comm: as Not tainted 5.0.0-rc5-20190208-thp-net-florian-doflr+ #1
> [ 6466.598693] Hardware name: MSI MS-7640/890FXA-GD70 (MS-7640)  , BIOS V1.8B1 09/13/2010
> [ 6466.611579] RIP: e030:dql_completed+0x126/0x140
> [ 6466.624339] Code: 2b 47 54 ba 00 00 00 00 c7 47 54 ff ff ff ff 0f 48 c2 48 8b 15 7b 39 4a 01 48 89 57 58 e9 48 ff ff ff 44 89 c0 e9 40 ff ff ff <0f> 0b 8b 47 50 29 e8 41 0f 48 c3 eb 9f 90 90 90 90 90 90 90 90 90
> [ 6466.648130] RSP: e02b:ffff88807d4c3e78 EFLAGS: 00010297
> [ 6466.659616] RAX: 0000000000000042 RBX: ffff8880049cf800 RCX: 0000000000000000
> [ 6466.672835] RDX: 0000000000000001 RSI: 0000000000000042 RDI: ffff8880049cf8c0
> [ 6466.684521] RBP: ffff888077df7260 R08: 0000000000000001 R09: 0000000000000000
> [ 6466.696824] R10: 00000000387c2336 R11: 00000000387c2336 R12: 0000000010000000
> [ 6466.709953] R13: ffff888077df6898 R14: ffff888077df75c0 R15: 0000000000454677
> [ 6466.722165] FS:  00007fd869147200(0000) GS:ffff88807d4c0000(0000) knlGS:0000000000000000
> [ 6466.733228] CS:  e030 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 6466.746581] CR2: 00007fd867dfd000 CR3: 0000000074884000 CR4: 0000000000000660
> [ 6466.758366] Call Trace:
> [ 6466.768118]  <IRQ>
> [ 6466.778214]  rtl8169_poll+0x4f4/0x640
> [ 6466.789198]  net_rx_action+0x23d/0x370
> [ 6466.798467]  __do_softirq+0xed/0x229
> [ 6466.807039]  irq_exit+0xb7/0xc0
> [ 6466.815471]  xen_evtchn_do_upcall+0x27/0x40
> [ 6466.826647]  xen_do_hypervisor_callback+0x29/0x40
> [ 6466.835902]  </IRQ>
> [ 6466.845361] RIP: e030:xen_hypercall_mmu_update+0xa/0x20
> [ 6466.853390] Code: 51 41 53 b8 00 00 00 00 0f 05 41 5b 59 c3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 51 41 53 b8 01 00 00 00 0f 05 <41> 5b 59 c3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
> [ 6466.874031] RSP: e02b:ffffc90003c0bdd0 EFLAGS: 00000246
> [ 6466.883452] RAX: 0000000000000000 RBX: 000000041f83bfe8 RCX: ffffffff8100102a
> [ 6466.891986] RDX: deadbeefdeadf00d RSI: deadbeefdeadf00d RDI: deadbeefdeadf00d
> [ 6466.903402] RBP: 0000000000000fe8 R08: 000000000000000b R09: 0000000000000000
> [ 6466.911201] R10: deadbeefdeadf00d R11: 0000000000000246 R12: 800000050c346067
> [ 6466.918491] R13: ffff8880607c4fe8 R14: ffff888005082800 R15: 0000000000000000
> [ 6466.926647]  ? xen_hypercall_mmu_update+0xa/0x20
> [ 6466.938195]  ? xen_set_pte_at+0x78/0xe0
> [ 6466.947046]  ? __handle_mm_fault+0xc43/0x1060
> [ 6466.955772]  ? do_mmap+0x44b/0x5b0
> [ 6466.964410]  ? handle_mm_fault+0xf8/0x200
> [ 6466.973290]  ? __do_page_fault+0x231/0x4a0
> [ 6466.981973]  ? page_fault+0x8/0x30
> [ 6466.990904]  ? page_fault+0x1e/0x30
> [ 6466.999585] Modules linked in:
> [ 6467.007533] ---[ end trace 94bec01608fe4061 ]---
> [ 6467.016751] RIP: e030:dql_completed+0x126/0x140
> [ 6467.024271] Code: 2b 47 54 ba 00 00 00 00 c7 47 54 ff ff ff ff 0f 48 c2 48 8b 15 7b 39 4a 01 48 89 57 58 e9 48 ff ff ff 44 89 c0 e9 40 ff ff ff <0f> 0b 8b 47 50 29 e8 41 0f 48 c3 eb 9f 90 90 90 90 90 90 90 90 90
> [ 6467.039726] RSP: e02b:ffff88807d4c3e78 EFLAGS: 00010297
> [ 6467.047243] RAX: 0000000000000042 RBX: ffff8880049cf800 RCX: 0000000000000000
> [ 6467.054202] RDX: 0000000000000001 RSI: 0000000000000042 RDI: ffff8880049cf8c0
> [ 6467.062000] RBP: ffff888077df7260 R08: 0000000000000001 R09: 0000000000000000
> [ 6467.069664] R10: 00000000387c2336 R11: 00000000387c2336 R12: 0000000010000000
> [ 6467.077715] R13: ffff888077df6898 R14: ffff888077df75c0 R15: 0000000000454677
> [ 6467.084916] FS:  00007fd869147200(0000) GS:ffff88807d4c0000(0000) knlGS:0000000000000000
> [ 6467.093352] CS:  e030 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 6467.101492] CR2: 00007fd867dfd000 CR3: 0000000074884000 CR4: 0000000000000660
> [ 6467.110542] Kernel panic - not syncing: Fatal exception in interrupt
> [ 6467.118166] Kernel Offset: disabled
> (XEN) [2019-02-08 18:04:48.854] Hardware Dom0 crashed: rebooting machine in 5 seconds.
> 


^ permalink raw reply

* Re: [PATCH][next] can: at91_can: mark expected switch fall-throughs
From: Sergei Shtylyov @ 2019-02-08 18:55 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Wolfgang Grandegger, Marc Kleine-Budde,
	David S. Miller, Nicolas Ferre, Alexandre Belloni,
	Ludovic Desroches
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel
In-Reply-To: <20190208184444.GA28484@embeddedor>

Hello!

On 02/08/2019 09:44 PM, Gustavo A. R. Silva wrote:

> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
> 
> Notice that, in this particular case, the /* fall through */
> comments are placed at the bottom of the case statement, which
> is what GCC is expecting to find.
> 
> Warning level 3 was used: -Wimplicit-fallthrough=3
> 
> This patch is part of the ongoing efforts to enabling
> -Wimplicit-fallthrough.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/net/can/at91_can.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
> index d98c69045b17..1718c20f9c99 100644
> --- a/drivers/net/can/at91_can.c
> +++ b/drivers/net/can/at91_can.c
> @@ -902,7 +902,8 @@ static void at91_irq_err_state(struct net_device *dev,
>  				CAN_ERR_CRTL_TX_WARNING :
>  				CAN_ERR_CRTL_RX_WARNING;
>  		}
> -	case CAN_STATE_ERROR_WARNING:	/* fallthrough */
> +		/* fall through */

   Why do we need this comment at all? Just remove it, that's all.

> +	case CAN_STATE_ERROR_WARNING:
>  		/*
>  		 * from: ERROR_ACTIVE, ERROR_WARNING
>  		 * to  : ERROR_PASSIVE, BUS_OFF
> @@ -951,7 +952,8 @@ static void at91_irq_err_state(struct net_device *dev,
>  		netdev_dbg(dev, "Error Active\n");
>  		cf->can_id |= CAN_ERR_PROT;
>  		cf->data[2] = CAN_ERR_PROT_ACTIVE;
> -	case CAN_STATE_ERROR_WARNING:	/* fallthrough */
> +		/* fall through */

   Again, we don;t need it here.

> +	case CAN_STATE_ERROR_WARNING:
>  		reg_idr = AT91_IRQ_ERRA | AT91_IRQ_WARN | AT91_IRQ_BOFF;
>  		reg_ier = AT91_IRQ_ERRP;
>  		break;

MBR, Serfei

^ permalink raw reply

* [PATCH net-next] net: usb: pegasus: Mark expected switch fall-through
From: Gustavo A. R. Silva @ 2019-02-08 19:07 UTC (permalink / raw)
  To: Petko Manolov, David S. Miller
  Cc: linux-usb, netdev, linux-kernel, Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/usb/pegasus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index f4247b275e09..63e44e746ccc 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -1011,6 +1011,7 @@ static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
 	switch (cmd) {
 	case SIOCDEVPRIVATE:
 		data[0] = pegasus->phy;
+		/* fall through */
 	case SIOCDEVPRIVATE + 1:
 		read_mii_word(pegasus, data[0], data[1] & 0x1f, &data[3]);
 		res = 0;
-- 
2.20.1


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox