linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855
@ 2021-11-18 10:05 Wen Gong
  2021-11-18 10:05 ` [PATCH v2 1/2] ath11k: add configure country code for QCA6390 and WCN6855 Wen Gong
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Wen Gong @ 2021-11-18 10:05 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, quic_wgong

v2:
   1. rebased to latest ath.git master ath-202111170737
   2. add "ath11k: add configure country code for QCA6390 and WCN6855", it is needed for 
      patch "ath11k: add 11d scan offload support"

Wen Gong (2):
  ath11k: add configure country code for QCA6390 and WCN6855
  ath11k: add 11d scan offload support

 drivers/net/wireless/ath/ath11k/core.c |  30 +++++
 drivers/net/wireless/ath/ath11k/core.h |   9 ++
 drivers/net/wireless/ath/ath11k/mac.c  | 162 ++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath11k/mac.h  |   7 ++
 drivers/net/wireless/ath/ath11k/pci.c  |   1 +
 drivers/net/wireless/ath/ath11k/reg.c  |  15 +++
 drivers/net/wireless/ath/ath11k/wmi.c  | 145 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/wmi.h  |  39 ++++++
 8 files changed, 407 insertions(+), 1 deletion(-)


base-commit: 63ec871bc50a306aac550e2d85f697ca2d5f5deb
-- 
2.31.1


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

* [PATCH v2 1/2] ath11k: add configure country code for QCA6390 and WCN6855
  2021-11-18 10:05 [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 Wen Gong
@ 2021-11-18 10:05 ` Wen Gong
  2021-11-18 10:05 ` [PATCH v2 2/2] ath11k: add 11d scan offload support Wen Gong
  2021-11-22 12:28 ` [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 Kalle Valo
  2 siblings, 0 replies; 8+ messages in thread
From: Wen Gong @ 2021-11-18 10:05 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, quic_wgong

Add handler to send WMI_SET_CURRENT_COUNTRY_CMDID to firmware which
is used for QCA6390 and WCN6855.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1

Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/wmi.c | 36 +++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/wmi.h | 12 +++++++++
 2 files changed, 48 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 614b2f6bcc8e..e5f3d04645d4 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -2793,6 +2793,42 @@ ath11k_wmi_send_init_country_cmd(struct ath11k *ar,
 	return ret;
 }
 
+int ath11k_wmi_send_set_current_country_cmd(struct ath11k *ar,
+					    struct wmi_set_current_country_params *param)
+{
+	struct ath11k_pdev_wmi *wmi = ar->wmi;
+	struct wmi_set_current_country_cmd *cmd;
+	struct sk_buff *skb;
+	int ret;
+
+	skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
+	if (!skb)
+		return -ENOMEM;
+
+	cmd = (struct wmi_set_current_country_cmd *)skb->data;
+	cmd->tlv_header =
+		FIELD_PREP(WMI_TLV_TAG, WMI_TAG_SET_CURRENT_COUNTRY_CMD) |
+		FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
+
+	cmd->pdev_id = ar->pdev->pdev_id;
+	memcpy(&cmd->new_alpha2, &param->alpha2, 3);
+	ret = ath11k_wmi_cmd_send(wmi, skb, WMI_SET_CURRENT_COUNTRY_CMDID);
+
+	ath11k_dbg(ar->ab, ATH11K_DBG_WMI,
+		   "set current country pdev id %d alpha2 %c%c\n",
+		   ar->pdev->pdev_id,
+		   param->alpha2[0],
+		   param->alpha2[1]);
+
+	if (ret) {
+		ath11k_warn(ar->ab,
+			    "failed to send WMI_SET_CURRENT_COUNTRY_CMDID: %d\n", ret);
+		dev_kfree_skb(skb);
+	}
+
+	return ret;
+}
+
 int
 ath11k_wmi_send_thermal_mitigation_param_cmd(struct ath11k *ar,
 					     struct thermal_mitigation_params *param)
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index 4eb06cb7f883..e1686a2ab520 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -3770,6 +3770,16 @@ struct stats_request_params {
 	u32 pdev_id;
 };
 
+struct wmi_set_current_country_params {
+	u8 alpha2[3];
+};
+
+struct wmi_set_current_country_cmd {
+	u32 tlv_header;
+	u32 pdev_id;
+	u32 new_alpha2;
+} __packed;
+
 enum set_init_cc_type {
 	WMI_COUNTRY_INFO_TYPE_ALPHA,
 	WMI_COUNTRY_INFO_TYPE_COUNTRY_CODE,
@@ -5433,6 +5443,8 @@ int ath11k_wmi_delba_send(struct ath11k *ar, u32 vdev_id, const u8 *mac,
 			  u32 tid, u32 initiator, u32 reason);
 int ath11k_wmi_send_bcn_offload_control_cmd(struct ath11k *ar,
 					    u32 vdev_id, u32 bcn_ctrl_op);
+int ath11k_wmi_send_set_current_country_cmd(struct ath11k *ar,
+					    struct wmi_set_current_country_params *param);
 int
 ath11k_wmi_send_init_country_cmd(struct ath11k *ar,
 				 struct wmi_init_country_params init_cc_param);
-- 
2.31.1


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

* [PATCH v2 2/2] ath11k: add 11d scan offload support
  2021-11-18 10:05 [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 Wen Gong
  2021-11-18 10:05 ` [PATCH v2 1/2] ath11k: add configure country code for QCA6390 and WCN6855 Wen Gong
@ 2021-11-18 10:05 ` Wen Gong
  2021-11-22 12:28 ` [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 Kalle Valo
  2 siblings, 0 replies; 8+ messages in thread
From: Wen Gong @ 2021-11-18 10:05 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, quic_wgong

Add handler for WMI_11D_NEW_COUNTRY_EVENTID, WMI_11D_SCAN_START_CMDID,
WMI_11D_SCAN_STOP_CMDID.

After vdev create for STATION, send WMI_11D_SCAN_START_CMDID to firmware
and wait firmware complete it, the scan from mac80211 also need to wait
the 11d scan finished, and send WMI_11D_SCAN_STOP_CMDID to firmware
before vdev delete for STATION.

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

Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/core.c |  30 +++++
 drivers/net/wireless/ath/ath11k/core.h |   9 ++
 drivers/net/wireless/ath/ath11k/mac.c  | 162 ++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath11k/mac.h  |   7 ++
 drivers/net/wireless/ath/ath11k/pci.c  |   1 +
 drivers/net/wireless/ath/ath11k/reg.c  |  15 +++
 drivers/net/wireless/ath/ath11k/wmi.c  | 109 +++++++++++++++++
 drivers/net/wireless/ath/ath11k/wmi.h  |  27 +++++
 8 files changed, 359 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index a40bbca3e9af..ad0c20cbf976 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -1045,6 +1045,34 @@ void ath11k_core_halt(struct ath11k *ar)
 	idr_init(&ar->txmgmt_idr);
 }
 
+static void ath11k_update_11d(struct work_struct *work)
+{
+	struct ath11k_base *ab = container_of(work, struct ath11k_base, update_11d_work);
+	struct ath11k *ar;
+	struct ath11k_pdev *pdev;
+	struct wmi_set_current_country_params set_current_param = {};
+	int ret, i;
+
+	spin_lock_bh(&ab->base_lock);
+	memcpy(&set_current_param.alpha2, &ab->new_alpha2, 2);
+	spin_unlock_bh(&ab->base_lock);
+
+	ath11k_dbg(ab, ATH11K_DBG_WMI, "update 11d new cc %c%c\n",
+		   set_current_param.alpha2[0],
+		   set_current_param.alpha2[1]);
+
+	for (i = 0; i < ab->num_radios; i++) {
+		pdev = &ab->pdevs[i];
+		ar = pdev->ar;
+
+		ret = ath11k_wmi_send_set_current_country_cmd(ar, &set_current_param);
+		if (ret)
+			ath11k_warn(ar->ab,
+				    "pdev id %d failed set current country code: %d\n",
+				    i, ret);
+	}
+}
+
 static void ath11k_core_restart(struct work_struct *work)
 {
 	struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work);
@@ -1214,12 +1242,14 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
 
 	mutex_init(&ab->core_lock);
 	spin_lock_init(&ab->base_lock);
+	mutex_init(&ab->vdev_id_11d_lock);
 
 	INIT_LIST_HEAD(&ab->peers);
 	init_waitqueue_head(&ab->peer_mapping_wq);
 	init_waitqueue_head(&ab->wmi_ab.tx_credits_wq);
 	init_waitqueue_head(&ab->qmi.cold_boot_waitq);
 	INIT_WORK(&ab->restart_work, ath11k_core_restart);
+	INIT_WORK(&ab->update_11d_work, ath11k_update_11d);
 	timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0);
 	init_completion(&ab->htc_suspend);
 	init_completion(&ab->wow.wakeup_completed);
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index bbfc10fd5c6d..98986b604806 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -585,6 +585,11 @@ struct ath11k {
 #endif
 	bool dfs_block_radar_events;
 	struct ath11k_thermal thermal;
+	u32 vdev_id_11d_scan;
+	struct completion finish_11d_scan;
+	struct completion finish_11d_ch_list;
+	bool pending_11d;
+	bool regdom_set_by_user;
 };
 
 struct ath11k_band_cap {
@@ -754,6 +759,8 @@ struct ath11k_base {
 	struct completion driver_recovery;
 	struct workqueue_struct *workqueue;
 	struct work_struct restart_work;
+	struct work_struct update_11d_work;
+	u8 new_alpha2[3];
 	struct {
 		/* protected by data_lock */
 		u32 fw_crash_counter;
@@ -763,6 +770,8 @@ struct ath11k_base {
 	struct ath11k_dbring_cap *db_caps;
 	u32 num_db_cap;
 
+	/* To synchronize 11d scan vdev id */
+	struct mutex vdev_id_11d_lock;
 	struct timer_list mon_reap_timer;
 
 	struct completion htc_suspend;
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 292b2b7eab11..047783f787b5 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -2584,6 +2584,8 @@ static void ath11k_bss_assoc(struct ieee80211_hw *hw,
 	if (ret)
 		ath11k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n",
 			    arvif->vdev_id, ret);
+
+	ath11k_mac_11d_scan_stop_all(ar->ab);
 }
 
 static void ath11k_bss_disassoc(struct ieee80211_hw *hw,
@@ -3313,6 +3315,7 @@ static int ath11k_start_scan(struct ath11k *ar,
 			     struct scan_req_params *arg)
 {
 	int ret;
+	unsigned long timeout = 1 * HZ;
 
 	lockdep_assert_held(&ar->conf_mutex);
 
@@ -3323,7 +3326,14 @@ static int ath11k_start_scan(struct ath11k *ar,
 	if (ret)
 		return ret;
 
-	ret = wait_for_completion_timeout(&ar->scan.started, 1 * HZ);
+	if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) {
+		timeout = 5 * HZ;
+
+		if (ar->supports_6ghz)
+			timeout += 5 * HZ;
+	}
+
+	ret = wait_for_completion_timeout(&ar->scan.started, timeout);
 	if (ret == 0) {
 		ret = ath11k_scan_stop(ar);
 		if (ret)
@@ -3380,6 +3390,26 @@ static int ath11k_mac_op_hw_scan(struct ieee80211_hw *hw,
 	if (ret)
 		goto exit;
 
+	/* Currently the pending_11d=true only happened 1 time while
+	 * wlan interface up in ath11k_mac_11d_scan_start(), it is called by
+	 * ath11k_mac_op_add_interface(), after wlan interface up,
+	 * pending_11d=false always.
+	 * If remove below wait, it always happened scan fail and lead connect
+	 * fail while wlan interface up, because it has a 11d scan which is running
+	 * in firmware, and lead this scan failed.
+	 */
+	if (ar->pending_11d) {
+		long time_left;
+		unsigned long timeout = 5 * HZ;
+
+		if (ar->supports_6ghz)
+			timeout += 5 * HZ;
+
+		time_left = wait_for_completion_timeout(&ar->finish_11d_ch_list, timeout);
+		ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
+			   "mac wait 11d channel list time left %ld\n", time_left);
+	}
+
 	memset(&arg, 0, sizeof(arg));
 	ath11k_wmi_start_scan_init(ar, &arg);
 	arg.vdev_id = arvif->vdev_id;
@@ -5677,6 +5707,122 @@ static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw,
 	}
 }
 
+static bool ath11k_mac_vif_ap_active_any(struct ath11k_base *ab)
+{
+	struct ath11k *ar;
+	struct ath11k_pdev *pdev;
+	struct ath11k_vif *arvif;
+	int i;
+
+	for (i = 0; i < ab->num_radios; i++) {
+		pdev = &ab->pdevs[i];
+		ar = pdev->ar;
+		list_for_each_entry(arvif, &ar->arvifs, list) {
+			if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_AP)
+				return true;
+		}
+	}
+	return false;
+}
+
+void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait)
+{
+	struct wmi_11d_scan_start_params param;
+	int ret;
+
+	mutex_lock(&ar->ab->vdev_id_11d_lock);
+
+	ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev id for 11d scan %d\n",
+		   ar->vdev_id_11d_scan);
+
+	if (ar->regdom_set_by_user)
+		goto fin;
+
+	if (ar->vdev_id_11d_scan != ATH11K_11D_INVALID_VDEV_ID)
+		goto fin;
+
+	if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map))
+		goto fin;
+
+	if (ath11k_mac_vif_ap_active_any(ar->ab))
+		goto fin;
+
+	param.vdev_id = vdev_id;
+	param.start_interval_msec = 0;
+	param.scan_period_msec = ATH11K_SCAN_11D_INTERVAL;
+
+	ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac start 11d scan\n");
+
+	if (wait)
+		reinit_completion(&ar->finish_11d_scan);
+
+	ret = ath11k_wmi_send_11d_scan_start_cmd(ar, &param);
+	if (ret) {
+		ath11k_warn(ar->ab, "failed to start 11d scan vdev %d ret: %d\n",
+			    vdev_id, ret);
+	} else {
+		ar->vdev_id_11d_scan = vdev_id;
+		if (wait) {
+			ar->pending_11d = true;
+			ret = wait_for_completion_timeout(&ar->finish_11d_scan,
+							  5 * HZ);
+			ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
+				   "mac 11d scan left time %d\n", ret);
+
+			if (!ret)
+				ar->pending_11d = false;
+		}
+	}
+
+fin:
+	mutex_unlock(&ar->ab->vdev_id_11d_lock);
+}
+
+void ath11k_mac_11d_scan_stop(struct ath11k *ar)
+{
+	int ret;
+	u32 vdev_id;
+
+	if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map))
+		return;
+
+	ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac stop 11d scan\n");
+
+	mutex_lock(&ar->ab->vdev_id_11d_lock);
+
+	ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac stop 11d vdev id %d\n",
+		   ar->vdev_id_11d_scan);
+
+	if (ar->vdev_id_11d_scan != ATH11K_11D_INVALID_VDEV_ID) {
+		vdev_id = ar->vdev_id_11d_scan;
+
+		ret = ath11k_wmi_send_11d_scan_stop_cmd(ar, vdev_id);
+		if (ret)
+			ath11k_warn(ar->ab,
+				    "failed to stopt 11d scan vdev %d ret: %d\n",
+				    vdev_id, ret);
+		else
+			ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID;
+	}
+	mutex_unlock(&ar->ab->vdev_id_11d_lock);
+}
+
+void ath11k_mac_11d_scan_stop_all(struct ath11k_base *ab)
+{
+	struct ath11k *ar;
+	struct ath11k_pdev *pdev;
+	int i;
+
+	ath11k_dbg(ab, ATH11K_DBG_MAC, "mac stop soc 11d scan\n");
+
+	for (i = 0; i < ab->num_radios; i++) {
+		pdev = &ab->pdevs[i];
+		ar = pdev->ar;
+
+		ath11k_mac_11d_scan_stop(ar);
+	}
+}
+
 static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,
 				       struct ieee80211_vif *vif)
 {
@@ -5810,6 +5956,8 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,
 				    arvif->vdev_id, ret);
 			goto err_peer_del;
 		}
+
+		ath11k_mac_11d_scan_stop_all(ar->ab);
 		break;
 	case WMI_VDEV_TYPE_STA:
 		param_id = WMI_STA_PS_PARAM_RX_WAKE_POLICY;
@@ -5849,6 +5997,9 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,
 				    arvif->vdev_id, ret);
 			goto err_peer_del;
 		}
+
+		ath11k_mac_11d_scan_start(ar, arvif->vdev_id, true);
+
 		break;
 	case WMI_VDEV_TYPE_MONITOR:
 		set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags);
@@ -5950,6 +6101,9 @@ static void ath11k_mac_op_remove_interface(struct ieee80211_hw *hw,
 	ath11k_dbg(ab, ATH11K_DBG_MAC, "mac remove interface (vdev %d)\n",
 		   arvif->vdev_id);
 
+	if (arvif->vdev_type == WMI_VDEV_TYPE_STA)
+		ath11k_mac_11d_scan_stop(ar);
+
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		ret = ath11k_peer_delete(ar, arvif->vdev_id, vif->addr);
 		if (ret)
@@ -6698,6 +6852,9 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
 				    ret);
 	}
 
+	if (arvif->vdev_type == WMI_VDEV_TYPE_STA)
+		ath11k_mac_11d_scan_start(ar, arvif->vdev_id, false);
+
 	mutex_unlock(&ar->conf_mutex);
 }
 
@@ -8099,6 +8256,9 @@ int ath11k_mac_allocate(struct ath11k_base *ab)
 
 		ar->monitor_vdev_id = -1;
 		clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags);
+		ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID;
+		init_completion(&ar->finish_11d_scan);
+		init_completion(&ar->finish_11d_ch_list);
 	}
 
 	return 0;
diff --git a/drivers/net/wireless/ath/ath11k/mac.h b/drivers/net/wireless/ath/ath11k/mac.h
index f6f37e8c8c6a..dfa112c10834 100644
--- a/drivers/net/wireless/ath/ath11k/mac.h
+++ b/drivers/net/wireless/ath/ath11k/mac.h
@@ -127,6 +127,13 @@ struct ath11k_generic_iter {
 
 extern const struct htt_rx_ring_tlv_filter ath11k_mac_mon_status_filter_default;
 
+#define ATH11K_SCAN_11D_INTERVAL		600000
+#define ATH11K_11D_INVALID_VDEV_ID		0xFFFF
+
+void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait);
+void ath11k_mac_11d_scan_stop(struct ath11k *ar);
+void ath11k_mac_11d_scan_stop_all(struct ath11k_base *ab);
+
 void ath11k_mac_destroy(struct ath11k_base *ab);
 void ath11k_mac_unregister(struct ath11k_base *ab);
 int ath11k_mac_register(struct ath11k_base *ab);
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index 958c2b2c5b3e..3cc666a002b9 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -1383,6 +1383,7 @@ static void ath11k_pci_remove(struct pci_dev *pdev)
 
 	set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
 
+	cancel_work_sync(&ab->update_11d_work);
 	ath11k_core_deinit(ab);
 
 qmi_fail:
diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index 8606170ba80d..1f8a81987187 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -86,6 +86,9 @@ ath11k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
 	if (ret)
 		ath11k_warn(ar->ab,
 			    "INIT Country code set to fw failed : %d\n", ret);
+
+	ath11k_mac_11d_scan_stop(ar);
+	ar->regdom_set_by_user = true;
 }
 
 int ath11k_reg_update_chan_list(struct ath11k *ar)
@@ -179,6 +182,11 @@ int ath11k_reg_update_chan_list(struct ath11k *ar)
 	ret = ath11k_wmi_send_scan_chan_list_cmd(ar, params);
 	kfree(params);
 
+	if (ar->pending_11d) {
+		complete(&ar->finish_11d_ch_list);
+		ar->pending_11d = false;
+	}
+
 	return ret;
 }
 
@@ -244,8 +252,15 @@ int ath11k_regd_update(struct ath11k *ar)
 		goto err;
 	}
 
+	if (ar->pending_11d)
+		complete(&ar->finish_11d_scan);
+
 	rtnl_lock();
 	wiphy_lock(ar->hw->wiphy);
+
+	if (ar->pending_11d)
+		reinit_completion(&ar->finish_11d_ch_list);
+
 	ret = regulatory_set_wiphy_regd_sync(ar->hw->wiphy, regd_copy);
 	wiphy_unlock(ar->hw->wiphy);
 	rtnl_unlock();
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index e5f3d04645d4..652d80eeedf4 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -130,6 +130,8 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = {
 		.min_len = sizeof(struct wmi_vdev_delete_resp_event) },
 	[WMI_TAG_OBSS_COLOR_COLLISION_EVT] = {
 		.min_len = sizeof(struct wmi_obss_color_collision_event) },
+	[WMI_TAG_11D_NEW_COUNTRY_EVENT] = {
+		.min_len = sizeof(struct wmi_11d_new_cc_ev) },
 };
 
 #define PRIMAP(_hw_mode_) \
@@ -2893,6 +2895,75 @@ ath11k_wmi_send_thermal_mitigation_param_cmd(struct ath11k *ar,
 	return ret;
 }
 
+int ath11k_wmi_send_11d_scan_start_cmd(struct ath11k *ar,
+				       struct wmi_11d_scan_start_params *param)
+{
+	struct ath11k_pdev_wmi *wmi = ar->wmi;
+	struct wmi_11d_scan_start_cmd *cmd;
+	struct sk_buff *skb;
+	int ret;
+
+	skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
+	if (!skb)
+		return -ENOMEM;
+
+	cmd = (struct wmi_11d_scan_start_cmd *)skb->data;
+	cmd->tlv_header =
+		FIELD_PREP(WMI_TLV_TAG, WMI_TAG_11D_SCAN_START_CMD) |
+		FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
+
+	cmd->vdev_id = param->vdev_id;
+	cmd->scan_period_msec = param->scan_period_msec;
+	cmd->start_interval_msec = param->start_interval_msec;
+	ret = ath11k_wmi_cmd_send(wmi, skb, WMI_11D_SCAN_START_CMDID);
+
+	ath11k_dbg(ar->ab, ATH11K_DBG_WMI,
+		   "send 11d scan start vdev id %d period %d ms internal %d ms\n",
+		   cmd->vdev_id,
+		   cmd->scan_period_msec,
+		   cmd->start_interval_msec);
+
+	if (ret) {
+		ath11k_warn(ar->ab,
+			    "failed to send WMI_11D_SCAN_START_CMDID: %d\n", ret);
+		dev_kfree_skb(skb);
+	}
+
+	return ret;
+}
+
+int ath11k_wmi_send_11d_scan_stop_cmd(struct ath11k *ar, u32 vdev_id)
+{
+	struct ath11k_pdev_wmi *wmi = ar->wmi;
+	struct wmi_11d_scan_stop_cmd *cmd;
+	struct sk_buff *skb;
+	int ret;
+
+	skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
+	if (!skb)
+		return -ENOMEM;
+
+	cmd = (struct wmi_11d_scan_stop_cmd *)skb->data;
+	cmd->tlv_header =
+		FIELD_PREP(WMI_TLV_TAG, WMI_TAG_11D_SCAN_STOP_CMD) |
+		FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
+
+	cmd->vdev_id = vdev_id;
+	ret = ath11k_wmi_cmd_send(wmi, skb, WMI_11D_SCAN_STOP_CMDID);
+
+	ath11k_dbg(ar->ab, ATH11K_DBG_WMI,
+		   "send 11d scan stop vdev id %d\n",
+		   cmd->vdev_id);
+
+	if (ret) {
+		ath11k_warn(ar->ab,
+			    "failed to send WMI_11D_SCAN_STOP_CMDID: %d\n", ret);
+		dev_kfree_skb(skb);
+	}
+
+	return ret;
+}
+
 int ath11k_wmi_pdev_pktlog_enable(struct ath11k *ar, u32 pktlog_filter)
 {
 	struct ath11k_pdev_wmi *wmi = ar->wmi;
@@ -5932,6 +6003,41 @@ static void ath11k_wmi_op_ep_tx_credits(struct ath11k_base *ab)
 	wake_up(&ab->wmi_ab.tx_credits_wq);
 }
 
+static int ath11k_reg_11d_new_cc_event(struct ath11k_base *ab, struct sk_buff *skb)
+{
+	const struct wmi_11d_new_cc_ev *ev;
+	const void **tb;
+	int ret;
+
+	tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC);
+	if (IS_ERR(tb)) {
+		ret = PTR_ERR(tb);
+		ath11k_warn(ab, "failed to parse tlv: %d\n", ret);
+		return ret;
+	}
+
+	ev = tb[WMI_TAG_11D_NEW_COUNTRY_EVENT];
+	if (!ev) {
+		kfree(tb);
+		ath11k_warn(ab, "failed to fetch 11d new cc ev");
+		return -EPROTO;
+	}
+
+	spin_lock_bh(&ab->base_lock);
+	memcpy(&ab->new_alpha2, &ev->new_alpha2, 2);
+	spin_unlock_bh(&ab->base_lock);
+
+	ath11k_dbg(ab, ATH11K_DBG_WMI, "wmi 11d new cc %c%c\n",
+		   ab->new_alpha2[0],
+		   ab->new_alpha2[1]);
+
+	kfree(tb);
+
+	queue_work(ab->workqueue, &ab->update_11d_work);
+
+	return 0;
+}
+
 static void ath11k_wmi_htc_tx_complete(struct ath11k_base *ab,
 				       struct sk_buff *skb)
 {
@@ -7321,6 +7427,9 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb)
 	case WMI_WOW_WAKEUP_HOST_EVENTID:
 		ath11k_wmi_event_wow_wakeup_host(ab, skb);
 		break;
+	case WMI_11D_NEW_COUNTRY_EVENTID:
+		ath11k_reg_11d_new_cc_event(ab, skb);
+		break;
 	/* TODO: Add remaining events */
 	default:
 		ath11k_dbg(ab, ATH11K_DBG_WMI, "Unknown eventid: 0x%x\n", id);
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index e1686a2ab520..3b7ad14f0901 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -3813,6 +3813,28 @@ struct wmi_init_country_cmd {
 	} cc_info;
 } __packed;
 
+struct wmi_11d_scan_start_params {
+	u32 vdev_id;
+	u32 scan_period_msec;
+	u32 start_interval_msec;
+};
+
+struct wmi_11d_scan_start_cmd {
+	u32 tlv_header;
+	u32 vdev_id;
+	u32 scan_period_msec;
+	u32 start_interval_msec;
+} __packed;
+
+struct wmi_11d_scan_stop_cmd {
+	u32 tlv_header;
+	u32 vdev_id;
+} __packed;
+
+struct wmi_11d_new_cc_ev {
+	u32 new_alpha2;
+} __packed;
+
 #define THERMAL_LEVELS  1
 struct tt_level_config {
 	u32 tmplwm;
@@ -5448,6 +5470,11 @@ int ath11k_wmi_send_set_current_country_cmd(struct ath11k *ar,
 int
 ath11k_wmi_send_init_country_cmd(struct ath11k *ar,
 				 struct wmi_init_country_params init_cc_param);
+
+int ath11k_wmi_send_11d_scan_start_cmd(struct ath11k *ar,
+				       struct wmi_11d_scan_start_params *param);
+int ath11k_wmi_send_11d_scan_stop_cmd(struct ath11k *ar, u32 vdev_id);
+
 int
 ath11k_wmi_send_thermal_mitigation_param_cmd(struct ath11k *ar,
 					     struct thermal_mitigation_params *param);
-- 
2.31.1


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

* Re: [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855
  2021-11-18 10:05 [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 Wen Gong
  2021-11-18 10:05 ` [PATCH v2 1/2] ath11k: add configure country code for QCA6390 and WCN6855 Wen Gong
  2021-11-18 10:05 ` [PATCH v2 2/2] ath11k: add 11d scan offload support Wen Gong
@ 2021-11-22 12:28 ` Kalle Valo
  2021-11-25 11:00   ` Wen Gong
  2021-11-25 11:01   ` Wen Gong
  2 siblings, 2 replies; 8+ messages in thread
From: Kalle Valo @ 2021-11-22 12:28 UTC (permalink / raw)
  To: Wen Gong; +Cc: ath11k, linux-wireless

Wen Gong <quic_wgong@quicinc.com> writes:

> v2:
>    1. rebased to latest ath.git master ath-202111170737
>    2. add "ath11k: add configure country code for QCA6390 and WCN6855", it is needed for 
>       patch "ath11k: add 11d scan offload support"
>
> Wen Gong (2):
>   ath11k: add configure country code for QCA6390 and WCN6855
>   ath11k: add 11d scan offload support
>
>  drivers/net/wireless/ath/ath11k/core.c |  30 +++++
>  drivers/net/wireless/ath/ath11k/core.h |   9 ++
>  drivers/net/wireless/ath/ath11k/mac.c  | 162 ++++++++++++++++++++++++-
>  drivers/net/wireless/ath/ath11k/mac.h  |   7 ++
>  drivers/net/wireless/ath/ath11k/pci.c  |   1 +
>  drivers/net/wireless/ath/ath11k/reg.c  |  15 +++
>  drivers/net/wireless/ath/ath11k/wmi.c  | 145 ++++++++++++++++++++++
>  drivers/net/wireless/ath/ath11k/wmi.h  |  39 ++++++
>  8 files changed, 407 insertions(+), 1 deletion(-)

I suspect this patch adds a new lockdep warning on my NUC testbox.

Tag:	ath-202111221111

[   87.034989] ath11k_pci 0000:06:00.0: MSI vectors: 32
[   87.035059] ath11k_pci 0000:06:00.0: qca6390 hw2.0
[   87.684032] ath11k_pci 0000:06:00.0: chip_id 0x0 chip_family 0xb board_id 0xff soc_id 0xffffffff
[   87.684277] ath11k_pci 0000:06:00.0: fw_version 0x101c06cc fw_build_timestamp 2020-06-24 19:50 fw_build

[...]

[  527.024672] ======================================================
[  527.024708] WARNING: possible circular locking dependency detected
[  527.024746] 5.16.0-rc1-wt-ath+ #528 Not tainted
[  527.024785] ------------------------------------------------------
[  527.024819] wpa_supplicant/2309 is trying to acquire lock:
[  527.024857] ffff88811fe6f148 ((wq_completion)phy0){+.+.}-{0:0}, at: flush_workqueue+0xd9/0x1340
[  527.024901] 
               but task is already holding lock:
[  527.024934] ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_stop+0xa0/0x680 [mac80211]
[  527.025023] 
               which lock already depends on the new lock.

[  527.025058] 
               the existing dependency chain (in reverse order) is:
[  527.025091] 
               -> #3 (&rdev->wiphy.mtx){+.+.}-{3:3}:
[  527.025129]        __lock_acquire+0xb72/0x1870
[  527.025166]        lock_acquire.part.0+0x117/0x340
[  527.025219]        __mutex_lock+0x15a/0x1610
[  527.025267]        reg_process_self_managed_hints+0x5e/0x130 [cfg80211]
[  527.025343]        wiphy_register+0x1607/0x2640 [cfg80211]
[  527.025409]        ieee80211_register_hw+0x17d5/0x3150 [mac80211]
[  527.025481]        __ath11k_mac_register+0x1944/0x25c0 [ath11k]
[  527.025530]        ath11k_mac_register+0x2ee/0x610 [ath11k]
[  527.025578]        ath11k_core_qmi_firmware_ready.part.0+0x9e/0x2b0 [ath11k]
[  527.025626]        ath11k_qmi_driver_event_work+0x49c/0xa80 [ath11k]
[  527.025674]        process_one_work+0x866/0x1490
[  527.026142]        worker_thread+0x596/0x1010
[  527.026180]        kthread+0x35d/0x420
[  527.026247]        ret_from_fork+0x22/0x30
[  527.026282] 
               -> #2 (rtnl_mutex){+.+.}-{3:3}:
[  527.026319]        __lock_acquire+0xb72/0x1870
[  527.026355]        lock_acquire.part.0+0x117/0x340
[  527.026388]        __mutex_lock+0x15a/0x1610
[  527.026423]        ath11k_regd_update+0x1ce/0x580 [ath11k]
[  527.026471]        process_one_work+0x866/0x1490
[  527.026505]        worker_thread+0x596/0x1010
[  527.026540]        kthread+0x35d/0x420
[  527.026574]        ret_from_fork+0x22/0x30
[  527.026608] 
               -> #1 ((work_completion)(&ar->regd_update_work)){+.+.}-{0:0}:
[  527.026645]        __lock_acquire+0xb72/0x1870
[  527.026679]        lock_acquire.part.0+0x117/0x340
[  527.026714]        process_one_work+0x7f6/0x1490
[  527.026748]        worker_thread+0x596/0x1010
[  527.026782]        kthread+0x35d/0x420
[  527.026814]        ret_from_fork+0x22/0x30
[  527.026848] 
               -> #0 ((wq_completion)phy0){+.+.}-{0:0}:
[  527.026883]        check_prev_add+0x15e/0x20f0
[  527.026917]        validate_chain+0xf7f/0x1b30
[  527.026957]        __lock_acquire+0xb72/0x1870
[  527.026992]        lock_acquire.part.0+0x117/0x340
[  527.027026]        flush_workqueue+0xfc/0x1340
[  527.027061]        ieee80211_stop_device+0x50/0x60 [mac80211]
[  527.027142]        ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
[  527.027248]        ieee80211_stop+0xad/0x680 [mac80211]
[  527.027322]        __dev_close_many+0x18f/0x2a0
[  527.027357]        __dev_change_flags+0x264/0x680
[  527.027391]        dev_change_flags+0x86/0x150
[  527.027425]        devinet_ioctl+0xfbb/0x18f0
[  527.027460]        inet_ioctl+0x2ae/0x2f0
[  527.027493]        sock_do_ioctl+0xd5/0x1d0
[  527.027527]        sock_ioctl+0x1c1/0x570
[  527.027561]        __x64_sys_ioctl+0x122/0x190
[  527.027598]        do_syscall_64+0x3b/0x90
[  527.027631]        entry_SYSCALL_64_after_hwframe+0x44/0xae
[  527.027666] 
               other info that might help us debug this:

[  527.027700] Chain exists of:
                 (wq_completion)phy0 --> rtnl_mutex --> &rdev->wiphy.mtx

[  527.027739]  Possible unsafe locking scenario:

[  527.027772]        CPU0                    CPU1
[  527.027808]        ----                    ----
[  527.027841]   lock(&rdev->wiphy.mtx);
[  527.027880]                                lock(rtnl_mutex);
[  527.027916]                                lock(&rdev->wiphy.mtx);
[  527.027950]   lock((wq_completion)phy0);
[  527.027984] 
                *** DEADLOCK ***

[  527.028017] 2 locks held by wpa_supplicant/2309:
[  527.028051]  #0: ffffffff8ff3cb70 (rtnl_mutex){+.+.}-{3:3}, at: devinet_ioctl+0x182/0x18f0
[  527.029006]  #1: ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_stop+0xa0/0x680 [mac80211]
[  527.029087] 
               stack backtrace:
[  527.029121] CPU: 6 PID: 2309 Comm: wpa_supplicant Kdump: loaded Not tainted 5.16.0-rc1-wt-ath+ #528
[  527.029158] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
[  527.029211] Call Trace:
[  527.029246]  <TASK>
[  527.029292]  dump_stack_lvl+0x57/0x7d
[  527.029328]  check_noncircular+0x26a/0x310
[  527.029363]  ? print_circular_bug+0x450/0x450
[  527.029403]  ? __kernel_text_address+0x9/0x30
[  527.029439]  ? alloc_chain_hlocks+0x1de/0x530
[  527.029474]  check_prev_add+0x15e/0x20f0
[  527.029511]  ? __lock_acquire+0xb72/0x1870
[  527.029547]  validate_chain+0xf7f/0x1b30
[  527.029583]  ? check_prev_add+0x20f0/0x20f0
[  527.029618]  ? __lock_release+0x4bd/0x9f0
[  527.029655]  __lock_acquire+0xb72/0x1870
[  527.029691]  lock_acquire.part.0+0x117/0x340
[  527.029727]  ? flush_workqueue+0xd9/0x1340
[  527.029763]  ? rcu_read_unlock+0x40/0x40
[  527.029799]  ? rcu_read_lock_sched_held+0x3a/0x70
[  527.029833]  ? lock_acquire+0x1a8/0x210
[  527.029868]  ? flush_workqueue+0xd9/0x1340
[  527.029903]  flush_workqueue+0xfc/0x1340
[  527.029936]  ? flush_workqueue+0xd9/0x1340
[  527.029970]  ? mark_held_locks+0xa5/0xe0
[  527.030009]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
[  527.030044]  ? check_flush_dependency+0x350/0x350
[  527.030082]  ? ath11k_mac_op_remove_interface+0x58b/0xa20 [ath11k]
[  527.030131]  ? ieee80211_stop_device+0x50/0x60 [mac80211]
[  527.030241]  ieee80211_stop_device+0x50/0x60 [mac80211]
[  527.030321]  ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
[  527.030397]  ? mutex_lock_io_nested+0x1470/0x1470
[  527.030436]  ? lock_downgrade+0x130/0x130
[  527.030473]  ? ieee80211_adjust_monitor_flags+0x1f0/0x1f0 [mac80211]
[  527.030547]  ? mark_held_locks+0xa5/0xe0
[  527.030583]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
[  527.030618]  ? __local_bh_enable_ip+0xa0/0x110
[  527.030654]  ieee80211_stop+0xad/0x680 [mac80211]
[  527.030728]  __dev_close_many+0x18f/0x2a0
[  527.030764]  ? unregister_netdevice_notifier+0x150/0x150
[  527.030799]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
[  527.030834]  ? __local_bh_enable_ip+0xa0/0x110
[  527.030869]  __dev_change_flags+0x264/0x680
[  527.030903]  ? dev_set_allmulti+0x10/0x10
[  527.030940]  dev_change_flags+0x86/0x150
[  527.030976]  devinet_ioctl+0xfbb/0x18f0
[  527.031011]  inet_ioctl+0x2ae/0x2f0
[  527.031048]  ? inet_dgram_connect+0x220/0x220
[  527.031087]  ? lock_downgrade+0x130/0x130
[  527.032054]  ? __might_fault+0xb3/0x160
[  527.032090]  ? __might_fault+0xb3/0x160
[  527.032124]  ? _copy_to_user+0x94/0xb0
[  527.032160]  sock_do_ioctl+0xd5/0x1d0
[  527.032216]  ? put_user_ifreq+0x70/0x70
[  527.032279]  ? vfs_fileattr_set+0x930/0x930
[  527.032314]  ? selinux_file_ioctl+0x375/0x520
[  527.032350]  sock_ioctl+0x1c1/0x570
[  527.032385]  ? br_ioctl_call+0x90/0x90
[  527.032420]  ? __ia32_sys_sendmmsg+0xeb/0xf0
[  527.032454]  ? __sys_recvmsg_sock+0x10/0x10
[  527.032492]  __x64_sys_ioctl+0x122/0x190
[  527.032527]  do_syscall_64+0x3b/0x90
[  527.032562]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  527.032597] RIP: 0033:0x7fd37113850b
[  527.032636] Code: 0f 1e fa 48 8b 05 85 39 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 55 39 0d 00 f7 d8 64 89 01 48
[  527.032679] RSP: 002b:00007ffd0174b258 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  527.032718] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd37113850b
[  527.032755] RDX: 00007ffd0174b260 RSI: 0000000000008914 RDI: 0000000000000008
[  527.032790] RBP: 0000000000000008 R08: 0000000000000007 R09: 00007fd37120cb80
[  527.032824] R10: 0000000000000007 R11: 0000000000000246 R12: 0000000000000000
[  527.032857] R13: 00005641e16bfa70 R14: 00007ffd0174b260 R15: 00005641e16b4840
[  527.032894]  </TASK>

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

* Re: [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855
  2021-11-22 12:28 ` [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 Kalle Valo
@ 2021-11-25 11:00   ` Wen Gong
  2021-11-25 11:01   ` Wen Gong
  1 sibling, 0 replies; 8+ messages in thread
From: Wen Gong @ 2021-11-25 11:00 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless

I am afraid you hit the issue same with below patch, they looks similar, 
but I am not sure it is same root cause.

https://patchwork.kernel.org/project/linux-wireless/patch/1608617166-17180-1-git-send-email-wgong@codeaurora.org/

[RFC] ath11k: fix blocked for more than 120 seconds caused by reg update

On 11/22/2021 8:28 PM, Kalle Valo wrote:
> Wen Gong <quic_wgong@quicinc.com> writes:
>
>> v2:
>>     1. rebased to latest ath.git master ath-202111170737
>>     2. add "ath11k: add configure country code for QCA6390 and WCN6855", it is needed for
>>        patch "ath11k: add 11d scan offload support"
>>
>> Wen Gong (2):
>>    ath11k: add configure country code for QCA6390 and WCN6855
>>    ath11k: add 11d scan offload support
>>
>>   drivers/net/wireless/ath/ath11k/core.c |  30 +++++
>>   drivers/net/wireless/ath/ath11k/core.h |   9 ++
>>   drivers/net/wireless/ath/ath11k/mac.c  | 162 ++++++++++++++++++++++++-
>>   drivers/net/wireless/ath/ath11k/mac.h  |   7 ++
>>   drivers/net/wireless/ath/ath11k/pci.c  |   1 +
>>   drivers/net/wireless/ath/ath11k/reg.c  |  15 +++
>>   drivers/net/wireless/ath/ath11k/wmi.c  | 145 ++++++++++++++++++++++
>>   drivers/net/wireless/ath/ath11k/wmi.h  |  39 ++++++
>>   8 files changed, 407 insertions(+), 1 deletion(-)
> I suspect this patch adds a new lockdep warning on my NUC testbox.
>
> Tag:	ath-202111221111
>
> [   87.034989] ath11k_pci 0000:06:00.0: MSI vectors: 32
> [   87.035059] ath11k_pci 0000:06:00.0: qca6390 hw2.0
> [   87.684032] ath11k_pci 0000:06:00.0: chip_id 0x0 chip_family 0xb board_id 0xff soc_id 0xffffffff
> [   87.684277] ath11k_pci 0000:06:00.0: fw_version 0x101c06cc fw_build_timestamp 2020-06-24 19:50 fw_build
>
> [...]
>
> [  527.024672] ======================================================
> [  527.024708] WARNING: possible circular locking dependency detected
> [  527.024746] 5.16.0-rc1-wt-ath+ #528 Not tainted
> [  527.024785] ------------------------------------------------------
> [  527.024819] wpa_supplicant/2309 is trying to acquire lock:
> [  527.024857] ffff88811fe6f148 ((wq_completion)phy0){+.+.}-{0:0}, at: flush_workqueue+0xd9/0x1340
> [  527.024901]
>                 but task is already holding lock:
> [  527.024934] ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_stop+0xa0/0x680 [mac80211]
> [  527.025023]
>                 which lock already depends on the new lock.
>
> [  527.025058]
>                 the existing dependency chain (in reverse order) is:
> [  527.025091]
>                 -> #3 (&rdev->wiphy.mtx){+.+.}-{3:3}:
> [  527.025129]        __lock_acquire+0xb72/0x1870
> [  527.025166]        lock_acquire.part.0+0x117/0x340
> [  527.025219]        __mutex_lock+0x15a/0x1610
> [  527.025267]        reg_process_self_managed_hints+0x5e/0x130 [cfg80211]
> [  527.025343]        wiphy_register+0x1607/0x2640 [cfg80211]
> [  527.025409]        ieee80211_register_hw+0x17d5/0x3150 [mac80211]
> [  527.025481]        __ath11k_mac_register+0x1944/0x25c0 [ath11k]
> [  527.025530]        ath11k_mac_register+0x2ee/0x610 [ath11k]
> [  527.025578]        ath11k_core_qmi_firmware_ready.part.0+0x9e/0x2b0 [ath11k]
> [  527.025626]        ath11k_qmi_driver_event_work+0x49c/0xa80 [ath11k]
> [  527.025674]        process_one_work+0x866/0x1490
> [  527.026142]        worker_thread+0x596/0x1010
> [  527.026180]        kthread+0x35d/0x420
> [  527.026247]        ret_from_fork+0x22/0x30
> [  527.026282]
>                 -> #2 (rtnl_mutex){+.+.}-{3:3}:
> [  527.026319]        __lock_acquire+0xb72/0x1870
> [  527.026355]        lock_acquire.part.0+0x117/0x340
> [  527.026388]        __mutex_lock+0x15a/0x1610
> [  527.026423]        ath11k_regd_update+0x1ce/0x580 [ath11k]
> [  527.026471]        process_one_work+0x866/0x1490
> [  527.026505]        worker_thread+0x596/0x1010
> [  527.026540]        kthread+0x35d/0x420
> [  527.026574]        ret_from_fork+0x22/0x30
> [  527.026608]
>                 -> #1 ((work_completion)(&ar->regd_update_work)){+.+.}-{0:0}:
> [  527.026645]        __lock_acquire+0xb72/0x1870
> [  527.026679]        lock_acquire.part.0+0x117/0x340
> [  527.026714]        process_one_work+0x7f6/0x1490
> [  527.026748]        worker_thread+0x596/0x1010
> [  527.026782]        kthread+0x35d/0x420
> [  527.026814]        ret_from_fork+0x22/0x30
> [  527.026848]
>                 -> #0 ((wq_completion)phy0){+.+.}-{0:0}:
> [  527.026883]        check_prev_add+0x15e/0x20f0
> [  527.026917]        validate_chain+0xf7f/0x1b30
> [  527.026957]        __lock_acquire+0xb72/0x1870
> [  527.026992]        lock_acquire.part.0+0x117/0x340
> [  527.027026]        flush_workqueue+0xfc/0x1340
> [  527.027061]        ieee80211_stop_device+0x50/0x60 [mac80211]
> [  527.027142]        ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
> [  527.027248]        ieee80211_stop+0xad/0x680 [mac80211]
> [  527.027322]        __dev_close_many+0x18f/0x2a0
> [  527.027357]        __dev_change_flags+0x264/0x680
> [  527.027391]        dev_change_flags+0x86/0x150
> [  527.027425]        devinet_ioctl+0xfbb/0x18f0
> [  527.027460]        inet_ioctl+0x2ae/0x2f0
> [  527.027493]        sock_do_ioctl+0xd5/0x1d0
> [  527.027527]        sock_ioctl+0x1c1/0x570
> [  527.027561]        __x64_sys_ioctl+0x122/0x190
> [  527.027598]        do_syscall_64+0x3b/0x90
> [  527.027631]        entry_SYSCALL_64_after_hwframe+0x44/0xae
> [  527.027666]
>                 other info that might help us debug this:
>
> [  527.027700] Chain exists of:
>                   (wq_completion)phy0 --> rtnl_mutex --> &rdev->wiphy.mtx
>
> [  527.027739]  Possible unsafe locking scenario:
>
> [  527.027772]        CPU0                    CPU1
> [  527.027808]        ----                    ----
> [  527.027841]   lock(&rdev->wiphy.mtx);
> [  527.027880]                                lock(rtnl_mutex);
> [  527.027916]                                lock(&rdev->wiphy.mtx);
> [  527.027950]   lock((wq_completion)phy0);
> [  527.027984]
>                  *** DEADLOCK ***
>
> [  527.028017] 2 locks held by wpa_supplicant/2309:
> [  527.028051]  #0: ffffffff8ff3cb70 (rtnl_mutex){+.+.}-{3:3}, at: devinet_ioctl+0x182/0x18f0
> [  527.029006]  #1: ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_stop+0xa0/0x680 [mac80211]
> [  527.029087]
>                 stack backtrace:
> [  527.029121] CPU: 6 PID: 2309 Comm: wpa_supplicant Kdump: loaded Not tainted 5.16.0-rc1-wt-ath+ #528
> [  527.029158] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
> [  527.029211] Call Trace:
> [  527.029246]  <TASK>
> [  527.029292]  dump_stack_lvl+0x57/0x7d
> [  527.029328]  check_noncircular+0x26a/0x310
> [  527.029363]  ? print_circular_bug+0x450/0x450
> [  527.029403]  ? __kernel_text_address+0x9/0x30
> [  527.029439]  ? alloc_chain_hlocks+0x1de/0x530
> [  527.029474]  check_prev_add+0x15e/0x20f0
> [  527.029511]  ? __lock_acquire+0xb72/0x1870
> [  527.029547]  validate_chain+0xf7f/0x1b30
> [  527.029583]  ? check_prev_add+0x20f0/0x20f0
> [  527.029618]  ? __lock_release+0x4bd/0x9f0
> [  527.029655]  __lock_acquire+0xb72/0x1870
> [  527.029691]  lock_acquire.part.0+0x117/0x340
> [  527.029727]  ? flush_workqueue+0xd9/0x1340
> [  527.029763]  ? rcu_read_unlock+0x40/0x40
> [  527.029799]  ? rcu_read_lock_sched_held+0x3a/0x70
> [  527.029833]  ? lock_acquire+0x1a8/0x210
> [  527.029868]  ? flush_workqueue+0xd9/0x1340
> [  527.029903]  flush_workqueue+0xfc/0x1340
> [  527.029936]  ? flush_workqueue+0xd9/0x1340
> [  527.029970]  ? mark_held_locks+0xa5/0xe0
> [  527.030009]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
> [  527.030044]  ? check_flush_dependency+0x350/0x350
> [  527.030082]  ? ath11k_mac_op_remove_interface+0x58b/0xa20 [ath11k]
> [  527.030131]  ? ieee80211_stop_device+0x50/0x60 [mac80211]
> [  527.030241]  ieee80211_stop_device+0x50/0x60 [mac80211]
> [  527.030321]  ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
> [  527.030397]  ? mutex_lock_io_nested+0x1470/0x1470
> [  527.030436]  ? lock_downgrade+0x130/0x130
> [  527.030473]  ? ieee80211_adjust_monitor_flags+0x1f0/0x1f0 [mac80211]
> [  527.030547]  ? mark_held_locks+0xa5/0xe0
> [  527.030583]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
> [  527.030618]  ? __local_bh_enable_ip+0xa0/0x110
> [  527.030654]  ieee80211_stop+0xad/0x680 [mac80211]
> [  527.030728]  __dev_close_many+0x18f/0x2a0
> [  527.030764]  ? unregister_netdevice_notifier+0x150/0x150
> [  527.030799]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
> [  527.030834]  ? __local_bh_enable_ip+0xa0/0x110
> [  527.030869]  __dev_change_flags+0x264/0x680
> [  527.030903]  ? dev_set_allmulti+0x10/0x10
> [  527.030940]  dev_change_flags+0x86/0x150
> [  527.030976]  devinet_ioctl+0xfbb/0x18f0
> [  527.031011]  inet_ioctl+0x2ae/0x2f0
> [  527.031048]  ? inet_dgram_connect+0x220/0x220
> [  527.031087]  ? lock_downgrade+0x130/0x130
> [  527.032054]  ? __might_fault+0xb3/0x160
> [  527.032090]  ? __might_fault+0xb3/0x160
> [  527.032124]  ? _copy_to_user+0x94/0xb0
> [  527.032160]  sock_do_ioctl+0xd5/0x1d0
> [  527.032216]  ? put_user_ifreq+0x70/0x70
> [  527.032279]  ? vfs_fileattr_set+0x930/0x930
> [  527.032314]  ? selinux_file_ioctl+0x375/0x520
> [  527.032350]  sock_ioctl+0x1c1/0x570
> [  527.032385]  ? br_ioctl_call+0x90/0x90
> [  527.032420]  ? __ia32_sys_sendmmsg+0xeb/0xf0
> [  527.032454]  ? __sys_recvmsg_sock+0x10/0x10
> [  527.032492]  __x64_sys_ioctl+0x122/0x190
> [  527.032527]  do_syscall_64+0x3b/0x90
> [  527.032562]  entry_SYSCALL_64_after_hwframe+0x44/0xae
> [  527.032597] RIP: 0033:0x7fd37113850b
> [  527.032636] Code: 0f 1e fa 48 8b 05 85 39 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 55 39 0d 00 f7 d8 64 89 01 48
> [  527.032679] RSP: 002b:00007ffd0174b258 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> [  527.032718] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd37113850b
> [  527.032755] RDX: 00007ffd0174b260 RSI: 0000000000008914 RDI: 0000000000000008
> [  527.032790] RBP: 0000000000000008 R08: 0000000000000007 R09: 00007fd37120cb80
> [  527.032824] R10: 0000000000000007 R11: 0000000000000246 R12: 0000000000000000
> [  527.032857] R13: 00005641e16bfa70 R14: 00007ffd0174b260 R15: 00005641e16b4840
> [  527.032894]  </TASK>
>

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

* Re: [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855
  2021-11-22 12:28 ` [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 Kalle Valo
  2021-11-25 11:00   ` Wen Gong
@ 2021-11-25 11:01   ` Wen Gong
  2021-11-26 11:23     ` Wen Gong
  1 sibling, 1 reply; 8+ messages in thread
From: Wen Gong @ 2021-11-25 11:01 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless

Hi Kalle,

I am afraid you hit same issue of below patch, they looks similar, but I 
am not sure they are the same root cause.

https://patchwork.kernel.org/project/linux-wireless/patch/1608617166-17180-1-git-send-email-wgong@codeaurora.org/

[RFC] ath11k: fix blocked for more than 120 seconds caused by reg update

On 11/22/2021 8:28 PM, Kalle Valo wrote:
> Wen Gong <quic_wgong@quicinc.com> writes:
>
>> v2:
>>     1. rebased to latest ath.git master ath-202111170737
>>     2. add "ath11k: add configure country code for QCA6390 and WCN6855", it is needed for
>>        patch "ath11k: add 11d scan offload support"
>>
>> Wen Gong (2):
>>    ath11k: add configure country code for QCA6390 and WCN6855
>>    ath11k: add 11d scan offload support
>>
>>   drivers/net/wireless/ath/ath11k/core.c |  30 +++++
>>   drivers/net/wireless/ath/ath11k/core.h |   9 ++
>>   drivers/net/wireless/ath/ath11k/mac.c  | 162 ++++++++++++++++++++++++-
>>   drivers/net/wireless/ath/ath11k/mac.h  |   7 ++
>>   drivers/net/wireless/ath/ath11k/pci.c  |   1 +
>>   drivers/net/wireless/ath/ath11k/reg.c  |  15 +++
>>   drivers/net/wireless/ath/ath11k/wmi.c  | 145 ++++++++++++++++++++++
>>   drivers/net/wireless/ath/ath11k/wmi.h  |  39 ++++++
>>   8 files changed, 407 insertions(+), 1 deletion(-)
> I suspect this patch adds a new lockdep warning on my NUC testbox.
>
> Tag:	ath-202111221111
>
> [   87.034989] ath11k_pci 0000:06:00.0: MSI vectors: 32
> [   87.035059] ath11k_pci 0000:06:00.0: qca6390 hw2.0
> [   87.684032] ath11k_pci 0000:06:00.0: chip_id 0x0 chip_family 0xb board_id 0xff soc_id 0xffffffff
> [   87.684277] ath11k_pci 0000:06:00.0: fw_version 0x101c06cc fw_build_timestamp 2020-06-24 19:50 fw_build
>
> [...]
>
> [  527.024672] ======================================================
> [  527.024708] WARNING: possible circular locking dependency detected
> [  527.024746] 5.16.0-rc1-wt-ath+ #528 Not tainted
> [  527.024785] ------------------------------------------------------
> [  527.024819] wpa_supplicant/2309 is trying to acquire lock:
> [  527.024857] ffff88811fe6f148 ((wq_completion)phy0){+.+.}-{0:0}, at: flush_workqueue+0xd9/0x1340
> [  527.024901]
>                 but task is already holding lock:
> [  527.024934] ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_stop+0xa0/0x680 [mac80211]
> [  527.025023]
>                 which lock already depends on the new lock.
>
> [  527.025058]
>                 the existing dependency chain (in reverse order) is:
> [  527.025091]
>                 -> #3 (&rdev->wiphy.mtx){+.+.}-{3:3}:
> [  527.025129]        __lock_acquire+0xb72/0x1870
> [  527.025166]        lock_acquire.part.0+0x117/0x340
> [  527.025219]        __mutex_lock+0x15a/0x1610
> [  527.025267]        reg_process_self_managed_hints+0x5e/0x130 [cfg80211]
> [  527.025343]        wiphy_register+0x1607/0x2640 [cfg80211]
> [  527.025409]        ieee80211_register_hw+0x17d5/0x3150 [mac80211]
> [  527.025481]        __ath11k_mac_register+0x1944/0x25c0 [ath11k]
> [  527.025530]        ath11k_mac_register+0x2ee/0x610 [ath11k]
> [  527.025578]        ath11k_core_qmi_firmware_ready.part.0+0x9e/0x2b0 [ath11k]
> [  527.025626]        ath11k_qmi_driver_event_work+0x49c/0xa80 [ath11k]
> [  527.025674]        process_one_work+0x866/0x1490
> [  527.026142]        worker_thread+0x596/0x1010
> [  527.026180]        kthread+0x35d/0x420
> [  527.026247]        ret_from_fork+0x22/0x30
> [  527.026282]
>                 -> #2 (rtnl_mutex){+.+.}-{3:3}:
> [  527.026319]        __lock_acquire+0xb72/0x1870
> [  527.026355]        lock_acquire.part.0+0x117/0x340
> [  527.026388]        __mutex_lock+0x15a/0x1610
> [  527.026423]        ath11k_regd_update+0x1ce/0x580 [ath11k]
> [  527.026471]        process_one_work+0x866/0x1490
> [  527.026505]        worker_thread+0x596/0x1010
> [  527.026540]        kthread+0x35d/0x420
> [  527.026574]        ret_from_fork+0x22/0x30
> [  527.026608]
>                 -> #1 ((work_completion)(&ar->regd_update_work)){+.+.}-{0:0}:
> [  527.026645]        __lock_acquire+0xb72/0x1870
> [  527.026679]        lock_acquire.part.0+0x117/0x340
> [  527.026714]        process_one_work+0x7f6/0x1490
> [  527.026748]        worker_thread+0x596/0x1010
> [  527.026782]        kthread+0x35d/0x420
> [  527.026814]        ret_from_fork+0x22/0x30
> [  527.026848]
>                 -> #0 ((wq_completion)phy0){+.+.}-{0:0}:
> [  527.026883]        check_prev_add+0x15e/0x20f0
> [  527.026917]        validate_chain+0xf7f/0x1b30
> [  527.026957]        __lock_acquire+0xb72/0x1870
> [  527.026992]        lock_acquire.part.0+0x117/0x340
> [  527.027026]        flush_workqueue+0xfc/0x1340
> [  527.027061]        ieee80211_stop_device+0x50/0x60 [mac80211]
> [  527.027142]        ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
> [  527.027248]        ieee80211_stop+0xad/0x680 [mac80211]
> [  527.027322]        __dev_close_many+0x18f/0x2a0
> [  527.027357]        __dev_change_flags+0x264/0x680
> [  527.027391]        dev_change_flags+0x86/0x150
> [  527.027425]        devinet_ioctl+0xfbb/0x18f0
> [  527.027460]        inet_ioctl+0x2ae/0x2f0
> [  527.027493]        sock_do_ioctl+0xd5/0x1d0
> [  527.027527]        sock_ioctl+0x1c1/0x570
> [  527.027561]        __x64_sys_ioctl+0x122/0x190
> [  527.027598]        do_syscall_64+0x3b/0x90
> [  527.027631]        entry_SYSCALL_64_after_hwframe+0x44/0xae
> [  527.027666]
>                 other info that might help us debug this:
>
> [  527.027700] Chain exists of:
>                   (wq_completion)phy0 --> rtnl_mutex --> &rdev->wiphy.mtx
>
> [  527.027739]  Possible unsafe locking scenario:
>
> [  527.027772]        CPU0                    CPU1
> [  527.027808]        ----                    ----
> [  527.027841]   lock(&rdev->wiphy.mtx);
> [  527.027880]                                lock(rtnl_mutex);
> [  527.027916]                                lock(&rdev->wiphy.mtx);
> [  527.027950]   lock((wq_completion)phy0);
> [  527.027984]
>                  *** DEADLOCK ***
>
> [  527.028017] 2 locks held by wpa_supplicant/2309:
> [  527.028051]  #0: ffffffff8ff3cb70 (rtnl_mutex){+.+.}-{3:3}, at: devinet_ioctl+0x182/0x18f0
> [  527.029006]  #1: ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_stop+0xa0/0x680 [mac80211]
> [  527.029087]
>                 stack backtrace:
> [  527.029121] CPU: 6 PID: 2309 Comm: wpa_supplicant Kdump: loaded Not tainted 5.16.0-rc1-wt-ath+ #528
> [  527.029158] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
> [  527.029211] Call Trace:
> [  527.029246]  <TASK>
> [  527.029292]  dump_stack_lvl+0x57/0x7d
> [  527.029328]  check_noncircular+0x26a/0x310
> [  527.029363]  ? print_circular_bug+0x450/0x450
> [  527.029403]  ? __kernel_text_address+0x9/0x30
> [  527.029439]  ? alloc_chain_hlocks+0x1de/0x530
> [  527.029474]  check_prev_add+0x15e/0x20f0
> [  527.029511]  ? __lock_acquire+0xb72/0x1870
> [  527.029547]  validate_chain+0xf7f/0x1b30
> [  527.029583]  ? check_prev_add+0x20f0/0x20f0
> [  527.029618]  ? __lock_release+0x4bd/0x9f0
> [  527.029655]  __lock_acquire+0xb72/0x1870
> [  527.029691]  lock_acquire.part.0+0x117/0x340
> [  527.029727]  ? flush_workqueue+0xd9/0x1340
> [  527.029763]  ? rcu_read_unlock+0x40/0x40
> [  527.029799]  ? rcu_read_lock_sched_held+0x3a/0x70
> [  527.029833]  ? lock_acquire+0x1a8/0x210
> [  527.029868]  ? flush_workqueue+0xd9/0x1340
> [  527.029903]  flush_workqueue+0xfc/0x1340
> [  527.029936]  ? flush_workqueue+0xd9/0x1340
> [  527.029970]  ? mark_held_locks+0xa5/0xe0
> [  527.030009]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
> [  527.030044]  ? check_flush_dependency+0x350/0x350
> [  527.030082]  ? ath11k_mac_op_remove_interface+0x58b/0xa20 [ath11k]
> [  527.030131]  ? ieee80211_stop_device+0x50/0x60 [mac80211]
> [  527.030241]  ieee80211_stop_device+0x50/0x60 [mac80211]
> [  527.030321]  ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
> [  527.030397]  ? mutex_lock_io_nested+0x1470/0x1470
> [  527.030436]  ? lock_downgrade+0x130/0x130
> [  527.030473]  ? ieee80211_adjust_monitor_flags+0x1f0/0x1f0 [mac80211]
> [  527.030547]  ? mark_held_locks+0xa5/0xe0
> [  527.030583]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
> [  527.030618]  ? __local_bh_enable_ip+0xa0/0x110
> [  527.030654]  ieee80211_stop+0xad/0x680 [mac80211]
> [  527.030728]  __dev_close_many+0x18f/0x2a0
> [  527.030764]  ? unregister_netdevice_notifier+0x150/0x150
> [  527.030799]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
> [  527.030834]  ? __local_bh_enable_ip+0xa0/0x110
> [  527.030869]  __dev_change_flags+0x264/0x680
> [  527.030903]  ? dev_set_allmulti+0x10/0x10
> [  527.030940]  dev_change_flags+0x86/0x150
> [  527.030976]  devinet_ioctl+0xfbb/0x18f0
> [  527.031011]  inet_ioctl+0x2ae/0x2f0
> [  527.031048]  ? inet_dgram_connect+0x220/0x220
> [  527.031087]  ? lock_downgrade+0x130/0x130
> [  527.032054]  ? __might_fault+0xb3/0x160
> [  527.032090]  ? __might_fault+0xb3/0x160
> [  527.032124]  ? _copy_to_user+0x94/0xb0
> [  527.032160]  sock_do_ioctl+0xd5/0x1d0
> [  527.032216]  ? put_user_ifreq+0x70/0x70
> [  527.032279]  ? vfs_fileattr_set+0x930/0x930
> [  527.032314]  ? selinux_file_ioctl+0x375/0x520
> [  527.032350]  sock_ioctl+0x1c1/0x570
> [  527.032385]  ? br_ioctl_call+0x90/0x90
> [  527.032420]  ? __ia32_sys_sendmmsg+0xeb/0xf0
> [  527.032454]  ? __sys_recvmsg_sock+0x10/0x10
> [  527.032492]  __x64_sys_ioctl+0x122/0x190
> [  527.032527]  do_syscall_64+0x3b/0x90
> [  527.032562]  entry_SYSCALL_64_after_hwframe+0x44/0xae
> [  527.032597] RIP: 0033:0x7fd37113850b
> [  527.032636] Code: 0f 1e fa 48 8b 05 85 39 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 55 39 0d 00 f7 d8 64 89 01 48
> [  527.032679] RSP: 002b:00007ffd0174b258 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> [  527.032718] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd37113850b
> [  527.032755] RDX: 00007ffd0174b260 RSI: 0000000000008914 RDI: 0000000000000008
> [  527.032790] RBP: 0000000000000008 R08: 0000000000000007 R09: 00007fd37120cb80
> [  527.032824] R10: 0000000000000007 R11: 0000000000000246 R12: 0000000000000000
> [  527.032857] R13: 00005641e16bfa70 R14: 00007ffd0174b260 R15: 00005641e16b4840
> [  527.032894]  </TASK>
>

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

* Re: [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855
  2021-11-25 11:01   ` Wen Gong
@ 2021-11-26 11:23     ` Wen Gong
  2021-11-30 11:14       ` Wen Gong
  0 siblings, 1 reply; 8+ messages in thread
From: Wen Gong @ 2021-11-26 11:23 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless

Hi Kalle,

I read the 2 patches of "11d scan offload" again, not found it will 
introduce this new lockdep directly.

Could you tell what the steps/operation in your test?

I can try to reproduce it after enable the lockdep config.

On 11/25/2021 7:01 PM, Wen Gong wrote:
> Hi Kalle,
>
> I am afraid you hit same issue of below patch, they looks similar, but 
> I am not sure they are the same root cause.
>
> https://patchwork.kernel.org/project/linux-wireless/patch/1608617166-17180-1-git-send-email-wgong@codeaurora.org/ 
>
>
> [RFC] ath11k: fix blocked for more than 120 seconds caused by reg update
>
> On 11/22/2021 8:28 PM, Kalle Valo wrote:
>> Wen Gong <quic_wgong@quicinc.com> writes:
>>
>>> v2:
>>>     1. rebased to latest ath.git master ath-202111170737
>>>     2. add "ath11k: add configure country code for QCA6390 and 
>>> WCN6855", it is needed for
>>>        patch "ath11k: add 11d scan offload support"
>>>
>>> Wen Gong (2):
>>>    ath11k: add configure country code for QCA6390 and WCN6855
>>>    ath11k: add 11d scan offload support
>>>
>>>   drivers/net/wireless/ath/ath11k/core.c |  30 +++++
>>>   drivers/net/wireless/ath/ath11k/core.h |   9 ++
>>>   drivers/net/wireless/ath/ath11k/mac.c  | 162 
>>> ++++++++++++++++++++++++-
>>>   drivers/net/wireless/ath/ath11k/mac.h  |   7 ++
>>>   drivers/net/wireless/ath/ath11k/pci.c  |   1 +
>>>   drivers/net/wireless/ath/ath11k/reg.c  |  15 +++
>>>   drivers/net/wireless/ath/ath11k/wmi.c  | 145 ++++++++++++++++++++++
>>>   drivers/net/wireless/ath/ath11k/wmi.h  |  39 ++++++
>>>   8 files changed, 407 insertions(+), 1 deletion(-)
>> I suspect this patch adds a new lockdep warning on my NUC testbox.
>>
>> Tag:    ath-202111221111
>>
>> [   87.034989] ath11k_pci 0000:06:00.0: MSI vectors: 32
>> [   87.035059] ath11k_pci 0000:06:00.0: qca6390 hw2.0
>> [   87.684032] ath11k_pci 0000:06:00.0: chip_id 0x0 chip_family 0xb 
>> board_id 0xff soc_id 0xffffffff
>> [   87.684277] ath11k_pci 0000:06:00.0: fw_version 0x101c06cc 
>> fw_build_timestamp 2020-06-24 19:50 fw_build
>>
>> [...]
>>
>> [  527.024672] ======================================================
>> [  527.024708] WARNING: possible circular locking dependency detected
>> [  527.024746] 5.16.0-rc1-wt-ath+ #528 Not tainted
>> [  527.024785] ------------------------------------------------------
>> [  527.024819] wpa_supplicant/2309 is trying to acquire lock:
>> [  527.024857] ffff88811fe6f148 ((wq_completion)phy0){+.+.}-{0:0}, 
>> at: flush_workqueue+0xd9/0x1340
>> [  527.024901]
>>                 but task is already holding lock:
>> [  527.024934] ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: 
>> ieee80211_stop+0xa0/0x680 [mac80211]
>> [  527.025023]
>>                 which lock already depends on the new lock.
>>
>> [  527.025058]
>>                 the existing dependency chain (in reverse order) is:
>> [  527.025091]
>>                 -> #3 (&rdev->wiphy.mtx){+.+.}-{3:3}:
>> [  527.025129]        __lock_acquire+0xb72/0x1870
>> [  527.025166]        lock_acquire.part.0+0x117/0x340
>> [  527.025219]        __mutex_lock+0x15a/0x1610
>> [  527.025267]        reg_process_self_managed_hints+0x5e/0x130 
>> [cfg80211]
>> [  527.025343]        wiphy_register+0x1607/0x2640 [cfg80211]
>> [  527.025409]        ieee80211_register_hw+0x17d5/0x3150 [mac80211]
>> [  527.025481]        __ath11k_mac_register+0x1944/0x25c0 [ath11k]
>> [  527.025530]        ath11k_mac_register+0x2ee/0x610 [ath11k]
>> [  527.025578] ath11k_core_qmi_firmware_ready.part.0+0x9e/0x2b0 [ath11k]
>> [  527.025626]        ath11k_qmi_driver_event_work+0x49c/0xa80 [ath11k]
>> [  527.025674]        process_one_work+0x866/0x1490
>> [  527.026142]        worker_thread+0x596/0x1010
>> [  527.026180]        kthread+0x35d/0x420
>> [  527.026247]        ret_from_fork+0x22/0x30
>> [  527.026282]
>>                 -> #2 (rtnl_mutex){+.+.}-{3:3}:
>> [  527.026319]        __lock_acquire+0xb72/0x1870
>> [  527.026355]        lock_acquire.part.0+0x117/0x340
>> [  527.026388]        __mutex_lock+0x15a/0x1610
>> [  527.026423]        ath11k_regd_update+0x1ce/0x580 [ath11k]
>> [  527.026471]        process_one_work+0x866/0x1490
>> [  527.026505]        worker_thread+0x596/0x1010
>> [  527.026540]        kthread+0x35d/0x420
>> [  527.026574]        ret_from_fork+0x22/0x30
>> [  527.026608]
>>                 -> #1 
>> ((work_completion)(&ar->regd_update_work)){+.+.}-{0:0}:
>> [  527.026645]        __lock_acquire+0xb72/0x1870
>> [  527.026679]        lock_acquire.part.0+0x117/0x340
>> [  527.026714]        process_one_work+0x7f6/0x1490
>> [  527.026748]        worker_thread+0x596/0x1010
>> [  527.026782]        kthread+0x35d/0x420
>> [  527.026814]        ret_from_fork+0x22/0x30
>> [  527.026848]
>>                 -> #0 ((wq_completion)phy0){+.+.}-{0:0}:
>> [  527.026883]        check_prev_add+0x15e/0x20f0
>> [  527.026917]        validate_chain+0xf7f/0x1b30
>> [  527.026957]        __lock_acquire+0xb72/0x1870
>> [  527.026992]        lock_acquire.part.0+0x117/0x340
>> [  527.027026]        flush_workqueue+0xfc/0x1340
>> [  527.027061]        ieee80211_stop_device+0x50/0x60 [mac80211]
>> [  527.027142]        ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
>> [  527.027248]        ieee80211_stop+0xad/0x680 [mac80211]
>> [  527.027322]        __dev_close_many+0x18f/0x2a0
>> [  527.027357]        __dev_change_flags+0x264/0x680
>> [  527.027391]        dev_change_flags+0x86/0x150
>> [  527.027425]        devinet_ioctl+0xfbb/0x18f0
>> [  527.027460]        inet_ioctl+0x2ae/0x2f0
>> [  527.027493]        sock_do_ioctl+0xd5/0x1d0
>> [  527.027527]        sock_ioctl+0x1c1/0x570
>> [  527.027561]        __x64_sys_ioctl+0x122/0x190
>> [  527.027598]        do_syscall_64+0x3b/0x90
>> [  527.027631]        entry_SYSCALL_64_after_hwframe+0x44/0xae
>> [  527.027666]
>>                 other info that might help us debug this:
>>
>> [  527.027700] Chain exists of:
>>                   (wq_completion)phy0 --> rtnl_mutex --> 
>> &rdev->wiphy.mtx
>>
>> [  527.027739]  Possible unsafe locking scenario:
>>
>> [  527.027772]        CPU0                    CPU1
>> [  527.027808]        ----                    ----
>> [  527.027841]   lock(&rdev->wiphy.mtx);
>> [  527.027880]                                lock(rtnl_mutex);
>> [  527.027916] lock(&rdev->wiphy.mtx);
>> [  527.027950]   lock((wq_completion)phy0);
>> [  527.027984]
>>                  *** DEADLOCK ***
>>
>> [  527.028017] 2 locks held by wpa_supplicant/2309:
>> [  527.028051]  #0: ffffffff8ff3cb70 (rtnl_mutex){+.+.}-{3:3}, at: 
>> devinet_ioctl+0x182/0x18f0
>> [  527.029006]  #1: ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, 
>> at: ieee80211_stop+0xa0/0x680 [mac80211]
>> [  527.029087]
>>                 stack backtrace:
>> [  527.029121] CPU: 6 PID: 2309 Comm: wpa_supplicant Kdump: loaded 
>> Not tainted 5.16.0-rc1-wt-ath+ #528
>> [  527.029158] Hardware name: Intel(R) Client Systems 
>> NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
>> [  527.029211] Call Trace:
>> [  527.029246]  <TASK>
>> [  527.029292]  dump_stack_lvl+0x57/0x7d
>> [  527.029328]  check_noncircular+0x26a/0x310
>> [  527.029363]  ? print_circular_bug+0x450/0x450
>> [  527.029403]  ? __kernel_text_address+0x9/0x30
>> [  527.029439]  ? alloc_chain_hlocks+0x1de/0x530
>> [  527.029474]  check_prev_add+0x15e/0x20f0
>> [  527.029511]  ? __lock_acquire+0xb72/0x1870
>> [  527.029547]  validate_chain+0xf7f/0x1b30
>> [  527.029583]  ? check_prev_add+0x20f0/0x20f0
>> [  527.029618]  ? __lock_release+0x4bd/0x9f0
>> [  527.029655]  __lock_acquire+0xb72/0x1870
>> [  527.029691]  lock_acquire.part.0+0x117/0x340
>> [  527.029727]  ? flush_workqueue+0xd9/0x1340
>> [  527.029763]  ? rcu_read_unlock+0x40/0x40
>> [  527.029799]  ? rcu_read_lock_sched_held+0x3a/0x70
>> [  527.029833]  ? lock_acquire+0x1a8/0x210
>> [  527.029868]  ? flush_workqueue+0xd9/0x1340
>> [  527.029903]  flush_workqueue+0xfc/0x1340
>> [  527.029936]  ? flush_workqueue+0xd9/0x1340
>> [  527.029970]  ? mark_held_locks+0xa5/0xe0
>> [  527.030009]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
>> [  527.030044]  ? check_flush_dependency+0x350/0x350
>> [  527.030082]  ? ath11k_mac_op_remove_interface+0x58b/0xa20 [ath11k]
>> [  527.030131]  ? ieee80211_stop_device+0x50/0x60 [mac80211]
>> [  527.030241]  ieee80211_stop_device+0x50/0x60 [mac80211]
>> [  527.030321]  ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
>> [  527.030397]  ? mutex_lock_io_nested+0x1470/0x1470
>> [  527.030436]  ? lock_downgrade+0x130/0x130
>> [  527.030473]  ? ieee80211_adjust_monitor_flags+0x1f0/0x1f0 [mac80211]
>> [  527.030547]  ? mark_held_locks+0xa5/0xe0
>> [  527.030583]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
>> [  527.030618]  ? __local_bh_enable_ip+0xa0/0x110
>> [  527.030654]  ieee80211_stop+0xad/0x680 [mac80211]
>> [  527.030728]  __dev_close_many+0x18f/0x2a0
>> [  527.030764]  ? unregister_netdevice_notifier+0x150/0x150
>> [  527.030799]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
>> [  527.030834]  ? __local_bh_enable_ip+0xa0/0x110
>> [  527.030869]  __dev_change_flags+0x264/0x680
>> [  527.030903]  ? dev_set_allmulti+0x10/0x10
>> [  527.030940]  dev_change_flags+0x86/0x150
>> [  527.030976]  devinet_ioctl+0xfbb/0x18f0
>> [  527.031011]  inet_ioctl+0x2ae/0x2f0
>> [  527.031048]  ? inet_dgram_connect+0x220/0x220
>> [  527.031087]  ? lock_downgrade+0x130/0x130
>> [  527.032054]  ? __might_fault+0xb3/0x160
>> [  527.032090]  ? __might_fault+0xb3/0x160
>> [  527.032124]  ? _copy_to_user+0x94/0xb0
>> [  527.032160]  sock_do_ioctl+0xd5/0x1d0
>> [  527.032216]  ? put_user_ifreq+0x70/0x70
>> [  527.032279]  ? vfs_fileattr_set+0x930/0x930
>> [  527.032314]  ? selinux_file_ioctl+0x375/0x520
>> [  527.032350]  sock_ioctl+0x1c1/0x570
>> [  527.032385]  ? br_ioctl_call+0x90/0x90
>> [  527.032420]  ? __ia32_sys_sendmmsg+0xeb/0xf0
>> [  527.032454]  ? __sys_recvmsg_sock+0x10/0x10
>> [  527.032492]  __x64_sys_ioctl+0x122/0x190
>> [  527.032527]  do_syscall_64+0x3b/0x90
>> [  527.032562]  entry_SYSCALL_64_after_hwframe+0x44/0xae
>> [  527.032597] RIP: 0033:0x7fd37113850b
>> [  527.032636] Code: 0f 1e fa 48 8b 05 85 39 0d 00 64 c7 00 26 00 00 
>> 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 
>> 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 55 39 0d 00 f7 d8 64 
>> 89 01 48
>> [  527.032679] RSP: 002b:00007ffd0174b258 EFLAGS: 00000246 ORIG_RAX: 
>> 0000000000000010
>> [  527.032718] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 
>> 00007fd37113850b
>> [  527.032755] RDX: 00007ffd0174b260 RSI: 0000000000008914 RDI: 
>> 0000000000000008
>> [  527.032790] RBP: 0000000000000008 R08: 0000000000000007 R09: 
>> 00007fd37120cb80
>> [  527.032824] R10: 0000000000000007 R11: 0000000000000246 R12: 
>> 0000000000000000
>> [  527.032857] R13: 00005641e16bfa70 R14: 00007ffd0174b260 R15: 
>> 00005641e16b4840
>> [  527.032894]  </TASK>
>>

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

* Re: [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855
  2021-11-26 11:23     ` Wen Gong
@ 2021-11-30 11:14       ` Wen Gong
  0 siblings, 0 replies; 8+ messages in thread
From: Wen Gong @ 2021-11-30 11:14 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless

Hi Kalle,

I have reproduced the "WARNING: possible circular locking dependency 
detected" which is same with you while stop wlan.

the reason is not directly relative with "ath11k: add 11d scan offload 
support for QCA6390/WCN6855".

it is because the ieee80211_queue_work(ar->hw, &ar->regd_update_work) in 
function ath11k_reg_chan_list_event().

I also see the same warning after I removed 11d scan and run "iw reg set 
US" instead to trigger the ieee80211_queue_work(ar->hw, 
&ar->regd_update_work).


And the real deadlock happened in 
https://patchwork.kernel.org/project/linux-wireless/patch/1608617166-17180-1-git-send-email-wgong@codeaurora.org/

which I hit.


This warning gone by change "ieee80211_queue_work(ar->hw, 
&ar->regd_update_work)" to "queue_work(ab->workqueue, 
&ar->regd_update_work)" in my test on tag ath-202111221111.

On 11/26/2021 7:23 PM, Wen Gong wrote:
> Hi Kalle,
>
> I read the 2 patches of "11d scan offload" again, not found it will 
> introduce this new lockdep directly.
>
> Could you tell what the steps/operation in your test?
>
> I can try to reproduce it after enable the lockdep config.
>
> On 11/25/2021 7:01 PM, Wen Gong wrote:
>> Hi Kalle,
>>
>> I am afraid you hit same issue of below patch, they looks similar, 
>> but I am not sure they are the same root cause.
>>
>> https://patchwork.kernel.org/project/linux-wireless/patch/1608617166-17180-1-git-send-email-wgong@codeaurora.org/ 
>>
>>
>> [RFC] ath11k: fix blocked for more than 120 seconds caused by reg update
>>
>> On 11/22/2021 8:28 PM, Kalle Valo wrote:
>>> Wen Gong <quic_wgong@quicinc.com> writes:
>>>
>>>> v2:
>>>>     1. rebased to latest ath.git master ath-202111170737
>>>>     2. add "ath11k: add configure country code for QCA6390 and 
>>>> WCN6855", it is needed for
>>>>        patch "ath11k: add 11d scan offload support"
>>>>
>>>> Wen Gong (2):
>>>>    ath11k: add configure country code for QCA6390 and WCN6855
>>>>    ath11k: add 11d scan offload support
>>>>
>>>>   drivers/net/wireless/ath/ath11k/core.c |  30 +++++
>>>>   drivers/net/wireless/ath/ath11k/core.h |   9 ++
>>>>   drivers/net/wireless/ath/ath11k/mac.c  | 162 
>>>> ++++++++++++++++++++++++-
>>>>   drivers/net/wireless/ath/ath11k/mac.h  |   7 ++
>>>>   drivers/net/wireless/ath/ath11k/pci.c  |   1 +
>>>>   drivers/net/wireless/ath/ath11k/reg.c  |  15 +++
>>>>   drivers/net/wireless/ath/ath11k/wmi.c  | 145 ++++++++++++++++++++++
>>>>   drivers/net/wireless/ath/ath11k/wmi.h  |  39 ++++++
>>>>   8 files changed, 407 insertions(+), 1 deletion(-)
>>> I suspect this patch adds a new lockdep warning on my NUC testbox.
>>>
>>> Tag:    ath-202111221111
>>>
>>> [   87.034989] ath11k_pci 0000:06:00.0: MSI vectors: 32
>>> [   87.035059] ath11k_pci 0000:06:00.0: qca6390 hw2.0
>>> [   87.684032] ath11k_pci 0000:06:00.0: chip_id 0x0 chip_family 0xb 
>>> board_id 0xff soc_id 0xffffffff
>>> [   87.684277] ath11k_pci 0000:06:00.0: fw_version 0x101c06cc 
>>> fw_build_timestamp 2020-06-24 19:50 fw_build
>>>
>>> [...]
>>>
>>> [  527.024672] ======================================================
>>> [  527.024708] WARNING: possible circular locking dependency detected
>>> [  527.024746] 5.16.0-rc1-wt-ath+ #528 Not tainted
>>> [  527.024785] ------------------------------------------------------
>>> [  527.024819] wpa_supplicant/2309 is trying to acquire lock:
>>> [  527.024857] ffff88811fe6f148 ((wq_completion)phy0){+.+.}-{0:0}, 
>>> at: flush_workqueue+0xd9/0x1340
>>> [  527.024901]
>>>                 but task is already holding lock:
>>> [  527.024934] ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: 
>>> ieee80211_stop+0xa0/0x680 [mac80211]
>>> [  527.025023]
>>>                 which lock already depends on the new lock.
>>>
>>> [  527.025058]
>>>                 the existing dependency chain (in reverse order) is:
>>> [  527.025091]
>>>                 -> #3 (&rdev->wiphy.mtx){+.+.}-{3:3}:
>>> [  527.025129]        __lock_acquire+0xb72/0x1870
>>> [  527.025166]        lock_acquire.part.0+0x117/0x340
>>> [  527.025219]        __mutex_lock+0x15a/0x1610
>>> [  527.025267] reg_process_self_managed_hints+0x5e/0x130 [cfg80211]
>>> [  527.025343]        wiphy_register+0x1607/0x2640 [cfg80211]
>>> [  527.025409]        ieee80211_register_hw+0x17d5/0x3150 [mac80211]
>>> [  527.025481]        __ath11k_mac_register+0x1944/0x25c0 [ath11k]
>>> [  527.025530]        ath11k_mac_register+0x2ee/0x610 [ath11k]
>>> [  527.025578] ath11k_core_qmi_firmware_ready.part.0+0x9e/0x2b0 
>>> [ath11k]
>>> [  527.025626]        ath11k_qmi_driver_event_work+0x49c/0xa80 [ath11k]
>>> [  527.025674]        process_one_work+0x866/0x1490
>>> [  527.026142]        worker_thread+0x596/0x1010
>>> [  527.026180]        kthread+0x35d/0x420
>>> [  527.026247]        ret_from_fork+0x22/0x30
>>> [  527.026282]
>>>                 -> #2 (rtnl_mutex){+.+.}-{3:3}:
>>> [  527.026319]        __lock_acquire+0xb72/0x1870
>>> [  527.026355]        lock_acquire.part.0+0x117/0x340
>>> [  527.026388]        __mutex_lock+0x15a/0x1610
>>> [  527.026423]        ath11k_regd_update+0x1ce/0x580 [ath11k]
>>> [  527.026471]        process_one_work+0x866/0x1490
>>> [  527.026505]        worker_thread+0x596/0x1010
>>> [  527.026540]        kthread+0x35d/0x420
>>> [  527.026574]        ret_from_fork+0x22/0x30
>>> [  527.026608]
>>>                 -> #1 
>>> ((work_completion)(&ar->regd_update_work)){+.+.}-{0:0}:
>>> [  527.026645]        __lock_acquire+0xb72/0x1870
>>> [  527.026679]        lock_acquire.part.0+0x117/0x340
>>> [  527.026714]        process_one_work+0x7f6/0x1490
>>> [  527.026748]        worker_thread+0x596/0x1010
>>> [  527.026782]        kthread+0x35d/0x420
>>> [  527.026814]        ret_from_fork+0x22/0x30
>>> [  527.026848]
>>>                 -> #0 ((wq_completion)phy0){+.+.}-{0:0}:
>>> [  527.026883]        check_prev_add+0x15e/0x20f0
>>> [  527.026917]        validate_chain+0xf7f/0x1b30
>>> [  527.026957]        __lock_acquire+0xb72/0x1870
>>> [  527.026992]        lock_acquire.part.0+0x117/0x340
>>> [  527.027026]        flush_workqueue+0xfc/0x1340
>>> [  527.027061]        ieee80211_stop_device+0x50/0x60 [mac80211]
>>> [  527.027142]        ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
>>> [  527.027248]        ieee80211_stop+0xad/0x680 [mac80211]
>>> [  527.027322]        __dev_close_many+0x18f/0x2a0
>>> [  527.027357]        __dev_change_flags+0x264/0x680
>>> [  527.027391]        dev_change_flags+0x86/0x150
>>> [  527.027425]        devinet_ioctl+0xfbb/0x18f0
>>> [  527.027460]        inet_ioctl+0x2ae/0x2f0
>>> [  527.027493]        sock_do_ioctl+0xd5/0x1d0
>>> [  527.027527]        sock_ioctl+0x1c1/0x570
>>> [  527.027561]        __x64_sys_ioctl+0x122/0x190
>>> [  527.027598]        do_syscall_64+0x3b/0x90
>>> [  527.027631]        entry_SYSCALL_64_after_hwframe+0x44/0xae
>>> [  527.027666]
>>>                 other info that might help us debug this:
>>>
>>> [  527.027700] Chain exists of:
>>>                   (wq_completion)phy0 --> rtnl_mutex --> 
>>> &rdev->wiphy.mtx
>>>
>>> [  527.027739]  Possible unsafe locking scenario:
>>>
>>> [  527.027772]        CPU0                    CPU1
>>> [  527.027808]        ----                    ----
>>> [  527.027841]   lock(&rdev->wiphy.mtx);
>>> [  527.027880] lock(rtnl_mutex);
>>> [  527.027916] lock(&rdev->wiphy.mtx);
>>> [  527.027950]   lock((wq_completion)phy0);
>>> [  527.027984]
>>>                  *** DEADLOCK ***
>>>
>>> [  527.028017] 2 locks held by wpa_supplicant/2309:
>>> [  527.028051]  #0: ffffffff8ff3cb70 (rtnl_mutex){+.+.}-{3:3}, at: 
>>> devinet_ioctl+0x182/0x18f0
>>> [  527.029006]  #1: ffff8881563b07d0 (&rdev->wiphy.mtx){+.+.}-{3:3}, 
>>> at: ieee80211_stop+0xa0/0x680 [mac80211]
>>> [  527.029087]
>>>                 stack backtrace:
>>> [  527.029121] CPU: 6 PID: 2309 Comm: wpa_supplicant Kdump: loaded 
>>> Not tainted 5.16.0-rc1-wt-ath+ #528
>>> [  527.029158] Hardware name: Intel(R) Client Systems 
>>> NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
>>> [  527.029211] Call Trace:
>>> [  527.029246]  <TASK>
>>> [  527.029292]  dump_stack_lvl+0x57/0x7d
>>> [  527.029328]  check_noncircular+0x26a/0x310
>>> [  527.029363]  ? print_circular_bug+0x450/0x450
>>> [  527.029403]  ? __kernel_text_address+0x9/0x30
>>> [  527.029439]  ? alloc_chain_hlocks+0x1de/0x530
>>> [  527.029474]  check_prev_add+0x15e/0x20f0
>>> [  527.029511]  ? __lock_acquire+0xb72/0x1870
>>> [  527.029547]  validate_chain+0xf7f/0x1b30
>>> [  527.029583]  ? check_prev_add+0x20f0/0x20f0
>>> [  527.029618]  ? __lock_release+0x4bd/0x9f0
>>> [  527.029655]  __lock_acquire+0xb72/0x1870
>>> [  527.029691]  lock_acquire.part.0+0x117/0x340
>>> [  527.029727]  ? flush_workqueue+0xd9/0x1340
>>> [  527.029763]  ? rcu_read_unlock+0x40/0x40
>>> [  527.029799]  ? rcu_read_lock_sched_held+0x3a/0x70
>>> [  527.029833]  ? lock_acquire+0x1a8/0x210
>>> [  527.029868]  ? flush_workqueue+0xd9/0x1340
>>> [  527.029903]  flush_workqueue+0xfc/0x1340
>>> [  527.029936]  ? flush_workqueue+0xd9/0x1340
>>> [  527.029970]  ? mark_held_locks+0xa5/0xe0
>>> [  527.030009]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
>>> [  527.030044]  ? check_flush_dependency+0x350/0x350
>>> [  527.030082]  ? ath11k_mac_op_remove_interface+0x58b/0xa20 [ath11k]
>>> [  527.030131]  ? ieee80211_stop_device+0x50/0x60 [mac80211]
>>> [  527.030241]  ieee80211_stop_device+0x50/0x60 [mac80211]
>>> [  527.030321]  ieee80211_do_stop+0x11cf/0x1a20 [mac80211]
>>> [  527.030397]  ? mutex_lock_io_nested+0x1470/0x1470
>>> [  527.030436]  ? lock_downgrade+0x130/0x130
>>> [  527.030473]  ? ieee80211_adjust_monitor_flags+0x1f0/0x1f0 [mac80211]
>>> [  527.030547]  ? mark_held_locks+0xa5/0xe0
>>> [  527.030583]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
>>> [  527.030618]  ? __local_bh_enable_ip+0xa0/0x110
>>> [  527.030654]  ieee80211_stop+0xad/0x680 [mac80211]
>>> [  527.030728]  __dev_close_many+0x18f/0x2a0
>>> [  527.030764]  ? unregister_netdevice_notifier+0x150/0x150
>>> [  527.030799]  ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370
>>> [  527.030834]  ? __local_bh_enable_ip+0xa0/0x110
>>> [  527.030869]  __dev_change_flags+0x264/0x680
>>> [  527.030903]  ? dev_set_allmulti+0x10/0x10
>>> [  527.030940]  dev_change_flags+0x86/0x150
>>> [  527.030976]  devinet_ioctl+0xfbb/0x18f0
>>> [  527.031011]  inet_ioctl+0x2ae/0x2f0
>>> [  527.031048]  ? inet_dgram_connect+0x220/0x220
>>> [  527.031087]  ? lock_downgrade+0x130/0x130
>>> [  527.032054]  ? __might_fault+0xb3/0x160
>>> [  527.032090]  ? __might_fault+0xb3/0x160
>>> [  527.032124]  ? _copy_to_user+0x94/0xb0
>>> [  527.032160]  sock_do_ioctl+0xd5/0x1d0
>>> [  527.032216]  ? put_user_ifreq+0x70/0x70
>>> [  527.032279]  ? vfs_fileattr_set+0x930/0x930
>>> [  527.032314]  ? selinux_file_ioctl+0x375/0x520
>>> [  527.032350]  sock_ioctl+0x1c1/0x570
>>> [  527.032385]  ? br_ioctl_call+0x90/0x90
>>> [  527.032420]  ? __ia32_sys_sendmmsg+0xeb/0xf0
>>> [  527.032454]  ? __sys_recvmsg_sock+0x10/0x10
>>> [  527.032492]  __x64_sys_ioctl+0x122/0x190
>>> [  527.032527]  do_syscall_64+0x3b/0x90
>>> [  527.032562]  entry_SYSCALL_64_after_hwframe+0x44/0xae
>>> [  527.032597] RIP: 0033:0x7fd37113850b
>>> [  527.032636] Code: 0f 1e fa 48 8b 05 85 39 0d 00 64 c7 00 26 00 00 
>>> 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 
>>> 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 55 39 0d 00 f7 d8 64 
>>> 89 01 48
>>> [  527.032679] RSP: 002b:00007ffd0174b258 EFLAGS: 00000246 ORIG_RAX: 
>>> 0000000000000010
>>> [  527.032718] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 
>>> 00007fd37113850b
>>> [  527.032755] RDX: 00007ffd0174b260 RSI: 0000000000008914 RDI: 
>>> 0000000000000008
>>> [  527.032790] RBP: 0000000000000008 R08: 0000000000000007 R09: 
>>> 00007fd37120cb80
>>> [  527.032824] R10: 0000000000000007 R11: 0000000000000246 R12: 
>>> 0000000000000000
>>> [  527.032857] R13: 00005641e16bfa70 R14: 00007ffd0174b260 R15: 
>>> 00005641e16b4840
>>> [  527.032894]  </TASK>
>>>

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

end of thread, other threads:[~2021-11-30 11:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 10:05 [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 Wen Gong
2021-11-18 10:05 ` [PATCH v2 1/2] ath11k: add configure country code for QCA6390 and WCN6855 Wen Gong
2021-11-18 10:05 ` [PATCH v2 2/2] ath11k: add 11d scan offload support Wen Gong
2021-11-22 12:28 ` [PATCH v2 0/2] ath11k: add 11d scan offload support for QCA6390/WCN6855 Kalle Valo
2021-11-25 11:00   ` Wen Gong
2021-11-25 11:01   ` Wen Gong
2021-11-26 11:23     ` Wen Gong
2021-11-30 11:14       ` Wen Gong

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).