xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: Mukesh Rathor <mukesh.rathor@oracle.com>
Cc: Keir Fraser <keir@xen.org>, Tim Deegan <tim@xen.org>,
	Jan Beulich <JBeulich@suse.com>,
	xen-devel@lists.xenproject.org,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH RFC] pvh: clearly specify used parameters in vcpu_guest_context
Date: Mon, 18 Nov 2013 11:50:51 +0000	[thread overview]
Message-ID: <5289FF1B.1080709@eu.citrix.com> (raw)
In-Reply-To: <20131115155652.3201414a@mantra.us.oracle.com>

On 15/11/13 23:56, Mukesh Rathor wrote:
> On Fri, 15 Nov 2013 13:56:54 -0800
> Mukesh Rathor <mukesh.rathor@oracle.com> wrote:
>
>> On Fri, 15 Nov 2013 16:45:47 +0000
>> "Jan Beulich" <JBeulich@suse.com> wrote:
>>
>>>>>> On 15.11.13 at 17:40, George Dunlap
>>>>>> <george.dunlap@eu.citrix.com> wrote:
>>>> On 15/11/13 16:32, Jan Beulich wrote:
>>>>>>>> On 15.11.13 at 16:50, Roger Pau Monne <roger.pau@citrix.com>
>>>>>>>> wrote:
>>>>>> --- a/xen/arch/x86/domain.c
>>>>>> +++ b/xen/arch/x86/domain.c
>>>>>> @@ -704,9 +704,11 @@ int arch_set_info_guest(
>>>>>>            /* PVH 32bitfixme */
>>>>>>            ASSERT(!compat);
>>>>>>    
>>>>>> -        if ( c(ctrlreg[1]) || c(ldt_base) || c(ldt_ents) ||
>>>>>> +        if ( c(ctrlreg[0]) || c(ctrlreg[1]) || c(ctrlreg[2]) ||
>>>>>> +             c(ctrlreg[4]) || c(ldt_base) || c(ldt_ents) ||
>>>>> I think it should actually be a bug for the guest to request an
>>>>> all blank CR0 or CR4. Minimally CR0.PE, CR0.PG, and CR4.PAE
>>>>> would seem to be a valid requirement to be set.
>>>>>
>>>>> Apart from that ctrlreg[] is an 8-element array... And I don't
>>>>> see debugreg[] being verified at all.
>>>>>
>>>>>>                 c(user_regs.cs) || c(user_regs.ss) ||
>>>>>> c(user_regs.es) || c(user_regs.ds) || c(user_regs.fs) ||
>>>>>> c(user_regs.gs) ||
>>>>>> +             c(kernel_ss) || c(kernel_sp) ||
>>>>>> c.nat->gs_base_kernel ||
>>>>> So George and/or Mukesh found it necessary to set
>>>>> gs_base_kernel, and you rip it out? I'm curious as to what
>>>>> they're going to say...
>>>> I didn't find it necessary; I was mostly focused on merging the
>>>> PVH and HVM codepaths without causing any regressions.  It's not
>>>> obvious to me what's special about gs_base_kernel, and I haven't
>>>> yet gone back to try to find out why Mukesh did it that way.
>> Hi,
>>
>> We had talked about this while ago, but upon boot, the first thing
>> a vcpu needs is access to kernel data structure. (A secondary vcpu
>> is bootstrapped way up into the kernel). It would be possible to
>> get rid of gs_base_kernel, but will take some work on the linux side.
>> I can try and test it out, and let you guys know.
> Ok, looking at this more, I can hack cpu_bringup_and_idle() in
> linux to include a static variable for cpuid, which is the least a
> vcpu needs to know first thing. But, I think that would not work when
> vcpu hotplug support is added. Another option would be to pass cpuid
> in one of the registers, say rdi. Thus, rdi == cpuid will be passed
> to VCPUOP_initialise. In bringup function, the booting vcpu can then
> load it's own gs based on the cpuid. If linux folks, konrad (CCd), is OK
> with this, we can remove gs_base_kernel.  Otherwise, it's such a small
> thing, hopefually it can stay.

So Linux has the exact same problem on native, and (AFAICT) they solve 
it by simply writing gs to a global variable called initial_gs.  Is 
there any reason why we can't just do what native Linux does here?  We 
should, in fact, be able to use the exact same variable.

  -George

  parent reply	other threads:[~2013-11-18 11:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-15 15:50 [PATCH RFC] pvh: clearly specify used parameters in vcpu_guest_context Roger Pau Monne
2013-11-15 16:32 ` Jan Beulich
2013-11-15 16:40   ` George Dunlap
2013-11-15 16:45     ` Jan Beulich
2013-11-15 21:56       ` Mukesh Rathor
2013-11-15 23:56         ` Mukesh Rathor
2013-11-16  1:12           ` Mukesh Rathor
2013-11-16  1:56             ` Mukesh Rathor
2013-11-16  8:02               ` Roger Pau Monné
2013-11-18 12:15               ` George Dunlap
2013-11-18 16:17                 ` Konrad Rzeszutek Wilk
2013-11-18 16:19             ` Konrad Rzeszutek Wilk
2013-11-18 11:50           ` George Dunlap [this message]
2013-11-15 16:55   ` Tim Deegan
2013-11-15 23:35     ` Mukesh Rathor
2013-11-16  8:04     ` Roger Pau Monné
2013-11-15 16:59   ` Roger Pau Monné

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=5289FF1B.1080709@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=mukesh.rathor@oracle.com \
    --cc=roger.pau@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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).