Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4738a9bc authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched/cputime: Fix a deadlock on 32bit systems



CPU's irqtime structure updates are protected with a seqlock on
32bit systems. There is a potential deadlock with this seqlock
and rq->lock.

CPU 1                             CPU0
==========================        ========================
--> acquire CPU0 rq->lock         --> __irq_enter()
----> task enqueue/dequeue        ----> irqtime_account_irq()
------> update_rq_clock()         ------> u64_stats_update_begin()
--------> irq_time_read()         --------> sched_account_irqtime()
(waiting for the seqlock          (waiting for the CPU0 rq->lock)
held in u64_stats_update_begin()

Fix this issue by dropping the seqlock before calling
sched_account_irqtime().

Change-Id: I29a33876e372f99435a57cc11eada9c8cfd59a3f
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 3b157650
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -71,12 +71,12 @@ void irqtime_account_irq(struct task_struct *curr)
	else
		account = false;

	u64_stats_update_end(&irqtime->sync);

	if (account)
		sched_account_irqtime(cpu, curr, delta, wallclock);
	else if (curr != this_cpu_ksoftirqd())
		sched_account_irqstart(cpu, curr, wallclock);

	u64_stats_update_end(&irqtime->sync);
}
EXPORT_SYMBOL_GPL(irqtime_account_irq);