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-ia64-devel

Re: [Xen-ia64-devel] [PATCH 1/3] p2m table expsosure xen side

To: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Subject: Re: [Xen-ia64-devel] [PATCH 1/3] p2m table expsosure xen side
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Tue, 03 Oct 2006 16:33:43 -0600
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 03 Oct 2006 15:34:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20061003094131.GA23174%yamahata@xxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: OSLO R&D
References: <20061003094131.GA23174%yamahata@xxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Isaku,

   Some comments...

On Tue, 2006-10-03 at 18:41 +0900, Isaku Yamahata wrote:
> +static int
> +expose_p2m_page(struct domain* d, unsigned long mpaddr, struct
> page_info* page)
> +{
> +    // we can't get_page(page) here.
> +    // pte page is allocated form xen heap.(see
> pte_alloc_one_kernel().)
> +    // so that the page has NULL page owner and it's reference count
> +    // is useless.
> +    // see also relinquish_pte()'s page_get_owner() == NULL check.
> +    BUG_ON(page_get_owner(page) != NULL);
> +
> +    if (__assign_domain_page(d, mpaddr, page_to_maddr(page),
> +                             ASSIGN_readonly) < 0) {
> +        // There was a race.
> +        return -EAGAIN;
> +    }
> +    return 0;
> +}

   Couldn't this be simplified as:

    return __assign_domain_page(d, mpaddr, page_to_maddr(page), ASSIGN_readonly)


> +    // allocate pgd, pmd.
> +    for (i = conv_start_gpfn; i < expose_num_pfn + 1; i++) {
> +        conv_pte = lookup_noalloc_domain_pte(d, (conv_start_gpfn + i)
> << PAGE_SHIFT);
> +        if (conv_pte == NULL) {
> +            continue;
> +        }
> +        
> +        assign_pte = lookup_alloc_domain_pte(d, (assign_start_gpfn <<
> PAGE_SHIFT) + i * sizeof(pte_t));
> +        if (assign_pte == NULL) {
> +            DPRINTK("%s failed to allocate pte page\n", __func__);
> +            return -ENOMEM;
> +        }
> +
> +        // skip to next pte page
> +        i += PTRS_PER_PTE;
> +        i &= ~(PTRS_PER_PTE - 1);
> +        i--;// compensate i++
> +    }

  The usage of i here is a little weird (pre-decrementing to account for
the increment in the for loop).  I think it'd be better to update it
more explicitly.  How about something like:

i = conv_start_gpfn;
while (i < expose_num_pfn + 1) {
    ...
    if (conv_pte == NULL) {
        i++;
        continue;
    }
    ...
    i += PTRS_PER_PTE;
    i &= ~(PTRS_PER_PTE - 1);
}

Same for the next for loop w/ the same structure.  Thanks,

        Alex

-- 
Alex Williamson                             HP Open Source & Linux Org.


_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

<Prev in Thread] Current Thread [Next in Thread>