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

Re: [Xen-devel] [PATCH] x86: allow grant table originating pte-sto have

To: "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] x86: allow grant table originating pte-sto have their guest available bits set
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Tue, 04 Nov 2008 11:58:49 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 04 Nov 2008 03:58:49 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C535E68F.28AF6%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <490F1C5A.76E4.0078.0@xxxxxxxxxx> <C535E68F.28AF6%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> Keir Fraser <keir.fraser@xxxxxxxxxxxxx> 04.11.08 12:46 >>>
>Applied, thanks. I assume backport at least to 3.3 would be desirable?

We would of course very much appreciate if you would do that, but to be
honest I didn't really expect you to (as it's not a bug fix in that sense, i.e.
the kernel can get away without this, though of course not without some
extra effort and overhead).

Jan

On 3/11/08 14:44, "Jan Beulich" <jbeulich@xxxxxxxxxx> wrote:

> In order to allow 2.6.27's get_user_pages_fast() to correctly detect
> granted pages (so they would be passed to get_user_pages()), it must be
> possible to tell the grant table code in Xen to set the three available
> bits in the pte-s it creates.
> 
> While not applicable to the 2.6.18 tree, I'm nevertheless attaching our
> Linux side patch for reference.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
> 
> Index: 2008-10-27/xen/arch/x86/mm.c
> ===================================================================
> --- 2008-10-27.orig/xen/arch/x86/mm.c 2008-10-31 16:13:56.000000000 +0100
> +++ 2008-10-27/xen/arch/x86/mm.c 2008-10-31 17:41:12.000000000 +0100
> @@ -3326,6 +3326,10 @@ int create_grant_host_mapping(uint64_t a
>      if ( !(flags & GNTMAP_readonly) )
>          l1e_add_flags(pte,_PAGE_RW);
>  
> +    l1e_add_flags(pte,
> +                  ((flags >> _GNTMAP_guest_avail0) * _PAGE_AVAIL0)
> +                   & _PAGE_AVAIL);
> +
>      l1e_add_flags(pte, cacheattr_to_pte_flags(cache_flags >> 5));
>  
>      if ( flags & GNTMAP_contains_pte )
> Index: 2008-10-27/xen/common/kernel.c
> ===================================================================
> --- 2008-10-27.orig/xen/common/kernel.c 2008-10-27 11:25:15.000000000 +0100
> +++ 2008-10-27/xen/common/kernel.c 2008-10-31 17:17:30.000000000 +0100
> @@ -222,7 +222,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
>  #ifdef CONFIG_X86
>              if ( !is_hvm_vcpu(current) )
>                  fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) |
> -                             (1U << XENFEAT_highmem_assist);
> +                             (1U << XENFEAT_highmem_assist) |
> +                             (1U << XENFEAT_gnttab_map_avail_bits);
>  #endif
>              break;
>          default:
> Index: 2008-10-27/xen/include/public/features.h
> ===================================================================
> --- 2008-10-27.orig/xen/include/public/features.h 2008-10-27
> 11:24:26.000000000 +0100
> +++ 2008-10-27/xen/include/public/features.h 2008-10-31 17:03:12.000000000
> +0100
> @@ -62,6 +62,12 @@
>  /* x86: Does this Xen host support the MMU_{CLEAR,COPY}_PAGE hypercall? */
>  #define XENFEAT_highmem_assist             6
>  
> +/*
> + * If set, GNTTABOP_map_grant_ref honors flags to be placed into guest kernel
> + * available pte bits.
> + */
> +#define XENFEAT_gnttab_map_avail_bits      7
> +
>  #define XENFEAT_NR_SUBMAPS 1
>  
>  #endif /* __XEN_PUBLIC_FEATURES_H__ */
> Index: 2008-10-27/xen/include/public/grant_table.h
> ===================================================================
> --- 2008-10-27.orig/xen/include/public/grant_table.h 2007-12-07
> 11:51:50.000000000 +0100
> +++ 2008-10-27/xen/include/public/grant_table.h 2008-10-31 17:10:21.000000000
> +0100
> @@ -360,7 +360,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and
>  
>  
>  /*
> - * Bitfield values for update_pin_status.flags.
> + * Bitfield values for gnttab_map_grant_ref.flags.
>   */
>   /* Map the grant entry for access by I/O devices. */
>  #define _GNTMAP_device_map      (0)
> @@ -388,6 +388,13 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and
>  #define GNTMAP_contains_pte     (1<<_GNTMAP_contains_pte)
>  
>  /*
> + * Bits to be placed in guest kernel available PTE bits (architecture
> + * dependent; only supported when XENFEAT_gnttab_map_avail_bits is set).
> + */
> +#define _GNTMAP_guest_avail0    (16)
> +#define GNTMAP_guest_avail_mask ((uint32_t)~0 << _GNTMAP_guest_avail0)
> +
> +/*
>   * Values for error status returns. All errors are -ve.
>   */
>  #define GNTST_okay             (0)  /* Normal return.
> */
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx 
> http://lists.xensource.com/xen-devel 



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