Skip to content

Commit 331e2ca

Browse files
rohanmclurempe
authored andcommitted
powerpc: powernv: Annotate data races in opal events
The kopald thread handles opal events as they appear, but by polling a static bit-vector in last_outstanding_events. Annotate these data races accordingly. We are not at risk of missing events, but use of READ_ONCE, WRITE_ONCE will assist readers in seeing that kopald only consumes the events it is aware of when it is scheduled. Also removes extraneous KCSAN warnings. Signed-off-by: Rohan McLure <[email protected]> Reviewed-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 86dacd9 commit 331e2ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/powerpc/platforms/powernv/opal-irqchip.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void opal_handle_events(void)
5959

6060
cond_resched();
6161
}
62-
last_outstanding_events = 0;
62+
WRITE_ONCE(last_outstanding_events, 0);
6363
if (opal_poll_events(&events) != OPAL_SUCCESS)
6464
return;
6565
e = be64_to_cpu(events) & opal_event_irqchip.mask;
@@ -69,7 +69,7 @@ void opal_handle_events(void)
6969

7070
bool opal_have_pending_events(void)
7171
{
72-
if (last_outstanding_events & opal_event_irqchip.mask)
72+
if (READ_ONCE(last_outstanding_events) & opal_event_irqchip.mask)
7373
return true;
7474
return false;
7575
}
@@ -124,7 +124,7 @@ static irqreturn_t opal_interrupt(int irq, void *data)
124124
__be64 events;
125125

126126
opal_handle_interrupt(virq_to_hw(irq), &events);
127-
last_outstanding_events = be64_to_cpu(events);
127+
WRITE_ONCE(last_outstanding_events, be64_to_cpu(events));
128128
if (opal_have_pending_events())
129129
opal_wake_poller();
130130

0 commit comments

Comments
 (0)