* 32-on-64 support in xen-unstable?
@ 2009-07-06 14:18 Chris Lalancette
2009-07-06 14:37 ` Jan Beulich
2009-07-06 15:23 ` Keir Fraser
0 siblings, 2 replies; 4+ messages in thread
From: Chris Lalancette @ 2009-07-06 14:18 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
Hello,
I've been browsing through the preemptible pagetable stuff, and ran across
a piece of code that I don't understand or is buggy. Looking at
arch/x86/mm.c:new_guest_cr3(), we have this code for 32-on-64 support:
if ( is_pv_32on64_domain(d) )
{
okay = paging_mode_refcounts(d)
? 0 /* Old code was broken, but what should it be? */
: mod_l4_entry(
__va(pagetable_get_paddr(curr->arch.guest_table)),
l4e_from_pfn(
mfn,
(_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)),
pagetable_get_pfn(curr->arch.guest_table), 0, 0, curr) == 0;
if ( unlikely(!okay) )
{
MEM_LOG("Error while installing new compat baseptr %lx", mfn);
return 0;
}
However, looking at arch/x86/mm.c:mod_l4_entry(), it returns 0 on success and <
0 on error. It seems to me that booting a 32-bit PV guest is always going to
fall into the !okay check on success, when it really shouldn't. Shouldn't this
be something like:
okay = paging_mode_refcounts(d)
? 0 /* Old code was broken, but what should it be? */
: !mod_l4_entry(
__va(pagetable_get_paddr(curr->arch.guest_table)),
l4e_from_pfn(
mfn,
(_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)),
pagetable_get_pfn(curr->arch.guest_table), 0, 0, curr) == 0;
Or am I just missing something? (NOTE: this still leaves open the possibility
for failure if mod_l4_entry() returns EINTR or EAGAIN, but maybe we don't have
to worry about that here?)
Thanks,
--
Chris Lalancette
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: 32-on-64 support in xen-unstable?
2009-07-06 14:18 32-on-64 support in xen-unstable? Chris Lalancette
@ 2009-07-06 14:37 ` Jan Beulich
2009-07-06 14:44 ` Chris Lalancette
2009-07-06 15:23 ` Keir Fraser
1 sibling, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2009-07-06 14:37 UTC (permalink / raw)
To: Chris Lalancette; +Cc: xen-devel@lists.xensource.com
>>> Chris Lalancette <clalance@redhat.com> 06.07.09 16:18 >>>
>Hello,
> I've been browsing through the preemptible pagetable stuff, and ran across
>a piece of code that I don't understand or is buggy. Looking at
>arch/x86/mm.c:new_guest_cr3(), we have this code for 32-on-64 support:
You probably overlooked the == 0 et the end of the expression:
> if ( is_pv_32on64_domain(d) )
> {
> okay = paging_mode_refcounts(d)
> ? 0 /* Old code was broken, but what should it be? */
> : mod_l4_entry(
> __va(pagetable_get_paddr(curr->arch.guest_table)),
> l4e_from_pfn(
> mfn,
> (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)),
> pagetable_get_pfn(curr->arch.guest_table), 0, 0, curr) == 0;
^^^^
Which basically is equivalent to what you were trying to suggest.
Jan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: 32-on-64 support in xen-unstable?
2009-07-06 14:37 ` Jan Beulich
@ 2009-07-06 14:44 ` Chris Lalancette
0 siblings, 0 replies; 4+ messages in thread
From: Chris Lalancette @ 2009-07-06 14:44 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel@lists.xensource.com
Jan Beulich wrote:
>>>> Chris Lalancette <clalance@redhat.com> 06.07.09 16:18 >>>
>> Hello,
>> I've been browsing through the preemptible pagetable stuff, and ran across
>> a piece of code that I don't understand or is buggy. Looking at
>> arch/x86/mm.c:new_guest_cr3(), we have this code for 32-on-64 support:
>
> You probably overlooked the == 0 et the end of the expression:
>
>> if ( is_pv_32on64_domain(d) )
>> {
>> okay = paging_mode_refcounts(d)
>> ? 0 /* Old code was broken, but what should it be? */
>> : mod_l4_entry(
>> __va(pagetable_get_paddr(curr->arch.guest_table)),
>> l4e_from_pfn(
>> mfn,
>> (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)),
>> pagetable_get_pfn(curr->arch.guest_table), 0, 0, curr) == 0;
> ^^^^
>
> Which basically is equivalent to what you were trying to suggest.
D'oh! Of course. I did overlook that, thanks for pointing it out.
--
Chris Lalancette
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: 32-on-64 support in xen-unstable?
2009-07-06 14:18 32-on-64 support in xen-unstable? Chris Lalancette
2009-07-06 14:37 ` Jan Beulich
@ 2009-07-06 15:23 ` Keir Fraser
1 sibling, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2009-07-06 15:23 UTC (permalink / raw)
To: Chris Lalancette, xen-devel@lists.xensource.com
On 06/07/2009 15:18, "Chris Lalancette" <clalance@redhat.com> wrote:
> However, looking at arch/x86/mm.c:mod_l4_entry(), it returns 0 on success and
> <
> 0 on error. It seems to me that booting a 32-bit PV guest is always going to
> fall into the !okay check on success, when it really shouldn't.
You didn't spot the '== 0' tacked on the end of that long ternary
expression?
-- Keir
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-06 15:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-06 14:18 32-on-64 support in xen-unstable? Chris Lalancette
2009-07-06 14:37 ` Jan Beulich
2009-07-06 14:44 ` Chris Lalancette
2009-07-06 15:23 ` Keir Fraser
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.