From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
xen-devel@lists.xenproject.org, Keir Fraser <keir@xen.org>,
Tim Deegan <tim@xen.org>
Subject: Re: [PATCH 1/2] pvh: clearly specify used parameters in vcpu_guest_context
Date: Tue, 19 Nov 2013 17:42:30 +0100 [thread overview]
Message-ID: <528B94F6.3090804@citrix.com> (raw)
In-Reply-To: <528B93260200007800104972@nat28.tlf.novell.com>
On 19/11/13 16:34, Jan Beulich wrote:
>>>> On 19.11.13 at 16:04, Roger Pau Monné<roger.pau@citrix.com> wrote:
>> On 19/11/13 14:32, Jan Beulich wrote:
>>>>>> On 19.11.13 at 13:34, Roger Pau Monne <roger.pau@citrix.com> wrote:
>>>> @@ -704,9 +705,13 @@ int arch_set_info_guest(
>>>> /* PVH 32bitfixme */
>>>> ASSERT(!compat);
>>>>
>>>> - if ( c(ctrlreg[1]) || c(ldt_base) || c(ldt_ents) ||
>>>> + if ( (c(ctrlreg[0]) & HVM_CR0_GUEST_RESERVED_BITS) ||
>>>> + (c(ctrlreg[4]) & HVM_CR4_GUEST_RESERVED_BITS(v)) ||
>>>> + c(ctrlreg[1]) || c(ctrlreg[2]) || c(ctrlreg[5]) ||
>>>> + c(ctrlreg[6]) || c(ctrlreg[7]) || c(ldt_base) || c(ldt_ents)
>> ||
>>>> 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 ||
>>>> c.nat->gdt_ents || c.nat->fs_base || c.nat->gs_base_user )
>>>> return -EINVAL;
>>>> }
>>>
>>> Still no checking of debugreg[]?
>>
>> Why do we need to check debugreg[]? This code is executed on PVH (and PV
>> and HVM), and I guessed it does the right thing:
>>
>> for ( i = 0; i < ARRAY_SIZE(v->arch.debugreg); ++i )
>> v->arch.debugreg[i] = c(debugreg[i]);
>
> If it does - fine; I didn't verify whether that would actually result in
> the debug registers getting properly loaded with the requested
> values.
I've done a quick test by setting debugreg[0] from vcpu_guest_context
and then reading dr0 from inside the guest AP and it seems to work fine.
>>>> + v->arch.hvm_vcpu.guest_cr[0] |= c.nat->ctrlreg[0];
>>>
>>> Did you really mean |= here? I would expect to simply fail a
>>> request when certain required bits aren't set.
>>
>> Yes, I wanted to do |= because as described on the public header, flags
>> specified by the user are appended to PVH mandatory flags. This is kind
>> of awkward, so I wouldn't mind making cr0/cr4 mandatory for PVH AP
>> bringup, so we would have to check that:
>>
>> cr0 & (X86_CR0_PE | X86_CR0_ET | X86_CR0_PG) == (X86_CR0_PE | X86_CR0_ET
>> | X86_CR0_PG)
>
> Except that I'm not sure the ET check is really needed.
>
>> And:
>>
>> cr4 & X86_CR4_PAE == X86_CR4_PAE
>>
>>> Also, by now honoring CR0 and CR4 settings, you again move
>>> towards the hybrid model (some fields honored, some refused)
>>> that was (I think by you) previously described as unacceptable.
>>
>> From a strict POV we should just set cr3, flags and user_regs, but then
>> Tim mentioned also honouring cr0/cr4,
>
> I understood his response to mean all fields, or none of them.
Trying to make all those fields functional on PVH (or HVM) is quite
useless IMHO, it's going to add more code that I doubt anyone is going
to use when you can instead use the bare metal functions to set all
those things (and from an OS point of view it's also more comfortable
because you need less Xen specific stuff).
When you refer to not using any fields, does this mean to enable LAPIC
for PVH and use the bare metal CPU bringup method?
And I guess introducing a new hypercall (that also uses a different
vcpu_guest_context struct) to bringup vcpus inside of HVM domains is
completely out of the picture?
>
>> and I don't really have a strong
>> opinion against that. What I think was definitely wrong was only using
>> gs_base_kernel and not the other gs_* or fs_* fields.
>>
>> Since we need cr3, using only those and not the other cr* fields seems
>> strange.
>
> Hmm, I think it's going to remain looking strange as long as some
> of the fields are used and some are not (of course ignoring those
> that are PV specific).
>
> Jan
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-11-19 16:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 12:34 [PATCH 1/2] pvh: proposed BSP/AP bringup changes Roger Pau Monne
2013-11-19 12:34 ` [PATCH 1/2] pvh: clearly specify used parameters in vcpu_guest_context Roger Pau Monne
2013-11-19 13:32 ` Jan Beulich
2013-11-19 15:04 ` Roger Pau Monné
2013-11-19 15:34 ` Jan Beulich
2013-11-19 16:42 ` Roger Pau Monné [this message]
2013-11-19 16:53 ` Jan Beulich
2013-11-20 9:18 ` Roger Pau Monné
2013-11-20 9:28 ` Jan Beulich
2013-11-20 9:37 ` Roger Pau Monné
2013-11-20 9:54 ` Jan Beulich
2013-11-20 10:29 ` Roger Pau Monné
2013-11-20 18:19 ` George Dunlap
2013-11-20 18:24 ` Roger Pau Monné
2013-11-20 21:19 ` Mukesh Rathor
2013-11-22 17:38 ` George Dunlap
2013-11-21 13:16 ` Tim Deegan
2013-11-19 12:34 ` [PATCH 2/2] pvh: set only minimal cr0 and cr4 flags in order to use paging Roger Pau Monne
2013-11-19 13:34 ` Jan Beulich
2013-11-25 13:25 ` Jan Beulich
2013-11-25 14:53 ` George Dunlap
2013-11-25 22:39 ` Mukesh Rathor
2013-11-26 0:29 ` Dong, Eddie
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=528B94F6.3090804@citrix.com \
--to=roger.pau@citrix.com \
--cc=JBeulich@suse.com \
--cc=george.dunlap@eu.citrix.com \
--cc=keir@xen.org \
--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 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.