All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Yang Hongyang <yanghy@cn.fujitsu.com>, Keir Fraser <keir@xen.org>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 1/3] [RFC] x86/hvm: Permit HVM_PARAM_IDENT_PT to be set more than once
Date: Fri, 8 May 2015 14:48:45 +0100	[thread overview]
Message-ID: <554CBEBD.3050902@citrix.com> (raw)
In-Reply-To: <554CDA6802000078000784D8@mail.emea.novell.com>

On 08/05/15 14:46, Jan Beulich wrote:
>>>> On 08.05.15 at 14:54, <andrew.cooper3@citrix.com> wrote:
>> There is no conceptual problem with setting this parameter more than once.
>> Checkpointed migration streams will typically set it once per checkpoint to
>> the same value.
>>
>> The parameter is only actually needed on early-generation VT-x which lacked
>> the unrestricted guest capability, although it could plausibly be used on
>> newer VT-x with unusual execution control settings.  Short circuit the
>> expensive operations on non VT-x hardware.
>>
>> The parameter itself must always be latched to avoid issues if the VM
>> eventually migrates to a host which needs to use the pagetable.
> Reads all plausible, except that I think the way you carry out this
> last aspect needs adjustment:
>
>> --- a/xen/arch/x86/hvm/hvm.c
>> +++ b/xen/arch/x86/hvm/hvm.c
>> @@ -5730,12 +5730,13 @@ static int hvmop_set_param(
>>              rc = -EINVAL;
>>          break;
>>      case HVM_PARAM_IDENT_PT:
>> -        rc = -EINVAL;
>> -        if ( d->arch.hvm_domain.params[a.index] != 0 )
>> -            break;
>> -
>>          rc = 0;
>> -        if ( !paging_mode_hap(d) )
>> +        d->arch.hvm_domain.params[a.index] = a.value;
>> +        /*
>> +         * Only actually required for VT-x lacking unrestricted_guest
>> +         * capabilities.  Short circuit the pause if possible.
>> +         */
>> +        if ( !paging_mode_hap(d) || !cpu_has_vmx )
>>              break;
> You should latch the new value inside this if()'s body and ...
>
>> @@ -5749,7 +5750,6 @@ static int hvmop_set_param(
>>  
>>          rc = 0;
>>          domain_pause(d);
>> -        d->arch.hvm_domain.params[a.index] = a.value;
>>          for_each_vcpu ( d, v )
>>              paging_update_cr3(v);
>>          domain_unpause(d);
> ... leave this one alone so the use site in VMX code won't see the
> new value prematurely.

Good point - I will fix this up.

~Andrew

  reply	other threads:[~2015-05-08 13:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 12:54 [PATCH 0/3] Misc patches to aid migration v2 Remus support Andrew Cooper
2015-05-08 12:54 ` [PATCH 1/3] [RFC] x86/hvm: Permit HVM_PARAM_IDENT_PT to be set more than once Andrew Cooper
2015-05-08 13:46   ` Jan Beulich
2015-05-08 13:48     ` Andrew Cooper [this message]
2015-05-08 12:54 ` [PATCH 2/3] tools/libxc: Properly quote macro parameters Andrew Cooper
2015-05-08 13:00   ` Andrew Cooper
2015-05-08 15:00     ` Ian Campbell
2015-05-08 13:26   ` Ian Campbell
2015-05-08 12:54 ` [PATCH 3/3] libxc/migrationv2: Split {start, end}_of_stream() to make checkpoint variants Andrew Cooper
2015-05-08 13:30   ` Ian Campbell
2015-05-08 13:37     ` Andrew Cooper
2015-05-08 13:50       ` Ian Campbell
2015-05-08 13:55         ` Andrew Cooper
2015-05-08 14:12           ` Ian Campbell
2015-05-11  2:40           ` Hongyang Yang
2015-05-11  2:31     ` Hongyang Yang
2015-05-11  9:02       ` Andrew Cooper
2015-05-11  9:23         ` Hongyang Yang
2015-05-08 13:15 ` [PATCH 0/3] Misc patches to aid migration v2 Remus support Andrew Cooper
2015-05-11  2:43   ` Hongyang Yang

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=554CBEBD.3050902@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.org \
    --cc=yanghy@cn.fujitsu.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.