All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Glauber Costa <glommer@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"H. Peter Anvin" <hpa@zytor.com>, Gleb Natapov <gleb@redhat.com>
Subject: Re: [PATCH 1/2] replace drop_interrupt_shadow by set_interrupt_shadow
Date: Sun, 10 May 2009 16:07:30 +0300	[thread overview]
Message-ID: <4A06D192.2010501@redhat.com> (raw)
In-Reply-To: <1241814187-5973-2-git-send-email-glommer@redhat.com>

Glauber Costa wrote:
> This patch replaces drop_interrupt_shadow with the more
> general set_interrupt_shadow, that can either drop or raise
> it, depending on its parameter.
>
>  	void (*skip_emulated_instruction)(struct kvm_vcpu *vcpu);
> +	void (*set_interrupt_shadow)(struct kvm_vcpu *vcpu, int mask);
> +	u32 (*get_interrupt_shadow)(struct kvm_vcpu *vcpu);
>   

Would be better to make these symmetric in their mask types.

> +++ b/arch/x86/kvm/svm.c
> @@ -202,6 +202,27 @@ static int is_external_interrupt(u32 info)
>  	return info == (SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR);
>  }
>  
> +static u32 svm_get_interrupt_shadow(struct kvm_vcpu *vcpu)
> +{
> +	struct vcpu_svm *svm = to_svm(vcpu);
> +	u32 ret = 0;
> +
> +	if (svm->vmcb->control.int_state & SVM_INTERRUPT_SHADOW_MASK)
> +		ret |= (X86_SHADOW_INT_STI && X86_SHADOW_INT_MOV_SS);
>   

&& -> |.  Parentheses unnecessary.

>  {
>  	struct vcpu_svm *svm = to_svm(vcpu);
> @@ -2637,6 +2652,8 @@ static struct kvm_x86_ops svm_x86_ops = {
>  	.run = svm_vcpu_run,
>  	.handle_exit = handle_exit,
>  	.skip_emulated_instruction = skip_emulated_instruction,
> +	.set_interrupt_shadow= svm_set_interrupt_shadow,
>   

Missing space.

> +static void vmx_set_interrupt_shadow(struct kvm_vcpu *vcpu, int mask)
> +{
> +	u32 interruptibility_old = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
> +	u32 interruptibility = interruptibility_old;
> +
> +	switch (mask) {
> +	case 0:
> +		interruptibility &= ~((GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS));
> +		break;
>   

Need to clear this unconditionally, otherwise 'sti; mov ss' will set 
both flags.

> +	case X86_SHADOW_INT_MOV_SS:
> +		interruptibility |= GUEST_INTR_STATE_MOV_SS;
> +		break;
> +	case X86_SHADOW_INT_STI:
> +		interruptibility |= GUEST_INTR_STATE_STI;
> +		break;
> +	default:
> +		printk(KERN_ERR "Bogus mask for interrupt shadow!\n");
> +	}
>   

I suggest we deal with the case where both are set.  One day we'll live 
migrate this state, and if we come from an AMD host, we might get this 
state.

-- 
error compiling committee.c: too many arguments to function


  parent reply	other threads:[~2009-05-10 13:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-08 20:23 [PATCH 0/2] Deal with shadow interrupts after emulated instructions Glauber Costa
2009-05-08 20:23 ` [PATCH 1/2] replace drop_interrupt_shadow by set_interrupt_shadow Glauber Costa
2009-05-08 20:23   ` [PATCH 2/2] deal with interrupt shadow state for emulated instruction Glauber Costa
2009-05-10 13:09     ` Avi Kivity
2009-05-10 13:07   ` Avi Kivity [this message]
2009-05-10  8:15 ` [PATCH 0/2] Deal with shadow interrupts after emulated instructions Gleb Natapov
  -- strict thread matches above, loose matches on Subject: below --
2009-05-12 15:13 Glauber Costa
2009-05-12 15:13 ` [PATCH 1/2] replace drop_interrupt_shadow by set_interrupt_shadow Glauber Costa
2009-05-12 18:11   ` Avi Kivity
2009-05-12 20:21 [PATCH 0/2] Deal with shadow interrupts after emulated instructions Glauber Costa
2009-05-12 20:21 ` [PATCH 1/2] replace drop_interrupt_shadow by set_interrupt_shadow Glauber Costa

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=4A06D192.2010501@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=glommer@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.