ath10k: Add history for tracking certain events
PATCH 1/1 ath10k: Add history for tracking certain events
For debugging many issues, a history of the below mentioned events can help get an idea of what exactly was going on just before any issue occurred in the system. These event history will be collected only when the host driver is run in debug mode (i.e. with the config ATH10K_DEBUG enabled).
Add history for tracking the below events
- register read
- register write
- IRQ trigger
- IRQ Enable
- IRQ Disable
- NAPI poll
- CE service
- WMI cmd
- WMI event
- WMI tx completion
This will help in debugging any crash or any improper behaviour.
Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/ce.c | 2 + drivers/net/wireless/ath/ath10k/core.h | 77 +++++++++++++++++ drivers/net/wireless/ath/ath10k/debug.c | 134 ++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/debug.h | 74 +++++++++++++++++ drivers/net/wireless/ath/ath10k/snoc.c | 17 ++++ drivers/net/wireless/ath/ath10k/wmi-tlv.c | 1 + drivers/net/wireless/ath/ath10k/wmi.c | 10 +++ 7 files changed, 315 insertions(+)
drivers/net/wireless/ath/ath10k/ce.c +2 -0
@@ -509,6 +509,7 @@ u32 ath10k_ce_gen_interrupt_summary(struct ath10k *ar) } } +ath10k_record_ce_event (ar,ATH10K_IRQ_SUMMARY , irq_summary);return irq_summary; }EXPORT_SYMBOL (ath10k_ce_gen_interrupt_summary);
@@ -1331,6 +1332,7 @@ void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id)struct ath10k_hw_ce_host_wm_regs *wm_regs = ar->hw_ce_regs->wm_regs;u32 ctrl_addr = ce_state->ctrl_addr; +ath10k_record_ce_event (ar,ATH10K_CE_SERVICE , ce_id);/* * Clear before handling *
drivers/net/wireless/ath/ath10k/core.h +77 -0
89 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/debug.c +134 -0
138 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/debug.h +74 -0
86 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/snoc.c +17 -0
@@ -474,6 +474,7 @@ static void ath10k_snoc_write32(struct ath10k *ar, u32 offset, u32 value) {struct ath10k_snoc *ar_snoc =ath10k_snoc_priv (ar); +ath10k_record_reg_access (ar, offset, value, true);iowrite32 (value, ar_snoc->mem + offset); }
@@ -482,7 +483,9 @@ static u32 ath10k_snoc_read32(struct ath10k *ar, u32 offset)struct ath10k_snoc *ar_snoc =ath10k_snoc_priv (ar);u32 val; +ath10k_record_reg_access (ar, offset,0 , false); val =ioread32 (ar_snoc->mem + offset); +ath10k_record_reg_access (ar, offset, val, false);return val; }
@@ -828,11 +831,13 @@ static void ath10k_snoc_hif_get_default_pipe(struct ath10k *ar,static inline void ath10k_snoc_irq_disable (struct ath10k *ar) {ath10k_ce_disable_interrupts (ar); +ath10k_record_ce_event (ar,ATH10K_IRQ_DISABLE ,0 ); }static inline void ath10k_snoc_irq_enable (struct ath10k *ar) {ath10k_ce_enable_interrupts (ar); +ath10k_record_ce_event (ar,ATH10K_IRQ_ENABLE ,0 ); }static void ath10k_snoc_rx_pipe_cleanup (struct ath10k_snoc_pipe *snoc_pipe)
@@ -1154,7 +1159,9 @@ static irqreturn_t ath10k_snoc_per_engine_handler(int irq, void *arg)struct ath10k_snoc *ar_snoc =ath10k_snoc_priv (ar);int ce_id =ath10k_snoc_get_ce_id_from_irq (ar, irq); +ath10k_record_ce_event (ar,ATH10K_IRQ_ENTRY , ce_id);if (ce_id <0 || ce_id >=ARRAY_SIZE (ar_snoc->pipe_info)) { +ath10k_record_ce_event (ar,ATH10K_IRQ_EXIT , ce_id);ath10k_warn (ar,"unexpected/invalid irq %d ce_id %d\n" , irq, ce_id);return IRQ_HANDLED ;
@@ -1163,6 +1170,7 @@ static irqreturn_t ath10k_snoc_per_engine_handler(int irq, void *arg)ath10k_snoc_irq_disable (ar);napi_schedule (&ar->napi); +ath10k_record_ce_event (ar,ATH10K_IRQ_EXIT , ce_id);return IRQ_HANDLED ; }
@@ -1171,6 +1179,7 @@ static int ath10k_snoc_napi_poll(struct napi_struct *ctx, int budget) struct ath10k *ar = container_of(ctx, struct ath10k, napi);int done =0 ; +ath10k_record_ce_event (ar,ATH10K_NAPI_POLL ,0 );if (test_bit (ATH10K_FLAG_CRASH_FLUSH , &ar->dev_flags)) {napi_complete (ctx);return done;
@@ -1182,6 +1191,9 @@ static int ath10k_snoc_napi_poll(struct napi_struct *ctx, int budget)if (done < budget) {napi_complete (ctx);ath10k_snoc_irq_enable (ar); +ath10k_record_ce_event (ar,ATH10K_NAPI_COMPLETE ,0 ); + }else { +ath10k_record_ce_event (ar,ATH10K_NAPI_RESCHED ,0 ); }return done;
@@ -1655,6 +1667,11 @@ static int ath10k_snoc_probe(struct platform_device *pdev) ar->ce_priv = &ar_snoc->ce; msa_size = drv_data->msa_size; +ath10k_core_reg_access_history_init (ar,ATH10K_REG_ACCESS_HISTORY_MAX ); +ath10k_core_wmi_event_history_init (ar,ATH10K_WMI_EVENT_HISTORY_MAX ); +ath10k_core_wmi_cmd_history_init (ar,ATH10K_WMI_CMD_HISTORY_MAX ); +ath10k_core_ce_event_history_init (ar,ATH10K_CE_EVENT_HISTORY_MAX ); +ath10k_snoc_quirks_init (ar); ret =ath10k_snoc_resource_init (ar);
drivers/net/wireless/ath/ath10k/wmi-tlv.c +1 -0
@@ -627,6 +627,7 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)if (skb_pull (skb,sizeof (struct wmi_cmd_hdr )) ==NULL ) goto out; +ath10k_record_wmi_event (ar,ATH10K_WMI_EVENT , id, skb->data);trace_ath10k_wmi_event (ar, id, skb->data, skb->len); consumed =ath10k_tm_event_wmi (ar, id, skb);
drivers/net/wireless/ath/ath10k/wmi.c +10 -0
@@ -1802,6 +1802,15 @@ struct sk_buff *ath10k_wmi_alloc_skb(struct ath10k *ar, u32 len)static void ath10k_wmi_htc_tx_complete (struct ath10k *ar,struct sk_buff *skb) { +struct wmi_cmd_hdr *cmd_hdr; +enum wmi_tlv_event_id id; + + cmd_hdr = (struct wmi_cmd_hdr *)skb->data; + id =MS (__le32_to_cpu (cmd_hdr->cmd_id),WMI_CMD_HDR_CMD_ID ); + +ath10k_record_wmi_event (ar,ATH10K_WMI_TX_COMPL , id, + skb->data +sizeof (struct wmi_cmd_hdr )); +dev_kfree_skb (skb); }
@@ -1912,6 +1921,7 @@ int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id)might_sleep (); +ath10k_record_wmi_event (ar,ATH10K_WMI_CMD , cmd_id, skb->data);if (cmd_id ==WMI_CMD_UNSUPPORTED ) {ath10k_warn (ar,"wmi command %d is not supported by firmware\n" , cmd_id);
Signature · 7 lines
2.7.4 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 7 lines · Rakesh Pillai
For debugging many issues, a history of the below mentioned events can help get an idea of what exactly was going on just before any issue occurred in the system. These event history will be collected only when the host driver is run in debug mode (i.e. with the config
ATH10K_DEBUGenabled).
This should be disabled by default unless user specifically pokes some debugfs value to turn it on so that it does not impact performance.
Thanks,
Ben
Quoted 15 lines
Add history for tracking the below events
- register read
- register write
- IRQ trigger
- IRQ Enable
- IRQ Disable
- NAPI poll
- CE service
- WMI cmd
- WMI event
- WMI tx completionThis will help in debugging any crash or any improper behaviour.
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 20 lines
-----Original Message-----
From: Ben Greear <[email protected]>
Sent: Saturday, June 27, 2020 8:58 PM
To: Rakesh Pillai <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] ath10k: Add history for tracking certain eventsQuoted 7 lines · Rakesh Pillai
For debugging many issues, a history of the below mentioned events can help get an idea of what exactly was going on just before any issue occurred in the system. These event history will be collected only when the host driver is run in debug mode (i.e. with the config
ATH10K_DEBUGenabled).
Quoted 3 lines
This should be disabled by default unless user specifically pokes some debugfs
value to turn it on so that it does not impact performance.
Hi Ben,
This history is enabled only if the user compiles the kernel with ATH10K_DEBUG.
Making it runtime, adds a lot of "if" conditions for this history record. Do you suggest to add support to enable/disable it runtime even in ATH10K_DEBUG ?
Quoted 17 lines
Thanks,
BenQuoted 13 lines
Add history for tracking the below events
- register read
- register write
- IRQ trigger
- IRQ Enable
- IRQ Disable
- NAPI poll
- CE service
- WMI cmd
- WMI event
- WMI tx completion
Quoted 7 lines
Quoted 2 lines
This will help in debugging any crash or any improper behaviour.
--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 24 lines · Rakesh Pillai
Quoted 20 lines
-----Original Message-----
From: Ben Greear <[email protected]>
Sent: Saturday, June 27, 2020 8:58 PM
To: Rakesh Pillai <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] ath10k: Add history for tracking certain eventsQuoted 7 lines · Rakesh Pillai
For debugging many issues, a history of the below mentioned events can help get an idea of what exactly was going on just before any issue occurred in the system. These event history will be collected only when the host driver is run in debug mode (i.e. with the config
ATH10K_DEBUGenabled).Quoted 3 lines
This should be disabled by default unless user specifically pokes some debugfs
value to turn it on so that it does not impact performance.
Quoted 6 lines
Hi Ben,
This history is enabled only if the user compiles the kernel withATH10K_DEBUG.
Making it runtime, adds a lot of "if" conditions for this history record. Do you suggest to add support to enable/disable it runtime even inATH10K_DEBUG?
Yes, because you are adding lots of locks/unlocks. That is way more expensive than an if statement. You can add an 'unlikely' to the if check as well, so compiler will optimize for this feature not being enabled.
Thanks,
Ben
Quoted 26 lines
Quoted 25 lines
Thanks,
BenQuoted 13 lines
Add history for tracking the below events
- register read
- register write
- IRQ trigger
- IRQ Enable
- IRQ Disable
- NAPI poll
- CE service
- WMI cmd
- WMI event
- WMI tx completionQuoted 2 lines
This will help in debugging any crash or any improper behaviour.
--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 11 lines
-----Original Message-----
From: Ben Greear <[email protected]>
Sent: Sunday, June 28, 2020 10:56 PM
To: Rakesh Pillai <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] ath10k: Add history for tracking certain events
Quoted 29 lines
Quoted 28 lines · Rakesh Pillai
Quoted 20 lines
-----Original Message-----
From: Ben Greear <[email protected]>
Sent: Saturday, June 27, 2020 8:58 PM
To: Rakesh Pillai <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] ath10k: Add history for tracking certain eventsQuoted 7 lines · Rakesh Pillai
For debugging many issues, a history of the below mentioned events can help get an idea of what exactly was going on just before any issue occurred in the system. These event history will be collected only when the host driver is run in debug mode (i.e. with the config
ATH10K_DEBUGenabled).Quoted 3 lines
This should be disabled by default unless user specifically pokes some debugfs
value to turn it on so that it does not impact performance.Hi Ben,
This history is enabled only if the user compiles the kernel withATH10K_DEBUG.
Making it runtime, adds a lot of "if" conditions for this history
record.
Quoted 6 lines
Quoted 2 lines
Do you suggest to add support to enable/disable it runtime even in
ATH10K_DEBUG?Yes, because you are adding lots of locks/unlocks. That is way more expensive
than an if statement. You can add an 'unlikely' to the if check as well,
so
Quoted 1 line
compiler will optimize for this feature not being enabled.
Hi Ben,
I missed this mail somehow.
Yes sure, I will make the necessary changes and upload a new patchset.
Thanks,
Rakesh Pillai.
Quoted 26 lines
Thanks,
BenQuoted 22 lines
Quoted 22 lines
Thanks,
BenQuoted 15 lines
Add history for tracking the below events
- register read
- register write
- IRQ trigger
- IRQ Enable
- IRQ Disable
- NAPI poll
- CE service
- WMI cmd
- WMI event
- WMI tx completionThis will help in debugging any crash or any improper behaviour.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k