From: George Dunlap <george.dunlap@citrix.com>
To: Jan Beulich <JBeulich@suse.com>, Feng Wu <feng.wu@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Dario Faggioli <dario.faggioli@citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v7 15/17] vmx: VT-d posted-interrupt core logic handling
Date: Wed, 23 Sep 2015 10:44:24 +0100 [thread overview]
Message-ID: <56027478.1040604@citrix.com> (raw)
In-Reply-To: <56017B4102000078000A46CD@prv-mh.provo.novell.com>
On 09/22/2015 03:01 PM, Jan Beulich wrote:
>>>> On 22.09.15 at 15:40, <feng.wu@intel.com> wrote:
>
>>
>>> -----Original Message-----
>>> From: Jan Beulich [mailto:JBeulich@suse.com]
>>> Sent: Tuesday, September 22, 2015 5:00 PM
>>> To: Wu, Feng
>>> Cc: Andrew Cooper; Dario Faggioli; George Dunlap; George Dunlap; Tian,
>> Kevin;
>>> xen-devel@lists.xen.org; Keir Fraser
>>> Subject: RE: [Xen-devel] [PATCH v7 15/17] vmx: VT-d posted-interrupt core logic
>>> handling
>>>
>>>>>> On 22.09.15 at 09:19, <feng.wu@intel.com> wrote:
>>>> However, I do find some issues with my proposal above, see below:
>>>>
>>>> 1. Set _VPF_blocked
>>>> 2. ret = arch_block()
>>>> 3. if ( ret || local_events_need_delivery() )
>>>> clear_bit(_VPF_blocked, &v->pause_flags);
>>>>
>>>> After step #2, if ret == false, that means, we successfully changed the PI
>>>> descriptor in arch_block(), if local_events_need_delivery() returns true,
>>>> _VPF_blocked is cleared. After that, external interrupt come in, hence
>>>> pi_wakeup_interrupt() --> vcpu_unblock(), but _VPF_blocked is cleared,
>>>> so vcpu_unblock() does nothing, so the vCPU's PI state is incorrect.
>>>>
>>>> One possible solution for it is:
>>>> - Disable the interrupts before the check in step #3 above
>>>> - if local_events_need_delivery() returns true, undo all the operations
>>>> done in arch_block()
>>>> - Enable interrupts after _VPF_blocked gets cleared.
>>>
>>> Couldn't this be taken care of by, if necessary, adjusting PI state
>>> in vmx_do_resume()?
>>
>> What do you mean here? Could you please elaborate? Thanks!
>
> From the discussion so far I understand that all you're after is that
> the PI descriptor is correct for the period of time while the guest
> vCPU is actually executing in guest context. If that's a correct
> understanding of mine, then setting the vector and flags back to
> what's needed while the guest is running would be sufficient to be
> done right before entering the guest, i.e. in vmx_do_resume().
Along those lines, is setting the SN and NDST relatively expensive?
If they are, then of course switching them in __context_switch() makes
sense.
But if setting them is fairly cheap, then we could just clear SN on
every vmexit, and set SN and NDST on every vmentry, couldn't we? Then
we wouldn't need hooks on the context switch path at all (which are only
there to catch running -> runnable and runnable -> running) -- we could
just have the block/unblock hooks (to change NV and add / remove things
from the list).
Setting NDST on vmentry also has the advantage of being more robust --
you don't have to carefully think about cpu migration and all that; you
simply set it right when you're about to actually use it.
Looking at your comment in pi_notification_interrupt() -- I take it that
"pending interrupt in PIRR will be synced to vIRR" somewhere in the call
to vmx_intr_assist()? So if we were to set NDST and enable SN before
that call, we should be able to set VCPU_KICK if we get an interrupt
between vmx_intr_assist() and the actual vmentry as necessary.
-George
next prev parent reply other threads:[~2015-09-23 9:44 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-21 5:09 [PATCH v7 15/17] vmx: VT-d posted-interrupt core logic handling Wu, Feng
2015-09-21 9:54 ` George Dunlap
2015-09-21 12:22 ` Wu, Feng
2015-09-21 14:24 ` Dario Faggioli
2015-09-22 7:19 ` Wu, Feng
2015-09-22 8:59 ` Jan Beulich
2015-09-22 13:40 ` Wu, Feng
2015-09-22 14:01 ` Jan Beulich
2015-09-23 9:44 ` George Dunlap [this message]
2015-09-23 12:35 ` Wu, Feng
2015-09-23 15:25 ` George Dunlap
2015-09-23 15:38 ` Jan Beulich
2015-09-24 1:50 ` Wu, Feng
2015-09-24 3:35 ` Dario Faggioli
2015-09-24 7:51 ` Jan Beulich
2015-09-24 8:03 ` Wu, Feng
2015-09-22 10:26 ` George Dunlap
2015-09-23 6:35 ` Wu, Feng
2015-09-23 7:11 ` Dario Faggioli
2015-09-23 7:20 ` Wu, Feng
-- strict thread matches above, loose matches on Subject: below --
2015-09-21 5:08 Wu, Feng
2015-09-21 9:18 ` George Dunlap
2015-09-21 11:59 ` Wu, Feng
2015-09-21 13:31 ` Dario Faggioli
2015-09-21 13:50 ` Wu, Feng
2015-09-21 14:11 ` Dario Faggioli
2015-09-22 5:10 ` Wu, Feng
2015-09-22 10:43 ` George Dunlap
2015-09-22 10:46 ` George Dunlap
2015-09-22 13:25 ` Wu, Feng
2015-09-22 13:40 ` Dario Faggioli
2015-09-22 13:52 ` Wu, Feng
2015-09-22 14:15 ` George Dunlap
2015-09-22 14:38 ` Dario Faggioli
2015-09-23 5:52 ` Wu, Feng
2015-09-23 7:59 ` Dario Faggioli
2015-09-23 8:11 ` Wu, Feng
2015-09-22 14:28 ` George Dunlap
2015-09-23 5:37 ` Wu, Feng
2015-09-11 8:28 [PATCH v7 00/17] Add VT-d Posted-Interrupts support Feng Wu
2015-09-11 8:29 ` [PATCH v7 15/17] vmx: VT-d posted-interrupt core logic handling Feng Wu
2015-09-16 16:00 ` Dario Faggioli
2015-09-16 17:18 ` Dario Faggioli
2015-09-16 18:05 ` Dario Faggioli
2015-09-17 8:00 ` Wu, Feng
2015-09-17 8:48 ` Dario Faggioli
2015-09-17 9:16 ` Wu, Feng
2015-09-17 9:38 ` George Dunlap
2015-09-17 9:39 ` George Dunlap
2015-09-17 11:44 ` George Dunlap
2015-09-17 12:40 ` Dario Faggioli
2015-09-17 14:30 ` George Dunlap
2015-09-17 16:36 ` Dario Faggioli
2015-09-18 6:27 ` Jan Beulich
2015-09-18 9:22 ` Dario Faggioli
2015-09-18 14:31 ` George Dunlap
2015-09-18 14:34 ` George Dunlap
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=56027478.1040604@citrix.com \
--to=george.dunlap@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dario.faggioli@citrix.com \
--cc=feng.wu@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).