KVM: PPC: disable preemption when using hard_irq_disable()
A message that is not in the archive (sent off-list or not yet received): 1373651433.8183.276@snotra
Quoted 6 lines · Scott Wood
[1]
SOFT_DISABLE_INTSseems an odd name for something that updates the software state to be consistent with interrupts being *hard* disabled. I can sort of see the logic in it, but it's confusing when first encountered. From the name it looks like all it would do is setsoft_enabledto 1.
It's indeed odd. Also worse when we use DISABLE_INTS which is just a macro on top of SOFT_DISABLE_INTS :-)
I've been wanting to change the macro name for a while now and never got to it. Patch welcome :-)
Cheers,
Ben.
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 6 lines · Scott Wood
[1]
SOFT_DISABLE_INTSseems an odd name for something that updates the software state to be consistent with interrupts being *hard* disabled. I can sort of see the logic in it, but it's confusing when first encountered. From the name it looks like all it would do is setsoft_enabledto 1.
Quoted 6 lines
It's indeed odd. Also worse when we use
DISABLE_INTSwhich is just a macro on top ofSOFT_DISABLE_INTS:-)I've been wanting to change the macro name for a while now and never got to it. Patch welcome :-)
What about SOFT_IRQ_DISABLE? This is close to name hard_irq_disable() :) And then remove all DISABLE_INTS as well?
Tiejun
Quoted 3 lines · tiejun.chen
What about
SOFT_IRQ_DISABLE? This is close to namehard_irq_disable():) And
then remove allDISABLE_INTSas well?
Or RECONCILE_IRQ_STATE...
Ben.
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 3 lines · tiejun.chen
What about
SOFT_IRQ_DISABLE? This is close to namehard_irq_disable():) And
then remove allDISABLE_INTSas well?Or
RECONCILE_IRQ_STATE...
But sounds this doesn't imply this key point that the soft-irq is always disabled here :)
And as I understand, the irq state is always needed to be reconciled when we disable soft irq, right?
Tiejun
A message that is not in the archive (sent off-list or not yet received): 1373909248.8183.303@snotra
Quoted 17 lines · Scott Wood
Quoted 16 lines · tiejun.chen
Quoted 14 lines · Benjamin Herrenschmidt
Quoted 6 lines · Scott Wood
[1]
SOFT_DISABLE_INTSseems an odd name for something that updates the software state to be consistent with interrupts being *hard* disabled. I can sort of see the logic in it, but it's confusing when first encountered. From the name it looks like all it would do is setsoft_enabledto 1.It's indeed odd. Also worse when we use
DISABLE_INTSwhich is just a macro on top ofSOFT_DISABLE_INTS:-)I've been wanting to change the macro name for a while now and never got to it. Patch welcome :-)
Quoted 7 lines
Quoted 1 line
What about
SOFT_IRQ_DISABLE?What is semantically different about that from
SOFT_DISABLE_INTS?Quoted 1 line
This is close to name
hard_irq_disable():)Except that one says "soft" and the other says "hard". :-)
Yes, I want to leave as SOFT_IRQ_DISABLE and close to hard_irq_disable() just since I think the irq state is always needed to be reconciled when we disable soft irq. So maybe we shouldn't necessarily underline to sync the software state here as I understand.
But looks you also agree with that name, RECONCILE_IRQ_STATE, Ben mentioned previously. So I'd like to turn back :)
Quoted 5 lines
Quoted 2 lines
And then remove all
DISABLE_INTSas well?You mean opencode
WHATEVER_WE_CALL_IT(r3,r4)everwhere? Why?
OOPS :-P
Tiejun
Quoted 43 lines · Scott Wood
Quoted 42 lines · tiejun.chen
If so, why not to remove directly
hard_irq_disable()insidekvmppc_handle_exit()by reverting that commit, "kvm/ppc/booke64: Fix lazy ee handling inkvmppc_handle_exit()"?Then we can use
SOFT_DISABLE_INTS()explicitly before callkvmppc_handle_exit()like this:KVM: PPC: Book3E HV: call
SOFT_DISABLE_INTSto sync the software stateWe enter with interrupts disabled in hardware, but we need to call
SOFT_DISABLE_INTSanyway to ensure that the software state is kept in sync.Signed-off-by Tiejun Chen <[email protected]>arch/powerpc/kvm/bookehv_interrupts.S +10
-0@@ -33,6 +33,8 @@ #ifdef CONFIG_64BIT #include <asm/exception-64e.h> +#include <asm/hw_irq.h> +#include <asm/irqflags.h> #else #include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */ #endif@@ -469,6 +471,14 @@ _GLOBAL(kvmppc_resume_host) PPC_LL r3, HOST_RUN(r1) mr r5, r14 /* intno */ mr r14, r4 /* Save vcpu pointer. */ +#ifdef CONFIG_64BIT + /* + * We enter with interrupts disabled in hardware, but + * we need to call SOFT_DISABLE_INTS anyway to ensure + * that the software state is kept in sync. + */ + SOFT_DISABLE_INTS(r7,r8) +#endif
Quoted 4 lines
arch/powerpc/kvm/bookehv_interrupts.S _GLOBAL(kvmppc_resume_host) · line 483
Quoted 1 line
arch/powerpc/kvm/bookehv_interrupts.S +0
-0bl kvmppc_handle_exitThis will clobber the arguments we want to pass to
kvmppc_handle_exit. That can be fixed by moving SOFT_DISABLE_INTS[1] earlier, and maybe it's more idiomatic
Okay. Once we have a final name to replace SOFT_DISABLE_INTS, I can regenerate this as you comment.
Quoted 3 lines
to use
SOFT_DISABLE_INTSrather than what we currently do, but we still want to fixhard_irq_disable(). There are other places where we callhard_irq_disable()where interrupts (and I believe preemption) were previously enabled.
Yes, I had a preliminary change ACKed by Ben, and I guess you also saw :) so I'll send that firstly.
Thanks,
Tiejun