Re: [PATCH v2] schedutil: Allow cpufreq requests to be made even when kthread kicked

From: Viresh Kumar
Date: Tue May 22 2018 - 06:04:24 EST


On 22-05-18, 11:51, Patrick Bellasi wrote:
> It could happen, but using:
>
> raw_spin_lock_irqsave(&sg_policy->update_lock, flags);
> freq = READ_ONCE(sg_policy->next_freq)
> WRITE_ONCE(sg_policy->work_in_progress, false);
> raw_spin_unlock_irqrestore(&sg_policy->update_lock, flags);
>
> if (!READ_ONCE(sg_policy->work_in_progress)) {
> WRITE_ONCE(sg_policy->work_in_progress, true);
> irq_work_queue(&sg_policy->irq_work);
> }

I think its better to get locking in place for non-fast switching case in
single-policy systems right now.

> should fix it by enforcing the ordering as well as documenting the
> concurrent access.
>
> However, in the "sched update" side, where do we have the sequence:
>
> sg_policy->next_freq = 0;
> sg_policy->next_freq = real-next-freq;

Ah, that was just an example of what a compiler may do (though it shouldn't do).

--
viresh