All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>, Olaf Hering <olaf@aepfle.de>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	"Dong, Eddie" <eddie.dong@intel.com>,
	Jan Beulich <JBeulich@suse.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] x86/hvm: implement save/restore for posted interrupts
Date: Thu, 9 Oct 2014 14:19:55 +0100	[thread overview]
Message-ID: <54368B7B.6070407@citrix.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E0ABA76D8@SHSMSX104.ccr.corp.intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 3850 bytes --]

On 09/10/14 08:24, Zhang, Yang Z wrote:
> Olaf Hering wrote on 2014-10-08:
>> On Wed, Oct 08, Zhang, Yang Z wrote:
>>
>>> Olaf Hering wrote on 2014-10-08:
>>>> On Wed, Oct 08, Zhang, Yang Z wrote:
>>>>> Can you reproduce it with APICv disabled? You can add apicv=0
>>>>> into your grub to disable it.
>>>> Using 'apicv=0' with staging helps, the guest resumes properly.
>>> Does 'resumes properly' mean there are two sysrq in dmesg after resume?
>> Yes.
>>
>>>> Will now try the patch you mentioned in the other mail.
>>> Thanks. I am set upping the environment for testing now.
>> That patch (Message-ID: <20140804075007.GA11609@aepfle.de>) does not
>> help.
> Sorry. I forget to tell that that patch must combine with one fixing from your patch.
> I rebased it based on latest Xen and the attached patch includes all fixings. Could you have a try? It works on my side, hope it helps.
>
> diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
> index 99ae1be..e702ed3 100644
> --- a/xen/arch/x86/hvm/vlapic.c
> +++ b/xen/arch/x86/hvm/vlapic.c
> @@ -1259,6 +1259,9 @@ static int lapic_save_regs(struct domain *d, hvm_domain_context_t *h)
>  
>      for_each_vcpu ( d, v )
>      {
> +        if ( hvm_funcs.sync_pir_to_irr )
> +            hvm_funcs.sync_pir_to_irr(v);
> +
>          s = vcpu_vlapic(v);
>          if ( (rc = hvm_save_entry(LAPIC_REGS, v->vcpu_id, h, s->regs)) != 0 )
>              break;
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index 304aeea..7c4d796 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -1584,6 +1584,8 @@ static void vmx_process_isr(int isr, struct vcpu *v)
>  {
>      unsigned long status;
>      u8 old;
> +    int vector;

unsigned vector; especially as it is used in some pointer arithmetic
hidden inside the vlapic_test_vector() macro.

> +    struct vlapic *s = vcpu_vlapic(v);

's' seems to be a strange choice of variable name.  Prevailing use in
this file is "struct vlapic *vlapic = vcpu_vlapic(v);"

>  
>      if ( isr < 0 )
>          isr = 0;
> @@ -1597,6 +1599,14 @@ static void vmx_process_isr(int isr, struct vcpu *v)
>          status |= isr << VMX_GUEST_INTR_STATUS_SVI_OFFSET;
>          __vmwrite(GUEST_INTR_STATUS, status);
>      }
> +    for ( vector = 0; vector < NR_VECTORS; vector++ )

Vectors 0 to 0x0f are strictly reserved.  Any reason not to start vector
at 0x10 ?

> +        if (vlapic_test_vector(vector, &s->regs->data[APIC_TMR]))
> +            set_bit(vector,  v->arch.hvm_vmx.eoi_exit_bitmap);

Can't this loop be optimised somewhat to using word-sized |= operations?

~Andrew

> +        
> +    __vmwrite(0x201c, v->arch.hvm_vmx.eoi_exit_bitmap[0]);
> +    __vmwrite(0x201e, v->arch.hvm_vmx.eoi_exit_bitmap[1]);
> +    __vmwrite(0x2020, v->arch.hvm_vmx.eoi_exit_bitmap[2]);
> +    __vmwrite(0x2022, v->arch.hvm_vmx.eoi_exit_bitmap[3]);
>      vmx_vmcs_exit(v);
>  }
>  
> diff --git a/xen/include/asm-x86/hvm/vlapic.h b/xen/include/asm-x86/hvm/vlapic.h
> index bf59b95..fc8d131 100644
> --- a/xen/include/asm-x86/hvm/vlapic.h
> +++ b/xen/include/asm-x86/hvm/vlapic.h
> @@ -61,6 +61,8 @@
>  
>  #define VEC_POS(v) ((v) % 32)
>  #define REG_POS(v) (((v) / 32) * 0x10)
> +#define vlapic_test_vector(vec, bitmap)                         \
> +    test_bit(VEC_POS(vec), (uint32_t *)((bitmap) + REG_POS(vec)))
>  #define vlapic_test_and_set_vector(vec, bitmap)                         \
>      test_and_set_bit(VEC_POS(vec), (uint32_t *)((bitmap) + REG_POS(vec)))
>  #define vlapic_test_and_clear_vector(vec, bitmap)  
>
>> Olaf
>
> Best regards,
> Yang
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 5886 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

  parent reply	other threads:[~2014-10-09 13:19 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03 15:09 [PATCH] x86/hvm: implement save/restore for posted interrupts Olaf Hering
2014-07-03 15:27 ` Jan Beulich
2014-07-09 11:24 ` Zhang, Yang Z
2014-07-09 21:14   ` Tian, Kevin
2014-07-16 14:28     ` Olaf Hering
2014-07-16 16:11       ` Tian, Kevin
2014-07-17  7:11         ` Olaf Hering
2014-07-17  9:29           ` Zhang, Yang Z
2014-07-18 13:58             ` Olaf Hering
2014-07-22 23:06               ` Zhang, Yang Z
2014-07-23  8:03                 ` Olaf Hering
2014-07-25 21:38             ` Tian, Kevin
2014-07-28  6:52               ` Olaf Hering
2014-07-29  7:48                 ` Zhang, Yang Z
2014-07-29  8:27                   ` Jan Beulich
2014-08-02 10:59                   ` Olaf Hering
2014-08-04  1:08                     ` Zhang, Yang Z
2014-08-04  7:50                       ` Olaf Hering
2014-08-04  7:57                         ` Zhang, Yang Z
2014-08-05 10:32                           ` Olaf Hering
2014-08-08  0:18                             ` Zhang, Yang Z
2014-09-01  6:44                             ` Zhang, Yang Z
2014-09-18  3:29                             ` Zhang, Yang Z
2014-09-19 13:32                               ` Olaf Hering
2014-09-19 13:39                                 ` Jan Beulich
2014-09-19 17:51                                   ` Andrew Cooper
2014-09-22 22:43                                     ` Tian, Kevin
2014-09-24 16:26                                       ` Malcolm Crossley
2014-09-30 16:19                                 ` Jan Beulich
2014-10-01  8:07                                   ` Olaf Hering
2014-10-01  8:29                                     ` Jan Beulich
2014-10-01 20:13                                       ` Olaf Hering
2014-10-02  6:51                                         ` Jan Beulich
2014-10-02  8:10                                           ` Andrew Cooper
2014-10-02  8:20                                             ` Olaf Hering
2014-10-08  7:37                                         ` Zhang, Yang Z
2014-10-08  7:40                                           ` Olaf Hering
2014-10-08  7:55                                             ` Zhang, Yang Z
2014-10-08  8:28                                           ` Olaf Hering
2014-10-08  8:35                                             ` Zhang, Yang Z
2014-10-08  8:54                                               ` Olaf Hering
2014-10-09  7:24                                                 ` Zhang, Yang Z
2014-10-09  8:41                                                   ` Fabio Fantoni
2014-10-09  8:43                                                     ` Zhang, Yang Z
2014-10-09 12:49                                                       ` Fabio Fantoni
2014-10-09 11:35                                                   ` Malcolm Crossley
2014-10-09 13:19                                                   ` Andrew Cooper [this message]
2014-10-10  0:48                                                     ` Zhang, Yang Z
2014-10-09 13:31                                                   ` Olaf Hering
2014-10-09 14:11                                                     ` Olaf Hering
2014-10-10  0:52                                                       ` Zhang, Yang Z
2014-07-25  9:40 ` Jan Beulich
2014-07-25 12:49   ` Tian, Kevin
2014-07-25 13:59     ` Jan Beulich
2014-07-25 21:31       ` Tian, Kevin
2014-07-28  6:46         ` Jan Beulich
2014-07-28  7:52           ` Wu, Feng
2014-07-28  8:17           ` Zhang, Yang Z
2014-07-28  9:02             ` Jan Beulich
2014-07-28  9:50               ` Liuqiming (John)

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=54368B7B.6070407@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=eddie.dong@intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.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.