ath11k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath11k: dp_rx: fix monitor status dma unmap direction
@ 2020-11-23 18:27 Kalle Valo
  2020-12-02 18:34 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Kalle Valo @ 2020-11-23 18:27 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless

After enabling CONFIG_DMA_API_DEBUG there was a warning about using
dma_unmap_single() in wrong direction from ath11k_dp_rx_process_mon_status().

[  140.279477] ------------[ cut here ]------------
[  140.279908] DMA-API: ath11k_pci 0000:06:00.0: device driver syncs DMA memory with different direction [device address=0x00000000fac08a40] [size=2176 bytes] [mapped with DMA_FROM_DEVICE] [s
[  140.279925] WARNING: CPU: 7 PID: 97 at kernel/dma/debug.c:1120 check_sync+0x494/0x730
[  140.279939] Modules linked in: ath11k_pci ath11k mac80211 libarc4 cfg80211 qmi_helpers qrtr_mhi mhi qrtr ns nvme nvme_core
[  140.279958] CPU: 7 PID: 97 Comm: kworker/u16:1 Not tainted 5.10.0-rc4+ #262
[  140.279968] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0049.2018.0801.1601 08/01/2018
[  140.279995] Workqueue: phy0 ieee80211_scan_work [mac80211]
[  140.280009] RIP: 0010:check_sync+0x494/0x730
[  140.280022] Code: 8b 4c 24 10 4c 8b 44 24 18 4c 8b 54 24 20 48 89 c6 4c 89 54 24 10 4c 89 f9 4c 89 ea 48 c7 c7 40 b9 74 9c 41 56 e8 2f a0 ab 00 <0f> 0b 48 89 ef e8 e5 17 ac 00 41 58 4c 8b
[  140.280033] RSP: 0018:ffff9f588024cbd8 EFLAGS: 00010086
[  140.280046] RAX: 0000000000000000 RBX: ffff9f588024cc40 RCX: ffff8eed18dd9f98
[  140.280057] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff8eed18dd9f90
[  140.280067] RBP: ffff8eebc1407800 R08: 00000000ffffffea R09: 0000000000000000
[  140.280082] R10: 0000000000000003 R11: 3fffffffffffffff R12: ffffffff9e081060
[  140.280093] R13: ffff8eebc43908b0 R14: ffffffff9c74c104 R15: 00000000fac08a40
[  140.280104] FS:  0000000000000000(0000) GS:ffff8eed18c00000(0000) knlGS:0000000000000000
[  140.280115] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  140.280127] CR2: 00007f6feafb12a0 CR3: 00000001604ca001 CR4: 00000000003706e0
[  140.280138] Call Trace:
[  140.280149]  <IRQ>
[  140.280161]  debug_dma_sync_single_for_cpu+0x79/0x80
[  140.280173]  ? mark_held_locks+0x50/0x80
[  140.280185]  ? lockdep_hardirqs_on_prepare.part.0+0x65/0x130
[  140.280197]  ? __local_bh_enable_ip+0x6f/0xb0
[  140.280215]  ? ath11k_dp_rx_reap_mon_status_ring+0x202/0x340 [ath11k]
[  140.280231]  ath11k_dp_rx_reap_mon_status_ring+0x22c/0x340 [ath11k]
[  140.280249]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280265]  ath11k_dp_rx_process_mon_status+0x83/0x3c0 [ath11k]
[  140.280278]  ? __lock_acquire+0x3bd/0x6d0
[  140.280296]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280311]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280326]  ? ath11k_hw_mac_id_to_srng_id_qca6390+0x10/0x10 [ath11k]
[  140.280341]  ? ath11k_dp_rx_process_mon_rings+0x4a/0x1a0 [ath11k]
[  140.280353]  ? timer_fixup_init+0x30/0x30
[  140.280367]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280385]  ath11k_dp_service_mon_ring+0x2b/0x50 [ath11k]
[  140.280400]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280413]  call_timer_fn+0xb1/0x2d0
[  140.280426]  __run_timers.part.0+0x205/0x2f0
[  140.280439]  run_timer_softirq+0x21/0x50
[  140.280450]  __do_softirq+0xc2/0x454
[  140.280463]  asm_call_irq_on_stack+0x12/0x20
[  140.280476]  </IRQ>
[  140.280488]  do_softirq_own_stack+0x56/0x60
[  140.280500]  irq_exit_rcu+0x9a/0xd0
[  140.280511]  sysvec_apic_timer_interrupt+0x43/0xa0
[  140.280526]  asm_sysvec_apic_timer_interrupt+0x12/0x20
[  140.280540] RIP: 0010:_raw_spin_unlock_irqrestore+0x25/0x40
[  140.280551] Code: 80 00 00 00 00 55 48 89 fd 48 83 c7 18 53 48 89 f3 48 8b 74 24 10 e8 ca 8f 4b ff 48 89 ef e8 22 dc 4b ff f6 c7 02 75 0c 53 9d <65> ff 0d 04 51 20 64 5b 5d c3 e8 9c 08 56
[  140.280563] RSP: 0018:ffff9f58802e7878 EFLAGS: 00000246
[  140.280578] RAX: 00000000000435ef RBX: 0000000000000246 RCX: 0000000000000040
[  140.280592] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff9be13e84
[  140.280603] RBP: ffff8eed18dde480 R08: 0000000000000001 R09: ffff8eebc2292760
[  140.280614] R10: 0000000000000005 R11: ffff8eebc2292760 R12: 0000000000000000
[  140.280625] R13: ffff9f58802e7900 R14: ffff8eed18dde480 R15: ffff8eed18dde480
[  140.280637]  ? _raw_spin_unlock_irqrestore+0x34/0x40
[  140.280649]  __mod_timer+0x274/0x400
[  140.280661]  ? wait_for_completion_timeout+0x76/0x110
[  140.280675]  schedule_timeout+0xa8/0x140
[  140.280687]  ? __next_timer_interrupt+0x100/0x100
[  140.280698]  wait_for_completion_timeout+0xa2/0x110
[  140.280714]  ath11k_start_scan+0x4c/0xf0 [ath11k]
[  140.280730]  ath11k_mac_op_hw_scan+0x1e9/0x2c0 [ath11k]
[  140.280763]  drv_hw_scan+0x79/0x260 [mac80211]
[  140.280789]  __ieee80211_scan_completed+0x379/0x440 [mac80211]
[  140.280816]  ieee80211_scan_work+0x12f/0x330 [mac80211]
[  140.280830]  process_one_work+0x279/0x5b0
[  140.280842]  worker_thread+0x49/0x300
[  140.280854]  ? process_one_work+0x5b0/0x5b0
[  140.280868]  kthread+0x135/0x150
[  140.280880]  ? __kthread_bind_mask+0x60/0x60
[  140.280891]  ret_from_fork+0x22/0x30
[  140.280903] irq event stamp: 275961
[  140.280918] hardirqs last  enabled at (275960): [<ffffffff9b270f1f>] __local_bh_enable_ip+0x6f/0xb0
[  140.280931] hardirqs last disabled at (275961): [<ffffffff9be13ca3>] _raw_spin_lock_irqsave+0x63/0x80
[  140.280946] softirqs last  enabled at (275944): [<ffffffffc055288d>] ath11k_ce_send+0x14d/0x260 [ath11k]
[  140.280958] softirqs last disabled at (275953): [<ffffffff9c000f72>] asm_call_irq_on_stack+0x12/0x20
[  140.280971] ---[ end trace 31cb94e18d401398 ]---

Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1

Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/dp_rx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index 01625327eef7..37e5a408cd62 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -2715,7 +2715,7 @@ static struct sk_buff *ath11k_dp_rx_alloc_mon_status_buf(struct ath11k_base *ab,
 
 	paddr = dma_map_single(ab->dev, skb->data,
 			       skb->len + skb_tailroom(skb),
-			       DMA_BIDIRECTIONAL);
+			       DMA_FROM_DEVICE);
 	if (unlikely(dma_mapping_error(ab->dev, paddr)))
 		goto fail_free_skb;
 
