All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Jan Beulich' <JBeulich@suse.com>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] x86/hvm: more sure APIC assist is aborted if guest EOIs APIC
Date: Thu, 18 Jan 2018 09:55:37 +0000	[thread overview]
Message-ID: <e6463fcadeff435eb0d885d9ce5c8a76@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <5A60793A020000780019FC41@prv-mh.provo.novell.com>

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 18 January 2018 09:39
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>; xen-
> devel@lists.xenproject.org
> Subject: RE: [PATCH] x86/hvm: more sure APIC assist is aborted if guest EOIs
> APIC
> 
> >>> On 18.01.18 at 10:06, <Paul.Durrant@citrix.com> wrote:
> >>  -----Original Message-----
> >> From: Jan Beulich [mailto:JBeulich@suse.com]
> >> Sent: 18 January 2018 08:33
> >> To: Paul Durrant <Paul.Durrant@citrix.com>
> >> Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>; xen-
> >> devel@lists.xenproject.org
> >> Subject: Re: [PATCH] x86/hvm: more sure APIC assist is aborted if guest
> EOIs
> >> APIC
> >>
> >> >>> On 17.01.18 at 13:53, <paul.durrant@citrix.com> wrote:
> >> > --- a/xen/arch/x86/hvm/vlapic.c
> >> > +++ b/xen/arch/x86/hvm/vlapic.c
> >> > @@ -422,6 +422,13 @@ void vlapic_EOI_set(struct vlapic *vlapic)
> >> >      if ( vector == -1 )
> >> >          return;
> >> >
> >> > +    /*
> >> > +     * It is possible that APIC assist has been enabled by the guest but
> >> > +     * it has chosen not to use it, by EOIing normally. It is therefore
> >> > +     * necessary to abort any APIC assist that may have been started
> >> > +     * to avoid confusing the state machine.
> >> > +     */
> >> > +    viridian_abort_apic_assist(vlapic_vcpu(vlapic));
> >> >      vlapic_clear_vector(vector, &vlapic->regs->data[APIC_ISR]);
> >>
> >> Fundamentally fine, but is clearing bit 0 in the shared location a
> >> valid thing to do in this case? Plus shouldn't you pass in the vector,
> >> so the abort would only happen for the very vector that is pending?
> >
> > I believe that it is ok.
> >
> >> Iirc with nested interrupts normal EOI might still need to be used
> >> by Windows (as only a single vector can be in flight in the assist), so
> >> clearing the assist for the wrong vector might actually cause harm.
> >>
> >
> > If there are nested interrupts then the assist should be aborted anyway.
> > Assist only helps if there is one interrupt pending so should not have been
> > started if something higher priority already in the ISR
> 
> I was thinking about the opposite case - assist active with a higher
> priority interrupt coming in (and then being EOI-ed). But I guess
> that's already being taken care of by the existing call to
> viridian_abort_apic_assist().
> 

Yes, that's right.

> > so, if we see an EOI
> > for a vector that is not the one latched in assist I think this is also a bug
> > in the state machine. I can add verification of that, if you'd like.
> 
> At least one-time warnings would seem helpful here, so we have
> some sort of indication that some assumption is being violated.
> 

Ok. I'll re-work it so that abort is passed a vector and warns on mismatch.

  Paul

> Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-01-18  9:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 12:53 [PATCH] x86/hvm: more sure APIC assist is aborted if guest EOIs APIC Paul Durrant
2018-01-17 12:55 ` Paul Durrant
2018-01-18  8:32 ` Jan Beulich
2018-01-18  9:06   ` Paul Durrant
2018-01-18  9:38     ` Jan Beulich
2018-01-18  9:55       ` Paul Durrant [this message]
2018-01-18 10:17         ` Jan Beulich
2018-01-18 10:37           ` Paul Durrant
2018-01-18 11:21             ` Paul Durrant
2018-01-18 12:57               ` Jan Beulich

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=e6463fcadeff435eb0d885d9ce5c8a76@AMSPEX02CL03.citrite.net \
    --to=paul.durrant@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xenproject.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.