Skip to content

Commit 86dacd9

Browse files
rohanmclurempe
authored andcommitted
powerpc: Mark writes registering ipi to host cpu through kvm and polling
Mark writes to hypervisor ipi state so that KCSAN recognises these asynchronous issue of kvmppc_{set,clear}_host_ipi to be intended, with atomic writes. Mark asynchronous polls to this variable in kvm_ppc_read_one_intr(). 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 8608f14 commit 86dacd9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

arch/powerpc/include/asm/kvm_ppc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,12 @@ static inline void kvmppc_set_host_ipi(int cpu)
548548
* pairs with the barrier in kvmppc_clear_host_ipi()
549549
*/
550550
smp_mb();
551-
paca_ptrs[cpu]->kvm_hstate.host_ipi = 1;
551+
WRITE_ONCE(paca_ptrs[cpu]->kvm_hstate.host_ipi, 1);
552552
}
553553

554554
static inline void kvmppc_clear_host_ipi(int cpu)
555555
{
556-
paca_ptrs[cpu]->kvm_hstate.host_ipi = 0;
556+
WRITE_ONCE(paca_ptrs[cpu]->kvm_hstate.host_ipi, 0);
557557
/*
558558
* order clearing of host_ipi flag vs. processing of IPI messages
559559
*

arch/powerpc/kvm/book3s_hv_builtin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static long kvmppc_read_one_intr(bool *again)
406406
return 1;
407407

408408
/* see if a host IPI is pending */
409-
host_ipi = local_paca->kvm_hstate.host_ipi;
409+
host_ipi = READ_ONCE(local_paca->kvm_hstate.host_ipi);
410410
if (host_ipi)
411411
return 1;
412412

@@ -466,7 +466,7 @@ static long kvmppc_read_one_intr(bool *again)
466466
* meantime. If it's clear, we bounce the interrupt to the
467467
* guest
468468
*/
469-
host_ipi = local_paca->kvm_hstate.host_ipi;
469+
host_ipi = READ_ONCE(local_paca->kvm_hstate.host_ipi);
470470
if (unlikely(host_ipi != 0)) {
471471
/* We raced with the host,
472472
* we need to resend that IPI, bummer

0 commit comments

Comments
 (0)