Nakajima, Jun
2005-Aug-15 07:11 UTC
[Xen-devel] [PATCH] [x86_64] Fixing PGT_va_mutable and PGT_va_unknown
This patch ensures that type_info is always greater than PGT_va_unknown
if PGT_va_mutable is set.
Today, some (rare) cases (#PF in the kernel address space, such vmalloc
handling) are unnecessarily sent to the emulation code.
int ptwr_do_page_fault(struct domain *d, unsigned long addr,
struct cpu_user_regs *regs)
{
unsigned long pfn;
...
if ( unlikely(l2_idx >= PGT_va_unknown) )
goto emulate; /* Urk! This L1 is mapped in multiple L2 slots! */
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
diff -r f2e241ecf1c3 -r f89a34a65e7d xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h Mon Aug 15 01:10:47 2005
+++ b/xen/include/asm-x86/mm.h Mon Aug 15 03:31:27 2005
@@ -88,14 +88,11 @@
#elif defined(__x86_64__)
/* The 27 most significant bits of virt address if this is a page
table. */
#define PGT_va_shift 32
-#define PGT_va_mask ((unsigned
long)((1U<<28)-1)<<PGT_va_shift)
+#define PGT_va_mask ((unsigned
long)((1U<<29)-1)<<PGT_va_shift)
/* Is the back pointer still mutable (i.e. not fixed yet)? */
- /* Use PML4 slot for HYPERVISOR_VIRT_START.
- 18 = L4_PAGETABLE_SHIFT - L2_PAGETABLE_SHIFT */
-#define PGT_va_mutable ((unsigned
long)(256U<<18)<<PGT_va_shift)
+#define PGT_va_mutable ((unsigned long)(1U<<28)<<PGT_va_shift)
/* Is the back pointer unknown (e.g., p.t. is mapped at multiple VAs)?
*/
- /* Use PML4 slot for HYPERVISOR_VIRT_START + 1 */
-#define PGT_va_unknown ((unsigned
long)(257U<<18)<<PGT_va_shift)
+#define PGT_va_unknown ((unsigned
long)((1U<<28)-1)<<PGT_va_shift)
#endif
/* 16-bit count of uses of this frame as its current type. */
Jun
---
Intel Open Source Technology Center
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Keir Fraser
2005-Aug-15 07:35 UTC
Re: [Xen-devel] [PATCH] [x86_64] Fixing PGT_va_mutable and PGT_va_unknown
On 15 Aug 2005, at 08:11, Nakajima, Jun wrote:> This patch ensures that type_info is always greater than PGT_va_unknown > if PGT_va_mutable is set.Okay, but I see no reason to change PGT_va_mask. You already include 28 bits where you actually need only 27 bits of backptr. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2005-Aug-15 07:48 UTC
Re: [Xen-devel] [PATCH] [x86_64] Fixing PGT_va_mutable and PGT_va_unknown
On 15 Aug 2005, at 08:50, Nakajima, Jun wrote:>> Okay, but I see no reason to change PGT_va_mask. You already include >> 28 bits where you actually need only 27 bits of backptr. > > The current one > #define PGT_va_mask ((unsigned long)((1U<<28)-1)<<PGT_va_shift) > includes only 27 bits (see -1).(1<<n)-1 sets the n least significant bits, not n-1. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Nakajima, Jun
2005-Aug-15 07:50 UTC
RE: [Xen-devel] [PATCH] [x86_64] Fixing PGT_va_mutable and PGT_va_unknown
Keir Fraser wrote:> On 15 Aug 2005, at 08:11, Nakajima, Jun wrote: > >> This patch ensures that type_info is always greater than >> PGT_va_unknown if PGT_va_mutable is set. > > Okay, but I see no reason to change PGT_va_mask. You already include > 28 bits where you actually need only 27 bits of backptr.The current one #define PGT_va_mask ((unsigned long)((1U<<28)-1)<<PGT_va_shift) includes only 27 bits (see -1).> > -- KeirJun --- Intel Open Source Technology Center _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Nakajima, Jun
2005-Aug-15 08:06 UTC
RE: [Xen-devel] [PATCH] [x86_64] Fixing PGT_va_mutable and PGT_va_unknown
Keir Fraser wrote:> On 15 Aug 2005, at 08:50, Nakajima, Jun wrote: > >>> Okay, but I see no reason to change PGT_va_mask. You already include >>> 28 bits where you actually need only 27 bits of backptr. >> >> The current one >> #define PGT_va_mask ((unsigned >> long)((1U<<28)-1)<<PGT_va_shift) includes only 27 bits (see -1). > > (1<<n)-1 sets the n least significant bits, not n-1.You are right. I need to go to bed now.> > -- KeirJun --- Intel Open Source Technology Center _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel