ath10k: Add wrapper function to ath10k debug
PATCH v2 1/1 ath10k: Add wrapper function to ath10k debug
ath10k_dbg() is called in ath10k_process_rx() with huge set of arguments which is causing CPU overhead even when debug_mask is not set. Good improvement was observed in the receive side performance when call to ath10k_dbg() is avoided in the RX path.
Since currently all debug messages are sent via tracing infrastructure, we cannot entirely avoid calling ath10k_dbg. Therefore, call to ath10k_dbg() is made conditional based on tracing config in the driver.
Trasmit performance remains unchanged with this patch; below are some experimental results with this patch and tracing disabled.
mesh mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usage
TCP 840Mbps 76.53% 960Mbps 78.14% UDP 1030Mbps 74.58% 1132Mbps 74.31%
Infra mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usage
TCP Rx 1241Mbps 80.89% 1270Mbps 73.50% UDP Rx 1433Mbps 81.77% 1472Mbps 72.80%
Tested platform : IPQ8064
hardware used : QCA9984
firmware ver : ver 10.4-3.5.3-00057
---
v2:
* changed trace enabled check from IS_ENABLED(CONFIG_ATH10K_TRACING)
* to trace_ath10k_log_dbg_enabled().
drivers/net/wireless/ath/ath10k/core.c | 2 ++ drivers/net/wireless/ath/ath10k/debug.c | 8 ++++---- drivers/net/wireless/ath/ath10k/debug.h | 22 ++++++++++++++++------ drivers/net/wireless/ath/ath10k/trace.c | 1 + drivers/net/wireless/ath/ath10k/trace.h | 6 +++++- 5 files changed, 28 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +2 -0
@@ -26,6 +26,8 @@#include "coredump.h" unsigned int ath10k_debug_mask; +EXPORT_SYMBOL (ath10k_debug_mask); +static unsigned int ath10k_cryptmode_param;static bool uart_print;static bool skip_otp;
drivers/net/wireless/ath/ath10k/debug.c +4 -4
@@ -2620,8 +2620,8 @@ void ath10k_debug_unregister(struct ath10k *ar)#endif /* CONFIG_ATH10K_DEBUGFS */ #ifdef CONFIG_ATH10K_DEBUG -void ath10k_dbg (struct ath10k *ar,enum ath10k_debug_mask mask, -const char *fmt, ...) +void __ath10k_dbg (struct ath10k *ar,enum ath10k_debug_mask mask, +const char *fmt, ...) {struct va_format vaf;va_list args;
@@ -2638,7 +2638,7 @@ void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,va_end (args); } -EXPORT_SYMBOL (ath10k_dbg); +EXPORT_SYMBOL (__ath10k_dbg); void ath10k_dbg_dump(struct ath10k *ar, enum ath10k_debug_mask mask,
@@ -2651,7 +2651,7 @@ void ath10k_dbg_dump(struct ath10k *ar,if (ath10k_debug_mask & mask) {if (msg) -ath10k_dbg (ar, mask,"%s\n" , msg); +__ath10k_dbg (ar, mask,"%s\n" , msg);for (ptr = buf; (ptr - buf) < len; ptr +=16 ) { linebuflen =0 ;
drivers/net/wireless/ath/ath10k/debug.h +16 -6
@@ -240,18 +240,18 @@ void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k *ar,#endif /* CONFIG_MAC80211_DEBUGFS */ #ifdef CONFIG_ATH10K_DEBUG -__printf(3, 4) void ath10k_dbg(struct ath10k *ar, -enum ath10k_debug_mask mask, -const char *fmt, ...); +__printf(3, 4) void __ath10k_dbg(struct ath10k *ar, +enum ath10k_debug_mask mask, +const char *fmt, ...);void ath10k_dbg_dump (struct ath10k *ar,enum ath10k_debug_mask mask,const char *msg,const char *prefix,const void *buf,size_t len);#else /* CONFIG_ATH10K_DEBUG */ -static inline int ath10k_dbg (struct ath10k *ar, -enum ath10k_debug_mask dbg_mask, -const char *fmt, ...) +static inline int __ath10k_dbg (struct ath10k *ar, +enum ath10k_debug_mask dbg_mask, +const char *fmt, ...) {return 0 ; }
@@ -263,4 +263,14 @@ static inline void ath10k_dbg_dump(struct ath10k *ar, { }#endif /* CONFIG_ATH10K_DEBUG */ + +/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing +* disabled. +*/ +#define ath10k_dbg (ar, dbg_mask, fmt, ...) \ +do { \ + if ((ath10k_debug_mask & dbg_mask) || \ + trace_ath10k_log_dbg_enabled()) \ + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ +} while (0)#endif /* _DEBUG_H_ */
drivers/net/wireless/ath/ath10k/trace.c +1 -0
@@ -7,3 +7,4 @@#define CREATE_TRACE_POINTS #include "trace.h" +EXPORT_SYMBOL (__tracepoint_ath10k_log_dbg);
drivers/net/wireless/ath/ath10k/trace.h +5 -1
@@ -29,7 +29,11 @@ static inline u32 ath10k_frm_hdr_len(const void *buf, size_t len)#if !defined(CONFIG_ATH10K_TRACING )#undef TRACE_EVENT#define TRACE_EVENT (name, proto, ...) \ -static inline void trace_ ## name(proto) {} +static inline void trace_ ## name(proto) {} \ +static inline bool trace_##name##_enabled(void) \ +{ \ + return false; \ +}#undef DECLARE_EVENT_CLASS#define DECLARE_EVENT_CLASS (...)#undef DEFINE_EVENT
Signature · 7 lines
2.7.4 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 64 lines · Venkateswara Naralasetty
ath10k_dbg()is called inath10k_process_rx()with huge set of arguments which is causing CPU overhead even whendebug_maskis not set. Good improvement was observed in the receive side performance when call toath10k_dbg()is avoided in the RX path.Since currently all debug messages are sent via tracing infrastructure, we cannot entirely avoid calling
ath10k_dbg. Therefore, call toath10k_dbg()is made conditional based on tracing config in the driver.Trasmit performance remains unchanged with this patch; below are some experimental results with this patch and tracing disabled.
mesh mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usageTCP 840Mbps 76.53% 960Mbps 78.14% UDP 1030Mbps 74.58% 1132Mbps 74.31%Infra mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usageTCP Rx 1241Mbps 80.89% 1270Mbps 73.50% UDP Rx 1433Mbps 81.77% 1472Mbps 72.80%Tested platform : IPQ8064
hardware used : QCA9984
firmware ver : ver 10.4-3.5.3-00057Signed-off-by Kan Yan <[email protected]>Signed-off-by Venkateswara Naralasetty <[email protected]>---
v2:
* changed trace enabled check fromIS_ENABLED(CONFIG_ATH10K_TRACING)
* totrace_ath10k_log_dbg_enabled().drivers/net/wireless/ath/ath10k/core.c | 2 ++ drivers/net/wireless/ath/ath10k/debug.c | 8 ++++---- drivers/net/wireless/ath/ath10k/debug.h | 22 ++++++++++++++++------ drivers/net/wireless/ath/ath10k/trace.c | 1 + drivers/net/wireless/ath/ath10k/trace.h | 6 +++++- 5 files changed, 28 insertions(+), 11 deletions(-)drivers/net/wireless/ath/ath10k/core.c +2
-0@@ -26,6 +26,8 @@#include "coredump.h" unsigned int ath10k_debug_mask; +EXPORT_SYMBOL (ath10k_debug_mask); +static unsigned int ath10k_cryptmode_param;static bool uart_print;static bool skip_otp;drivers/net/wireless/ath/ath10k/debug.c +0
-0
drivers/net/wireless/ath/ath10k/debug.c void ath10k_debug_unregister(struct ath10k *ar) · line 2627
Quoted 10 lines
drivers/net/wireless/ath/ath10k/debug.c +2
-2@@ -2620,8 +2620,8 @@ void ath10k_debug_unregister(struct ath10k *ar)#endif /* CONFIG_ATH10K_DEBUGFS */ #ifdef CONFIG_ATH10K_DEBUG -void ath10k_dbg (struct ath10k *ar,enum ath10k_debug_mask mask, -const char *fmt, ...) +void __ath10k_dbg (struct ath10k *ar,enum ath10k_debug_mask mask, +const char *fmt, ...) {struct va_format vaf;va_list args;
Do you still need the check later in this method:
if (ath10k_debug_mask & mask)
since you already checked in the ath10k_dbg() macro?
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 94 lines
-----Original Message-----
From: ath10k <[email protected]> On Behalf Of Ben Greear
Sent: Friday, April 26, 2019 6:52 PM
To: Venkateswara Naralasetty <[email protected]>; [email protected]
Cc: Kan Yan <[email protected]>; [email protected]
Subject: [EXT] Re: [PATCHv2] ath10k: Add wrapper function to ath10k debugQuoted 2 lines · Venkateswara Naralasetty
ath10k_dbg()is called inath10k_process_rx()with huge set of arguments which is causing CPU overhead even whendebug_maskis notset.
Quoted 31 lines
Good improvement was observed in the receive side performance when call to
ath10k_dbg()is avoided in the RX path.Since currently all debug messages are sent via tracing infrastructure, we cannot entirely avoid calling
ath10k_dbg. Therefore, call toath10k_dbg()is made conditional based on tracing config in the driver.Trasmit performance remains unchanged with this patch; below are some experimental results with this patch and tracing disabled.
mesh mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usageTCP 840Mbps 76.53% 960Mbps 78.14% UDP 1030Mbps 74.58% 1132Mbps 74.31%Infra mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usageTCP Rx 1241Mbps 80.89% 1270Mbps 73.50% UDP Rx 1433Mbps 81.77% 1472Mbps 72.80%Tested platform : IPQ8064
hardware used : QCA9984
firmware ver : ver 10.4-3.5.3-00057Quoted 5 lines
Signed-off-by Kan Yan <[email protected]>Signed-off-by Venkateswara Naralasetty <[email protected]>---
v2:
* changed trace enabled check from
IS_ENABLED(CONFIG_ATH10K_TRACING)Quoted 29 lines
* to
trace_ath10k_log_dbg_enabled().drivers/net/wireless/ath/ath10k/core.c | 2 ++ drivers/net/wireless/ath/ath10k/debug.c | 8 ++++---- drivers/net/wireless/ath/ath10k/debug.h | 22 ++++++++++++++++------ drivers/net/wireless/ath/ath10k/trace.c | 1 + drivers/net/wireless/ath/ath10k/trace.h | 6 +++++- 5 files changed, 28 insertions(+), 11 deletions(-)drivers/net/wireless/ath/ath10k/core.c +2
-0@@ -26,6 +26,8 @@#include "coredump.h" unsigned int ath10k_debug_mask; +EXPORT_SYMBOL (ath10k_debug_mask); +static unsigned int ath10k_cryptmode_param;static bool uart_print;static bool skip_otp;drivers/net/wireless/ath/ath10k/debug.c +0
-0drivers/net/wireless/ath/ath10k/debug.c void ath10k_debug_unregister(struct ath10k *ar) · line 2627
Quoted 10 lines
drivers/net/wireless/ath/ath10k/debug.c +2
-2@@ -2620,8 +2620,8 @@ void ath10k_debug_unregister(struct ath10k *ar)#endif /* CONFIG_ATH10K_DEBUGFS */ #ifdef CONFIG_ATH10K_DEBUG -void ath10k_dbg (struct ath10k *ar,enum ath10k_debug_mask mask, -const char *fmt, ...) +void __ath10k_dbg (struct ath10k *ar,enum ath10k_debug_mask mask, +const char *fmt, ...) {struct va_format vaf;va_list args;Do you still need the check later in this method:
Quoted 3 lines
if (
ath10k_debug_mask& mask)since you already checked in the
ath10k_dbg()macro?
Yes, we need this check.
Otherwise all debug messages will be printed even without any debug mask set in case of tracing enabled.
Quoted 10 lines
Thanks,
Ben--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com
Quoted 4 lines
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 11 lines · Venkateswara Naralasetty
Quoted 11 lines
drivers/net/wireless/ath/ath10k/debug.c void ath10k_debug_unregister(struct ath10k *ar) · line 2627
Quoted 8 lines
#ifdef CONFIG_ATH10K_DEBUGdrivers/net/wireless/ath/ath10k/debug.c +2
-2-void ath10k_dbg (struct ath10k *ar,enum ath10k_debug_mask mask, -const char *fmt, ...) +void __ath10k_dbg (struct ath10k *ar,enum ath10k_debug_mask mask, +const char *fmt, ...) {struct va_format vaf;va_list args;Do you still need the check later in this method:
Quoted 5 lines
Quoted 3 lines
if (
ath10k_debug_mask& mask)since you already checked in the
ath10k_dbg()macro?Yes, we need this check.
Otherwise all debug messages will be printed even without any debug mask set in case of tracing enabled.
Ahh, I see.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 5 lines · Venkateswara Naralasetty
ath10k_dbg()is called inath10k_process_rx()with huge set of arguments which is causing CPU overhead even whendebug_maskis not set. Good improvement was observed in the receive side performance when call toath10k_dbg()is avoided in the RX path.
[...]
drivers/net/wireless/ath/ath10k/debug.h static inline void ath10k_dbg_dump(struct ath10k *ar, · line 275
Quoted 9 lines
drivers/net/wireless/ath/ath10k/debug.h +9
-0+/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing +* disabled. +*/ +#define ath10k_dbg (ar, dbg_mask, fmt, ...) \ +do { \ + if ((ath10k_debug_mask & dbg_mask) || \ + trace_ath10k_log_dbg_enabled()) \ + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ +} while (0)
Did you consider using jump labels (see include/linux/jump_label.h)? It's what tracing uses under the hood. I wonder if you could squeeze out a bit more performance with that? I guess you'd need to add struct static_key ath10k_dbg_mask_keys[ATH10K_DBG_MAX] and re-do ath10k_debug_mask enum a bit.
Michal
Quoted 9 lines · Michał Kazior
Quoted 5 lines · Venkateswara Naralasetty
ath10k_dbg()is called inath10k_process_rx()with huge set of arguments which is causing CPU overhead even whendebug_maskis not set. Good improvement was observed in the receive side performance when call toath10k_dbg()is avoided in the RX path.[...]
Quoted 15 lines
drivers/net/wireless/ath/ath10k/debug.h static inline void ath10k_dbg_dump(struct ath10k *ar, · line 275
Quoted 9 lines
drivers/net/wireless/ath/ath10k/debug.h +9
-0+/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing +* disabled. +*/ +#define ath10k_dbg (ar, dbg_mask, fmt, ...) \ +do { \ + if ((ath10k_debug_mask & dbg_mask) || \ + trace_ath10k_log_dbg_enabled()) \ + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ +} while (0)Did you consider using jump labels (see
include/linux/jump_label.h)? It's what tracing uses under the hood. I wonder if you could squeeze out a bit more performance with that? I guess you'd need to addstruct static_key ath10k_dbg_mask_keys[ATH10K_DBG_MAX]and re-doath10k_debug_maskenum a bit.
Maybe first test with debugging just compiled out to see if there is still any significant overhead with this new patch applied?
Thanks,
Ben
Signature · 8 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 39 lines
-----Original Message-----
From: ath10k <[email protected]> On Behalf Of Ben Greear
Sent: Friday, April 26, 2019 7:27 PM
To: Michał Kazior <[email protected]>; Venkateswara Naralasetty <[email protected]>
Cc: Kan Yan <[email protected]>; linux-wireless <linux- [email protected]>; [email protected]
Subject: [EXT] Re: [PATCHv2] ath10k: Add wrapper function to ath10k debugQuoted 5 lines · Michał Kazior
Quoted 3 lines · Venkateswara Naralasetty
ath10k_dbg()is called inath10k_process_rx()with huge set of arguments which is causing CPU overhead even whendebug_maskis notset.
Quoted 4 lines
Quoted 2 lines
Good improvement was observed in the receive side performance when call to
ath10k_dbg()is avoided in the RX path.[...]
Quoted 15 lines
drivers/net/wireless/ath/ath10k/debug.h static inline void ath10k_dbg_dump(struct ath10k *ar,
Quoted 9 lines
drivers/net/wireless/ath/ath10k/debug.h +9
-0+/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing +* disabled. +*/ +#define ath10k_dbg (ar, dbg_mask, fmt, ...) \ +do { \ + if ((ath10k_debug_mask & dbg_mask) || \ + trace_ath10k_log_dbg_enabled()) \ + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ } +while (0 )Did you consider using jump labels (see
include/linux/jump_label.h)? It's what tracing uses under the hood. I wonder if you could squeeze out a bit more performance with that? I guess you'd need to addstruct static_key ath10k_dbg_mask_keys[ATH10K_DBG_MAX]and re-doath10k_debug_maskenum a bit.
Quoted 2 lines
Maybe first test with debugging just compiled out to see if there is still any significant overhead with this new patch applied?
Since this macro ath10k_dbg defined outside of CONFIG_ATH10K_DEBUG will it make any difference even if debugging compiled out?
Thanks,
Venkatesh.
Quoted 13 lines
Thanks,
Ben--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 21 lines
-----Original Message-----
From: ath10k <[email protected]> On Behalf Of Michal Kazior
Sent: Friday, April 26, 2019 7:15 PM
To: Venkateswara Naralasetty <[email protected]>
Cc: Kan Yan <[email protected]>; linux-wireless <linux- [email protected]>; [email protected]
Subject: [EXT] Re: [PATCHv2] ath10k: Add wrapper function to ath10k debugQuoted 3 lines · Venkateswara Naralasetty
ath10k_dbg()is called inath10k_process_rx()with huge set of arguments which is causing CPU overhead even whendebug_maskis notset.
Quoted 2 lines
Good improvement was observed in the receive side performance when call to
ath10k_dbg()is avoided in the RX path.[...]
Quoted 16 lines
drivers/net/wireless/ath/ath10k/debug.h static inline void ath10k_dbg_dump(struct ath10k *ar,
Quoted 9 lines
drivers/net/wireless/ath/ath10k/debug.h +9
-0+/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing +* disabled. +*/ +#define ath10k_dbg (ar, dbg_mask, fmt, ...) \ +do { \ + if ((ath10k_debug_mask & dbg_mask) || \ + trace_ath10k_log_dbg_enabled()) \ + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ } +while (0 )Did you consider using jump labels (see
include/linux/jump_label.h)? It's what tracing uses under the hood. I wonder if you could squeeze out a bit more performance with that? I guess you'd need to addstruct static_key ath10k_dbg_mask_keys[ATH10K_DBG_MAX]and re-doath10k_debug_maskenum a bit.
I could not observe any significant Throughput/CPU improvement after using jump labels. For now shall we go with my patch?
Thanks,
Venkatesh.
Quoted 7 lines
Michal
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 28 lines · Venkateswara Naralasetty
ath10k_dbg()is called inath10k_process_rx()with huge set of arguments which is causing CPU overhead even whendebug_maskis not set. Good improvement was observed in the receive side performance when call toath10k_dbg()is avoided in the RX path.Since currently all debug messages are sent via tracing infrastructure, we cannot entirely avoid calling
ath10k_dbg. Therefore, call toath10k_dbg()is made conditional based on tracing config in the driver.Trasmit performance remains unchanged with this patch; below are some experimental results with this patch and tracing disabled.
mesh mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usageTCP 840Mbps 76.53% 960Mbps 78.14% UDP 1030Mbps 74.58% 1132Mbps 74.31%Infra mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usageTCP Rx 1241Mbps 80.89% 1270Mbps 73.50% UDP Rx 1433Mbps 81.77% 1472Mbps 72.80%
Quoted 7 lines
Tested platform : IPQ8064
hardware used : QCA9984
firmware ver : ver 10.4-3.5.3-00057Signed-off-by Kan Yan <[email protected]>Signed-off-by Venkateswara Naralasetty <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
9d740d6380e5 ath10k: Add wrapper function to ath10k debug
Signature · 9 lines
https://patchwork.kernel.org/patch/10919117/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 28 lines · Venkateswara Naralasetty
ath10k_dbg()is called inath10k_process_rx()with huge set of arguments which is causing CPU overhead even whendebug_maskis not set. Good improvement was observed in the receive side performance when call toath10k_dbg()is avoided in the RX path.Since currently all debug messages are sent via tracing infrastructure, we cannot entirely avoid calling
ath10k_dbg. Therefore, call toath10k_dbg()is made conditional based on tracing config in the driver.Trasmit performance remains unchanged with this patch; below are some experimental results with this patch and tracing disabled.
mesh mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usageTCP 840Mbps 76.53% 960Mbps 78.14% UDP 1030Mbps 74.58% 1132Mbps 74.31%Infra mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usageTCP Rx 1241Mbps 80.89% 1270Mbps 73.50% UDP Rx 1433Mbps 81.77% 1472Mbps 72.80%
Quoted 7 lines
Tested platform : IPQ8064
hardware used : QCA9984
firmware ver : ver 10.4-3.5.3-00057Signed-off-by Kan Yan <[email protected]>Signed-off-by Venkateswara Naralasetty <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
9d740d6380e5 ath10k: Add wrapper function to ath10k debug
Signature · 3 lines
https://patchwork.kernel.org/patch/10919117/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches