diff mbox

[v2,1/1] KVM: PPC: Book3E HV: call SOFT_DISABLE_INTS to sync the software state

Message ID 1375841103-5731-1-git-send-email-tiejun.chen@windriver.com
State New, archived
Headers show

Commit Message

Tiejun Chen Aug. 7, 2013, 2:05 a.m. UTC
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 instead of calling hard_irq_disable() directly.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
---
 arch/powerpc/kvm/booke.c              |   11 -----------
 arch/powerpc/kvm/bookehv_interrupts.S |   10 ++++++++++
 2 files changed, 10 insertions(+), 11 deletions(-)

Comments

Alexander Graf Aug. 14, 2013, 11:56 a.m. UTC | #1
On 07.08.2013, at 04:05, Tiejun Chen wrote:

> 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 instead of calling hard_irq_disable() directly.
> 
> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>

Scott, Ben, could you please ack?


Alex

> ---
> arch/powerpc/kvm/booke.c              |   11 -----------
> arch/powerpc/kvm/bookehv_interrupts.S |   10 ++++++++++
> 2 files changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 17722d8..7653c9c 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -833,17 +833,6 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
> 	int s;
> 	int idx;
> 
> -#ifdef CONFIG_PPC64
> -	WARN_ON(local_paca->irq_happened != 0);
> -#endif
> -
> -	/*
> -	 * We enter with interrupts disabled in hardware, but
> -	 * we need to call hard_irq_disable anyway to ensure that
> -	 * the software state is kept in sync.
> -	 */
> -	hard_irq_disable();
> -
> 	/* update before a new last_exit_type is rewritten */
> 	kvmppc_update_timing_stats(vcpu);
> 
> diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
> index e8ed7d6..4deaf2e 100644
> --- a/arch/powerpc/kvm/bookehv_interrupts.S
> +++ b/arch/powerpc/kvm/bookehv_interrupts.S
> @@ -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
> @@ -465,6 +467,14 @@ _GLOBAL(kvmppc_resume_host)
> 	mtspr	SPRN_EPCR, r3
> 	isync
> 
> +#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(r3,r5)
> +#endif
> 	/* Switch to kernel stack and jump to handler. */
> 	PPC_LL	r3, HOST_RUN(r1)
> 	mr	r5, r14 /* intno */
> -- 
> 1.7.9.5
> 

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Scott Wood Aug. 14, 2013, 7:34 p.m. UTC | #2
On Wed, 2013-08-14 at 13:56 +0200, Alexander Graf wrote:
> On 07.08.2013, at 04:05, Tiejun Chen wrote:
> 
> > 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 instead of calling hard_irq_disable() directly.
> > 
> > Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> 
> Scott, Ben, could you please ack?

ACK, but it needs to be updated due to this patch that renames
SOFT_DISABLE_INTS:

http://patchwork.ozlabs.org/patch/259337/

-Scott



--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Benjamin Herrenschmidt Aug. 14, 2013, 9:01 p.m. UTC | #3
On Wed, 2013-08-14 at 14:34 -0500, Scott Wood wrote:
> On Wed, 2013-08-14 at 13:56 +0200, Alexander Graf wrote:
> > On 07.08.2013, at 04:05, Tiejun Chen wrote:
> > 
> > > 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 instead of calling hard_irq_disable() directly.
> > > 
> > > Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> > 
> > Scott, Ben, could you please ack?
> 
> ACK, but it needs to be updated due to this patch that renames
> SOFT_DISABLE_INTS:
> 
> http://patchwork.ozlabs.org/patch/259337/

Note that the latter was applied to powerpc -next already.

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tiejun Chen Aug. 15, 2013, 3:19 a.m. UTC | #4
On 08/15/2013 05:01 AM, Benjamin Herrenschmidt wrote:
> On Wed, 2013-08-14 at 14:34 -0500, Scott Wood wrote:
>> On Wed, 2013-08-14 at 13:56 +0200, Alexander Graf wrote:
>>> On 07.08.2013, at 04:05, Tiejun Chen wrote:
>>>
>>>> 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 instead of calling hard_irq_disable() directly.
>>>>
>>>> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
>>>
>>> Scott, Ben, could you please ack?
>>
>> ACK, but it needs to be updated due to this patch that renames
>> SOFT_DISABLE_INTS:
>>
>> http://patchwork.ozlabs.org/patch/259337/
>
> Note that the latter was applied to powerpc -next already.
>

Thanks Ben and Scott.

Alex,

Should I resend an updated patch after you sync powerpc -next?

Tiejun

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 17722d8..7653c9c 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -833,17 +833,6 @@  int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
 	int s;
 	int idx;
 
-#ifdef CONFIG_PPC64
-	WARN_ON(local_paca->irq_happened != 0);
-#endif
-
-	/*
-	 * We enter with interrupts disabled in hardware, but
-	 * we need to call hard_irq_disable anyway to ensure that
-	 * the software state is kept in sync.
-	 */
-	hard_irq_disable();
-
 	/* update before a new last_exit_type is rewritten */
 	kvmppc_update_timing_stats(vcpu);
 
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index e8ed7d6..4deaf2e 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -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
@@ -465,6 +467,14 @@  _GLOBAL(kvmppc_resume_host)
 	mtspr	SPRN_EPCR, r3
 	isync
 
+#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(r3,r5)
+#endif
 	/* Switch to kernel stack and jump to handler. */
 	PPC_LL	r3, HOST_RUN(r1)
 	mr	r5, r14 /* intno */