WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] How to access a dom0 page from domU Guest in read-only mode.

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] How to access a dom0 page from domU Guest in read-only mode.
From: veerasena reddy <veeruyours@xxxxxxxxx>
Date: Thu, 23 Jun 2011 03:04:22 +0530
Delivery-date: Wed, 22 Jun 2011 14:35:15 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=8zEEvYxGSTYcbkC/LXMcCSdtOJ42mI07niNetG1QGsM=; b=eAMCnw0X6sXJaq/oUjEPOClcuEPaOL46Q8frnnMZVdyGu6pwQO+5doAmEUoP6r0oYb chyJdMS8a4lZ1DVz+CJMt+9mGVNWZismGXgi/PchHNc1GghDXW4//4uY9eqSfFzc0TfR 69+7oqryveMtkt1EFZV+P8MNleyk6KXdItqRE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=AWgTe7wKXmKulQJ6Rg71FYScICd6qE5ctCGyk73kRYhzPt+IvkVrZP7k6w/Kghjtb+ mreEJSeFvBy55f994d22m3a22joL+YBlCmDxlPyDBEqUdk9lpK4kjt46hLrz9XICI85D MAXyOJAtjxqahxyBd2GpXs3RSNGxwuwD+LKN4=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi,

I am trying to access a dom0 page from domU guest (in read-only mode) to send faster updates from IO device to domU without using ring structures and event channels. whenever there is some device update, the IO device writes to the dom0 page and domU polling on this page (in read-only mode) will pick the status update. I take the grant reference allocated in dom0 and pass it as module params to domU module.

I could successfully share domU page to dom0 but when i tried sharing dom0 page to domU the grant table operations are successful but when i tried to print the contents of the page, it crashes.

Could you please help me in understanding what i missed here.
I suspect I missed some flags to gnttab_set_map_op()/HYPERVISOR_grant_table_op(). The same flags worked when i accessed domU page in dom0. Please guide me the correct usage.

Thanks in Advance.

Regards,
VSR.

======= domU code ========
        struct vm_struct *v_start;
        int err;

        printk("\nxen: domU: init_module with gref = %d", gref); <<-- gref (grant reference is passed as a module parameter)
        // The following function reserves a range of kernel address space and
        // allocates pagetables to map that range. No actual mappings are created.
        v_start = alloc_vm_area(PAGE_SIZE);
        if (v_start == 0) {
                free_vm_area(v_start);
                printk("\nxen: dom0: could not allocate page");
                return -EFAULT;
        }

      gnttab_set_map_op(&ops, (unsigned long)v_start->addr, GNTMAP_host_map, gref, 0); /* flags, ref, domID */

      if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &ops, 1)) {
            printk("\nxen: domU: HYPERVISOR map grant ref failed");
            return -EFAULT;
      }

      if (ops.status) {
            printk("\nxen: domU: HYPERVISOR map grant ref failed status = %d",
                        ops.status);
      }
      printk("\nxen: domU: shared_page = %p, handle = %x, status = %x",
                  v_start->addr, ops.handle, ops.status);

                printk("\nBytes in page ");
                for(i=0;i<=10;i++)
                {
                        printk("%c", ((char*)(v_start->addr))[i]);   <<<--- when i enable this line, it crashes
                }
=========  crash message (on DomU) =========
root@PVHVM-domU:~/test_programs/page_share_interdomain# dmesg -c

[16259.922417] xen: domU: init_module with gref = 9   <<<<<--- grant ref passes as module param
[16259.928763] xen: domU: shared_page = ffffc90000590000, handle = 3, status = 0  <<<<<--- the status code shows SUCCESS
[16259.928871] Bytes in page                 <<<<<<<<<<--- trying to print the bytes in page; crash !!!!
[16259.929126] BUG: unable to handle kernel paging request at ffffc90000590000
[16259.929130] IP: [<ffffffffa010b185>] init_module+0x155/0x17c [domu_share2]
[16259.929144] PGD 3fd25067 PUD 3fd26067 PMD 3e667067 PTE 0
[16259.929178] Oops: 0000 [#3] SMP
===========================
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>