All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	andrew.cooper3@citrix.com, xen-devel@lists.xen.org,
	Jun Nakajima <jun.nakajima@intel.com>,
	sherry.hurwitz@amd.com, boris.ostrovsky@oracle.com
Subject: Re: [PATCH v2 01/10] x86/HVM: Introduce struct hvm_pi_ops
Date: Tue, 10 Jan 2017 13:51:21 +0700	[thread overview]
Message-ID: <d157ac23-079d-1140-18d6-46e3cf2b55f7@amd.com> (raw)
In-Reply-To: <586E798F020000780012D84E@prv-mh.provo.novell.com>

Jan,

On 01/05/2017 10:51 PM, Jan Beulich wrote:
>>>> On 31.12.16 at 06:45, <suravee.suthikulpanit@amd.com> wrote:
>> --- a/xen/include/asm-x86/hvm/domain.h
>> +++ b/xen/include/asm-x86/hvm/domain.h
>> @@ -72,6 +72,67 @@ struct hvm_ioreq_server {
>>      bool_t                 bufioreq_atomic;
>>  };
>>
>> +struct hvm_pi_ops {
>> +    /*
>> +     * To handle posted interrupts correctly, we need to set the following
>> +     * state:
>> +     *
>> +     * * The PI notification vector (NV)
>> +     * * The PI notification destination processor (NDST)
>> +     * * The PI "suppress notification" bit (SN)
>> +     * * The vcpu pi "blocked" list
>> +     *
>> +     * If a VM is currently running, we want the PI delivered to the guest vcpu
>> +     * on the proper pcpu (NDST = v->processor, SN clear).
>> +     *
>> +     * If the vm is blocked, we want the PI delivered to Xen so that it can
>> +     * wake it up  (SN clear, NV = pi_wakeup_vector, vcpu on block list).
>> +     *
>> +     * If the VM is currently either preempted or offline (i.e., not running
>> +     * because of some reason other than blocking waiting for an interrupt),
>> +     * there's nothing Xen can do -- we want the interrupt pending bit set in
>> +     * the guest, but we don't want to bother Xen with an interrupt (SN clear).
>> +     *
>> +     * There's a brief window of time between vmx_intr_assist() and checking
>> +     * softirqs where if an interrupt comes in it may be lost; so we need Xen
>> +     * to get an interrupt and raise a softirq so that it will go through the
>> +     * vmx_intr_assist() path again (SN clear, NV = posted_interrupt).
>> +     *
>> +     * The way we implement this now is by looking at what needs to happen on
>> +     * the following runstate transitions:
>> +     *
>> +     * A: runnable -> running
>> +     *  - SN = 0
>> +     *  - NDST = v->processor
>> +     * B: running -> runnable
>> +     *  - SN = 1
>> +     * C: running -> blocked
>> +     *  - NV = pi_wakeup_vector
>> +     *  - Add vcpu to blocked list
>> +     * D: blocked -> runnable
>> +     *  - NV = posted_intr_vector
>> +     *  - Take vcpu off blocked list
>> +     *
>> +     * For transitions A and B, we add hooks into vmx_ctxt_switch_{from,to}
>> +     * paths.
>> +     *
>> +     * For transition C, we add a new arch hook, arch_vcpu_block(), which is
>> +     * called from vcpu_block() and vcpu_do_poll().
>> +     *
>> +     * For transition D, rather than add an extra arch hook on vcpu_wake, we
>> +     * add a hook on the vmentry path which checks to see if either of the two
>> +     * actions need to be taken.
>> +     *
>> +     * These hooks only need to be called when the domain in question actually
>> +     * has a physical device assigned to it, so we set and clear the callbacks
>> +     * as appropriate when device assignment changes.
>> +     */
>> +    void (*vcpu_block) (struct vcpu *);
>> +    void (*pi_switch_from) (struct vcpu *v);
>> +    void (*pi_switch_to) (struct vcpu *v);
>> +    void (*pi_do_resume) (struct vcpu *v);
>> +};
>
> While the hooks (as said, with the pi_ prefixes dropped) are
> certainly fine to move here, the comment is extremely VMX
> centric, and hence doesn't fit in this file. It either needs to be
> generalized, or it should remain in VMX specific code, perhaps
> with a referral to it added here.
>
> Jan
>

