Skip to content

Commit 0c89649

Browse files
npigginmpe
authored andcommitted
powerpc/64s: Fix doorbell wakeup msgclr optimisation
Commit 3282a3d ("powerpc/64: Implement soft interrupt replay in C") broke the doorbell wakeup optimisation introduced by commit a9af97a ("powerpc/64s: msgclr when handling doorbell exceptions from system reset"). This patch restores the msgclr, in C code. It's now done in the system reset wakeup path rather than doorbell interrupt replay where it used to be, because it is always the right thing to do in the wakeup case, but it may be rarely of use in other interrupt replay situations in which case it's wasted work - we would have to run measurements to see if that was a worthwhile optimisation, and I suspect it would not be. The results are similar to those in the original commit, test on POWER8 of context_switch selftests benchmark with polling idle disabled (e.g., always nap, giving cross-CPU IPIs) gives the following results: broken patched Different threads, same core: 317k/s 375k/s +18.7% Different cores: 280k/s 282k/s +1.0% Fixes: 3282a3d ("powerpc/64: Implement soft interrupt replay in C") Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c17eb4d commit 0c89649

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

arch/powerpc/kernel/exceptions-64s.S

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3121,22 +3121,3 @@ handle_dabr_fault:
31213121
li r5,SIGSEGV
31223122
bl bad_page_fault
31233123
b interrupt_return
3124-
3125-
/*
3126-
* When doorbell is triggered from system reset wakeup, the message is
3127-
* not cleared, so it would fire again when EE is enabled.
3128-
*
3129-
* When coming from local_irq_enable, there may be the same problem if
3130-
* we were hard disabled.
3131-
*
3132-
* Execute msgclr to clear pending exceptions before handling it.
3133-
*/
3134-
h_doorbell_common_msgclr:
3135-
LOAD_REG_IMMEDIATE(r3, PPC_DBELL_MSGTYPE << (63-36))
3136-
PPC_MSGCLR(3)
3137-
b h_doorbell_common_virt
3138-
3139-
doorbell_super_common_msgclr:
3140-
LOAD_REG_IMMEDIATE(r3, PPC_DBELL_MSGTYPE << (63-36))
3141-
PPC_MSGCLRP(3)
3142-
b doorbell_super_common_virt

arch/powerpc/kernel/irq.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,19 @@ void irq_set_pending_from_srr1(unsigned long srr1)
527527
return;
528528
}
529529

530+
if (reason == PACA_IRQ_DBELL) {
531+
/*
532+
* When doorbell triggers a system reset wakeup, the message
533+
* is not cleared, so if the doorbell interrupt is replayed
534+
* and the IPI handled, the doorbell interrupt would still
535+
* fire when EE is enabled.
536+
*
537+
* To avoid taking the superfluous doorbell interrupt,
538+
* execute a msgclr here before the interrupt is replayed.
539+
*/
540+
ppc_msgclr(PPC_DBELL_MSGTYPE);
541+
}
542+
530543
/*
531544
* The 0 index (SRR1[42:45]=b0000) must always evaluate to 0,
532545
* so this can be called unconditionally with the SRR1 wake

0 commit comments

Comments
 (0)