Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1724170 > unrolled thread

[PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer

Started byAnna-Maria Gleixner <anna-maria@linutronix.de>
First post2017-08-31 14:30 +0200
Last post2017-09-05 11:00 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq  hrtimer Anna-Maria Gleixner <anna-maria@linutronix.de> - 2017-08-31 14:30 +0200
    Re: [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with  softirq hrtimer Johannes Berg <johannes@sipsolutions.net> - 2017-09-05 09:10 +0200
      Re: [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with  softirq hrtimer Thomas Gleixner <tglx@linutronix.de> - 2017-09-05 10:50 +0200
        Re: [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with  softirq hrtimer Johannes Berg <johannes@sipsolutions.net> - 2017-09-05 11:00 +0200

#1724170 — [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer

FromAnna-Maria Gleixner <anna-maria@linutronix.de>
Date2017-08-31 14:30 +0200
Subject[PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer
Message-ID<ukwLE-5Ay-19@gated-at.bofh.it>
From: Thomas Gleixner <tglx@linutronix.de>

Switch the timer to CLOCK_MONOTONIC_SOFT, which executed the timer
callback in softirq context and remove the hrtimer_tasklet.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org

---
 drivers/net/wireless/mac80211_hwsim.c |   44 +++++++++++++++-------------------
 1 file changed, 20 insertions(+), 24 deletions(-)

--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -537,7 +537,7 @@ struct mac80211_hwsim_data {
 	unsigned int rx_filter;
 	bool started, idle, scanning;
 	struct mutex mutex;
-	struct tasklet_hrtimer beacon_timer;
+	struct hrtimer beacon_timer;
 	enum ps_mode {
 		PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL
 	} ps;
@@ -1420,7 +1420,7 @@ static void mac80211_hwsim_stop(struct i
 {
 	struct mac80211_hwsim_data *data = hw->priv;
 	data->started = false;
-	tasklet_hrtimer_cancel(&data->beacon_timer);
+	hrtimer_cancel(&data->beacon_timer);
 	wiphy_debug(hw->wiphy, "%s\n", __func__);
 }
 
@@ -1543,14 +1543,12 @@ static enum hrtimer_restart
 mac80211_hwsim_beacon(struct hrtimer *timer)
 {
 	struct mac80211_hwsim_data *data =
-		container_of(timer, struct mac80211_hwsim_data,
-			     beacon_timer.timer);
+		container_of(timer, struct mac80211_hwsim_data, beacon_timer);
 	struct ieee80211_hw *hw = data->hw;
 	u64 bcn_int = data->beacon_int;
-	ktime_t next_bcn;
 
 	if (!data->started)
-		goto out;
+		return HRTIMER_NORESTART;
 
 	ieee80211_iterate_active_interfaces_atomic(
 		hw, IEEE80211_IFACE_ITER_NORMAL,
@@ -1562,11 +1560,9 @@ mac80211_hwsim_beacon(struct hrtimer *ti
 		data->bcn_delta = 0;
 	}
 
-	next_bcn = ktime_add(hrtimer_get_expires(timer),
-			     ns_to_ktime(bcn_int * 1000));
-	tasklet_hrtimer_start(&data->beacon_timer, next_bcn, HRTIMER_MODE_ABS);
-out:
-	return HRTIMER_NORESTART;
+	hrtimer_forward(&data->beacon_timer, hrtimer_get_expires(timer),
+			ns_to_ktime(bcn_int * NSEC_PER_USEC));
+	return HRTIMER_RESTART;
 }
 
 static const char * const hwsim_chanwidths[] = {
@@ -1640,15 +1636,15 @@ static int mac80211_hwsim_config(struct
 	mutex_unlock(&data->mutex);
 
 	if (!data->started || !data->beacon_int)
-		tasklet_hrtimer_cancel(&data->beacon_timer);
-	else if (!hrtimer_is_queued(&data->beacon_timer.timer)) {
+		hrtimer_cancel(&data->beacon_timer);
+	else if (!hrtimer_is_queued(&data->beacon_timer)) {
 		u64 tsf = mac80211_hwsim_get_tsf(hw, NULL);
 		u32 bcn_int = data->beacon_int;
 		u64 until_tbtt = bcn_int - do_div(tsf, bcn_int);
 
-		tasklet_hrtimer_start(&data->beacon_timer,
-				      ns_to_ktime(until_tbtt * 1000),
-				      HRTIMER_MODE_REL);
+		hrtimer_start(&data->beacon_timer,
+			      ns_to_ktime(until_tbtt * 1000),
+			      HRTIMER_MODE_REL);
 	}
 
 	return 0;
@@ -1711,7 +1707,7 @@ static void mac80211_hwsim_bss_info_chan
 			    info->enable_beacon, info->beacon_int);
 		vp->bcn_en = info->enable_beacon;
 		if (data->started &&
-		    !hrtimer_is_queued(&data->beacon_timer.timer) &&
+		    !hrtimer_is_queued(&data->beacon_timer) &&
 		    info->enable_beacon) {
 			u64 tsf, until_tbtt;
 			u32 bcn_int;
@@ -1719,9 +1715,9 @@ static void mac80211_hwsim_bss_info_chan
 			tsf = mac80211_hwsim_get_tsf(hw, vif);
 			bcn_int = data->beacon_int;
 			until_tbtt = bcn_int - do_div(tsf, bcn_int);
-			tasklet_hrtimer_start(&data->beacon_timer,
-					      ns_to_ktime(until_tbtt * 1000),
-					      HRTIMER_MODE_REL);
+			hrtimer_start(&data->beacon_timer,
+				      ns_to_ktime(until_tbtt * 1000),
+				      HRTIMER_MODE_REL);
 		} else if (!info->enable_beacon) {
 			unsigned int count = 0;
 			ieee80211_iterate_active_interfaces_atomic(
@@ -1730,7 +1726,7 @@ static void mac80211_hwsim_bss_info_chan
 			wiphy_debug(hw->wiphy, "  beaconing vifs remaining: %u",
 				    count);
 			if (count == 0) {
-				tasklet_hrtimer_cancel(&data->beacon_timer);
+				hrtimer_cancel(&data->beacon_timer);
 				data->beacon_int = 0;
 			}
 		}
@@ -2722,9 +2718,9 @@ static int mac80211_hwsim_new_radio(stru
 				    data->debugfs,
 				    data, &hwsim_simulate_radar);
 
-	tasklet_hrtimer_init(&data->beacon_timer,
-			     mac80211_hwsim_beacon,
-			     CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
+	hrtimer_init(&data->beacon_timer, CLOCK_MONOTONIC_SOFT,
+		     HRTIMER_MODE_ABS);
+	data->beacon_timer.function = mac80211_hwsim_beacon;
 
 	spin_lock_bh(&hwsim_radio_lock);
 	list_add_tail(&data->list, &hwsim_radios);

[toc] | [next] | [standalone]


#1726388 — Re: [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer

FromJohannes Berg <johannes@sipsolutions.net>
Date2017-09-05 09:10 +0200
SubjectRe: [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer
Message-ID<umg9I-82b-17@gated-at.bofh.it>
In reply to#1724170
On Thu, 2017-08-31 at 12:23 +0000, Anna-Maria Gleixner wrote:
> From: Thomas Gleixner <tglx@linutronix.de>
> 
> Switch the timer to CLOCK_MONOTONIC_SOFT, which executed the timer
> callback in softirq context and remove the hrtimer_tasklet.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: Kalle Valo <kvalo@codeaurora.org>
> Cc: linux-wireless@vger.kernel.org
> 
This looks fine to me,

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>

Are you planning to integrate all patches in the series through some
other tree, perhaps to be able to get rid of the tasklet_hrtimer API,
or should I apply this?

johannes

[toc] | [prev] | [next] | [standalone]


#1726552 — Re: [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer

FromThomas Gleixner <tglx@linutronix.de>
Date2017-09-05 10:50 +0200
SubjectRe: [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer
Message-ID<umhIu-pS-15@gated-at.bofh.it>
In reply to#1726388
On Tue, 5 Sep 2017, Johannes Berg wrote:
> On Thu, 2017-08-31 at 12:23 +0000, Anna-Maria Gleixner wrote:
> > From: Thomas Gleixner <tglx@linutronix.de>
> > 
> > Switch the timer to CLOCK_MONOTONIC_SOFT, which executed the timer
> > callback in softirq context and remove the hrtimer_tasklet.
> > 
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
> > Cc: Johannes Berg <johannes@sipsolutions.net>
> > Cc: Kalle Valo <kvalo@codeaurora.org>
> > Cc: linux-wireless@vger.kernel.org
> > 
> This looks fine to me,
> 
> Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
> 
> Are you planning to integrate all patches in the series through some
> other tree, perhaps to be able to get rid of the tasklet_hrtimer API,
> or should I apply this?

The patch depends on the hrtimer core changes, so we either delay the
removal for a release cycle or just take the whole lot through
tip:timers/core and get rid of it in one go.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1726564 — Re: [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer

FromJohannes Berg <johannes@sipsolutions.net>
Date2017-09-05 11:00 +0200
SubjectRe: [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer
Message-ID<umhSa-t5-17@gated-at.bofh.it>
In reply to#1726552
On Tue, 2017-09-05 at 10:49 +0200, Thomas Gleixner wrote:
> 
> > Are you planning to integrate all patches in the series through
> > some other tree, perhaps to be able to get rid of the
> > tasklet_hrtimer API, or should I apply this?
> 
> The patch depends on the hrtimer core changes, so we either delay the
> removal for a release cycle or just take the whole lot through
> tip:timers/core and get rid of it in one go.

Ok. For now then I'll assume that it'll go through tip; if not please
resend when it's appropriate.

Thanks,
johannes

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web