Skip to contentSkip to conversation

ath10k: locking cleanup

PATCH New Michal Kazior 2 participants 7 messages Apr 18, 2013 – Apr 22, 2013 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath10k: locking cleanup

This patchset kills vdev_mtx and scan.lock and
uses conf_mutex and data_lock respectively.

This simplifies and unifies locking in ath10k.

Michal Kazior (2):
ath10k: kill vdev_mtx and use conf_mutex
ath10k: refactor scan locking

 drivers/net/wireless/ath/ath10k/core.c |    2 -
 drivers/net/wireless/ath/ath10k/core.h |    2 -
 drivers/net/wireless/ath/ath10k/mac.c  |  111 +++++++++++++-------------------
 drivers/net/wireless/ath/ath10k/wmi.c  |   10 +--
 4 files changed, 50 insertions(+), 75 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 ath10k: kill vdev_mtx and use conf_mutex

The vdev_mtx doesn't serve any purpose anymore. The locking should be done with conf_mutex (it was already, implicitly anyway).

---
 drivers/net/wireless/ath/ath10k/core.c |    1 -
 drivers/net/wireless/ath/ath10k/core.h |    1 -
 drivers/net/wireless/ath/ath10k/mac.c  |   55 ++++++++++----------------------
 3 files changed, 17 insertions(+), 40 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +0 -1
index 39bc54c..a905f5e 100644
@@ -498,7 +498,6 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
 
 	init_completion(&ar->install_key_done);
 	init_completion(&ar->vdev_setup_done);
-	mutex_init(&ar->vdev_mtx);
 
 	setup_timer(&ar->scan.timeout, ath10k_ath10k_reset_scan, (unsigned long)ar);
 
