[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 16/22] vixen: pass grant table operations through to the outer Xen



On Sun, Jan 07, 2018 at 07:42:55AM -0800, Anthony Liguori wrote:
> On Sun, Jan 7, 2018 at 12:36 AM, Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
> > On Sat, Jan 06, 2018 at 02:54:31PM -0800, Anthony Liguori wrote:
> >> diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
> >> index 250450b..b302fd0 100644
> >> --- a/xen/common/grant_table.c
> >> +++ b/xen/common/grant_table.c
> >>  static long
> >> +vixen_gnttab_setup_table(
> >> +    XEN_GUEST_HANDLE_PARAM(gnttab_setup_table_t) uop, unsigned int count)
> >> +{
> >> +    long rc;
> >> +
> >> +    struct gnttab_setup_table op;
> >> +    xen_pfn_t *frame_list = NULL;
> >> +    static void *grant_table;
> >> +    XEN_GUEST_HANDLE(xen_pfn_t) old_frame_list;
> >> +
> >> +    if ( count != 1 )
> >> +        return -EINVAL;
> >> +
> >> +    if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
> >> +    {
> >> +        gdprintk(XENLOG_INFO, "Fault while reading 
> >> gnttab_setup_table_t.\n");
> >> +        return -EFAULT;
> >> +    }
> >> +
> >> +    if ( grant_table == NULL ) {
> >> +        struct xen_add_to_physmap xatp;
> >> +        struct domain *d;
> >> +        int i;
> >> +
> >> +        for ( i = 0; i < max_grant_frames; i++ )
> >> +        {
> >> +             grant_table = alloc_xenheap_page();
> >
> > This is wasting one memory page, grant table frames don't need to be
> > populated.
> 
> Well they have to have a valid struct page_info in order for the guest
> to map it within its address space.
> 
> Or did you have something else in mind?

You can map it in some unpopulated memory region and then add it to
the list of iomem regions for the guest (iomem_permit_access). Grant
table frames AFAICT don't require a struct page.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.