From: Andrew Cooper <andrew.cooper3@citrix.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>,
Jan Beulich <JBeulich@suse.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
"olaf@aepfle.de" <olaf@aepfle.de>,
"malcolm.crossley@citrix.com" <malcolm.crossley@citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] vmx, apicv: fix save/restore issue with apicv
Date: Tue, 14 Oct 2014 10:18:59 +0100 [thread overview]
Message-ID: <543CEA83.6050504@citrix.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E0ABABA82@SHSMSX104.ccr.corp.intel.com>
On 14/10/14 06:43, Zhang, Yang Z wrote:
> Jan Beulich wrote on 2014-10-13:
>>>>> On 11.10.14 at 09:54, <yang.z.zhang@intel.com> wrote:
>>> --- a/xen/arch/x86/hvm/vmx/vmx.c
>>> +++ b/xen/arch/x86/hvm/vmx/vmx.c
>>> @@ -1583,7 +1583,9 @@ static int
>>> vmx_virtual_intr_delivery_enabled(void)
>>> static void vmx_process_isr(int isr, struct vcpu *v) {
>>> unsigned long status;
>>> - u8 old;
>>> + u8 old, i;
>> There is absolutely no point in i being u8 - this can be plain unsigned int.
> It's ok to change it to unsigned int.
>
>>> + unsigned int *eoi_exit_bitmap, val;
>>> + struct vlapic *vlapic = vcpu_vlapic(v);
>>>
>>> if ( isr < 0 )
>>> isr = 0;
>>> @@ -1597,6 +1599,29 @@ static void vmx_process_isr(int isr, struct vcpu
>> *v)
>>> status |= isr << VMX_GUEST_INTR_STATUS_SVI_OFFSET;
>>> __vmwrite(GUEST_INTR_STATUS, status);
>>> }
>>> +
>>> + eoi_exit_bitmap = (unsigned int
>>> + *)v->arch.hvm_vmx.eoi_exit_bitmap;
>> No casts like this please. This is a bitmap and would hence preferably be
>> treated that way consistently. The code here isn't performance critical.
> Yes, it's performance critical from the live migration's point and that's why I use the cast here and
It is run once per vLAPIC on restore. I would not qualify it as
performance critical, but I would also advocate the efficient method of
word accesses over the inefficient bit accesses where it makes sense.
>
>>> + /*
>>> + * We cannot simple copy the TMR as eoi exit bitmap due to the special
>>> + * periodic timer interrupt which is edge trigger but need a mandatory
>>> + * EOI-induced VM exit to let pending periodic timer interrupts have
>> the
>>> + * chance to be injected for compensation.
>>> + * Here we will construct the eoi exit bimap via (IRR | ISR). Though it
>>> + * may cause unnecessary eoi exit of the interrupts that pending in IRR
>> or
>>> + * ISR during save/resotre, each pending interrupt only causes one
>> vmexit.
>>> + * The subsequent interrupts will adjust the eoi exit bitmap correctly.
>> So
>>> + * the performace hurt can be ingored.
>>> + */
>>> + for ( i = 0x10; i < 0x80; i += 0x10 )
>> So you skip the first 32 vectors instead of just the first 16. That's not in line with
>
>> the APIC definitions. Also basing the loop variable on APIC register numbers is
>> kind of odd. I'd really suggest using something more natural, like vector space
>> (which would also allow you to use existing helper functions/macros).
>>
> ...skip the first 32 vectors and operates based on group instead vector
>
> Also, Spec says "21-31 - Intel reserved. Do not use." So it's ok to skip them.
And what do you expect will happen to DoS guests which continue to use
the legacy PICs?
This range cannot possibly be skipped.
~Andrew
next prev parent reply other threads:[~2014-10-14 9:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-11 7:54 [PATCH] vmx, apicv: fix save/restore issue with apicv Yang Zhang
2014-10-13 8:33 ` Jan Beulich
2014-10-14 5:43 ` Zhang, Yang Z
2014-10-14 9:18 ` Andrew Cooper [this message]
2014-10-14 12:54 ` Zhang, Yang Z
2014-10-14 9:53 ` Jan Beulich
2014-10-14 13:10 ` Zhang, Yang Z
2014-10-14 13:31 ` Jan Beulich
2014-10-16 6:38 ` Zhang, Yang Z
2014-10-16 9:53 ` Andrew Cooper
2014-10-14 14:19 ` Olaf Hering
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=543CEA83.6050504@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=kevin.tian@intel.com \
--cc=malcolm.crossley@citrix.com \
--cc=olaf@aepfle.de \
--cc=xen-devel@lists.xen.org \
--cc=yang.z.zhang@intel.com \
/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.