Commit 8cc2af7c authored by Ingo Tuchscherer's avatar Ingo Tuchscherer Committed by Martin Schwidefsky

s390/zcrypt: fixed ap poll timer behavior

The ap poll timer restart condition was wrong. Hence the poll timer
was not restarted reliable when setting a new time interval via the
poll_timeout sysfs attribute.
Added missing timer locking.
Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Tuchscherer <ingo.tuchscherer@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 771aada9
...@@ -1158,11 +1158,12 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf, ...@@ -1158,11 +1158,12 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf,
poll_timeout = time; poll_timeout = time;
hr_time = ktime_set(0, poll_timeout); hr_time = ktime_set(0, poll_timeout);
if (!hrtimer_is_queued(&ap_poll_timer) || spin_lock_bh(&ap_poll_timer_lock);
!hrtimer_forward(&ap_poll_timer, hrtimer_get_expires(&ap_poll_timer), hr_time)) { hrtimer_cancel(&ap_poll_timer);
hrtimer_set_expires(&ap_poll_timer, hr_time); hrtimer_set_expires(&ap_poll_timer, hr_time);
hrtimer_start_expires(&ap_poll_timer, HRTIMER_MODE_ABS); hrtimer_start_expires(&ap_poll_timer, HRTIMER_MODE_ABS);
} spin_unlock_bh(&ap_poll_timer_lock);
return count; return count;
} }
...@@ -1528,14 +1529,11 @@ static inline void __ap_schedule_poll_timer(void) ...@@ -1528,14 +1529,11 @@ static inline void __ap_schedule_poll_timer(void)
ktime_t hr_time; ktime_t hr_time;
spin_lock_bh(&ap_poll_timer_lock); spin_lock_bh(&ap_poll_timer_lock);
if (hrtimer_is_queued(&ap_poll_timer) || ap_suspend_flag) if (!hrtimer_is_queued(&ap_poll_timer) && !ap_suspend_flag) {
goto out;
if (ktime_to_ns(hrtimer_expires_remaining(&ap_poll_timer)) <= 0) {
hr_time = ktime_set(0, poll_timeout); hr_time = ktime_set(0, poll_timeout);
hrtimer_forward_now(&ap_poll_timer, hr_time); hrtimer_forward_now(&ap_poll_timer, hr_time);
hrtimer_restart(&ap_poll_timer); hrtimer_restart(&ap_poll_timer);
} }
out:
spin_unlock_bh(&ap_poll_timer_lock); spin_unlock_bh(&ap_poll_timer_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment