All of lore.kernel.org
 help / color / mirror / Atom feed
* Trouble using update_va_mapping
@ 2006-02-13 16:06 Mathieu Ropert
  2006-02-13 16:47 ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Mathieu Ropert @ 2006-02-13 16:06 UTC (permalink / raw)
  To: xen-devel


Hi,

i'm trying to run a very simple domU kernel on Xen/x86_64, and i'm 
getting some trouble with update_va_mapping(): when trying to remap some 
page table entry, i find the virtual address still pointing to the same 
machine address after the return of the hypercall.

Here's the interesting part of the code:

        cons = (struct xencons_interface *) addr;
        cons->out_prod = 0x42;

        if (HYPERVISOR_update_va_mapping (addr, 
(xen_start_info->console_mfn  << PAGE_SHIFT) | 0x67, 0))
                BUG ();

        tlb_flush ();

        cons = (struct xencons_interface *) addr;

        if (cons->out_prod == 0x42) /* Fails here */
                BUG ();

I've double-checked hypercalls and tlb_flush() function, all seems fine. 
So my guess is that either i missed something in the docs, or there's 
something wrong with update_va_mapping().


Regards,

Mathieu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Trouble using update_va_mapping
  2006-02-13 16:06 Trouble using update_va_mapping Mathieu Ropert
@ 2006-02-13 16:47 ` Keir Fraser
  2006-02-13 17:07   ` Mathieu Ropert
  2006-02-14 13:28   ` Mathieu Ropert
  0 siblings, 2 replies; 4+ messages in thread
From: Keir Fraser @ 2006-02-13 16:47 UTC (permalink / raw)
  To: Mathieu Ropert; +Cc: xen-devel


On 13 Feb 2006, at 16:06, Mathieu Ropert wrote:

> i'm trying to run a very simple domU kernel on Xen/x86_64, and i'm 
> getting some trouble with update_va_mapping(): when trying to remap 
> some page table entry, i find the virtual address still pointing to 
> the same machine address after the return of the hypercall.

What machine page does 'cons' point at before update_va_mapping()? Is 
it definitely a different page?

  -- Keir

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Trouble using update_va_mapping
  2006-02-13 16:47 ` Keir Fraser
@ 2006-02-13 17:07   ` Mathieu Ropert
  2006-02-14 13:28   ` Mathieu Ropert
  1 sibling, 0 replies; 4+ messages in thread
From: Mathieu Ropert @ 2006-02-13 17:07 UTC (permalink / raw)
  To: xen-devel

Keir Fraser wrote:

>
> On 13 Feb 2006, at 16:06, Mathieu Ropert wrote:
>
>> i'm trying to run a very simple domU kernel on Xen/x86_64, and i'm 
>> getting some trouble with update_va_mapping(): when trying to remap 
>> some page table entry, i find the virtual address still pointing to 
>> the same machine address after the return of the hypercall.
>
>
> What machine page does 'cons' point at before update_va_mapping()? Is 
> it definitely a different page?
>
>  -- Keir
>
"cons" is a page in the domU kernel address space. I left a 4k blank 
(page aligned) after the kernel entry point for this purpose.
In terms of assembly code, it looks like something like this:

    .org 0x2000
    .globl console_page
    console_page:
    .fill 256, 8, 0

and then, cons = (struct xencons_interface *) &console_page in my C code.

That may sound stupid and/or lazy, but i wanted a valid virtual address 
easy, complexity will come after i fully understand the thing :)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Trouble using update_va_mapping
  2006-02-13 16:47 ` Keir Fraser
  2006-02-13 17:07   ` Mathieu Ropert
@ 2006-02-14 13:28   ` Mathieu Ropert
  1 sibling, 0 replies; 4+ messages in thread
From: Mathieu Ropert @ 2006-02-14 13:28 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

Keir Fraser wrote:

>
> On 13 Feb 2006, at 16:06, Mathieu Ropert wrote:
>
>> i'm trying to run a very simple domU kernel on Xen/x86_64, and i'm 
>> getting some trouble with update_va_mapping(): when trying to remap 
>> some page table entry, i find the virtual address still pointing to 
>> the same machine address after the return of the hypercall.
>
>
> What machine page does 'cons' point at before update_va_mapping()? Is 
> it definitely a different page?
>
>  -- Keir
>
Done some more checks and found the bug: the virtual address i used was 
mis-aligned  (missing a 0x in .align directive :)).
How does update_va_mapping() should normally behave when given a non 
paged-aligned virtual address? From the code, i guess it just remap the 
page containing the given address (discarding the lower 12 bits). Is 
this intended?

Mathieu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-02-14 13:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-13 16:06 Trouble using update_va_mapping Mathieu Ropert
2006-02-13 16:47 ` Keir Fraser
2006-02-13 17:07   ` Mathieu Ropert
2006-02-14 13:28   ` Mathieu Ropert

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.