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] [read-only mapping] GNTMAP_readonly sup

To: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Subject: Re: [Xen-ia64-devel] [PATCH 1/3] [read-only mapping] GNTMAP_readonly support xen part
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Thu, 18 May 2006 13:43:29 -0600
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 18 May 2006 12:43:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060517050926.GA10409%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: LOSL
References: <20060517050926.GA10409%yamahata@xxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Isaku,

   A few comments/questions on this patch came up as I tried to merge it
in...

On Wed, 2006-05-17 at 14:09 +0900, Isaku Yamahata wrote:

> +static void
> +assign_pte(pte_t* pte, unsigned long maddr, unsigned long readonly)
> +{
> +    unsigned long arflags = _PAGE_AR_RWX;
> +    if (readonly)
> +        arflags = _PAGE_AR_R;
> +    set_pte(pte, pfn_pte(maddr >> PAGE_SHIFT,
> +                         __pgprot(__DIRTY_BITS | _PAGE_PL_2 |
> arflags)));
> +}
> +

   This function seems unnecessary.  In the end, it's really only doing
(readonly ? _PAGE_AR_R : _PAGE_AR_RWX) which could be done in the caller
or maybe simplified in the caller with a macro.

> @@ -804,16 +813,15 @@ assign_new_domain0_page(struct domain *d
>  /* map a physical address to the specified metaphysical addr */
>  void
>  __assign_domain_page(struct domain *d,
> -                     unsigned long mpaddr, unsigned long physaddr)
> +                     unsigned long mpaddr, unsigned long physaddr,
> +                     unsigned long readonly)

unsigned long for a boolean value?  See comment on flags vs readonly
below.

> @@ -1083,7 +1090,7 @@ out:
>  // caller must call set_gpfn_from_mfn().
>  static void
>  assign_domain_page_replace(struct domain *d, unsigned long mpaddr,
> -                           unsigned long mfn, unsigned int flags)
> +                           unsigned long mfn, unsigned int readonly)

I'm not sure I see the benefit of replacing a generic "flags" parameter
with a very specific "readonly" for all of these.  Wouldn't it be more
consistent to continue using GNTMAP_readonly?  There's actually one
place in this patch that still calls this function with (flags &
GNTMAP_readonly).

>  {
>      struct mm_struct *mm = d->arch.mm;
>      pte_t* pte;
> @@ -1093,8 +1100,7 @@ assign_domain_page_replace(struct domain
>  
>      // update pte
>      old_pte = ptep_get_and_clear(mm, mpaddr, pte);
> -    set_pte(pte, pfn_pte(mfn,
> -                         __pgprot(__DIRTY_BITS | _PAGE_PL_2 |
> _PAGE_AR_RWX)));
> +    assign_pte(pte, mfn << PAGE_SHIFT, readonly);

   This chunk conflicts with Tristan's pte_xchg patch.  With the current
code, I think the cleanest way to add the readonly attribute is to
simply do a (readonly ? _PAGE_AR_R : _PAGE_AR_RWX) in the __pgprot,
which again makes the extra step of having an assign_pte function seem
unnecessary.

Thanks,

        Alex

-- 
Alex Williamson                             HP Linux & Open Source Lab


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