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

Commit f2197a20 authored by Chris Lew's avatar Chris Lew
Browse files

soc: qcom: smp2p: Add memory barrier for irq_pending



There is a very tight race where the irq_retrigger function is run
on one cpu and the actual retrigger softirq is running on a second
cpu. When this happens, there may be a chance that the second cpu
will not see the updated irq_pending value from first cpu.

Add a memory barrier to ensure that irq_pending is read correctly.

Change-Id: I3dd185decc4f050bd57c0b6558f417ead2a3aa5a
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent 9d099b50
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -270,6 +270,9 @@ static void qcom_smp2p_notify_in(struct qcom_smp2p *smp2p)

		status = val ^ entry->last_value;
		entry->last_value = val;

		/* Ensure irq_pending is read correctly */
		mb();
		status |= *entry->irq_pending;

		SMP2P_INFO("%d:\t%s: status:%0lx val:%0x\n",
@@ -391,6 +394,11 @@ static int smp2p_retrigger_irq(struct irq_data *irqd)
	SMP2P_INFO("%d: %s: %lu\n", entry->smp2p->remote_pid, entry->name, irq);
	set_bit(irq, entry->irq_pending);

	/* Ensure irq_pending is visible to all cpus that retried interrupt
	 * can run on
	 */
	mb();

	return 0;
}