* [PATCH RFC 0/4] net: skb: to use (function, line) pair as reason for kfree_skb_reason()
@ 2022-02-03 15:37 Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 1/4] net: skb: use line number to trace dropped skb Dongli Zhang
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Dongli Zhang @ 2022-02-03 15:37 UTC (permalink / raw)
To: netdev, bpf
Cc: linux-kernel, rostedt, mingo, davem, kuba, edumazet, yoshfuji,
dsahern, ast, daniel, andrii, imagedong, joao.m.martins, joe.jin
This RFC is to seek for suggestion to track the reason that the sk_buff is
dropped.
Sometimes the kernel may not directly call kfree_skb() to drop the sk_buff.
Instead, it "goto drop" and call kfree_skb() at 'drop'. This makes it
difficult to track the reason that the sk_buff is dropped.
The commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") has
introduced the kfree_skb_reason() to help track the reason. However, we may
need to define many reasons for each driver/subsystem.
I am going to trace the "goto drop" in TUN and TAP drivers. However, I will
need to introduce many new reasons if I re-use kfree_skb_reason().
There are some other options.
1. The 1st option is to introduce a new tracepoint, e.g., trace_drop_skb()
as below to track the function and line number. We would call
trace_drop_skb() before "goto drop".
TP_PROTO(struct sk_buff *skb, struct net_device *dev,
const char *function, unsigned int line),
2. The 2nd option is to directly call trace_kfree_skb() before "goto drop".
And we may replace kfree_skb() with below kfree_skb_notrace() as suggested
by Joao Martins.
/**
* kfree_skb_notrace - free an sk_buff without tracing
* @skb: buffer to free
*
* Drop a reference to the buffer and free it if the usage count has
* hit zero.
*/
void kfree_skb_notrace(struct sk_buff *skb)
{
if (!skb_unref(skb))
return;
__kfree_skb(skb);
}
3. The last option is this RFC. To avoid introducing so many new reasons,
we use (__func__, __LINE__) to uniquely identify the location of
each "goto drop". The 'reason' introduced by the
commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") is replaced
by the (function, line) pair.
The below is the sample output from trace_pipe by this RFC, when the
sk_buff is dropped by TUN driver.
<idle>-0 [016] ..s1. 432.701987: kfree_skb: skbaddr=00000000a65c0a72 protocol=0 location=000000008a49d80c function=none line=0
<idle>-0 [003] b.s2. 432.704397: kfree_skb: skbaddr=00000000665e5ccd protocol=2048 location=00000000ec3b7129 function=tun_net_xmit line=1116
<idle>-0 [003] ..s1. 432.704400: kfree_skb: skbaddr=00000000e4c806f8 protocol=2048 location=000000002929642d function=none line=0
<idle>-0 [002] b.s2. 432.734617: kfree_skb: skbaddr=00000000079749b3 protocol=2048 location=00000000ec3b7129 function=tun_net_xmit line=1116
<idle>-0 [015] b.s2. 432.880571: kfree_skb: skbaddr=00000000e1542f1e protocol=34525 location=00000000ec3b7129 function=tun_net_xmit line=1116
<idle>-0 [015] ..s1. 432.880577: kfree_skb: skbaddr=000000004f3022b6 protocol=34525 location=00000000547c5c25 function=none line=0
<idle>-0 [002] b.s2. 432.886247: kfree_skb: skbaddr=0000000062990a71 protocol=2054 location=00000000ec3b7129 function=tun_net_xmit line=1116
drivers/net/tap.c | 30 ++++++++++++++++++++++--------
drivers/net/tun.c | 33 +++++++++++++++++++++++++--------
include/linux/skbuff.h | 24 +++++++-----------------
include/trace/events/skb.h | 37 ++++++++-----------------------------
net/core/dev.c | 3 ++-
net/core/skbuff.c | 10 ++++++----
net/ipv4/tcp_ipv4.c | 14 +++++++-------
net/ipv4/udp.c | 14 +++++++-------
8 files changed, 84 insertions(+), 81 deletions(-)
Would you please share your suggestion and feedback?
Thank you very much!
Dongli Zhang
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RFC 1/4] net: skb: use line number to trace dropped skb
2022-02-03 15:37 [PATCH RFC 0/4] net: skb: to use (function, line) pair as reason for kfree_skb_reason() Dongli Zhang
@ 2022-02-03 15:37 ` Dongli Zhang
2022-02-03 15:48 ` David Ahern
` (3 more replies)
2022-02-03 15:37 ` [PATCH RFC 2/4] net: skb: add function name as part of reason Dongli Zhang
` (2 subsequent siblings)
3 siblings, 4 replies; 13+ messages in thread
From: Dongli Zhang @ 2022-02-03 15:37 UTC (permalink / raw)
To: netdev, bpf
Cc: linux-kernel, rostedt, mingo, davem, kuba, edumazet, yoshfuji,
dsahern, ast, daniel, andrii, imagedong, joao.m.martins, joe.jin
Sometimes the kernel may not directly call kfree_skb() to drop the sk_buff.
Instead, it "goto drop" and call kfree_skb() at 'drop'. This make it
difficult to track the reason that the sk_buff is dropped.
The commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") has
introduced the kfree_skb_reason() to help track the reason. However, we may
need to define many reasons for each driver/subsystem.
To avoid introducing so many new reasons, this is to use line number
("__LINE__") to trace where the sk_buff is dropped. As a result, the reason
will be generated automatically.
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
include/linux/skbuff.h | 21 ++++-----------------
include/trace/events/skb.h | 35 ++++++-----------------------------
net/core/dev.c | 2 +-
net/core/skbuff.c | 9 ++++-----
net/ipv4/tcp_ipv4.c | 14 +++++++-------
net/ipv4/udp.c | 14 +++++++-------
6 files changed, 29 insertions(+), 66 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 8a636e678902..471268a4a497 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -307,21 +307,8 @@ struct sk_buff_head {
struct sk_buff;
-/* The reason of skb drop, which is used in kfree_skb_reason().
- * en...maybe they should be splited by group?
- *
- * Each item here should also be in 'TRACE_SKB_DROP_REASON', which is
- * used to translate the reason to string.
- */
-enum skb_drop_reason {
- SKB_DROP_REASON_NOT_SPECIFIED,
- SKB_DROP_REASON_NO_SOCKET,
- SKB_DROP_REASON_PKT_TOO_SMALL,
- SKB_DROP_REASON_TCP_CSUM,
- SKB_DROP_REASON_SOCKET_FILTER,
- SKB_DROP_REASON_UDP_CSUM,
- SKB_DROP_REASON_MAX,
-};
+#define SKB_DROP_LINE_NONE 0
+#define SKB_DROP_LINE __LINE__
/* To allow 64K frame to be packed as single skb without frag_list we
* require 64K/PAGE_SIZE pages plus 1 additional page to allow for
@@ -1103,7 +1090,7 @@ static inline bool skb_unref(struct sk_buff *skb)
return true;
}
-void kfree_skb_reason(struct sk_buff *skb, enum skb_drop_reason reason);
+void kfree_skb_reason(struct sk_buff *skb, unsigned int line);
/**
* kfree_skb - free an sk_buff with 'NOT_SPECIFIED' reason
@@ -1111,7 +1098,7 @@ void kfree_skb_reason(struct sk_buff *skb, enum skb_drop_reason reason);
*/
static inline void kfree_skb(struct sk_buff *skb)
{
- kfree_skb_reason(skb, SKB_DROP_REASON_NOT_SPECIFIED);
+ kfree_skb_reason(skb, SKB_DROP_LINE_NONE);
}
void skb_release_head_state(struct sk_buff *skb);
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index a8a64b97504d..45d1a1757ff1 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -9,56 +9,33 @@
#include <linux/netdevice.h>
#include <linux/tracepoint.h>
-#define TRACE_SKB_DROP_REASON \
- EM(SKB_DROP_REASON_NOT_SPECIFIED, NOT_SPECIFIED) \
- EM(SKB_DROP_REASON_NO_SOCKET, NO_SOCKET) \
- EM(SKB_DROP_REASON_PKT_TOO_SMALL, PKT_TOO_SMALL) \
- EM(SKB_DROP_REASON_TCP_CSUM, TCP_CSUM) \
- EM(SKB_DROP_REASON_SOCKET_FILTER, SOCKET_FILTER) \
- EM(SKB_DROP_REASON_UDP_CSUM, UDP_CSUM) \
- EMe(SKB_DROP_REASON_MAX, MAX)
-
-#undef EM
-#undef EMe
-
-#define EM(a, b) TRACE_DEFINE_ENUM(a);
-#define EMe(a, b) TRACE_DEFINE_ENUM(a);
-
-TRACE_SKB_DROP_REASON
-
-#undef EM
-#undef EMe
-#define EM(a, b) { a, #b },
-#define EMe(a, b) { a, #b }
-
/*
* Tracepoint for free an sk_buff:
*/
TRACE_EVENT(kfree_skb,
TP_PROTO(struct sk_buff *skb, void *location,
- enum skb_drop_reason reason),
+ unsigned int line),
- TP_ARGS(skb, location, reason),
+ TP_ARGS(skb, location, line),
TP_STRUCT__entry(
__field(void *, skbaddr)
__field(void *, location)
__field(unsigned short, protocol)
- __field(enum skb_drop_reason, reason)
+ __field(unsigned int, line)
),
TP_fast_assign(
__entry->skbaddr = skb;
__entry->location = location;
__entry->protocol = ntohs(skb->protocol);
- __entry->reason = reason;
+ __entry->line = line;
),
- TP_printk("skbaddr=%p protocol=%u location=%p reason: %s",
+ TP_printk("skbaddr=%p protocol=%u location=%p line: %u",
__entry->skbaddr, __entry->protocol, __entry->location,
- __print_symbolic(__entry->reason,
- TRACE_SKB_DROP_REASON))
+ __entry->line)
);
TRACE_EVENT(consume_skb,
diff --git a/net/core/dev.c b/net/core/dev.c
index 1baab07820f6..448f390d35d3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4900,7 +4900,7 @@ static __latent_entropy void net_tx_action(struct softirq_action *h)
trace_consume_skb(skb);
else
trace_kfree_skb(skb, net_tx_action,
- SKB_DROP_REASON_NOT_SPECIFIED);
+ SKB_DROP_LINE);
if (skb->fclone != SKB_FCLONE_UNAVAILABLE)
__kfree_skb(skb);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 0118f0afaa4f..8572c3bce264 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -761,18 +761,17 @@ EXPORT_SYMBOL(__kfree_skb);
/**
* kfree_skb_reason - free an sk_buff with special reason
* @skb: buffer to free
- * @reason: reason why this skb is dropped
+ * @line: the line where this skb is dropped
*
* Drop a reference to the buffer and free it if the usage count has
- * hit zero. Meanwhile, pass the drop reason to 'kfree_skb'
- * tracepoint.
+ * hit zero. Meanwhile, pass the drop line to 'kfree_skb' tracepoint.
*/
-void kfree_skb_reason(struct sk_buff *skb, enum skb_drop_reason reason)
+void kfree_skb_reason(struct sk_buff *skb, unsigned int line)
{
if (!skb_unref(skb))
return;
- trace_kfree_skb(skb, __builtin_return_address(0), reason);
+ trace_kfree_skb(skb, __builtin_return_address(0), line);
__kfree_skb(skb);
}
EXPORT_SYMBOL(kfree_skb_reason);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index fec656f5a39e..f23af94d1186 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1971,10 +1971,10 @@ int tcp_v4_rcv(struct sk_buff *skb)
const struct tcphdr *th;
bool refcounted;
struct sock *sk;
- int drop_reason;
+ unsigned int drop_line;
int ret;
- drop_reason = SKB_DROP_REASON_NOT_SPECIFIED;
+ drop_line = SKB_DROP_LINE_NONE;
if (skb->pkt_type != PACKET_HOST)
goto discard_it;
@@ -1987,7 +1987,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
th = (const struct tcphdr *)skb->data;
if (unlikely(th->doff < sizeof(struct tcphdr) / 4)) {
- drop_reason = SKB_DROP_REASON_PKT_TOO_SMALL;
+ drop_line = SKB_DROP_LINE;
goto bad_packet;
}
if (!pskb_may_pull(skb, th->doff * 4))
@@ -2095,7 +2095,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
nf_reset_ct(skb);
if (tcp_filter(sk, skb)) {
- drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
+ drop_line = SKB_DROP_LINE;
goto discard_and_relse;
}
th = (const struct tcphdr *)skb->data;
@@ -2130,7 +2130,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
return ret;
no_tcp_socket:
- drop_reason = SKB_DROP_REASON_NO_SOCKET;
+ drop_line = SKB_DROP_LINE;
if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
goto discard_it;
@@ -2138,7 +2138,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
if (tcp_checksum_complete(skb)) {
csum_error:
- drop_reason = SKB_DROP_REASON_TCP_CSUM;
+ drop_line = SKB_DROP_LINE;
trace_tcp_bad_csum(skb);
__TCP_INC_STATS(net, TCP_MIB_CSUMERRORS);
bad_packet:
@@ -2149,7 +2149,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
discard_it:
/* Discard frame. */
- kfree_skb_reason(skb, drop_reason);
+ kfree_skb_reason(skb, drop_line);
return 0;
discard_and_relse:
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 090360939401..f0715d1072d7 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2411,9 +2411,9 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
__be32 saddr, daddr;
struct net *net = dev_net(skb->dev);
bool refcounted;
- int drop_reason;
+ unsigned int drop_line;
- drop_reason = SKB_DROP_REASON_NOT_SPECIFIED;
+ drop_line = SKB_DROP_LINE_NONE;
/*
* Validate the packet.
@@ -2469,7 +2469,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
if (udp_lib_checksum_complete(skb))
goto csum_error;
- drop_reason = SKB_DROP_REASON_NO_SOCKET;
+ drop_line = SKB_DROP_LINE;
__UDP_INC_STATS(net, UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE);
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
@@ -2477,11 +2477,11 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
* Hmm. We got an UDP packet to a port to which we
* don't wanna listen. Ignore it.
*/
- kfree_skb_reason(skb, drop_reason);
+ kfree_skb_reason(skb, drop_line);
return 0;
short_packet:
- drop_reason = SKB_DROP_REASON_PKT_TOO_SMALL;
+ drop_line = SKB_DROP_LINE;
net_dbg_ratelimited("UDP%s: short packet: From %pI4:%u %d/%d to %pI4:%u\n",
proto == IPPROTO_UDPLITE ? "Lite" : "",
&saddr, ntohs(uh->source),
@@ -2494,7 +2494,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
* RFC1122: OK. Discards the bad packet silently (as far as
* the network is concerned, anyway) as per 4.1.3.4 (MUST).
*/
- drop_reason = SKB_DROP_REASON_UDP_CSUM;
+ drop_line = SKB_DROP_LINE;
net_dbg_ratelimited("UDP%s: bad checksum. From %pI4:%u to %pI4:%u ulen %d\n",
proto == IPPROTO_UDPLITE ? "Lite" : "",
&saddr, ntohs(uh->source), &daddr, ntohs(uh->dest),
@@ -2502,7 +2502,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
__UDP_INC_STATS(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE);
drop:
__UDP_INC_STATS(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
- kfree_skb_reason(skb, drop_reason);
+ kfree_skb_reason(skb, drop_line);
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH RFC 2/4] net: skb: add function name as part of reason
2022-02-03 15:37 [PATCH RFC 0/4] net: skb: to use (function, line) pair as reason for kfree_skb_reason() Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 1/4] net: skb: use line number to trace dropped skb Dongli Zhang
@ 2022-02-03 15:37 ` Dongli Zhang
2022-02-04 1:31 ` kernel test robot
2022-02-03 15:37 ` [PATCH RFC 3/4] net: tun: track dropped skb via kfree_skb_reason() Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 4/4] net: tap: " Dongli Zhang
3 siblings, 1 reply; 13+ messages in thread
From: Dongli Zhang @ 2022-02-03 15:37 UTC (permalink / raw)
To: netdev, bpf
Cc: linux-kernel, rostedt, mingo, davem, kuba, edumazet, yoshfuji,
dsahern, ast, daniel, andrii, imagedong, joao.m.martins, joe.jin
In addition to the line number ("__LINE__"), this is to make the
function name ("__func__", which is the caller of kfree_skb_reason())
as part of reason.
The (function, line) combination is able to uniquely represent where the
sk_buff is dropped.
The existing trace_kfree_skb() is able to trace the 'location'. While it
is fine to either echo 'stacktrace' to the trigger, or trace at
userspace via ebpf, the TP_printk will only print %p.
With the function name, the TP_printk will tell the function and the
line number that the sk_buff is dropped.
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
include/linux/skbuff.h | 7 +++++--
include/trace/events/skb.h | 10 ++++++----
net/core/dev.c | 1 +
net/core/skbuff.c | 9 ++++++---
net/ipv4/tcp_ipv4.c | 2 +-
net/ipv4/udp.c | 4 ++--
6 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 471268a4a497..10bcbe4f690f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -309,6 +309,8 @@ struct sk_buff;
#define SKB_DROP_LINE_NONE 0
#define SKB_DROP_LINE __LINE__
+#define SKB_DROP_FUNC_NONE "none"
+#define SKB_DROP_FUNC __func__
/* To allow 64K frame to be packed as single skb without frag_list we
* require 64K/PAGE_SIZE pages plus 1 additional page to allow for
@@ -1090,7 +1092,8 @@ static inline bool skb_unref(struct sk_buff *skb)
return true;
}
-void kfree_skb_reason(struct sk_buff *skb, unsigned int line);
+void kfree_skb_reason(struct sk_buff *skb, const char *func,
+ unsigned int line);
/**
* kfree_skb - free an sk_buff with 'NOT_SPECIFIED' reason
@@ -1098,7 +1101,7 @@ void kfree_skb_reason(struct sk_buff *skb, unsigned int line);
*/
static inline void kfree_skb(struct sk_buff *skb)
{
- kfree_skb_reason(skb, SKB_DROP_LINE_NONE);
+ kfree_skb_reason(skb, SKB_DROP_FUNC_NONE, SKB_DROP_LINE_NONE);
}
void skb_release_head_state(struct sk_buff *skb);
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 45d1a1757ff1..b63bf724809e 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -15,14 +15,15 @@
TRACE_EVENT(kfree_skb,
TP_PROTO(struct sk_buff *skb, void *location,
- unsigned int line),
+ const char *function, unsigned int line),
- TP_ARGS(skb, location, line),
+ TP_ARGS(skb, location, function, line),
TP_STRUCT__entry(
__field(void *, skbaddr)
__field(void *, location)
__field(unsigned short, protocol)
+ __string(function, function)
__field(unsigned int, line)
),
@@ -30,12 +31,13 @@ TRACE_EVENT(kfree_skb,
__entry->skbaddr = skb;
__entry->location = location;
__entry->protocol = ntohs(skb->protocol);
+ __assign_str(function, function);
__entry->line = line;
),
- TP_printk("skbaddr=%p protocol=%u location=%p line: %u",
+ TP_printk("skbaddr=%p protocol=%u location=%p function=%s line=%u",
__entry->skbaddr, __entry->protocol, __entry->location,
- __entry->line)
+ __get_str(function), __entry->line)
);
TRACE_EVENT(consume_skb,
diff --git a/net/core/dev.c b/net/core/dev.c
index 448f390d35d3..3dccd3248de9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4900,6 +4900,7 @@ static __latent_entropy void net_tx_action(struct softirq_action *h)
trace_consume_skb(skb);
else
trace_kfree_skb(skb, net_tx_action,
+ SKB_DROP_FUNC,
SKB_DROP_LINE);
if (skb->fclone != SKB_FCLONE_UNAVAILABLE)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 8572c3bce264..f7bceb310912 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -761,17 +761,20 @@ EXPORT_SYMBOL(__kfree_skb);
/**
* kfree_skb_reason - free an sk_buff with special reason
* @skb: buffer to free
+ * @func: the function where this skb is dropped
* @line: the line where this skb is dropped
*
* Drop a reference to the buffer and free it if the usage count has
- * hit zero. Meanwhile, pass the drop line to 'kfree_skb' tracepoint.
+ * hit zero. Meanwhile, pass the drop function and line to 'kfree_skb'
+ * tracepoint.
*/
-void kfree_skb_reason(struct sk_buff *skb, unsigned int line)
+void kfree_skb_reason(struct sk_buff *skb, const char *func,
+ unsigned int line)
{
if (!skb_unref(skb))
return;
- trace_kfree_skb(skb, __builtin_return_address(0), line);
+ trace_kfree_skb(skb, __builtin_return_address(0), func, line);
__kfree_skb(skb);
}
EXPORT_SYMBOL(kfree_skb_reason);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index f23af94d1186..a1cb1252370b 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2149,7 +2149,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
discard_it:
/* Discard frame. */
- kfree_skb_reason(skb, drop_line);
+ kfree_skb_reason(skb, SKB_DROP_FUNC, drop_line);
return 0;
discard_and_relse:
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index f0715d1072d7..ae86ab56a7dd 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2477,7 +2477,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
* Hmm. We got an UDP packet to a port to which we
* don't wanna listen. Ignore it.
*/
- kfree_skb_reason(skb, drop_line);
+ kfree_skb_reason(skb, SKB_DROP_FUNC, drop_line);
return 0;
short_packet:
@@ -2502,7 +2502,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
__UDP_INC_STATS(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE);
drop:
__UDP_INC_STATS(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
- kfree_skb_reason(skb, drop_line);
+ kfree_skb_reason(skb, SKB_DROP_FUNC, drop_line);
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH RFC 3/4] net: tun: track dropped skb via kfree_skb_reason()
2022-02-03 15:37 [PATCH RFC 0/4] net: skb: to use (function, line) pair as reason for kfree_skb_reason() Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 1/4] net: skb: use line number to trace dropped skb Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 2/4] net: skb: add function name as part of reason Dongli Zhang
@ 2022-02-03 15:37 ` Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 4/4] net: tap: " Dongli Zhang
3 siblings, 0 replies; 13+ messages in thread
From: Dongli Zhang @ 2022-02-03 15:37 UTC (permalink / raw)
To: netdev, bpf
Cc: linux-kernel, rostedt, mingo, davem, kuba, edumazet, yoshfuji,
dsahern, ast, daniel, andrii, imagedong, joao.m.martins, joe.jin
The TUN can be used as vhost-net backend. E.g, the tun_net_xmit() is the
interface to forward the skb from TUN to vhost-net/virtio-net.
However, there are many "goto drop" in the TUN driver. Therefore, the
kfree_skb_reason() is involved at each "goto drop" to help userspace
ftrace/ebpf to track the reason for the loss of packets.
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
drivers/net/tun.c | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index fed85447701a..8f6c6d23a787 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1062,13 +1062,16 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
struct netdev_queue *queue;
struct tun_file *tfile;
int len = skb->len;
+ unsigned int drop_line = SKB_DROP_LINE_NONE;
rcu_read_lock();
tfile = rcu_dereference(tun->tfiles[txq]);
/* Drop packet if interface is not attached */
- if (!tfile)
+ if (!tfile) {
+ drop_line = SKB_DROP_LINE;
goto drop;
+ }
if (!rcu_dereference(tun->steering_prog))
tun_automq_xmit(tun, skb);
@@ -1078,19 +1081,27 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
/* Drop if the filter does not like it.
* This is a noop if the filter is disabled.
* Filter can be enabled only for the TAP devices. */
- if (!check_filter(&tun->txflt, skb))
+ if (!check_filter(&tun->txflt, skb)) {
+ drop_line = SKB_DROP_LINE;
goto drop;
+ }
if (tfile->socket.sk->sk_filter &&
- sk_filter(tfile->socket.sk, skb))
+ sk_filter(tfile->socket.sk, skb)) {
+ drop_line = SKB_DROP_LINE;
goto drop;
+ }
len = run_ebpf_filter(tun, skb, len);
- if (len == 0 || pskb_trim(skb, len))
+ if (len == 0 || pskb_trim(skb, len)) {
+ drop_line = SKB_DROP_LINE;
goto drop;
+ }
- if (unlikely(skb_orphan_frags_rx(skb, GFP_ATOMIC)))
+ if (unlikely(skb_orphan_frags_rx(skb, GFP_ATOMIC))) {
+ drop_line = SKB_DROP_LINE;
goto drop;
+ }
skb_tx_timestamp(skb);
@@ -1101,8 +1112,10 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
nf_reset_ct(skb);
- if (ptr_ring_produce(&tfile->tx_ring, skb))
+ if (ptr_ring_produce(&tfile->tx_ring, skb)) {
+ drop_line = SKB_DROP_LINE;
goto drop;
+ }
/* NETIF_F_LLTX requires to do our own update of trans_start */
queue = netdev_get_tx_queue(dev, txq);
@@ -1119,7 +1132,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
drop:
atomic_long_inc(&dev->tx_dropped);
skb_tx_error(skb);
- kfree_skb(skb);
+ kfree_skb_reason(skb, SKB_DROP_FUNC, drop_line);
rcu_read_unlock();
return NET_XMIT_DROP;
}
@@ -1717,6 +1730,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
u32 rxhash = 0;
int skb_xdp = 1;
bool frags = tun_napi_frags_enabled(tfile);
+ unsigned int drop_line = SKB_DROP_LINE_NONE;
if (!(tun->flags & IFF_NO_PI)) {
if (len < sizeof(pi))
@@ -1820,9 +1834,10 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
if (err) {
err = -EFAULT;
+ drop_line = SKB_DROP_LINE;
drop:
atomic_long_inc(&tun->dev->rx_dropped);
- kfree_skb(skb);
+ kfree_skb_reason(skb, SKB_DROP_FUNC, drop_line);
if (frags) {
tfile->napi.skb = NULL;
mutex_unlock(&tfile->napi_mutex);
@@ -1868,6 +1883,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
break;
case IFF_TAP:
if (frags && !pskb_may_pull(skb, ETH_HLEN)) {
+ drop_line = SKB_DROP_LINE;
err = -ENOMEM;
goto drop;
}
@@ -1922,6 +1938,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
if (unlikely(!(tun->dev->flags & IFF_UP))) {
err = -EIO;
rcu_read_unlock();
+ drop_line = SKB_DROP_LINE;
goto drop;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH RFC 4/4] net: tap: track dropped skb via kfree_skb_reason()
2022-02-03 15:37 [PATCH RFC 0/4] net: skb: to use (function, line) pair as reason for kfree_skb_reason() Dongli Zhang
` (2 preceding siblings ...)
2022-02-03 15:37 ` [PATCH RFC 3/4] net: tun: track dropped skb via kfree_skb_reason() Dongli Zhang
@ 2022-02-03 15:37 ` Dongli Zhang
3 siblings, 0 replies; 13+ messages in thread
From: Dongli Zhang @ 2022-02-03 15:37 UTC (permalink / raw)
To: netdev, bpf
Cc: linux-kernel, rostedt, mingo, davem, kuba, edumazet, yoshfuji,
dsahern, ast, daniel, andrii, imagedong, joao.m.martins, joe.jin
The TAP can be used as vhost-net backend. E.g., the tap_handle_frame() is
the interface to forward the skb from TAP to vhost-net/virtio-net.
However, there are many "goto drop" in the TAP driver. Therefore, the
kfree_skb_reason() is involved at each "goto drop" to help userspace
ftrace/ebpf to track the reason for the loss of packets.
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
drivers/net/tap.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index 8e3a28ba6b28..78828dd1b74b 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -322,6 +322,7 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)
struct tap_dev *tap;
struct tap_queue *q;
netdev_features_t features = TAP_FEATURES;
+ unsigned int drop_line = SKB_DROP_LINE_NONE;
tap = tap_dev_get_rcu(dev);
if (!tap)
@@ -343,12 +344,16 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)
struct sk_buff *segs = __skb_gso_segment(skb, features, false);
struct sk_buff *next;
- if (IS_ERR(segs))
+ if (IS_ERR(segs)) {
+ drop_line = SKB_DROP_LINE;
goto drop;
+ }
if (!segs) {
- if (ptr_ring_produce(&q->ring, skb))
+ if (ptr_ring_produce(&q->ring, skb)) {
+ drop_line = SKB_DROP_LINE;
goto drop;
+ }
goto wake_up;
}
@@ -369,10 +374,14 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)
*/
if (skb->ip_summed == CHECKSUM_PARTIAL &&
!(features & NETIF_F_CSUM_MASK) &&
- skb_checksum_help(skb))
+ skb_checksum_help(skb)) {
+ drop_line = SKB_DROP_LINE;
goto drop;
- if (ptr_ring_produce(&q->ring, skb))
+ }
+ if (ptr_ring_produce(&q->ring, skb)) {
+ drop_line = SKB_DROP_LINE;
goto drop;
+ }
}
wake_up:
@@ -383,7 +392,7 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)
/* Count errors/drops only here, thus don't care about args. */
if (tap->count_rx_dropped)
tap->count_rx_dropped(tap);
- kfree_skb(skb);
+ kfree_skb_reason(skb, SKB_DROP_FUNC, drop_line);
return RX_HANDLER_CONSUMED;
}
EXPORT_SYMBOL_GPL(tap_handle_frame);
@@ -632,6 +641,7 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,
int depth;
bool zerocopy = false;
size_t linear;
+ unsigned int drop_line = SKB_DROP_LINE_NONE;
if (q->flags & IFF_VNET_HDR) {
vnet_hdr_len = READ_ONCE(q->vnet_hdr_sz);
@@ -696,8 +706,10 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,
else
err = skb_copy_datagram_from_iter(skb, 0, from, len);
- if (err)
+ if (err) {
+ drop_line = SKB_DROP_LINE;
goto err_kfree;
+ }
skb_set_network_header(skb, ETH_HLEN);
skb_reset_mac_header(skb);
@@ -706,8 +718,10 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,
if (vnet_hdr_len) {
err = virtio_net_hdr_to_skb(skb, &vnet_hdr,
tap_is_little_endian(q));
- if (err)
+ if (err) {
+ drop_line = SKB_DROP_LINE;
goto err_kfree;
+ }
}
skb_probe_transport_header(skb);
@@ -738,7 +752,7 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,
return total_len;
err_kfree:
- kfree_skb(skb);
+ kfree_skb_reason(skb, SKB_DROP_FUNC, drop_line);
err:
rcu_read_lock();
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH RFC 1/4] net: skb: use line number to trace dropped skb
2022-02-03 15:37 ` [PATCH RFC 1/4] net: skb: use line number to trace dropped skb Dongli Zhang
@ 2022-02-03 15:48 ` David Ahern
2022-02-03 17:13 ` Dongli Zhang
2022-02-03 15:59 ` Eric Dumazet
` (2 subsequent siblings)
3 siblings, 1 reply; 13+ messages in thread
From: David Ahern @ 2022-02-03 15:48 UTC (permalink / raw)
To: Dongli Zhang, netdev, bpf
Cc: linux-kernel, rostedt, mingo, davem, kuba, edumazet, yoshfuji,
dsahern, ast, daniel, andrii, imagedong, joao.m.martins, joe.jin
On 2/3/22 8:37 AM, Dongli Zhang wrote:
> Sometimes the kernel may not directly call kfree_skb() to drop the sk_buff.
> Instead, it "goto drop" and call kfree_skb() at 'drop'. This make it
> difficult to track the reason that the sk_buff is dropped.
>
> The commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") has
> introduced the kfree_skb_reason() to help track the reason. However, we may
> need to define many reasons for each driver/subsystem.
>
> To avoid introducing so many new reasons, this is to use line number
> ("__LINE__") to trace where the sk_buff is dropped. As a result, the reason
> will be generated automatically.
>
I don't agree with this approach. It is only marginally better than the
old kfree_skb that only gave the instruction pointer. That tells you the
function that dropped the packet, but not why the packet is dropped.
Adding the line number only makes users have to consult the source code.
When I watch drop monitor for kfree_skb I want to know *why* the packet
was dropped, not the line number in the source code. e.g., dropmon
showing OTHERHOST means too many packets are sent to this host (e.g.,
hypervisor) that do not belong to the host or the VMs running on it, or
packets have invalid checksum (IP, TCP, UDP). Usable information by
everyone, not just someone with access to the source code for that
specific kernel.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH RFC 1/4] net: skb: use line number to trace dropped skb
2022-02-03 15:37 ` [PATCH RFC 1/4] net: skb: use line number to trace dropped skb Dongli Zhang
2022-02-03 15:48 ` David Ahern
@ 2022-02-03 15:59 ` Eric Dumazet
2022-02-03 17:14 ` Dongli Zhang
2022-02-04 1:29 ` kernel test robot
2022-02-04 1:30 ` kernel test robot
3 siblings, 1 reply; 13+ messages in thread
From: Eric Dumazet @ 2022-02-03 15:59 UTC (permalink / raw)
To: Dongli Zhang
Cc: netdev, bpf, LKML, Steven Rostedt, Ingo Molnar, David Miller,
Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Menglong Dong, Joao Martins, joe.jin
On Thu, Feb 3, 2022 at 7:38 AM Dongli Zhang <dongli.zhang@oracle.com> wrote:
>
> Sometimes the kernel may not directly call kfree_skb() to drop the sk_buff.
> Instead, it "goto drop" and call kfree_skb() at 'drop'. This make it
> difficult to track the reason that the sk_buff is dropped.
>
> The commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") has
> introduced the kfree_skb_reason() to help track the reason. However, we may
> need to define many reasons for each driver/subsystem.
>
> To avoid introducing so many new reasons, this is to use line number
> ("__LINE__") to trace where the sk_buff is dropped. As a result, the reason
> will be generated automatically.
>
> Cc: Joao Martins <joao.m.martins@oracle.com>
> Cc: Joe Jin <joe.jin@oracle.com>
> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
> ---
> include/linux/skbuff.h | 21 ++++-----------------
> include/trace/events/skb.h | 35 ++++++-----------------------------
> net/core/dev.c | 2 +-
> net/core/skbuff.c | 9 ++++-----
> net/ipv4/tcp_ipv4.c | 14 +++++++-------
> net/ipv4/udp.c | 14 +++++++-------
> 6 files changed, 29 insertions(+), 66 deletions(-)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 8a636e678902..471268a4a497 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -307,21 +307,8 @@ struct sk_buff_head {
>
> struct sk_buff;
>
> -/* The reason of skb drop, which is used in kfree_skb_reason().
> - * en...maybe they should be splited by group?
> - *
> - * Each item here should also be in 'TRACE_SKB_DROP_REASON', which is
> - * used to translate the reason to string.
> - */
> -enum skb_drop_reason {
> - SKB_DROP_REASON_NOT_SPECIFIED,
> - SKB_DROP_REASON_NO_SOCKET,
> - SKB_DROP_REASON_PKT_TOO_SMALL,
> - SKB_DROP_REASON_TCP_CSUM,
> - SKB_DROP_REASON_SOCKET_FILTER,
> - SKB_DROP_REASON_UDP_CSUM,
> - SKB_DROP_REASON_MAX,
> -};
Seriously, we have to stop messing with things like that.
Your patch comes too late, another approach has been taken.
Please continue this effort by providing patches that improve things,
instead of throwing away effort already done.
I say no to this patch.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH RFC 1/4] net: skb: use line number to trace dropped skb
2022-02-03 15:48 ` David Ahern
@ 2022-02-03 17:13 ` Dongli Zhang
0 siblings, 0 replies; 13+ messages in thread
From: Dongli Zhang @ 2022-02-03 17:13 UTC (permalink / raw)
To: David Ahern
Cc: linux-kernel, rostedt, mingo, davem, kuba, edumazet, yoshfuji,
dsahern, ast, daniel, andrii, imagedong, joao.m.martins, joe.jin,
netdev, bpf
Hi David,
On 2/3/22 7:48 AM, David Ahern wrote:
> On 2/3/22 8:37 AM, Dongli Zhang wrote:
>> Sometimes the kernel may not directly call kfree_skb() to drop the sk_buff.
>> Instead, it "goto drop" and call kfree_skb() at 'drop'. This make it
>> difficult to track the reason that the sk_buff is dropped.
>>
>> The commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") has
>> introduced the kfree_skb_reason() to help track the reason. However, we may
>> need to define many reasons for each driver/subsystem.
>>
>> To avoid introducing so many new reasons, this is to use line number
>> ("__LINE__") to trace where the sk_buff is dropped. As a result, the reason
>> will be generated automatically.
>>
>
> I don't agree with this approach. It is only marginally better than the
> old kfree_skb that only gave the instruction pointer. That tells you the
> function that dropped the packet, but not why the packet is dropped.
> Adding the line number only makes users have to consult the source code.
>
> When I watch drop monitor for kfree_skb I want to know *why* the packet
> was dropped, not the line number in the source code. e.g., dropmon
> showing OTHERHOST means too many packets are sent to this host (e.g.,
> hypervisor) that do not belong to the host or the VMs running on it, or
> packets have invalid checksum (IP, TCP, UDP). Usable information by
> everyone, not just someone with access to the source code for that
> specific kernel.
>
Thank you very much for the suggestion!
I will not follow this approach. I will introduce new reasons to TUN and TAP
drivers.
Dongli Zhang
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH RFC 1/4] net: skb: use line number to trace dropped skb
2022-02-03 15:59 ` Eric Dumazet
@ 2022-02-03 17:14 ` Dongli Zhang
0 siblings, 0 replies; 13+ messages in thread
From: Dongli Zhang @ 2022-02-03 17:14 UTC (permalink / raw)
To: Eric Dumazet
Cc: netdev, bpf, LKML, Steven Rostedt, Ingo Molnar, David Miller,
Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Menglong Dong, Joao Martins, joe.jin
Hi Eric,
On 2/3/22 7:59 AM, Eric Dumazet wrote:
> On Thu, Feb 3, 2022 at 7:38 AM Dongli Zhang <dongli.zhang@oracle.com> wrote:
>>
>> Sometimes the kernel may not directly call kfree_skb() to drop the sk_buff.
>> Instead, it "goto drop" and call kfree_skb() at 'drop'. This make it
>> difficult to track the reason that the sk_buff is dropped.
>>
>> The commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") has
>> introduced the kfree_skb_reason() to help track the reason. However, we may
>> need to define many reasons for each driver/subsystem.
>>
>> To avoid introducing so many new reasons, this is to use line number
>> ("__LINE__") to trace where the sk_buff is dropped. As a result, the reason
>> will be generated automatically.
>>
>> Cc: Joao Martins <joao.m.martins@oracle.com>
>> Cc: Joe Jin <joe.jin@oracle.com>
>> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
>> ---
>> include/linux/skbuff.h | 21 ++++-----------------
>> include/trace/events/skb.h | 35 ++++++-----------------------------
>> net/core/dev.c | 2 +-
>> net/core/skbuff.c | 9 ++++-----
>> net/ipv4/tcp_ipv4.c | 14 +++++++-------
>> net/ipv4/udp.c | 14 +++++++-------
>> 6 files changed, 29 insertions(+), 66 deletions(-)
>>
>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>> index 8a636e678902..471268a4a497 100644
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -307,21 +307,8 @@ struct sk_buff_head {
>>
>> struct sk_buff;
>>
>> -/* The reason of skb drop, which is used in kfree_skb_reason().
>> - * en...maybe they should be splited by group?
>> - *
>> - * Each item here should also be in 'TRACE_SKB_DROP_REASON', which is
>> - * used to translate the reason to string.
>> - */
>> -enum skb_drop_reason {
>> - SKB_DROP_REASON_NOT_SPECIFIED,
>> - SKB_DROP_REASON_NO_SOCKET,
>> - SKB_DROP_REASON_PKT_TOO_SMALL,
>> - SKB_DROP_REASON_TCP_CSUM,
>> - SKB_DROP_REASON_SOCKET_FILTER,
>> - SKB_DROP_REASON_UDP_CSUM,
>> - SKB_DROP_REASON_MAX,
>> -};
>
>
> Seriously, we have to stop messing with things like that.
>
> Your patch comes too late, another approach has been taken.
>
> Please continue this effort by providing patches that improve things,
> instead of throwing away effort already done.
Thank you very much for the suggestion!
I will introduce new reasons to TUN and TAP drivers, in order to track the
dropped sk_buff.
Dongli Zhang
>
> I say no to this patch.
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH RFC 1/4] net: skb: use line number to trace dropped skb
2022-02-03 15:37 ` [PATCH RFC 1/4] net: skb: use line number to trace dropped skb Dongli Zhang
2022-02-03 15:48 ` David Ahern
2022-02-03 15:59 ` Eric Dumazet
@ 2022-02-04 1:29 ` kernel test robot
2022-02-04 1:30 ` kernel test robot
3 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2022-02-04 1:29 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9580 bytes --]
Hi Dongli,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on net/master]
[also build test WARNING on horms-ipvs/master net-next/master linus/master v5.17-rc2 next-20220203]
[cannot apply to rostedt-trace/for-next mst-vhost/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Dongli-Zhang/net-skb-to-use-function-line-pair-as-reason-for-kfree_skb_reason/20220203-234047
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4a81f6da9cb2d1ef911131a6fd8bd15cb61fc772
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220204/202202040234.v2s33Nzf-lkp(a)intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f4f541c242dc39728703547e3088572a7f7e2f38
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dongli-Zhang/net-skb-to-use-function-line-pair-as-reason-for-kfree_skb_reason/20220203-234047
git checkout f4f541c242dc39728703547e3088572a7f7e2f38
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash net/core/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> net/core/drop_monitor.c:114:38: warning: 'enum skb_drop_reason' declared inside parameter list will not be visible outside of this definition or declaration
114 | enum skb_drop_reason reason);
| ^~~~~~~~~~~~~~~
net/core/drop_monitor.c:268:38: warning: 'enum skb_drop_reason' declared inside parameter list will not be visible outside of this definition or declaration
268 | enum skb_drop_reason reason)
| ^~~~~~~~~~~~~~~
net/core/drop_monitor.c:268:54: error: parameter 4 ('reason') has incomplete type
268 | enum skb_drop_reason reason)
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~
net/core/drop_monitor.c:266:13: error: function declaration isn't a prototype [-Werror=strict-prototypes]
266 | static void trace_kfree_skb_hit(void *ignore, struct sk_buff *skb,
| ^~~~~~~~~~~~~~~~~~~
net/core/drop_monitor.c:497:52: warning: 'enum skb_drop_reason' declared inside parameter list will not be visible outside of this definition or declaration
497 | enum skb_drop_reason reason)
| ^~~~~~~~~~~~~~~
net/core/drop_monitor.c:497:68: error: parameter 4 ('reason') has incomplete type
497 | enum skb_drop_reason reason)
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~
net/core/drop_monitor.c:494:13: error: function declaration isn't a prototype [-Werror=strict-prototypes]
494 | static void net_dm_packet_trace_kfree_skb_hit(void *ignore,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/drop_monitor.c: In function 'net_dm_trace_on_set':
net/core/drop_monitor.c:1136:42: error: passing argument 1 of 'register_trace_kfree_skb' from incompatible pointer type [-Werror=incompatible-pointer-types]
1136 | rc = register_trace_kfree_skb(ops->kfree_skb_probe, NULL);
| ~~~^~~~~~~~~~~~~~~~~
| |
| void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)
In file included from include/trace/events/skb.h:10,
from net/core/drop_monitor.c:34:
include/linux/tracepoint.h:260:38: note: expected 'void (*)(void *, struct sk_buff *, void *, unsigned int)' but argument is of type 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)'
260 | register_trace_##name(void (*probe)(data_proto), void *data) \
| ~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/tracepoint.h:419:9: note: in expansion of macro '__DECLARE_TRACE'
419 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
| ^~~~~~~~~~~~~~~
include/linux/tracepoint.h:553:9: note: in expansion of macro 'DECLARE_TRACE'
553 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: in expansion of macro 'TRACE_EVENT'
15 | TRACE_EVENT(kfree_skb,
| ^~~~~~~~~~~
net/core/drop_monitor.c:1151:39: error: passing argument 1 of 'unregister_trace_kfree_skb' from incompatible pointer type [-Werror=incompatible-pointer-types]
1151 | unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
| ~~~^~~~~~~~~~~~~~~~~
| |
| void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)
In file included from include/trace/events/skb.h:10,
from net/core/drop_monitor.c:34:
include/linux/tracepoint.h:273:40: note: expected 'void (*)(void *, struct sk_buff *, void *, unsigned int)' but argument is of type 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)'
273 | unregister_trace_##name(void (*probe)(data_proto), void *data) \
| ~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/tracepoint.h:419:9: note: in expansion of macro '__DECLARE_TRACE'
419 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
| ^~~~~~~~~~~~~~~
include/linux/tracepoint.h:553:9: note: in expansion of macro 'DECLARE_TRACE'
553 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: in expansion of macro 'TRACE_EVENT'
15 | TRACE_EVENT(kfree_skb,
| ^~~~~~~~~~~
net/core/drop_monitor.c: In function 'net_dm_trace_off_set':
net/core/drop_monitor.c:1175:39: error: passing argument 1 of 'unregister_trace_kfree_skb' from incompatible pointer type [-Werror=incompatible-pointer-types]
1175 | unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
| ~~~^~~~~~~~~~~~~~~~~
| |
| void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)
In file included from include/trace/events/skb.h:10,
from net/core/drop_monitor.c:34:
include/linux/tracepoint.h:273:40: note: expected 'void (*)(void *, struct sk_buff *, void *, unsigned int)' but argument is of type 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)'
273 | unregister_trace_##name(void (*probe)(data_proto), void *data) \
| ~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/tracepoint.h:419:9: note: in expansion of macro '__DECLARE_TRACE'
419 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
| ^~~~~~~~~~~~~~~
include/linux/tracepoint.h:553:9: note: in expansion of macro 'DECLARE_TRACE'
553 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: in expansion of macro 'TRACE_EVENT'
15 | TRACE_EVENT(kfree_skb,
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
vim +114 net/core/drop_monitor.c
28315f7999870b Ido Schimmel 2019-08-11 110
28315f7999870b Ido Schimmel 2019-08-11 111 struct net_dm_alert_ops {
28315f7999870b Ido Schimmel 2019-08-11 112 void (*kfree_skb_probe)(void *ignore, struct sk_buff *skb,
c504e5c2f9648a Menglong Dong 2022-01-09 113 void *location,
c504e5c2f9648a Menglong Dong 2022-01-09 @114 enum skb_drop_reason reason);
28315f7999870b Ido Schimmel 2019-08-11 115 void (*napi_poll_probe)(void *ignore, struct napi_struct *napi,
28315f7999870b Ido Schimmel 2019-08-11 116 int work, int budget);
28315f7999870b Ido Schimmel 2019-08-11 117 void (*work_item_func)(struct work_struct *work);
5e58109b1ea454 Ido Schimmel 2019-08-17 118 void (*hw_work_item_func)(struct work_struct *work);
5855357cd40e8b Ido Schimmel 2020-09-29 119 void (*hw_trap_probe)(void *ignore, const struct devlink *devlink,
5855357cd40e8b Ido Schimmel 2020-09-29 120 struct sk_buff *skb,
5855357cd40e8b Ido Schimmel 2020-09-29 121 const struct devlink_trap_metadata *metadata);
28315f7999870b Ido Schimmel 2019-08-11 122 };
28315f7999870b Ido Schimmel 2019-08-11 123
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH RFC 1/4] net: skb: use line number to trace dropped skb
2022-02-03 15:37 ` [PATCH RFC 1/4] net: skb: use line number to trace dropped skb Dongli Zhang
` (2 preceding siblings ...)
2022-02-04 1:29 ` kernel test robot
@ 2022-02-04 1:30 ` kernel test robot
3 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2022-02-04 1:30 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 20498 bytes --]
Hi Dongli,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on net/master]
[also build test ERROR on horms-ipvs/master net-next/master linus/master v5.17-rc2 next-20220203]
[cannot apply to rostedt-trace/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Dongli-Zhang/net-skb-to-use-function-line-pair-as-reason-for-kfree_skb_reason/20220203-234047
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4a81f6da9cb2d1ef911131a6fd8bd15cb61fc772
config: s390-randconfig-r044-20220130 (https://download.01.org/0day-ci/archive/20220204/202202040444.13eiIxgB-lkp(a)intel.com/config)
compiler: s390-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f4f541c242dc39728703547e3088572a7f7e2f38
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dongli-Zhang/net-skb-to-use-function-line-pair-as-reason-for-kfree_skb_reason/20220203-234047
git checkout f4f541c242dc39728703547e3088572a7f7e2f38
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash net/core/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> net/core/drop_monitor.c:114:38: warning: 'enum skb_drop_reason' declared inside parameter list will not be visible outside of this definition or declaration
114 | enum skb_drop_reason reason);
| ^~~~~~~~~~~~~~~
net/core/drop_monitor.c:268:38: warning: 'enum skb_drop_reason' declared inside parameter list will not be visible outside of this definition or declaration
268 | enum skb_drop_reason reason)
| ^~~~~~~~~~~~~~~
>> net/core/drop_monitor.c:268:54: error: parameter 4 ('reason') has incomplete type
268 | enum skb_drop_reason reason)
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~
>> net/core/drop_monitor.c:266:13: error: function declaration isn't a prototype [-Werror=strict-prototypes]
266 | static void trace_kfree_skb_hit(void *ignore, struct sk_buff *skb,
| ^~~~~~~~~~~~~~~~~~~
net/core/drop_monitor.c:497:52: warning: 'enum skb_drop_reason' declared inside parameter list will not be visible outside of this definition or declaration
497 | enum skb_drop_reason reason)
| ^~~~~~~~~~~~~~~
net/core/drop_monitor.c:497:68: error: parameter 4 ('reason') has incomplete type
497 | enum skb_drop_reason reason)
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~
net/core/drop_monitor.c:494:13: error: function declaration isn't a prototype [-Werror=strict-prototypes]
494 | static void net_dm_packet_trace_kfree_skb_hit(void *ignore,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/drop_monitor.c: In function 'net_dm_trace_on_set':
>> net/core/drop_monitor.c:1136:42: error: passing argument 1 of 'register_trace_kfree_skb' from incompatible pointer type [-Werror=incompatible-pointer-types]
1136 | rc = register_trace_kfree_skb(ops->kfree_skb_probe, NULL);
| ~~~^~~~~~~~~~~~~~~~~
| |
| void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)
In file included from include/trace/events/skb.h:10,
from net/core/drop_monitor.c:34:
include/linux/tracepoint.h:260:38: note: expected 'void (*)(void *, struct sk_buff *, void *, unsigned int)' but argument is of type 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)'
260 | register_trace_##name(void (*probe)(data_proto), void *data) \
| ~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/tracepoint.h:419:9: note: in expansion of macro '__DECLARE_TRACE'
419 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
| ^~~~~~~~~~~~~~~
include/linux/tracepoint.h:553:9: note: in expansion of macro 'DECLARE_TRACE'
553 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: in expansion of macro 'TRACE_EVENT'
15 | TRACE_EVENT(kfree_skb,
| ^~~~~~~~~~~
>> net/core/drop_monitor.c:1151:39: error: passing argument 1 of 'unregister_trace_kfree_skb' from incompatible pointer type [-Werror=incompatible-pointer-types]
1151 | unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
| ~~~^~~~~~~~~~~~~~~~~
| |
| void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)
In file included from include/trace/events/skb.h:10,
from net/core/drop_monitor.c:34:
include/linux/tracepoint.h:273:40: note: expected 'void (*)(void *, struct sk_buff *, void *, unsigned int)' but argument is of type 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)'
273 | unregister_trace_##name(void (*probe)(data_proto), void *data) \
| ~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/tracepoint.h:419:9: note: in expansion of macro '__DECLARE_TRACE'
419 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
| ^~~~~~~~~~~~~~~
include/linux/tracepoint.h:553:9: note: in expansion of macro 'DECLARE_TRACE'
553 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: in expansion of macro 'TRACE_EVENT'
15 | TRACE_EVENT(kfree_skb,
| ^~~~~~~~~~~
net/core/drop_monitor.c: In function 'net_dm_trace_off_set':
net/core/drop_monitor.c:1175:39: error: passing argument 1 of 'unregister_trace_kfree_skb' from incompatible pointer type [-Werror=incompatible-pointer-types]
1175 | unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
| ~~~^~~~~~~~~~~~~~~~~
| |
| void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)
In file included from include/trace/events/skb.h:10,
from net/core/drop_monitor.c:34:
include/linux/tracepoint.h:273:40: note: expected 'void (*)(void *, struct sk_buff *, void *, unsigned int)' but argument is of type 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)'
273 | unregister_trace_##name(void (*probe)(data_proto), void *data) \
| ~~~~~~~^~~~~~~~~~~~~~~~~~
include/linux/tracepoint.h:419:9: note: in expansion of macro '__DECLARE_TRACE'
419 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
| ^~~~~~~~~~~~~~~
include/linux/tracepoint.h:553:9: note: in expansion of macro 'DECLARE_TRACE'
553 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: in expansion of macro 'TRACE_EVENT'
15 | TRACE_EVENT(kfree_skb,
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
vim +114 net/core/drop_monitor.c
28315f7999870b Ido Schimmel 2019-08-11 110
28315f7999870b Ido Schimmel 2019-08-11 111 struct net_dm_alert_ops {
28315f7999870b Ido Schimmel 2019-08-11 112 void (*kfree_skb_probe)(void *ignore, struct sk_buff *skb,
c504e5c2f9648a Menglong Dong 2022-01-09 113 void *location,
c504e5c2f9648a Menglong Dong 2022-01-09 @114 enum skb_drop_reason reason);
28315f7999870b Ido Schimmel 2019-08-11 115 void (*napi_poll_probe)(void *ignore, struct napi_struct *napi,
28315f7999870b Ido Schimmel 2019-08-11 116 int work, int budget);
28315f7999870b Ido Schimmel 2019-08-11 117 void (*work_item_func)(struct work_struct *work);
5e58109b1ea454 Ido Schimmel 2019-08-17 118 void (*hw_work_item_func)(struct work_struct *work);
5855357cd40e8b Ido Schimmel 2020-09-29 119 void (*hw_trap_probe)(void *ignore, const struct devlink *devlink,
5855357cd40e8b Ido Schimmel 2020-09-29 120 struct sk_buff *skb,
5855357cd40e8b Ido Schimmel 2020-09-29 121 const struct devlink_trap_metadata *metadata);
28315f7999870b Ido Schimmel 2019-08-11 122 };
28315f7999870b Ido Schimmel 2019-08-11 123
ca30707dee2bc8 Ido Schimmel 2019-08-11 124 struct net_dm_skb_cb {
5e58109b1ea454 Ido Schimmel 2019-08-17 125 union {
a848c05f4bb6c2 Ido Schimmel 2020-09-29 126 struct devlink_trap_metadata *hw_metadata;
ca30707dee2bc8 Ido Schimmel 2019-08-11 127 void *pc;
ca30707dee2bc8 Ido Schimmel 2019-08-11 128 };
5e58109b1ea454 Ido Schimmel 2019-08-17 129 };
ca30707dee2bc8 Ido Schimmel 2019-08-11 130
ca30707dee2bc8 Ido Schimmel 2019-08-11 131 #define NET_DM_SKB_CB(__skb) ((struct net_dm_skb_cb *)&((__skb)->cb[0]))
ca30707dee2bc8 Ido Schimmel 2019-08-11 132
bec4596b4e6770 Eric Dumazet 2012-06-04 133 static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
9a8afc8d3962f3 Neil Horman 2009-03-11 134 {
9a8afc8d3962f3 Neil Horman 2009-03-11 135 size_t al;
9a8afc8d3962f3 Neil Horman 2009-03-11 136 struct net_dm_alert_msg *msg;
683703a26e4677 Neil Horman 2009-04-27 137 struct nlattr *nla;
3885ca785a3618 Neil Horman 2012-04-27 138 struct sk_buff *skb;
bec4596b4e6770 Eric Dumazet 2012-06-04 139 unsigned long flags;
4200462d88f47f Reiter Wolfgang 2016-12-31 140 void *msg_header;
9a8afc8d3962f3 Neil Horman 2009-03-11 141
9a8afc8d3962f3 Neil Horman 2009-03-11 142 al = sizeof(struct net_dm_alert_msg);
9a8afc8d3962f3 Neil Horman 2009-03-11 143 al += dm_hit_limit * sizeof(struct net_dm_drop_point);
683703a26e4677 Neil Horman 2009-04-27 144 al += sizeof(struct nlattr);
683703a26e4677 Neil Horman 2009-04-27 145
3885ca785a3618 Neil Horman 2012-04-27 146 skb = genlmsg_new(al, GFP_KERNEL);
3885ca785a3618 Neil Horman 2012-04-27 147
4200462d88f47f Reiter Wolfgang 2016-12-31 148 if (!skb)
4200462d88f47f Reiter Wolfgang 2016-12-31 149 goto err;
4200462d88f47f Reiter Wolfgang 2016-12-31 150
4200462d88f47f Reiter Wolfgang 2016-12-31 151 msg_header = genlmsg_put(skb, 0, 0, &net_drop_monitor_family,
9a8afc8d3962f3 Neil Horman 2009-03-11 152 0, NET_DM_CMD_ALERT);
4200462d88f47f Reiter Wolfgang 2016-12-31 153 if (!msg_header) {
4200462d88f47f Reiter Wolfgang 2016-12-31 154 nlmsg_free(skb);
4200462d88f47f Reiter Wolfgang 2016-12-31 155 skb = NULL;
4200462d88f47f Reiter Wolfgang 2016-12-31 156 goto err;
4200462d88f47f Reiter Wolfgang 2016-12-31 157 }
3885ca785a3618 Neil Horman 2012-04-27 158 nla = nla_reserve(skb, NLA_UNSPEC,
3885ca785a3618 Neil Horman 2012-04-27 159 sizeof(struct net_dm_alert_msg));
4200462d88f47f Reiter Wolfgang 2016-12-31 160 if (!nla) {
4200462d88f47f Reiter Wolfgang 2016-12-31 161 nlmsg_free(skb);
4200462d88f47f Reiter Wolfgang 2016-12-31 162 skb = NULL;
4200462d88f47f Reiter Wolfgang 2016-12-31 163 goto err;
4200462d88f47f Reiter Wolfgang 2016-12-31 164 }
683703a26e4677 Neil Horman 2009-04-27 165 msg = nla_data(nla);
9a8afc8d3962f3 Neil Horman 2009-03-11 166 memset(msg, 0, al);
4200462d88f47f Reiter Wolfgang 2016-12-31 167 goto out;
9a8afc8d3962f3 Neil Horman 2009-03-11 168
4200462d88f47f Reiter Wolfgang 2016-12-31 169 err:
4200462d88f47f Reiter Wolfgang 2016-12-31 170 mod_timer(&data->send_timer, jiffies + HZ / 10);
4200462d88f47f Reiter Wolfgang 2016-12-31 171 out:
bec4596b4e6770 Eric Dumazet 2012-06-04 172 spin_lock_irqsave(&data->lock, flags);
bec4596b4e6770 Eric Dumazet 2012-06-04 173 swap(data->skb, skb);
bec4596b4e6770 Eric Dumazet 2012-06-04 174 spin_unlock_irqrestore(&data->lock, flags);
bec4596b4e6770 Eric Dumazet 2012-06-04 175
3b48ab2248e614 Reiter Wolfgang 2017-01-03 176 if (skb) {
3b48ab2248e614 Reiter Wolfgang 2017-01-03 177 struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
3b48ab2248e614 Reiter Wolfgang 2017-01-03 178 struct genlmsghdr *gnlh = (struct genlmsghdr *)nlmsg_data(nlh);
3b48ab2248e614 Reiter Wolfgang 2017-01-03 179
3b48ab2248e614 Reiter Wolfgang 2017-01-03 180 genlmsg_end(skb, genlmsg_data(gnlh));
3b48ab2248e614 Reiter Wolfgang 2017-01-03 181 }
3b48ab2248e614 Reiter Wolfgang 2017-01-03 182
bec4596b4e6770 Eric Dumazet 2012-06-04 183 return skb;
3885ca785a3618 Neil Horman 2012-04-27 184 }
3885ca785a3618 Neil Horman 2012-04-27 185
85bae4bd8ae0a1 stephen hemminger 2016-08-31 186 static const struct genl_multicast_group dropmon_mcgrps[] = {
2a94fe48f32ccf Johannes Berg 2013-11-19 187 { .name = "events", },
e5dcecba015f97 Johannes Berg 2013-11-19 188 };
e5dcecba015f97 Johannes Berg 2013-11-19 189
bec4596b4e6770 Eric Dumazet 2012-06-04 190 static void send_dm_alert(struct work_struct *work)
9a8afc8d3962f3 Neil Horman 2009-03-11 191 {
9a8afc8d3962f3 Neil Horman 2009-03-11 192 struct sk_buff *skb;
bec4596b4e6770 Eric Dumazet 2012-06-04 193 struct per_cpu_dm_data *data;
4fdcfa12843bca Neil Horman 2012-05-01 194
bec4596b4e6770 Eric Dumazet 2012-06-04 195 data = container_of(work, struct per_cpu_dm_data, dm_alert_work);
9a8afc8d3962f3 Neil Horman 2009-03-11 196
bec4596b4e6770 Eric Dumazet 2012-06-04 197 skb = reset_per_cpu_data(data);
9a8afc8d3962f3 Neil Horman 2009-03-11 198
3885ca785a3618 Neil Horman 2012-04-27 199 if (skb)
68eb55031da7c9 Johannes Berg 2013-11-19 200 genlmsg_multicast(&net_drop_monitor_family, skb, 0,
2a94fe48f32ccf Johannes Berg 2013-11-19 201 0, GFP_KERNEL);
9a8afc8d3962f3 Neil Horman 2009-03-11 202 }
9a8afc8d3962f3 Neil Horman 2009-03-11 203
9a8afc8d3962f3 Neil Horman 2009-03-11 204 /*
9a8afc8d3962f3 Neil Horman 2009-03-11 205 * This is the timer function to delay the sending of an alert
9a8afc8d3962f3 Neil Horman 2009-03-11 206 * in the event that more drops will arrive during the
bec4596b4e6770 Eric Dumazet 2012-06-04 207 * hysteresis period.
9a8afc8d3962f3 Neil Horman 2009-03-11 208 */
e99e88a9d2b067 Kees Cook 2017-10-16 209 static void sched_send_work(struct timer_list *t)
9a8afc8d3962f3 Neil Horman 2009-03-11 210 {
e99e88a9d2b067 Kees Cook 2017-10-16 211 struct per_cpu_dm_data *data = from_timer(data, t, send_timer);
9a8afc8d3962f3 Neil Horman 2009-03-11 212
bec4596b4e6770 Eric Dumazet 2012-06-04 213 schedule_work(&data->dm_alert_work);
9a8afc8d3962f3 Neil Horman 2009-03-11 214 }
9a8afc8d3962f3 Neil Horman 2009-03-11 215
4ea7e38696c7e7 Neil Horman 2009-05-21 216 static void trace_drop_common(struct sk_buff *skb, void *location)
9a8afc8d3962f3 Neil Horman 2009-03-11 217 {
9a8afc8d3962f3 Neil Horman 2009-03-11 218 struct net_dm_alert_msg *msg;
dc30b4059f6e2a Arnd Bergmann 2020-04-30 219 struct net_dm_drop_point *point;
9a8afc8d3962f3 Neil Horman 2009-03-11 220 struct nlmsghdr *nlh;
683703a26e4677 Neil Horman 2009-04-27 221 struct nlattr *nla;
9a8afc8d3962f3 Neil Horman 2009-03-11 222 int i;
3885ca785a3618 Neil Horman 2012-04-27 223 struct sk_buff *dskb;
bec4596b4e6770 Eric Dumazet 2012-06-04 224 struct per_cpu_dm_data *data;
bec4596b4e6770 Eric Dumazet 2012-06-04 225 unsigned long flags;
3885ca785a3618 Neil Horman 2012-04-27 226
bec4596b4e6770 Eric Dumazet 2012-06-04 227 local_irq_save(flags);
903ceff7ca7b4d Christoph Lameter 2014-08-17 228 data = this_cpu_ptr(&dm_cpu_data);
bec4596b4e6770 Eric Dumazet 2012-06-04 229 spin_lock(&data->lock);
bec4596b4e6770 Eric Dumazet 2012-06-04 230 dskb = data->skb;
9a8afc8d3962f3 Neil Horman 2009-03-11 231
3885ca785a3618 Neil Horman 2012-04-27 232 if (!dskb)
3885ca785a3618 Neil Horman 2012-04-27 233 goto out;
9a8afc8d3962f3 Neil Horman 2009-03-11 234
3885ca785a3618 Neil Horman 2012-04-27 235 nlh = (struct nlmsghdr *)dskb->data;
683703a26e4677 Neil Horman 2009-04-27 236 nla = genlmsg_data(nlmsg_data(nlh));
683703a26e4677 Neil Horman 2009-04-27 237 msg = nla_data(nla);
dc30b4059f6e2a Arnd Bergmann 2020-04-30 238 point = msg->points;
9a8afc8d3962f3 Neil Horman 2009-03-11 239 for (i = 0; i < msg->entries; i++) {
dc30b4059f6e2a Arnd Bergmann 2020-04-30 240 if (!memcmp(&location, &point->pc, sizeof(void *))) {
dc30b4059f6e2a Arnd Bergmann 2020-04-30 241 point->count++;
9a8afc8d3962f3 Neil Horman 2009-03-11 242 goto out;
9a8afc8d3962f3 Neil Horman 2009-03-11 243 }
dc30b4059f6e2a Arnd Bergmann 2020-04-30 244 point++;
9a8afc8d3962f3 Neil Horman 2009-03-11 245 }
bec4596b4e6770 Eric Dumazet 2012-06-04 246 if (msg->entries == dm_hit_limit)
bec4596b4e6770 Eric Dumazet 2012-06-04 247 goto out;
9a8afc8d3962f3 Neil Horman 2009-03-11 248 /*
9a8afc8d3962f3 Neil Horman 2009-03-11 249 * We need to create a new entry
9a8afc8d3962f3 Neil Horman 2009-03-11 250 */
3885ca785a3618 Neil Horman 2012-04-27 251 __nla_reserve_nohdr(dskb, sizeof(struct net_dm_drop_point));
683703a26e4677 Neil Horman 2009-04-27 252 nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point));
dc30b4059f6e2a Arnd Bergmann 2020-04-30 253 memcpy(point->pc, &location, sizeof(void *));
dc30b4059f6e2a Arnd Bergmann 2020-04-30 254 point->count = 1;
9a8afc8d3962f3 Neil Horman 2009-03-11 255 msg->entries++;
9a8afc8d3962f3 Neil Horman 2009-03-11 256
9a8afc8d3962f3 Neil Horman 2009-03-11 257 if (!timer_pending(&data->send_timer)) {
9a8afc8d3962f3 Neil Horman 2009-03-11 258 data->send_timer.expires = jiffies + dm_delay * HZ;
bec4596b4e6770 Eric Dumazet 2012-06-04 259 add_timer(&data->send_timer);
9a8afc8d3962f3 Neil Horman 2009-03-11 260 }
9a8afc8d3962f3 Neil Horman 2009-03-11 261
9a8afc8d3962f3 Neil Horman 2009-03-11 262 out:
bec4596b4e6770 Eric Dumazet 2012-06-04 263 spin_unlock_irqrestore(&data->lock, flags);
9a8afc8d3962f3 Neil Horman 2009-03-11 264 }
9a8afc8d3962f3 Neil Horman 2009-03-11 265
c504e5c2f9648a Menglong Dong 2022-01-09 @266 static void trace_kfree_skb_hit(void *ignore, struct sk_buff *skb,
c504e5c2f9648a Menglong Dong 2022-01-09 267 void *location,
c504e5c2f9648a Menglong Dong 2022-01-09 @268 enum skb_drop_reason reason)
4ea7e38696c7e7 Neil Horman 2009-05-21 269 {
4ea7e38696c7e7 Neil Horman 2009-05-21 270 trace_drop_common(skb, location);
4ea7e38696c7e7 Neil Horman 2009-05-21 271 }
4ea7e38696c7e7 Neil Horman 2009-05-21 272
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH RFC 2/4] net: skb: add function name as part of reason
2022-02-03 15:37 ` [PATCH RFC 2/4] net: skb: add function name as part of reason Dongli Zhang
@ 2022-02-04 1:31 ` kernel test robot
0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2022-02-04 1:31 UTC (permalink / raw)
To: Dongli Zhang; +Cc: llvm, kbuild-all
Hi Dongli,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on net/master]
[also build test ERROR on horms-ipvs/master net-next/master linus/master v5.17-rc2 next-20220203]
[cannot apply to rostedt-trace/for-next mst-vhost/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Dongli-Zhang/net-skb-to-use-function-line-pair-as-reason-for-kfree_skb_reason/20220203-234047
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4a81f6da9cb2d1ef911131a6fd8bd15cb61fc772
config: i386-randconfig-r012-20220131 (https://download.01.org/0day-ci/archive/20220204/202202040814.dnMvgmym-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a73e4ce6a59b01f0e37037761c1e6889d539d233)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f23dbdfcd70917e6ee216f97a477bb3387731628
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dongli-Zhang/net-skb-to-use-function-line-pair-as-reason-for-kfree_skb_reason/20220203-234047
git checkout f23dbdfcd70917e6ee216f97a477bb3387731628
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash mm/ net/core/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
net/core/drop_monitor.c:114:10: warning: declaration of 'enum skb_drop_reason' will not be visible outside of this function [-Wvisibility]
enum skb_drop_reason reason);
^
net/core/drop_monitor.c:268:10: warning: declaration of 'enum skb_drop_reason' will not be visible outside of this function [-Wvisibility]
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:268:26: error: variable has incomplete type 'enum skb_drop_reason'
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:268:10: note: forward declaration of 'enum skb_drop_reason'
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:487:21: error: incompatible function pointer types initializing 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)' with an expression of type 'void (void *, struct sk_buff *, void *, enum skb_drop_reason)' [-Werror,-Wincompatible-function-pointer-types]
.kfree_skb_probe = trace_kfree_skb_hit,
^~~~~~~~~~~~~~~~~~~
net/core/drop_monitor.c:497:17: warning: declaration of 'enum skb_drop_reason' will not be visible outside of this function [-Wvisibility]
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:497:33: error: variable has incomplete type 'enum skb_drop_reason'
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:497:17: note: forward declaration of 'enum skb_drop_reason'
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:986:21: error: incompatible function pointer types initializing 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)' with an expression of type 'void (void *, struct sk_buff *, void *, enum skb_drop_reason)' [-Werror,-Wincompatible-function-pointer-types]
.kfree_skb_probe = net_dm_packet_trace_kfree_skb_hit,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/core/drop_monitor.c:1136:32: error: incompatible function pointer types passing 'void (*const)(void *, struct sk_buff *, void *, enum skb_drop_reason)' to parameter of type 'void (*)(void *, struct sk_buff *, void *, const char *, unsigned int)' [-Werror,-Wincompatible-function-pointer-types]
rc = register_trace_kfree_skb(ops->kfree_skb_probe, NULL);
^~~~~~~~~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: passing argument to parameter 'probe' here
TRACE_EVENT(kfree_skb,
^
include/linux/tracepoint.h:553:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:260:31: note: expanded from macro '__DECLARE_TRACE'
register_trace_##name(void (*probe)(data_proto), void *data) \
^
net/core/drop_monitor.c:1151:29: error: incompatible function pointer types passing 'void (*const)(void *, struct sk_buff *, void *, enum skb_drop_reason)' to parameter of type 'void (*)(void *, struct sk_buff *, void *, const char *, unsigned int)' [-Werror,-Wincompatible-function-pointer-types]
unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
^~~~~~~~~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: passing argument to parameter 'probe' here
TRACE_EVENT(kfree_skb,
^
include/linux/tracepoint.h:553:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:273:33: note: expanded from macro '__DECLARE_TRACE'
unregister_trace_##name(void (*probe)(data_proto), void *data) \
^
net/core/drop_monitor.c:1175:29: error: incompatible function pointer types passing 'void (*const)(void *, struct sk_buff *, void *, enum skb_drop_reason)' to parameter of type 'void (*)(void *, struct sk_buff *, void *, const char *, unsigned int)' [-Werror,-Wincompatible-function-pointer-types]
unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
^~~~~~~~~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: passing argument to parameter 'probe' here
TRACE_EVENT(kfree_skb,
^
include/linux/tracepoint.h:553:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:273:33: note: expanded from macro '__DECLARE_TRACE'
unregister_trace_##name(void (*probe)(data_proto), void *data) \
^
3 warnings and 7 errors generated.
vim +1136 net/core/drop_monitor.c
8e94c3bc922e70 Ido Schimmel 2019-08-17 1109
7c747838a55818 Ido Schimmel 2019-08-11 1110 static int net_dm_trace_on_set(struct netlink_ext_ack *extack)
9a8afc8d3962f3 Neil Horman 2009-03-11 1111 {
28315f7999870b Ido Schimmel 2019-08-11 1112 const struct net_dm_alert_ops *ops;
70c69274f354ec Ido Schimmel 2019-08-11 1113 int cpu, rc;
4b706372f18de5 Neil Horman 2010-07-20 1114
28315f7999870b Ido Schimmel 2019-08-11 1115 ops = net_dm_alert_ops_arr[net_dm_alert_mode];
28315f7999870b Ido Schimmel 2019-08-11 1116
cad456d5abbb63 Neil Horman 2012-05-17 1117 if (!try_module_get(THIS_MODULE)) {
965100966efe85 Ido Schimmel 2019-08-06 1118 NL_SET_ERR_MSG_MOD(extack, "Failed to take reference on module");
7c747838a55818 Ido Schimmel 2019-08-11 1119 return -ENODEV;
cad456d5abbb63 Neil Horman 2012-05-17 1120 }
cad456d5abbb63 Neil Horman 2012-05-17 1121
70c69274f354ec Ido Schimmel 2019-08-11 1122 for_each_possible_cpu(cpu) {
70c69274f354ec Ido Schimmel 2019-08-11 1123 struct per_cpu_dm_data *data = &per_cpu(dm_cpu_data, cpu);
44075f56379388 Ido Schimmel 2019-08-11 1124 struct sk_buff *skb;
70c69274f354ec Ido Schimmel 2019-08-11 1125
28315f7999870b Ido Schimmel 2019-08-11 1126 INIT_WORK(&data->dm_alert_work, ops->work_item_func);
70c69274f354ec Ido Schimmel 2019-08-11 1127 timer_setup(&data->send_timer, sched_send_work, 0);
44075f56379388 Ido Schimmel 2019-08-11 1128 /* Allocate a new per-CPU skb for the summary alert message and
44075f56379388 Ido Schimmel 2019-08-11 1129 * free the old one which might contain stale data from
44075f56379388 Ido Schimmel 2019-08-11 1130 * previous tracing.
44075f56379388 Ido Schimmel 2019-08-11 1131 */
44075f56379388 Ido Schimmel 2019-08-11 1132 skb = reset_per_cpu_data(data);
44075f56379388 Ido Schimmel 2019-08-11 1133 consume_skb(skb);
70c69274f354ec Ido Schimmel 2019-08-11 1134 }
70c69274f354ec Ido Schimmel 2019-08-11 1135
28315f7999870b Ido Schimmel 2019-08-11 @1136 rc = register_trace_kfree_skb(ops->kfree_skb_probe, NULL);
7c747838a55818 Ido Schimmel 2019-08-11 1137 if (rc) {
7c747838a55818 Ido Schimmel 2019-08-11 1138 NL_SET_ERR_MSG_MOD(extack, "Failed to connect probe to kfree_skb() tracepoint");
7c747838a55818 Ido Schimmel 2019-08-11 1139 goto err_module_put;
7c747838a55818 Ido Schimmel 2019-08-11 1140 }
cad456d5abbb63 Neil Horman 2012-05-17 1141
28315f7999870b Ido Schimmel 2019-08-11 1142 rc = register_trace_napi_poll(ops->napi_poll_probe, NULL);
7c747838a55818 Ido Schimmel 2019-08-11 1143 if (rc) {
7c747838a55818 Ido Schimmel 2019-08-11 1144 NL_SET_ERR_MSG_MOD(extack, "Failed to connect probe to napi_poll() tracepoint");
7c747838a55818 Ido Schimmel 2019-08-11 1145 goto err_unregister_trace;
7c747838a55818 Ido Schimmel 2019-08-11 1146 }
7c747838a55818 Ido Schimmel 2019-08-11 1147
7c747838a55818 Ido Schimmel 2019-08-11 1148 return 0;
7c747838a55818 Ido Schimmel 2019-08-11 1149
7c747838a55818 Ido Schimmel 2019-08-11 1150 err_unregister_trace:
28315f7999870b Ido Schimmel 2019-08-11 1151 unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
7c747838a55818 Ido Schimmel 2019-08-11 1152 err_module_put:
9398e9c0b1d44e Ido Schimmel 2021-03-10 1153 for_each_possible_cpu(cpu) {
9398e9c0b1d44e Ido Schimmel 2021-03-10 1154 struct per_cpu_dm_data *data = &per_cpu(dm_cpu_data, cpu);
9398e9c0b1d44e Ido Schimmel 2021-03-10 1155 struct sk_buff *skb;
9398e9c0b1d44e Ido Schimmel 2021-03-10 1156
9398e9c0b1d44e Ido Schimmel 2021-03-10 1157 del_timer_sync(&data->send_timer);
9398e9c0b1d44e Ido Schimmel 2021-03-10 1158 cancel_work_sync(&data->dm_alert_work);
9398e9c0b1d44e Ido Schimmel 2021-03-10 1159 while ((skb = __skb_dequeue(&data->drop_queue)))
9398e9c0b1d44e Ido Schimmel 2021-03-10 1160 consume_skb(skb);
9398e9c0b1d44e Ido Schimmel 2021-03-10 1161 }
7c747838a55818 Ido Schimmel 2019-08-11 1162 module_put(THIS_MODULE);
7c747838a55818 Ido Schimmel 2019-08-11 1163 return rc;
7c747838a55818 Ido Schimmel 2019-08-11 1164 }
7c747838a55818 Ido Schimmel 2019-08-11 1165
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH RFC 2/4] net: skb: add function name as part of reason
@ 2022-02-04 1:31 ` kernel test robot
0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2022-02-04 1:31 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 12020 bytes --]
Hi Dongli,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on net/master]
[also build test ERROR on horms-ipvs/master net-next/master linus/master v5.17-rc2 next-20220203]
[cannot apply to rostedt-trace/for-next mst-vhost/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Dongli-Zhang/net-skb-to-use-function-line-pair-as-reason-for-kfree_skb_reason/20220203-234047
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 4a81f6da9cb2d1ef911131a6fd8bd15cb61fc772
config: i386-randconfig-r012-20220131 (https://download.01.org/0day-ci/archive/20220204/202202040814.dnMvgmym-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a73e4ce6a59b01f0e37037761c1e6889d539d233)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f23dbdfcd70917e6ee216f97a477bb3387731628
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dongli-Zhang/net-skb-to-use-function-line-pair-as-reason-for-kfree_skb_reason/20220203-234047
git checkout f23dbdfcd70917e6ee216f97a477bb3387731628
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash mm/ net/core/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
net/core/drop_monitor.c:114:10: warning: declaration of 'enum skb_drop_reason' will not be visible outside of this function [-Wvisibility]
enum skb_drop_reason reason);
^
net/core/drop_monitor.c:268:10: warning: declaration of 'enum skb_drop_reason' will not be visible outside of this function [-Wvisibility]
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:268:26: error: variable has incomplete type 'enum skb_drop_reason'
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:268:10: note: forward declaration of 'enum skb_drop_reason'
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:487:21: error: incompatible function pointer types initializing 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)' with an expression of type 'void (void *, struct sk_buff *, void *, enum skb_drop_reason)' [-Werror,-Wincompatible-function-pointer-types]
.kfree_skb_probe = trace_kfree_skb_hit,
^~~~~~~~~~~~~~~~~~~
net/core/drop_monitor.c:497:17: warning: declaration of 'enum skb_drop_reason' will not be visible outside of this function [-Wvisibility]
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:497:33: error: variable has incomplete type 'enum skb_drop_reason'
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:497:17: note: forward declaration of 'enum skb_drop_reason'
enum skb_drop_reason reason)
^
net/core/drop_monitor.c:986:21: error: incompatible function pointer types initializing 'void (*)(void *, struct sk_buff *, void *, enum skb_drop_reason)' with an expression of type 'void (void *, struct sk_buff *, void *, enum skb_drop_reason)' [-Werror,-Wincompatible-function-pointer-types]
.kfree_skb_probe = net_dm_packet_trace_kfree_skb_hit,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/core/drop_monitor.c:1136:32: error: incompatible function pointer types passing 'void (*const)(void *, struct sk_buff *, void *, enum skb_drop_reason)' to parameter of type 'void (*)(void *, struct sk_buff *, void *, const char *, unsigned int)' [-Werror,-Wincompatible-function-pointer-types]
rc = register_trace_kfree_skb(ops->kfree_skb_probe, NULL);
^~~~~~~~~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: passing argument to parameter 'probe' here
TRACE_EVENT(kfree_skb,
^
include/linux/tracepoint.h:553:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:260:31: note: expanded from macro '__DECLARE_TRACE'
register_trace_##name(void (*probe)(data_proto), void *data) \
^
net/core/drop_monitor.c:1151:29: error: incompatible function pointer types passing 'void (*const)(void *, struct sk_buff *, void *, enum skb_drop_reason)' to parameter of type 'void (*)(void *, struct sk_buff *, void *, const char *, unsigned int)' [-Werror,-Wincompatible-function-pointer-types]
unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
^~~~~~~~~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: passing argument to parameter 'probe' here
TRACE_EVENT(kfree_skb,
^
include/linux/tracepoint.h:553:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:273:33: note: expanded from macro '__DECLARE_TRACE'
unregister_trace_##name(void (*probe)(data_proto), void *data) \
^
net/core/drop_monitor.c:1175:29: error: incompatible function pointer types passing 'void (*const)(void *, struct sk_buff *, void *, enum skb_drop_reason)' to parameter of type 'void (*)(void *, struct sk_buff *, void *, const char *, unsigned int)' [-Werror,-Wincompatible-function-pointer-types]
unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
^~~~~~~~~~~~~~~~~~~~
include/trace/events/skb.h:15:1: note: passing argument to parameter 'probe' here
TRACE_EVENT(kfree_skb,
^
include/linux/tracepoint.h:553:2: note: expanded from macro 'TRACE_EVENT'
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
^
include/linux/tracepoint.h:419:2: note: expanded from macro 'DECLARE_TRACE'
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
^
include/linux/tracepoint.h:273:33: note: expanded from macro '__DECLARE_TRACE'
unregister_trace_##name(void (*probe)(data_proto), void *data) \
^
3 warnings and 7 errors generated.
vim +1136 net/core/drop_monitor.c
8e94c3bc922e70 Ido Schimmel 2019-08-17 1109
7c747838a55818 Ido Schimmel 2019-08-11 1110 static int net_dm_trace_on_set(struct netlink_ext_ack *extack)
9a8afc8d3962f3 Neil Horman 2009-03-11 1111 {
28315f7999870b Ido Schimmel 2019-08-11 1112 const struct net_dm_alert_ops *ops;
70c69274f354ec Ido Schimmel 2019-08-11 1113 int cpu, rc;
4b706372f18de5 Neil Horman 2010-07-20 1114
28315f7999870b Ido Schimmel 2019-08-11 1115 ops = net_dm_alert_ops_arr[net_dm_alert_mode];
28315f7999870b Ido Schimmel 2019-08-11 1116
cad456d5abbb63 Neil Horman 2012-05-17 1117 if (!try_module_get(THIS_MODULE)) {
965100966efe85 Ido Schimmel 2019-08-06 1118 NL_SET_ERR_MSG_MOD(extack, "Failed to take reference on module");
7c747838a55818 Ido Schimmel 2019-08-11 1119 return -ENODEV;
cad456d5abbb63 Neil Horman 2012-05-17 1120 }
cad456d5abbb63 Neil Horman 2012-05-17 1121
70c69274f354ec Ido Schimmel 2019-08-11 1122 for_each_possible_cpu(cpu) {
70c69274f354ec Ido Schimmel 2019-08-11 1123 struct per_cpu_dm_data *data = &per_cpu(dm_cpu_data, cpu);
44075f56379388 Ido Schimmel 2019-08-11 1124 struct sk_buff *skb;
70c69274f354ec Ido Schimmel 2019-08-11 1125
28315f7999870b Ido Schimmel 2019-08-11 1126 INIT_WORK(&data->dm_alert_work, ops->work_item_func);
70c69274f354ec Ido Schimmel 2019-08-11 1127 timer_setup(&data->send_timer, sched_send_work, 0);
44075f56379388 Ido Schimmel 2019-08-11 1128 /* Allocate a new per-CPU skb for the summary alert message and
44075f56379388 Ido Schimmel 2019-08-11 1129 * free the old one which might contain stale data from
44075f56379388 Ido Schimmel 2019-08-11 1130 * previous tracing.
44075f56379388 Ido Schimmel 2019-08-11 1131 */
44075f56379388 Ido Schimmel 2019-08-11 1132 skb = reset_per_cpu_data(data);
44075f56379388 Ido Schimmel 2019-08-11 1133 consume_skb(skb);
70c69274f354ec Ido Schimmel 2019-08-11 1134 }
70c69274f354ec Ido Schimmel 2019-08-11 1135
28315f7999870b Ido Schimmel 2019-08-11 @1136 rc = register_trace_kfree_skb(ops->kfree_skb_probe, NULL);
7c747838a55818 Ido Schimmel 2019-08-11 1137 if (rc) {
7c747838a55818 Ido Schimmel 2019-08-11 1138 NL_SET_ERR_MSG_MOD(extack, "Failed to connect probe to kfree_skb() tracepoint");
7c747838a55818 Ido Schimmel 2019-08-11 1139 goto err_module_put;
7c747838a55818 Ido Schimmel 2019-08-11 1140 }
cad456d5abbb63 Neil Horman 2012-05-17 1141
28315f7999870b Ido Schimmel 2019-08-11 1142 rc = register_trace_napi_poll(ops->napi_poll_probe, NULL);
7c747838a55818 Ido Schimmel 2019-08-11 1143 if (rc) {
7c747838a55818 Ido Schimmel 2019-08-11 1144 NL_SET_ERR_MSG_MOD(extack, "Failed to connect probe to napi_poll() tracepoint");
7c747838a55818 Ido Schimmel 2019-08-11 1145 goto err_unregister_trace;
7c747838a55818 Ido Schimmel 2019-08-11 1146 }
7c747838a55818 Ido Schimmel 2019-08-11 1147
7c747838a55818 Ido Schimmel 2019-08-11 1148 return 0;
7c747838a55818 Ido Schimmel 2019-08-11 1149
7c747838a55818 Ido Schimmel 2019-08-11 1150 err_unregister_trace:
28315f7999870b Ido Schimmel 2019-08-11 1151 unregister_trace_kfree_skb(ops->kfree_skb_probe, NULL);
7c747838a55818 Ido Schimmel 2019-08-11 1152 err_module_put:
9398e9c0b1d44e Ido Schimmel 2021-03-10 1153 for_each_possible_cpu(cpu) {
9398e9c0b1d44e Ido Schimmel 2021-03-10 1154 struct per_cpu_dm_data *data = &per_cpu(dm_cpu_data, cpu);
9398e9c0b1d44e Ido Schimmel 2021-03-10 1155 struct sk_buff *skb;
9398e9c0b1d44e Ido Schimmel 2021-03-10 1156
9398e9c0b1d44e Ido Schimmel 2021-03-10 1157 del_timer_sync(&data->send_timer);
9398e9c0b1d44e Ido Schimmel 2021-03-10 1158 cancel_work_sync(&data->dm_alert_work);
9398e9c0b1d44e Ido Schimmel 2021-03-10 1159 while ((skb = __skb_dequeue(&data->drop_queue)))
9398e9c0b1d44e Ido Schimmel 2021-03-10 1160 consume_skb(skb);
9398e9c0b1d44e Ido Schimmel 2021-03-10 1161 }
7c747838a55818 Ido Schimmel 2019-08-11 1162 module_put(THIS_MODULE);
7c747838a55818 Ido Schimmel 2019-08-11 1163 return rc;
7c747838a55818 Ido Schimmel 2019-08-11 1164 }
7c747838a55818 Ido Schimmel 2019-08-11 1165
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-02-04 1:31 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 15:37 [PATCH RFC 0/4] net: skb: to use (function, line) pair as reason for kfree_skb_reason() Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 1/4] net: skb: use line number to trace dropped skb Dongli Zhang
2022-02-03 15:48 ` David Ahern
2022-02-03 17:13 ` Dongli Zhang
2022-02-03 15:59 ` Eric Dumazet
2022-02-03 17:14 ` Dongli Zhang
2022-02-04 1:29 ` kernel test robot
2022-02-04 1:30 ` kernel test robot
2022-02-03 15:37 ` [PATCH RFC 2/4] net: skb: add function name as part of reason Dongli Zhang
2022-02-04 1:31 ` kernel test robot
2022-02-04 1:31 ` kernel test robot
2022-02-03 15:37 ` [PATCH RFC 3/4] net: tun: track dropped skb via kfree_skb_reason() Dongli Zhang
2022-02-03 15:37 ` [PATCH RFC 4/4] net: tap: " Dongli Zhang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.