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] Fix for re-enabling PV-on-HVM on IPF

To: DOI Tsunehisa <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Subject: Re: [Xen-ia64-devel] [Patch] Fix for re-enabling PV-on-HVM on IPF
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Thu, 8 Mar 2007 14:19:57 +0900
Cc: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 07 Mar 2007 21:19:03 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <45EF8BAC.7020008@xxxxxxxxxxxxxx>
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>
References: <20070306145920.GA26842%yamahata@xxxxxxxxxxxxx> <200703070408.l2748MJ29453@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <45EF8BAC.7020008@xxxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
On Thu, Mar 08, 2007 at 01:06:04PM +0900, DOI Tsunehisa wrote:
> diff -r 61eb6589e720 -r b602dd142385 xen/arch/ia64/xen/mm.c
> --- a/xen/arch/ia64/xen/mm.c  Tue Mar 06 21:11:37 2007 +0900
> +++ b/xen/arch/ia64/xen/mm.c  Thu Mar 08 11:57:46 2007 +0900
> @@ -2110,12 +2125,31 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
>  
>          /* Unmap from old location, if any. */
>          gpfn = get_gpfn_from_mfn(mfn);
> -        if (gpfn != INVALID_M2P_ENTRY)
> +        if (gpfn != INVALID_M2P_ENTRY) {
> +            unsigned long x, nx;
> +            /*
> +             * guest_physmap_remove_page() (for IPF) descrements page
> +             * counter and unset PGC_allocated flag,
> +             * so pre-increment page counter and post-set flag inserted
> +             */
> +            /* pre-increment page counter */
> +            get_page(mfn_to_page(mfn), d);

Please check the return value.


> +
>              guest_physmap_remove_page(d, gpfn, mfn);
> +
> +            /* post-set PGC_allocated flag */
> +            do {
> +                x = mfn_to_page(mfn)->count_info;
> +                if ((x & PGC_count_mask) == 0)
> +                    goto out;
> +                nx = x | PGC_allocated;
> +            } while (cmpxchg_acq(&mfn_to_page(mfn)->count_info, x, nx) != x);
> +        }

checking == 0 is non-sense because we incremented it.
Probably you want to 
   if (!test_and_set_bit(page->count_info, _PGC_allocated)) {
        put_page(page);
        goto out;
   }

-- 
yamahata

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