@@ -2731,7 +2731,7 @@ static struct sk_buff *ath11k_dp_rx_alloc_mon_status_buf(struct ath11k_base *ab,
 
 fail_dma_unmap:
 	dma_unmap_single(ab->dev, paddr, skb->len + skb_tailroom(skb),
-			 DMA_BIDIRECTIONAL);
+			 DMA_FROM_DEVICE);
 fail_free_skb:
 	dev_kfree_skb_any(skb);
 fail_alloc_skb:
@@ -2795,7 +2795,7 @@ int ath11k_dp_rx_mon_status_bufs_replenish(struct ath11k_base *ab, int mac_id,
 	idr_remove(&rx_ring->bufs_idr, buf_id);
 	spin_unlock_bh(&rx_ring->idr_lock);
 	dma_unmap_single(ab->dev, paddr, skb->len + skb_tailroom(skb),
-			 DMA_BIDIRECTIONAL);
+			 DMA_FROM_DEVICE);
 	dev_kfree_skb_any(skb);
 	ath11k_hal_srng_access_end(ab, srng);
 	spin_unlock_bh(&srng->lock);
@@ -2862,7 +2862,7 @@ static int ath11k_dp_rx_reap_mon_status_ring(struct ath11k_base *ab, int mac_id,
 
 			dma_unmap_single(ab->dev, rxcb->paddr,
 					 skb->len + skb_tailroom(skb),
-					 DMA_BIDIRECTIONAL);
+					 DMA_FROM_DEVICE);
 
 			tlv = (struct hal_tlv_hdr *)skb->data;
 			if (FIELD_GET(HAL_TLV_HDR_TAG, tlv->tl) !=
-- 
2.7.4


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ath11k: dp_rx: fix monitor status dma unmap direction
  2020-11-23 18:27 [PATCH] ath11k: dp_rx: fix monitor status dma unmap direction Kalle Valo
@ 2020-12-02 18:34 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-12-02 18:34 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, ath11k

Kalle Valo <kvalo@codeaurora.org> wrote:

> After enabling CONFIG_DMA_API_DEBUG there was a warning about using
> dma_unmap_single() in wrong direction from ath11k_dp_rx_process_mon_status().
> 
> [  140.279477] ------------[ cut here ]------------
> [  140.279908] DMA-API: ath11k_pci 0000:06:00.0: device driver syncs DMA memory with different direction [device address=0x00000000fac08a40] [size=2176 bytes] [mapped with DMA_FROM_DEVICE] [s
> [  140.279925] WARNING: CPU: 7 PID: 97 at kernel/dma/debug.c:1120 check_sync+0x494/0x730
> [  140.279939] Modules linked in: ath11k_pci ath11k mac80211 libarc4 cfg80211 qmi_helpers qrtr_mhi mhi qrtr ns nvme nvme_core
> [  140.279958] CPU: 7 PID: 97 Comm: kworker/u16:1 Not tainted 5.10.0-rc4+ #262
> [  140.279968] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0049.2018.0801.1601 08/01/2018
> [  140.279995] Workqueue: phy0 ieee80211_scan_work [mac80211]
> [  140.280009] RIP: 0010:check_sync+0x494/0x730
> [  140.280022] Code: 8b 4c 24 10 4c 8b 44 24 18 4c 8b 54 24 20 48 89 c6 4c 89 54 24 10 4c 89 f9 4c 89 ea 48 c7 c7 40 b9 74 9c 41 56 e8 2f a0 ab 00 <0f> 0b 48 89 ef e8 e5 17 ac 00 41 58 4c 8b
> [  140.280033] RSP: 0018:ffff9f588024cbd8 EFLAGS: 00010086
> [  140.280046] RAX: 0000000000000000 RBX: ffff9f588024cc40 RCX: ffff8eed18dd9f98
> [  140.280057] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff8eed18dd9f90
> [  140.280067] RBP: ffff8eebc1407800 R08: 00000000ffffffea R09: 0000000000000000
> [  140.280082] R10: 0000000000000003 R11: 3fffffffffffffff R12: ffffffff9e081060
> [  140.280093] R13: ffff8eebc43908b0 R14: ffffffff9c74c104 R15: 00000000fac08a40
> [  140.280104] FS:  0000000000000000(0000) GS:ffff8eed18c00000(0000) knlGS:0000000000000000
> [  140.280115] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [  140.280127] CR2: 00007f6feafb12a0 CR3: 00000001604ca001 CR4: 00000000003706e0
> [  140.280138] Call Trace:
> [  140.280149]  <IRQ>
> [  140.280161]  debug_dma_sync_single_for_cpu+0x79/0x80
> [  140.280173]  ? mark_held_locks+0x50/0x80
> [  140.280185]  ? lockdep_hardirqs_on_prepare.part.0+0x65/0x130
> [  140.280197]  ? __local_bh_enable_ip+0x6f/0xb0
> [  140.280215]  ? ath11k_dp_rx_reap_mon_status_ring+0x202/0x340 [ath11k]
> [  140.280231]  ath11k_dp_rx_reap_mon_status_ring+0x22c/0x340 [ath11k]
> [  140.280249]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
> [  140.280265]  ath11k_dp_rx_process_mon_status+0x83/0x3c0 [ath11k]
> [  140.280278]  ? __lock_acquire+0x3bd/0x6d0
> [  140.280296]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
> [  140.280311]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
> [  140.280326]  ? ath11k_hw_mac_id_to_srng_id_qca6390+0x10/0x10 [ath11k]
> [  140.280341]  ? ath11k_dp_rx_process_mon_rings+0x4a/0x1a0 [ath11k]
> [  140.280353]  ? timer_fixup_init+0x30/0x30
> [  140.280367]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
> [  140.280385]  ath11k_dp_service_mon_ring+0x2b/0x50 [ath11k]
> [  140.280400]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
> [  140.280413]  call_timer_fn+0xb1/0x2d0
> [  140.280426]  __run_timers.part.0+0x205/0x2f0
> [  140.280439]  run_timer_softirq+0x21/0x50
> [  140.280450]  __do_softirq+0xc2/0x454
> [  140.280463]  asm_call_irq_on_stack+0x12/0x20
> [  140.280476]  </IRQ>
> [  140.280488]  do_softirq_own_stack+0x56/0x60
> [  140.280500]  irq_exit_rcu+0x9a/0xd0
> [  140.280511]  sysvec_apic_timer_interrupt+0x43/0xa0
> [  140.280526]  asm_sysvec_apic_timer_interrupt+0x12/0x20
> [  140.280540] RIP: 0010:_raw_spin_unlock_irqrestore+0x25/0x40
> [  140.280551] Code: 80 00 00 00 00 55 48 89 fd 48 83 c7 18 53 48 89 f3 48 8b 74 24 10 e8 ca 8f 4b ff 48 89 ef e8 22 dc 4b ff f6 c7 02 75 0c 53 9d <65> ff 0d 04 51 20 64 5b 5d c3 e8 9c 08 56
> [  140.280563] RSP: 0018:ffff9f58802e7878 EFLAGS: 00000246
> [  140.280578] RAX: 00000000000435ef RBX: 0000000000000246 RCX: 0000000000000040
> [  140.280592] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff9be13e84
> [  140.280603] RBP: ffff8eed18dde480 R08: 0000000000000001 R09: ffff8eebc2292760
> [  140.280614] R10: 0000000000000005 R11: ffff8eebc2292760 R12: 0000000000000000
> [  140.280625] R13: ffff9f58802e7900 R14: ffff8eed18dde480 R15: ffff8eed18dde480
> [  140.280637]  ? _raw_spin_unlock_irqrestore+0x34/0x40
> [  140.280649]  __mod_timer+0x274/0x400
> [  140.280661]  ? wait_for_completion_timeout+0x76/0x110
> [  140.280675]  schedule_timeout+0xa8/0x140
> [  140.280687]  ? __next_timer_interrupt+0x100/0x100
> [  140.280698]  wait_for_completion_timeout+0xa2/0x110
> [  140.280714]  ath11k_start_scan+0x4c/0xf0 [ath11k]
> [  140.280730]  ath11k_mac_op_hw_scan+0x1e9/0x2c0 [ath11k]
> [  140.280763]  drv_hw_scan+0x79/0x260 [mac80211]
> [  140.280789]  __ieee80211_scan_completed+0x379/0x440 [mac80211]
> [  140.280816]  ieee80211_scan_work+0x12f/0x330 [mac80211]
> [  140.280830]  process_one_work+0x279/0x5b0
> [  140.280842]  worker_thread+0x49/0x300
> [  140.280854]  ? process_one_work+0x5b0/0x5b0
> [  140.280868]  kthread+0x135/0x150
> [  140.280880]  ? __kthread_bind_mask+0x60/0x60
> [  140.280891]  ret_from_fork+0x22/0x30
> [  140.280903] irq event stamp: 275961
> [  140.280918] hardirqs last  enabled at (275960): [<ffffffff9b270f1f>] __local_bh_enable_ip+0x6f/0xb0
> [  140.280931] hardirqs last disabled at (275961): [<ffffffff9be13ca3>] _raw_spin_lock_irqsave+0x63/0x80
> [  140.280946] softirqs last  enabled at (275944): [<ffffffffc055288d>] ath11k_ce_send+0x14d/0x260 [ath11k]
> [  140.280958] softirqs last disabled at (275953): [<ffffffff9c000f72>] asm_call_irq_on_stack+0x12/0x20
> [  140.280971] ---[ end trace 31cb94e18d401398 ]---
> 
> Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
> 
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

cd6181ff7e93 ath11k: dp_rx: fix monitor status dma unmap direction

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1606156046-24764-1-git-send-email-kvalo@codeaurora.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-02 18:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 18:27 [PATCH] ath11k: dp_rx: fix monitor status dma unmap direction Kalle Valo
2020-12-02 18:34 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).