All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Mihai Caraman <mihai.caraman@freescale.com>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org,
	Mihai Caraman <mihai.caraman@freescale.com>
Subject: Re: [PATCH] KVM: PPC: Book3E 64: Fix IRQs warnings and hangs
Date: Fri, 03 May 2013 18:04:47 +0000	[thread overview]
Message-ID: <1367604287.19391.2@snotra> (raw)
In-Reply-To: <1367597470-22214-1-git-send-email-mihai.caraman@freescale.com> (from mihai.caraman@freescale.com on Fri May  3 11:11:10 2013)

On 05/03/2013 11:11:10 AM, Mihai Caraman wrote:
> A change in the generic code highlighted that we were running with  
> IRQs
> (soft) enabled on Book3E 64-bit when trying to restart interrupts from
> handle_exit(). This is a lesson to configure lockdep often :)
> 
> There is no reason to exit guest with soft_enabled = 1, a  
> local_irq_enable()
> call will do this for us so get rid of kvmppc_layz_ee() calls. With  
> this fix
> we eliminate irqs_disabled() warnings and some guest and host hangs  
> revealed
> under stress tests, but guests still exhibit some unresponsiveness.
> 
> The unresponsiveness has to do with the fact that  
> arch_local_irq_restore()
> does not guarantees to hard enable interrupts.

Could you elaborate?  If the saved IRQ state was "enabled", why  
wouldn't arch_local_irq_restore() hard-enable IRQs?  The last thing it  
does is __hard_irq_enable().

Where is the arch_local_irq_restore() instance you're talking about?

> To do so replace exception
> function calls like timer_interrupt() with irq_happened flags. The
> local_irq_enable() call takes care of replaying them and lets the  
> interrupts
> hard enabled.

Not sure what you mean by "lets the interrupts hard enabled"... Do you  
mean the EE bit in regs->msr, as opposed to the EE bit in the current  
MSR?

> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
> ---
>  arch/powerpc/kvm/booke.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 1020119..82f155e 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -673,7 +673,6 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run,  
> struct kvm_vcpu *vcpu)
>  		ret = s;
>  		goto out;
>  	}
> -	kvmppc_lazy_ee_enable();
> 
>  	kvm_guest_enter();
> 
> @@ -789,16 +788,16 @@ static void kvmppc_restart_interrupt(struct  
> kvm_vcpu *vcpu,
>  	switch (exit_nr) {
>  	case BOOKE_INTERRUPT_EXTERNAL:
>  		kvmppc_fill_pt_regs(&regs);
> -		do_IRQ(&regs);
> +		local_paca->irq_happened |= PACA_IRQ_EE;
>  		break;
>  	case BOOKE_INTERRUPT_DECREMENTER:
>  		kvmppc_fill_pt_regs(&regs);
> -		timer_interrupt(&regs);
> +		local_paca->irq_happened |= PACA_IRQ_DEC;
>  		break;
>  #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_BOOK3E_64)
>  	case BOOKE_INTERRUPT_DOORBELL:
>  		kvmppc_fill_pt_regs(&regs);
> -		doorbell_exception(&regs);
> +		local_paca->irq_happened |= PACA_IRQ_DBELL;
>  		break;
>  #endif

Aren't you breaking 32-bit here?

-Scott

WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Mihai Caraman <mihai.caraman@freescale.com>
Cc: Mihai Caraman <mihai.caraman@freescale.com>,
	linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: Book3E 64: Fix IRQs warnings and hangs
Date: Fri, 3 May 2013 13:04:47 -0500	[thread overview]
Message-ID: <1367604287.19391.2@snotra> (raw)
In-Reply-To: <1367597470-22214-1-git-send-email-mihai.caraman@freescale.com> (from mihai.caraman@freescale.com on Fri May  3 11:11:10 2013)

On 05/03/2013 11:11:10 AM, Mihai Caraman wrote:
> A change in the generic code highlighted that we were running with =20
> IRQs
> (soft) enabled on Book3E 64-bit when trying to restart interrupts from
> handle_exit(). This is a lesson to configure lockdep often :)
>=20
> There is no reason to exit guest with soft_enabled =3D=3D 1, a =20
> local_irq_enable()
> call will do this for us so get rid of kvmppc_layz_ee() calls. With =20
> this fix
> we eliminate irqs_disabled() warnings and some guest and host hangs =20
> revealed
> under stress tests, but guests still exhibit some unresponsiveness.
>=20
> The unresponsiveness has to do with the fact that =20
> arch_local_irq_restore()
> does not guarantees to hard enable interrupts.

Could you elaborate?  If the saved IRQ state was "enabled", why =20
wouldn't arch_local_irq_restore() hard-enable IRQs?  The last thing it =20
does is __hard_irq_enable().

Where is the arch_local_irq_restore() instance you're talking about?

> To do so replace exception
> function calls like timer_interrupt() with irq_happened flags. The
> local_irq_enable() call takes care of replaying them and lets the =20
> interrupts
> hard enabled.

Not sure what you mean by "lets the interrupts hard enabled"... Do you =20
mean the EE bit in regs->msr, as opposed to the EE bit in the current =20
MSR?

> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
> ---
>  arch/powerpc/kvm/booke.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
>=20
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 1020119..82f155e 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -673,7 +673,6 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, =20
> struct kvm_vcpu *vcpu)
>  		ret =3D s;
>  		goto out;
>  	}
> -	kvmppc_lazy_ee_enable();
>=20
>  	kvm_guest_enter();
>=20
> @@ -789,16 +788,16 @@ static void kvmppc_restart_interrupt(struct =20
> kvm_vcpu *vcpu,
>  	switch (exit_nr) {
>  	case BOOKE_INTERRUPT_EXTERNAL:
>  		kvmppc_fill_pt_regs(&regs);
> -		do_IRQ(&regs);
> +		local_paca->irq_happened |=3D PACA_IRQ_EE;
>  		break;
>  	case BOOKE_INTERRUPT_DECREMENTER:
>  		kvmppc_fill_pt_regs(&regs);
> -		timer_interrupt(&regs);
> +		local_paca->irq_happened |=3D PACA_IRQ_DEC;
>  		break;
>  #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_BOOK3E_64)
>  	case BOOKE_INTERRUPT_DOORBELL:
>  		kvmppc_fill_pt_regs(&regs);
> -		doorbell_exception(&regs);
> +		local_paca->irq_happened |=3D PACA_IRQ_DBELL;
>  		break;
>  #endif

Aren't you breaking 32-bit here?

-Scott=

WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Mihai Caraman <mihai.caraman@freescale.com>
Cc: <kvm-ppc@vger.kernel.org>, <kvm@vger.kernel.org>,
	<linuxppc-dev@lists.ozlabs.org>,
	Mihai Caraman <mihai.caraman@freescale.com>
Subject: Re: [PATCH] KVM: PPC: Book3E 64: Fix IRQs warnings and hangs
Date: Fri, 3 May 2013 13:04:47 -0500	[thread overview]
Message-ID: <1367604287.19391.2@snotra> (raw)
In-Reply-To: <1367597470-22214-1-git-send-email-mihai.caraman@freescale.com> (from mihai.caraman@freescale.com on Fri May  3 11:11:10 2013)

On 05/03/2013 11:11:10 AM, Mihai Caraman wrote:
> A change in the generic code highlighted that we were running with  
> IRQs
> (soft) enabled on Book3E 64-bit when trying to restart interrupts from
> handle_exit(). This is a lesson to configure lockdep often :)
> 
> There is no reason to exit guest with soft_enabled == 1, a  
> local_irq_enable()
> call will do this for us so get rid of kvmppc_layz_ee() calls. With  
> this fix
> we eliminate irqs_disabled() warnings and some guest and host hangs  
> revealed
> under stress tests, but guests still exhibit some unresponsiveness.
> 
> The unresponsiveness has to do with the fact that  
> arch_local_irq_restore()
> does not guarantees to hard enable interrupts.

Could you elaborate?  If the saved IRQ state was "enabled", why  
wouldn't arch_local_irq_restore() hard-enable IRQs?  The last thing it  
does is __hard_irq_enable().

Where is the arch_local_irq_restore() instance you're talking about?

> To do so replace exception
> function calls like timer_interrupt() with irq_happened flags. The
> local_irq_enable() call takes care of replaying them and lets the  
> interrupts
> hard enabled.

Not sure what you mean by "lets the interrupts hard enabled"... Do you  
mean the EE bit in regs->msr, as opposed to the EE bit in the current  
MSR?

> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
> ---
>  arch/powerpc/kvm/booke.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 1020119..82f155e 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -673,7 +673,6 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run,  
> struct kvm_vcpu *vcpu)
>  		ret = s;
>  		goto out;
>  	}
> -	kvmppc_lazy_ee_enable();
> 
>  	kvm_guest_enter();
> 
> @@ -789,16 +788,16 @@ static void kvmppc_restart_interrupt(struct  
> kvm_vcpu *vcpu,
>  	switch (exit_nr) {
>  	case BOOKE_INTERRUPT_EXTERNAL:
>  		kvmppc_fill_pt_regs(&regs);
> -		do_IRQ(&regs);
> +		local_paca->irq_happened |= PACA_IRQ_EE;
>  		break;
>  	case BOOKE_INTERRUPT_DECREMENTER:
>  		kvmppc_fill_pt_regs(&regs);
> -		timer_interrupt(&regs);
> +		local_paca->irq_happened |= PACA_IRQ_DEC;
>  		break;
>  #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_BOOK3E_64)
>  	case BOOKE_INTERRUPT_DOORBELL:
>  		kvmppc_fill_pt_regs(&regs);
> -		doorbell_exception(&regs);
> +		local_paca->irq_happened |= PACA_IRQ_DBELL;
>  		break;
>  #endif

Aren't you breaking 32-bit here?

-Scott

  parent reply	other threads:[~2013-05-03 18:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03 16:11 [PATCH] KVM: PPC: Book3E 64: Fix IRQs warnings and hangs Mihai Caraman
2013-05-03 16:11 ` Mihai Caraman
2013-05-03 16:11 ` Mihai Caraman
2013-05-03 16:24 ` Alexander Graf
2013-05-03 16:24   ` Alexander Graf
2013-05-03 16:24   ` Alexander Graf
2013-05-03 22:03   ` Benjamin Herrenschmidt
2013-05-03 22:03     ` Benjamin Herrenschmidt
2013-05-03 22:03     ` Benjamin Herrenschmidt
2013-05-03 18:04 ` Scott Wood [this message]
2013-05-03 18:04   ` Scott Wood
2013-05-03 18:04   ` Scott Wood
2013-05-03 20:01   ` Caraman Mihai Claudiu-B02008
2013-05-03 20:01     ` Caraman Mihai Claudiu-B02008
2013-05-03 20:01     ` Caraman Mihai Claudiu-B02008
2013-05-03 20:15     ` Scott Wood
2013-05-03 20:15       ` Scott Wood
2013-05-03 20:15       ` Scott Wood
2013-05-03 20:56       ` Caraman Mihai Claudiu-B02008
2013-05-03 20:56         ` Caraman Mihai Claudiu-B02008
2013-05-03 20:56         ` Caraman Mihai Claudiu-B02008
2013-05-03 22:06         ` Scott Wood
2013-05-03 22:06           ` Scott Wood
2013-05-03 22:06           ` Scott Wood
2013-05-03 22:59           ` Caraman Mihai Claudiu-B02008
2013-05-03 22:59             ` Caraman Mihai Claudiu-B02008
2013-05-03 22:59             ` Caraman Mihai Claudiu-B02008
2013-05-03 23:30             ` Scott Wood
2013-05-03 23:30               ` Scott Wood
2013-05-03 23:30               ` Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367604287.19391.2@snotra \
    --to=scottwood@freescale.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mihai.caraman@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.