forked from Minki/linux
flex_proportions: Disable preemption entering the write section.
The seqcount fprop_global::sequence is not associated with a lock. The write section (fprop_new_period()) is invoked from a timer and since the softirq is preemptible on PREEMPT_RT it is possible to preempt the write section which is not desited. Disable preemption around the write section on PREEMPT_RT. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20220825164131.402717-8-bigeasy@linutronix.de
This commit is contained in:
parent
c7e0b3d088
commit
9458e0a78c
@ -70,6 +70,7 @@ bool fprop_new_period(struct fprop_global *p, int periods)
|
|||||||
*/
|
*/
|
||||||
if (events <= 1)
|
if (events <= 1)
|
||||||
return false;
|
return false;
|
||||||
|
preempt_disable_nested();
|
||||||
write_seqcount_begin(&p->sequence);
|
write_seqcount_begin(&p->sequence);
|
||||||
if (periods < 64)
|
if (periods < 64)
|
||||||
events -= events >> periods;
|
events -= events >> periods;
|
||||||
@ -77,6 +78,7 @@ bool fprop_new_period(struct fprop_global *p, int periods)
|
|||||||
percpu_counter_add(&p->events, -events);
|
percpu_counter_add(&p->events, -events);
|
||||||
p->period += periods;
|
p->period += periods;
|
||||||
write_seqcount_end(&p->sequence);
|
write_seqcount_end(&p->sequence);
|
||||||
|
preempt_enable_nested();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user