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] pagetable update through xc_add_mmu_update always fails

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] pagetable update through xc_add_mmu_update always fails
From: Stephan Creutz <stephan.creutz@xxxxxxxxxxxxxxxxx>
Date: Thu, 5 Apr 2007 17:56:33 +0200
Delivery-date: Thu, 05 Apr 2007 08:56:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi,

I am trying to update pagetable entries through the interface provided
by libxc, but for now I'm far from successful. As simple demonstration
(see code below) I tried to update the first entry in a L2-table
(x86-processor without PAE and PSE enabled) with same value that is
found in this table.

#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <xenctrl.h>
#include <sys/mman.h>
#include <xen/xen.h>

static bool update_pagetable_entry(int xc_handle, uint32_t domid,
                unsigned long pte_ma, unsigned long ma)
{
        assert(pte_ma % 4 == 0);
        xc_mmu_t *mmu = xc_init_mmu_updates(xc_handle, domid);

        if (xc_add_mmu_update(xc_handle, mmu,
                                pte_ma | MMU_NORMAL_PT_UPDATE, ma) == -1)
                return false;

        if (xc_finish_mmu_updates(xc_handle, mmu) == -1)
                return false;

        return true;
}

int main(int argc, char **argv)
{
        if (argc < 2)
                return 1;

        uint32_t domid = (uint32_t) strtoul(argv[1], NULL, 10);
        int xc_handle = xc_interface_open();
        assert(xc_handle != -1 && domid != 0);

        vcpu_guest_context_t ctxt;
        xc_vcpu_getcontext(xc_handle, domid, 0, &ctxt);
        unsigned long cr3_ma = ctxt.ctrlreg[3];

        unsigned long *l2_table = xc_map_foreign_range(xc_handle, domid,
                        XC_PAGE_SIZE, PROT_READ, cr3_ma >> XC_PAGE_SHIFT);
        assert(l2_table != NULL);

        if (!update_pagetable_entry(xc_handle, domid, cr3_ma, l2_table[0]))
                fprintf(stderr, "update failed\n");

        munmap(l2_table, XC_PAGE_SIZE);

        xc_interface_close(xc_handle);
        return 0;
}

The function update_pagetable_entry always fails. The output of the
program is "ERROR Internal error: Failure when submitting mmu updates"
and "xm dmesg" tells me the following:

(XEN) [...]/xen/include/asm/mm.h:184:d0 Error pfn 31971: rd=ffbf0100,
od=ffbd8100, caf=80000005, taf=58000002
(XEN) mm.c:500:d0 Could not get page ref for pfn 31971
(XEN) mm.c:2319:d0 Could not get page for normal update

Where pfn 31971 is the frame number of the pagetable which I tried to
update. (I use Xen-unstable from 04/04/2007)

What I am doing wrong or what I am missing? All suggestions are
appreciated.

Thanks in advance!

Stephan

Attachment: pgpTsJBQ0mSa5.pgp
Description: PGP signature

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] pagetable update through xc_add_mmu_update always fails, Stephan Creutz <=