From: Dario Faggioli <dario.faggioli@citrix.com>
To: "Wu, Feng" <feng.wu@intel.com>, Jan Beulich <JBeulich@suse.com>
Cc: "george.dunlap@eu.citrix.com" <george.dunlap@eu.citrix.com>,
"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v3 4/6] Pause/Unpause the domain before/after assigning PI hooks
Date: Wed, 14 Sep 2016 16:51:53 +0200 [thread overview]
Message-ID: <1473864713.6339.142.camel@citrix.com> (raw)
In-Reply-To: <E959C4978C3B6342920538CF579893F0197CBDF0@SHSMSX103.ccr.corp.intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 3229 bytes --]
On Wed, 2016-09-14 at 02:23 +0000, Wu, Feng wrote:
> Then I tried to implement the function like the following:
>
> /* This function is called when pcidevs_lock is held */
> void vmx_pi_hooks_assign(struct domain *d)
> {
> if ( !iommu_intpost || !has_hvm_container_domain(d) )
> return;
>
> ASSERT(!d->arch.hvm_domain.vmx.vcpu_block);
>
> /*
> * We carefully handle the timing here:
> * - Install the context switch first
> * - Then set the NDST field
> * - Install the block and resume hooks in the end
> *
> * This can make sure the PI (especially the NDST feild) is
> * in proper state when we call vmx_vcpu_block().
> */
> d->arch.hvm_domain.vmx.pi_switch_from = vmx_pi_switch_from;
> d->arch.hvm_domain.vmx.pi_switch_to = vmx_pi_switch_to;
>
> for_each_vcpu ( d, v )
> {
> unsigned int dest = cpu_physical_id(v->processor);
> struct pi_desc *pi_desc = &v->arch.hvm_vmx.pi_desc;
>
> /* spot 1 */
>
> write_atomic(&pi_desc->ndst,
> x2apic_enabled ? dest : MASK_INSR(dest,
> PI_xAPIC_NDST_MASK));
> }
>
> d->arch.hvm_domain.vmx.vcpu_block = vmx_vcpu_block;
> d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume;
> }
>
> However, I still think it is problematic. Consider the _spot 1_
> above, we get
> the pCPU of the vCPU and update the NDST, but the vCPU can be happily
> rescheduled to another pCPU before updating the NDST. The problem is
> that it is not safe to update NDST here, since vCPU can be scheduled
> behind us at any time. And if this is the case, it is hard to safely
> do this
> without guarantee the vCPU is in a known state. Any further advice
> on this? Thanks a lot!
>
So, I'm sorry if this is me missing or not remembering something... but
I do remember that, at some point, in the early days of this series,
there were concerns about the use of v->processor behind the back of
the scheduler, i.e., without holding the proper scheduler related
locks.
Pausing the domain was not even being remotely considered at the time,
it (again, at least AFAICR) came up later for trying to address other
issues.
No, the whole point of why that was not a problem in the first place is
that what counts here is on the wait list of what pcpu the vcpu is put,
not really where the vcpu is being or has been scheduled last. Of
course it'd be better --and it would also be true most of the times--
if there where a match, but that was not a correctness concern.
So why this is all of the sudden becoming one? Am I completely off with
my recollection (or in general :-P)? Or what am I missing about the
issue we are trying to address with this new bits of the work?
Thanks and 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: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-09-14 14:51 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 3:56 [PATCH v3 0/6] VMX: Properly handle pi descriptor and per-cpu blocking list Feng Wu
2016-08-31 3:56 ` [PATCH v3 1/6] VMX: Statically assign two PI hooks Feng Wu
2016-09-01 8:16 ` Jan Beulich
2016-09-01 9:13 ` Wu, Feng
2016-09-01 9:23 ` Jan Beulich
2016-09-01 9:38 ` Wu, Feng
2016-09-06 8:42 ` Dario Faggioli
2016-09-06 9:53 ` Wu, Feng
2016-08-31 3:56 ` [PATCH v3 2/6] VMX: Properly handle pi when all the assigned devices are removed Feng Wu
2016-09-01 8:21 ` Jan Beulich
2016-09-01 9:22 ` Wu, Feng
2016-09-01 10:23 ` Jan Beulich
2016-09-01 13:12 ` Wu, Feng
2016-09-06 8:58 ` Dario Faggioli
2016-08-31 3:56 ` [PATCH v3 3/6] VMX: Cleanup PI per-cpu blocking list when vcpu is destroyed Feng Wu
2016-09-06 9:21 ` Dario Faggioli
2016-09-06 23:27 ` Wu, Feng
2016-08-31 3:56 ` [PATCH v3 4/6] Pause/Unpause the domain before/after assigning PI hooks Feng Wu
2016-09-01 8:29 ` Jan Beulich
2016-09-02 1:46 ` Wu, Feng
2016-09-02 7:04 ` Jan Beulich
2016-09-02 7:31 ` Wu, Feng
2016-09-02 8:16 ` Jan Beulich
2016-09-02 8:40 ` Wu, Feng
2016-09-02 9:25 ` Jan Beulich
2016-09-02 10:30 ` Wu, Feng
2016-09-02 10:45 ` Jan Beulich
2016-09-02 13:15 ` Wu, Feng
2016-09-02 13:54 ` Jan Beulich
2016-09-05 3:11 ` Wu, Feng
2016-09-05 9:27 ` Jan Beulich
2016-09-14 2:23 ` Wu, Feng
2016-09-14 8:46 ` Jan Beulich
2016-09-14 14:51 ` Dario Faggioli [this message]
2016-09-18 8:37 ` Wu, Feng
2016-09-19 23:12 ` Dario Faggioli
2016-09-20 0:48 ` Wu, Feng
2016-09-20 7:31 ` Jan Beulich
2016-09-20 7:53 ` Wu, Feng
2016-09-20 8:13 ` Dario Faggioli
2016-09-20 8:18 ` Wu, Feng
2016-09-23 14:19 ` Jan Beulich
2016-09-26 2:53 ` Wu, Feng
2016-08-31 3:56 ` [PATCH v3 5/6] VT-d: No need to set irq affinity for posted format IRTE Feng Wu
2016-09-01 8:38 ` Jan Beulich
2016-09-02 1:58 ` Wu, Feng
2016-08-31 3:56 ` [PATCH v3 6/6] VMX: Fixup PI descritpor when cpu is offline Feng Wu
2016-09-01 8:48 ` Jan Beulich
2016-09-02 3:25 ` Wu, Feng
2016-09-02 7:08 ` 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=1473864713.6339.142.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=feng.wu@intel.com \
--cc=george.dunlap@eu.citrix.com \
--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).