From: Dario Faggioli <dario.faggioli@citrix.com>
To: George Dunlap <george.dunlap@citrix.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
George Dunlap <george.dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Jan Beulich <jbeulich@suse.com>, "Wu, Feng" <feng.wu@intel.com>
Subject: Re: [PATCH v7 15/17] vmx: VT-d posted-interrupt core logic handling
Date: Thu, 17 Sep 2015 18:36:23 +0200 [thread overview]
Message-ID: <1442507783.15327.135.camel@citrix.com> (raw)
In-Reply-To: <55FACE83.6050607@citrix.com>
[-- Attachment #1.1: Type: text/plain, Size: 3870 bytes --]
On Thu, 2015-09-17 at 15:30 +0100, George Dunlap wrote:
> On 09/17/2015 01:40 PM, Dario Faggioli wrote:
> >> I haven't yet decided whether I prefer my original suggestion of
> >> switching the interrupt and putting things on the wake-up list in
> >> vcpu_block(), or of deferring adding things to the wake-up list until
> >> the actual context switch.
> >>
> > Sorry but I don't get what you mean with the latter.
> >
> > I particular, I don't think I understand what you mean with and how it
> > would work to "defer[ring] adding things to the wake-up list until
> > actual context switch"... In what case would you defer stuff to context
> > switch?
>
> So one option is to do the "blocking" stuff in an arch-specific call
> from vcpu_block():
>
> vcpu_block()
> set(_VPF_blocked)
> v->arch.block()
> - Add v to pcpu.pi_blocked_vcpu
> - NV => pi_wakeup_vector
> local_events_need_delivery()
> hvm_vcpu_has_pending_irq()
>
> ...
> context_switch(): nothing
>
> The other is to do the "blocking" stuff in the context switch (similar
> to what's done now):
>
> vcpu_block()
> set(_VPF_blocked)
> local_events_need_delivery()
> hvm_vcpu_has_pending_irq()
> ...
> context_switch
> v->arch.block()
> - Add v to pcpu.pi_blocked_vcpu
> - NV => pi_wakeup_vector
>
Ok, thanks for elaborating.
> If we do it the first way, and an interrupt comes in before the context
> switch is finished, it will call pi_wakeup_vector, which will DTRT --
> take v off the pi_blocked_vcpu list and call vcpu_unblock() (which in
> turn will set NV back to posted_intr_vector).
>
> If we do it the second way, and an interrupt comes in before the context
> switch is finished, it will call posted_intr_vector. We can, at that
> point, check to see if the current vcpu is marked as blocked. If it is,
> we can call vcpu_unblock() without having to modify NV or worry about
> adding / removing the vcpu from the pi_blocked_vcpu list.
>
Right.
> The thing I like about the first one is that it makes PI blocking the
> same as normal blocking -- everything happens in the same place; so the
> code is cleaner and easier to understand.
>
Indeed.
> The thing I like about the second one is that it cleverly avoids having
> to do all the work of adding the vcpu to the list and then searching to
> remove it if the vcpu in question gets woken up on the way to being
> blocked. So the code may end up being faster for workloads where that
> happens frequently.
>
Maybe some instrumentation to figure out how frequent this is, at least
in a couple of (thought to be) common workloads can be added, and a few
test performed? Feng?
One thing that may be worth giving some thinking at is whether
interrupts are enabled or not. I mean, during vcpu_block()
SCHEDULE_SOFTIRQ is raised, for invoking the scheduler. Then (at least)
during schedule(), IRQs are disabled. They're re-enabled near the end of
schedule(), and re-disabled for the actual context switch ( ~= around
__context_switch()).
My point being that IRQs are going to be disabled for a significant
amount of time, between vcpu_block() and the actual context being
switched. And solution 2 requires IRQs to be enabled in order to avoid a
potentially pointless NV update, doesn't it? If yes, that may
(negatively) affect the probability of being able to actually benefit
from the optimization...
Anyway, I'm not sure. I think my gut feelings are in favour of solution
1, but, really, it's hard to tell without actually trying.
Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-09-17 16:36 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 8:28 [PATCH v7 00/17] Add VT-d Posted-Interrupts support Feng Wu
2015-09-11 8:28 ` [PATCH v7 01/17] VT-d Posted-intterrupt (PI) design Feng Wu
2015-09-11 8:28 ` [PATCH v7 02/17] Add cmpxchg16b support for x86-64 Feng Wu
2015-09-22 13:50 ` Jan Beulich
2015-09-22 13:55 ` Wu, Feng
2015-09-11 8:28 ` [PATCH v7 03/17] iommu: Add iommu_intpost to control VT-d Posted-Interrupts feature Feng Wu
2015-09-11 8:28 ` [PATCH v7 04/17] vt-d: VT-d Posted-Interrupts feature detection Feng Wu
2015-09-22 14:18 ` Jan Beulich
2015-09-11 8:28 ` [PATCH v7 05/17] vmx: Extend struct pi_desc to support VT-d Posted-Interrupts Feng Wu
2015-09-22 14:20 ` Jan Beulich
2015-09-23 1:02 ` Wu, Feng
2015-09-23 7:36 ` Jan Beulich
2015-09-11 8:28 ` [PATCH v7 06/17] vmx: Add some helper functions for Posted-Interrupts Feng Wu
2015-09-11 8:28 ` [PATCH v7 07/17] vmx: Initialize VT-d Posted-Interrupts Descriptor Feng Wu
2015-09-11 8:28 ` [PATCH v7 08/17] vmx: Suppress posting interrupts when 'SN' is set Feng Wu
2015-09-22 14:23 ` Jan Beulich
2015-09-11 8:28 ` [PATCH v7 09/17] VT-d: Remove pointless casts Feng Wu
2015-09-22 14:30 ` Jan Beulich
2015-09-11 8:28 ` [PATCH v7 10/17] vt-d: Extend struct iremap_entry to support VT-d Posted-Interrupts Feng Wu
2015-09-22 14:28 ` Jan Beulich
2015-09-11 8:29 ` [PATCH v7 11/17] vt-d: Add API to update IRTE when VT-d PI is used Feng Wu
2015-09-22 14:42 ` Jan Beulich
2015-09-11 8:29 ` [PATCH v7 12/17] x86: move some APIC related macros to apicdef.h Feng Wu
2015-09-22 14:44 ` Jan Beulich
2015-09-11 8:29 ` [PATCH v7 13/17] Update IRTE according to guest interrupt config changes Feng Wu
2015-09-22 14:51 ` Jan Beulich
2015-09-11 8:29 ` [PATCH v7 14/17] vmx: Properly handle notification event when vCPU is running 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 [this message]
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
2015-09-11 8:29 ` [PATCH v7 16/17] VT-d: Dump the posted format IRTE Feng Wu
2015-09-22 14:58 ` Jan Beulich
2015-09-11 8:29 ` [PATCH v7 17/17] Add a command line parameter for VT-d posted-interrupts Feng Wu
-- strict thread matches above, loose matches on Subject: below --
2015-09-21 5:08 [PATCH v7 15/17] vmx: VT-d posted-interrupt core logic handling 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-21 5:09 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
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
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=1442507783.15327.135.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=feng.wu@intel.com \
--cc=george.dunlap@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=jbeulich@suse.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).