I see. I will move the comment into arch/x86/hvm/vmx/vmx.c close to 
where these hooks are implemented.

Thanks,
Suravee

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

  reply	other threads:[~2017-01-10  6:51 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-31  5:45 [PATCH v2 00/10] Introduce AMD SVM AVIC Suravee Suthikulpanit
2016-12-31  5:45 ` [PATCH v2 01/10] x86/HVM: Introduce struct hvm_pi_ops Suravee Suthikulpanit
2017-01-05  2:54   ` Tian, Kevin
2017-01-05  7:57     ` Jan Beulich
2017-01-05 15:51   ` Jan Beulich
2017-01-10  6:51     ` Suravee Suthikulpanit [this message]
2017-01-10  8:24       ` Jan Beulich
2017-01-10  9:45         ` Suravee Suthikulpanit
2016-12-31  5:45 ` [PATCH v2 02/10] x86/vLAPIC: Declare vlapic_read_aligned() and vlapic_reg_write() as non-static Suravee Suthikulpanit
2017-01-05 15:53   ` Jan Beulich
2017-01-10  6:57     ` Suravee Suthikulpanit
2017-01-10  8:25       ` Jan Beulich
2016-12-31  5:45 ` [PATCH v2 03/10] x86/HVM: Call vlapic_destroy after vcpu_destroy Suravee Suthikulpanit
2017-01-05  2:56   ` Tian, Kevin
2017-01-05 15:56   ` Jan Beulich
2017-01-10  8:18     ` Suravee Suthikulpanit
2016-12-31  5:45 ` [PATCH v2 04/10] x86/SVM: Modify VMCB fields to add AVIC support Suravee Suthikulpanit
2016-12-31  5:45 ` [PATCH v2 05/10] x86/HVM/SVM: Add AVIC initialization code Suravee Suthikulpanit
2017-01-02 16:37   ` Andrew Cooper
2017-01-04 17:24     ` Suravee Suthikulpanit
2017-01-04 17:59       ` Andrew Cooper
2017-01-10  3:06     ` Suravee Suthikulpanit
2017-01-03 14:54   ` Boris Ostrovsky
2016-12-31  5:45 ` [PATCH v2 06/10] x86/SVM: Add AVIC vmexit handlers Suravee Suthikulpanit
2017-01-02 17:28   ` Andrew Cooper
2017-01-05  4:07     ` Suravee Suthikulpanit
2017-01-03 15:34   ` Boris Ostrovsky
2017-01-05  6:41     ` Suravee Suthikulpanit
2016-12-31  5:45 ` [PATCH v2 07/10] x86/SVM: Add vcpu scheduling support for AVIC Suravee Suthikulpanit
2017-01-02 17:35   ` Andrew Cooper
2017-01-03 15:43   ` Boris Ostrovsky
2016-12-31  5:45 ` [PATCH v2 08/10] x86/SVM: Add interrupt management code via AVIC Suravee Suthikulpanit
2017-01-02 17:45   ` Andrew Cooper
2017-02-28 12:01     ` George Dunlap
2017-01-05 16:01   ` Jan Beulich
2016-12-31  5:46 ` [PATCH v2 09/10] x86/SVM: Hook up miscellaneous AVIC functions Suravee Suthikulpanit
2017-01-02 17:49   ` Andrew Cooper
2017-01-05 16:05   ` Jan Beulich
2017-01-10  8:35     ` Suravee Suthikulpanit
2017-01-10  9:00       ` Jan Beulich
2017-01-10 10:28         ` Suravee Suthikulpanit
2016-12-31  5:46 ` [PATCH v2 10/10] x86/SVM: Add AMD AVIC key handler Suravee Suthikulpanit
2017-01-03 16:01   ` Boris Ostrovsky
2017-01-03 16:04     ` Andrew Cooper
2017-01-05  8:00       ` Suravee Suthikulpanit
2017-01-05 16:07   ` Jan Beulich
2017-01-10 11:14     ` Suravee Suthikulpanit
2017-01-10 12:55       ` 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=d157ac23-079d-1140-18d6-46e3cf2b55f7@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=sherry.hurwitz@amd.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 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.