Memory management Xen ARM-如何使用授权表在域之间传输页面

Memory management Xen ARM-如何使用授权表在域之间传输页面,memory-management,arm,xen,hypervisor,armv8,Memory Management,Arm,Xen,Hypervisor,Armv8,到目前为止,我可以在ARMv8上运行xenv4.9,并让Dom0和DomU正常运行。 接下来,我想使用grant表将页面(更改页面所有权)从一个域转移到另一个域。 但我在发布hypercall以传输页面时,总是获得坏页面状态。 我在xen/common/grant_table.c 我发现它将调用steal_page()在xen/arch/arm/mm.c中实现 在Xen v4.11(最新版本)中,不支持该操作。 我不知道它不支持的原因,我做了一些猜测: ARM的架构不支持内存传输

到目前为止,我可以在ARMv8上运行xenv4.9,并让Dom0和DomU正常运行。
接下来,我想使用grant表将页面(更改页面所有权)从一个域转移到另一个域。
但我在发布hypercall以传输页面时,总是获得
坏页面
状态。
我在
xen/common/grant_table.c

我发现它将调用
steal_page()
xen/arch/arm/mm.c中实现


在Xen v4.11(最新版本)中,不支持该操作。


我不知道它不支持的原因,我做了一些猜测:

  • ARM的架构不支持内存传输?但是为什么呢?
  • ARM还有其他有效的方法来传输内存页吗?哪一个?
  • 该功能仍在建设中?似乎不是。。。
  • 如果DomU想要访问磁盘,它必须使用Dom0操作。
    从磁盘读取的数据可能是巨大的,如视频、图像等。
    因此,它必须传输页面(更改页面所有权),而不是映射和复制。

    如何传送页面?
    为什么不支持Xen手臂?


    谢谢

    在ARM上有一些关于实现steal_page()的补丁

    还有一些有趣的邮件列表:

    目前ARM上不支持XENMEM_exchange,因为 偷窃页面未被执行

    然而,即使实现了steal_页面,超级调用也无法工作 对于ARM,因为:

    • 不支持直接映射域
    • ARM没有M2P,因此最惠国对最惠国gmfn的使用无效
    由此


    希望我能对你的问题有所解释

    谢谢@Nick,我使用了补丁,然后它就可以工作了。我以前看过邮件列表。XENMEM_交换和授权表转移是不同的情况吗?为什么ARM不能支持XENMEM_交换,因为“不支持直接映射域”,但可以支持授权表传输
    if ( steal_page(d, page, 0) < 0 )
    {
        put_gfn(d, gop.mfn);
        gop.status = GNTST_bad_page;
        goto copyback;
    }
    
    int steal_page(struct domain *d, struct page_info *page, unsigned int memflags)
    {
        return -1;
    }
    
    int steal_page(struct domain *d, struct page_info *page, unsigned int memflags)
    {
        return -EOPNOTSUPP;
    }
    
    int steal_page(
        struct domain *d, struct page_info *page, unsigned int memflags)
    {
        unsigned long x, y;
        bool_t drop_dom_ref = 0;
        const struct domain *owner = dom_xen;
    
        spin_lock(&d->page_alloc_lock);
    
        if ( is_xen_heap_page(page) || ((owner = page_get_owner(page)) != d) )
            goto fail;
    
        /*
         * We require there is just one reference (PGC_allocated). We temporarily
         * drop this reference now so that we can safely swizzle the owner.
         */
        y = page->count_info;
        do {
            x = y;
            if ( (x & (PGC_count_mask|PGC_allocated)) != (1 | PGC_allocated) )
                goto fail;
            y = cmpxchg(&page->count_info, x, x & ~PGC_count_mask);
        } while ( y != x );
    
        /* Swizzle the owner then reinstate the PGC_allocated reference. */
        page_set_owner(page, NULL);
        y = page->count_info;
        do {
            x = y;
            BUG_ON((x & (PGC_count_mask|PGC_allocated)) != PGC_allocated);
        } while ( (y = cmpxchg(&page->count_info, x, x | 1)) != x );
    
        /* Unlink from original owner. */
        if ( !(memflags & MEMF_no_refcount) && !domain_adjust_tot_pages(d, -1) )
            drop_dom_ref = 1;
        page_list_del(page, &d->page_list);
    
        spin_unlock(&d->page_alloc_lock);
        if ( unlikely(drop_dom_ref) )
            put_domain(d);
        return 0;
    
     fail:
        spin_unlock(&d->page_alloc_lock);
        gdprintk(XENLOG_WARNING,
                 "Bad page %lx: ed=%d sd=%d caf=%08lx taf=%" PRtype_info,
                 page_to_mfn(page), d->domain_id,
                 owner ? owner->domain_id : DOMID_INVALID,
                 page->count_info, page->u.inuse.type_info);
        return -1;
    }