All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm: partially revert 21093:4a3e131f7498
@ 2011-02-14 13:50 Tim Deegan
  2011-02-16 16:11 ` Olaf Hering
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Deegan @ 2011-02-14 13:50 UTC (permalink / raw)
  To: xen-devel; +Cc: Gianni.Tedesco

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

p2m internals should always gate on whether HAP is enabled for the
domain, not whether a HAP paging mode is currently advertised.
This lets us revert the change to hap_enable() that advertises the
new mode before it's safe to use it.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>



[-- Attachment #2: xen-unstable.hg.patch --]
[-- Type: text/x-patch, Size: 3218 bytes --]

# HG changeset patch
# User Tim Deegan <Tim.Deegan@citrix.com>
# Date 1297690832 0
# Node ID 20140bcb4c047c5410594b3acc9e8b1f243b8ff9
# Parent  af84691a6cf9423a445f471af02b36b76ddf5314
x86/mm: partially revert 21093:4a3e131f7498

p2m internals should always gate on whether HAP is enabled for the
domain, not whether a HAP paging mode is currently advertised.
This lets us revert the change to hap_enable() that advertises the
new mode before it's safe to use it.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>

diff -r af84691a6cf9 -r 20140bcb4c04 xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c	Mon Feb 14 10:41:12 2011 +0000
+++ b/xen/arch/x86/mm/hap/hap.c	Mon Feb 14 13:40:32 2011 +0000
@@ -583,13 +583,9 @@ int hap_enable(struct domain *d, u32 mod
 {
     unsigned int old_pages;
     int rv = 0;
-    uint32_t oldmode;
 
     domain_pause(d);
 
-    oldmode = d->arch.paging.mode;
-    d->arch.paging.mode = mode | PG_HAP_enable;
-
     /* error check */
     if ( (d == current->domain) )
     {
@@ -624,9 +620,10 @@ int hap_enable(struct domain *d, u32 mod
             goto out;
     }
 
+    /* Now let other users see the new mode */
+    d->arch.paging.mode = mode | PG_HAP_enable;
+
  out:
-    if (rv)
-        d->arch.paging.mode = oldmode;
     domain_unpause(d);
     return rv;
 }
diff -r af84691a6cf9 -r 20140bcb4c04 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Mon Feb 14 10:41:12 2011 +0000
+++ b/xen/arch/x86/mm/p2m.c	Mon Feb 14 13:40:32 2011 +0000
@@ -1387,7 +1387,7 @@ p2m_set_entry(struct p2m_domain *p2m, un
     else if ( !p2m_next_level(p2m, &table_mfn, &table, &gfn_remainder, gfn,
                               L3_PAGETABLE_SHIFT - PAGE_SHIFT,
                               ((CONFIG_PAGING_LEVELS == 3)
-                               ? (paging_mode_hap(p2m->domain) ? 4 : 8)
+                               ? (hap_enabled(p2m->domain) ? 4 : 8)
                                : L3_PAGETABLE_ENTRIES),
                               PGT_l2_page_table) )
         goto out;
@@ -1848,7 +1848,7 @@ int set_p2m_entry(struct p2m_domain *p2m
 
     while ( todo )
     {
-        if ( is_hvm_domain(d) && paging_mode_hap(d) )
+        if ( hap_enabled(d) )
             order = ( (((gfn | mfn_x(mfn) | todo) & ((1ul << 18) - 1)) == 0) &&
                       hvm_hap_has_1gb(d) && opt_hap_1gb ) ? 18 :
                       ((((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) &&
@@ -1909,8 +1909,7 @@ int p2m_alloc_table(struct p2m_domain *p
 
     p2m->phys_table = pagetable_from_mfn(page_to_mfn(p2m_top));
 
-    if ( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled &&
-         (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) )
+    if ( hap_enabled(d) && (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) )
         iommu_set_pgd(d);
 
     P2M_PRINTK("populating p2m table\n");
@@ -2314,7 +2313,7 @@ static int gfn_check_limit(
      * hardware translation limit. This limitation is checked by comparing
      * gfn with 0xfffffUL.
      */
-    if ( !paging_mode_hap(d) || ((gfn + (1ul << order)) <= 0x100000UL) ||
+    if ( !hap_enabled(d) || ((gfn + (1ul << order)) <= 0x100000UL)
          (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) )
         return 0;
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/mm: partially revert 21093:4a3e131f7498
  2011-02-14 13:50 [PATCH] x86/mm: partially revert 21093:4a3e131f7498 Tim Deegan
@ 2011-02-16 16:11 ` Olaf Hering
  0 siblings, 0 replies; 2+ messages in thread
From: Olaf Hering @ 2011-02-16 16:11 UTC (permalink / raw)
  To: Tim Deegan; +Cc: xen-devel, Gianni.Tedesco

On Mon, Feb 14, Tim Deegan wrote:

> diff -r af84691a6cf9 -r 20140bcb4c04 xen/arch/x86/mm/p2m.c
> --- a/xen/arch/x86/mm/p2m.c	Mon Feb 14 10:41:12 2011 +0000
> +++ b/xen/arch/x86/mm/p2m.c	Mon Feb 14 13:40:32 2011 +0000

> @@ -2314,7 +2313,7 @@ static int gfn_check_limit(
>       * hardware translation limit. This limitation is checked by comparing
>       * gfn with 0xfffffUL.
>       */
> -    if ( !paging_mode_hap(d) || ((gfn + (1ul << order)) <= 0x100000UL) ||
> +    if ( !hap_enabled(d) || ((gfn + (1ul << order)) <= 0x100000UL)

This removes the ||

p2m.c: In function 'gfn_check_limit':
p2m.c:2317: error: called object '(1ul << (int)order) + gfn <= 1048576ul' is not a function
make[4]: *** [p2m.o] Error 1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-16 16:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 13:50 [PATCH] x86/mm: partially revert 21093:4a3e131f7498 Tim Deegan
2011-02-16 16:11 ` Olaf Hering

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.