drivers/net/wireless/ath/ath10k/core.h +0 -1
index de47b41..9874062 100644
@@ -341,7 +341,6 @@ struct ath10k {
 	struct wmi_pdev_set_wmm_params_arg wmm_params;
 	struct completion install_key_done;
 
-	struct mutex vdev_mtx;
 	struct completion vdev_setup_done;
 
 	bool hw_v1_workaround;
drivers/net/wireless/ath/ath10k/mac.c +17 -38

186 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/2 ath10k: kill vdev_mtx and use conf_mutex

Quoted 5 lines · Michal Kazior

The vdev_mtx doesn't serve any purpose anymore. The locking should be done with conf_mutex (it was already, implicitly anyway).

Patch 1 applied, but I have a question with patch 2.

Signature · 1 line
Kalle Valo
#3 lore raw

PATCH 2/2 ath10k: refactor scan locking

In reply to Michal Kazior

Since we have data_lock it is no longer necessary
to have scan.lock.

---
 drivers/net/wireless/ath/ath10k/core.c |    1 -
 drivers/net/wireless/ath/ath10k/core.h |    1 -
 drivers/net/wireless/ath/ath10k/mac.c  |   56 +++++++++++++++-----------------
 drivers/net/wireless/ath/ath10k/wmi.c  |   10 +++---
 4 files changed, 33 insertions(+), 35 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +0 -1
index a905f5e..527ae84 100644
@@ -494,7 +494,6 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
 
 	init_completion(&ar->scan.started);
 	init_completion(&ar->scan.completed);
-	spin_lock_init(&ar->scan.lock);
 
 	init_completion(&ar->install_key_done);
 	init_completion(&ar->vdev_setup_done);
drivers/net/wireless/ath/ath10k/core.h +0 -1
index 9874062..cdf9674 100644
@@ -316,7 +316,6 @@ struct ath10k {
 	} hw_params;
 
 	struct {
-		spinlock_t lock;
 		struct completion started;
 		struct completion completed;
 		struct timer_list timeout;
drivers/net/wireless/ath/ath10k/mac.c +27 -29

162 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/wmi.c +6 -4
index d19d2cc..fe9d844 100644
@@ -149,10 +149,12 @@ static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 	case WMI_SCAN_EVENT_STARTED:
 		ath10k_dbg(ATH10K_DBG_WMI, "SCAN_EVENT_STARTED\n");
 
-		if (ar->scan.is_roc)
+		spin_lock_bh(&ar->data_lock);
+		if (ar->scan.in_progress && ar->scan.is_roc)
 			ieee80211_ready_on_channel(ar->hw);
 
 		complete(&ar->scan.started);
+		spin_unlock_bh(&ar->data_lock);
 		break;
 	case WMI_SCAN_EVENT_COMPLETED:
 		ath10k_dbg(ATH10K_DBG_WMI, "SCAN_EVENT_COMPLETED\n");
@@ -175,10 +177,10 @@ static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 
 		rcu_assign_pointer(ar->scan_channel, NULL);
 
-		spin_lock_bh(&ar->scan.lock);
+		spin_lock_bh(&ar->data_lock);
 		if (!ar->scan.in_progress) {
+			spin_unlock_bh(&ar->data_lock);
 			ath10k_warn("no scan requested, ignoring\n");
-			spin_unlock_bh(&ar->scan.lock);
 			break;
 		}
 
@@ -194,7 +196,7 @@ static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 		del_timer(&ar->scan.timeout);
 		complete_all(&ar->scan.completed);
 		ar->scan.in_progress = false;
-		spin_unlock_bh(&ar->scan.lock);
+		spin_unlock_bh(&ar->data_lock);
 		break;
 	case WMI_SCAN_EVENT_BSS_CHANNEL:
 		ath10k_dbg(ATH10K_DBG_WMI, "SCAN_EVENT_BSS_CHANNEL\n");
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 2/2 ath10k: refactor scan locking

Quoted 5 lines · Michal Kazior

Since we have data_lock it is no longer necessary
to have scan.lock.

---

[...]

drivers/net/wireless/ath/ath10k/mac.c static void ath10k_abort_scan(struct ath10k *ar) · line 1419

Quoted 5 lines
drivers/net/wireless/ath/ath10k/mac.c +1 -0
 	ret = ath10k_wmi_stop_scan(ar, &arg);
 	if (ret)
 		ath10k_warn("%s: ath10k_wmi_stop_scan failed (%d)\n", __func__, ret);
 
+	ath10k_wmi_flush_tx(ar);

Is this by accident?

Signature · 1 line
Kalle Valo
#5 lore raw

PATCH 2/2 ath10k: refactor scan locking

Quoted 10 lines · Kalle Valo
Quoted 5 lines · Michal Kazior

Since we have data_lock it is no longer necessary
to have scan.lock.

---

[...]

Quoted 7 lines

drivers/net/wireless/ath/ath10k/mac.c static void ath10k_abort_scan(struct ath10k *ar) · line 1419

Quoted 5 lines
  	ret = ath10k_wmi_stop_scan(ar, &arg);
  	if (ret)
  		ath10k_warn("%s: ath10k_wmi_stop_scan failed (%d)\n", __func__, ret);
drivers/net/wireless/ath/ath10k/mac.c +1 -0
+	ath10k_wmi_flush_tx(ar);

Is this by accident?

Oh. I noticed we were missing it. Must've mixed it into the patch. Should I resend the patches split?

-- Pozdrawiam / Best regards, Michal Kazior.

#6 lore raw

PATCH 2/2 ath10k: refactor scan locking

Quoted 15 lines · Michal Kazior
Quoted 14 lines · Kalle Valo
Quoted 5 lines · Michal Kazior

Since we have data_lock it is no longer necessary
to have scan.lock.

---

[...]

Quoted 4 lines
  	ret = ath10k_wmi_stop_scan(ar, &arg);
  	if (ret)
  		ath10k_warn("%s: ath10k_wmi_stop_scan failed (%d)\n", __func__, ret);
Quoted 6 lines
Quoted 3 lines

drivers/net/wireless/ath/ath10k/mac.c static void ath10k_abort_scan(struct ath10k *ar) · line 1419

Quoted 1 line
drivers/net/wireless/ath/ath10k/mac.c +1 -0
+	ath10k_wmi_flush_tx(ar);

Is this by accident?

Oh. I noticed we were missing it. Must've mixed it into the patch. Should I resend the patches split?

Yes, please split patch 2. That makes it easier to bisect etc. And please note that I have already applied patch 1.

But please wait an hour or two so that I have gone through my patch backlog. Less conflicts that way.

Signature · 1 line
Kalle Valo