XEN-paravirt: Xen guest implementation for paravirt_ops interface
Subsystems (9)
cover XEN-paravirt: Xen guest implementation for paravirt_ops interface
This patch series implements the Linux Xen guest in terms of the paravirt-ops interface. The features in implemented this patch series are:
* domU only
* UP only (most code is SMP-safe, but there's no way to create a new vcpu)
* writable pagetables, with late pinning/early unpinning
(no shadow pagetable support)
* supports both PAE and non-PAE modes
* xen console
* virtual block device (blockfront)
(Netfront needs a bit of updating, and will be in a separate patch later.)
The patch series is in two parts:
1-11: cleanups to the core kernel, either to fix outright problems,
or to add appropriate hooks for Xen
12-20: the Xen guest implementation itself
I've tried to make each patch as self-explanatory as possible. The series is based on 2.6.20-rc4-mm1.
Thanks,
J
PATCH 1/20 XEN-paravirt: Fix typo in sync_constant_test_bit()s name.
Fix typo in sync_constant_test_bit()s name.
===================================================================
include/asm-i386/sync_bitops.h +1 -1
@@ -130,7 +130,7 @@ static inline int sync_test_and_change_breturn oldbit; } -static __always_inline int sync_const_test_bit(int nr, const volatile unsigned long *addr) +static __always_inline int sync_constant_test_bit(int nr, const volatile unsigned long *addr) {return ((1UL << (nr &31 )) & (((const volatile unsigned int *)addr)[nr >>5 ])) !=0 ;
PATCH 2/20 XEN-paravirt: Add a flag to allow the VGA console to be disabled
In reply to Jeremy FitzhardingeAdd a flag to allow the VGA console to be disabled. The VGA code will spin forever if there isn't any real VGA hardware, which will happen under Xen.
===================================================================
arch/i386/kernel/setup.c +4 -1
@@ -71,6 +71,9 @@ unsigned long init_pg_tables_end __initdint disable_pse__devinitdata =0 ; +/* use to runtime disable vga_con */ +int vgacon_enabled =1 ; +/* * Machine setup.. */
@@ -652,7 +655,7 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE ) -if (!efi_enabled || (efi_mem_type (0xa0000 ) !=EFI_CONVENTIONAL_MEMORY )) +if (vgacon_enabled && (!efi_enabled || (efi_mem_type (0xa0000 ) !=EFI_CONVENTIONAL_MEMORY ))) conswitchp = &vga_con;#elif defined(CONFIG_DUMMY_CONSOLE ) conswitchp = &dummy_con;
===================================================================
include/asm-i386/setup.h +2 -0
@@ -77,6 +77,8 @@ void __init add_memory_region(unsigned lvoid __init add_memory_region (unsigned long long start,unsigned long long size,int type); +extern int vgacon_enabled; +#endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */
PATCH 3/20 XEN-paravirt: paravirt: page-table accessors
In reply to Jeremy FitzhardingeAdd a set of accessors to pack, unpack and modify page table entries (at all levels). This allows a paravirt implementation to control the contents of pgd/pmd/pte entries. For example, Xen uses this to convert the (pseudo-)physical address into a machine address when populating a pagetable entry, and converting back to pphys address when an entry is read.
--
arch/i386/kernel/paravirt.c | 113 +++++++++++++++++++++++++++++++++---- arch/i386/kernel/vmlinux.lds.S | 3 include/asm-i386/page.h | 18 ++++- include/asm-i386/paravirt.h | 68 +++++++++++++++++++++- include/asm-i386/pgtable-2level.h | 5 - include/asm-i386/pgtable-3level.h | 27 ++++---- 6 files changed, 199 insertions(+), 35 deletions(-)
===================================================================
arch/i386/kernel/paravirt.c +101 -12
@@ -34,7 +34,7 @@#include <asm/tlbflush.h> /* nop stub */ -static void native_nop (void ) +void native_nop (void ) { }
@@ -400,38 +400,74 @@ static fastcall void native_flush_tlb_si }#ifndef CONFIG_X86_PAE -static fastcall void native_set_pte(pte_t *ptep, pte_t pteval) +fastcall void native_set_pte(pte_t *ptep, pte_t pteval) { *ptep = pteval; } -static fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval) +fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval) { *ptep = pteval; } -static fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) +fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) { *pmdp = pmdval; } +fastcall unsigned long native_pte_val (pte_t pte) +{ +return pte.pte_low; +} + +fastcall unsigned long native_pmd_val (pmd_t pmd) +{ +BUG (); +return 0 ; +} + +fastcall unsigned long native_pgd_val (pgd_t pgd) +{ +return pgd.pgd; +} + +fastcall pte_t native_make_pte(unsigned long pte) +{ +return (pte_t ){ pte }; +} + +fastcall pmd_t native_make_pmd(unsigned long pmd) +{ +BUG (); +} + +fastcall pgd_t native_make_pgd(unsigned long pgd) +{ +return (pgd_t ){ pgd }; +} + +fastcall pte_t native_ptep_get_and_clear(pte_t *ptep) +{ +return __pte (xchg (&(ptep)->pte_low,0 )); +} +#else /* CONFIG_X86_PAE */ -static fastcall void native_set_pte(pte_t *ptep, pte_t pte) +fastcall void native_set_pte(pte_t *ptep, pte_t pte) { ptep->pte_high = pte.pte_high;smp_wmb (); ptep->pte_low = pte.pte_low; } -static fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pte) +fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pte) { ptep->pte_high = pte.pte_high;smp_wmb (); ptep->pte_low = pte.pte_low; } -static fastcall void native_set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) +fastcall void native_set_pte_present(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pte) { ptep->pte_low =0 ;smp_wmb ();
@@ -440,34 +476,76 @@ static fastcall void native_set_pte_pres ptep->pte_low = pte.pte_low; } -static fastcall void native_set_pte_atomic(pte_t *ptep, pte_t pteval) +fastcall void native_set_pte_atomic(pte_t *ptep, pte_t pteval) {set_64bit ((unsigned long long *)ptep,pte_val (pteval)); } -static fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) +fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) {set_64bit ((unsigned long long *)pmdp,pmd_val (pmdval)); } -static fastcall void native_set_pud(pud_t *pudp, pud_t pudval) +fastcall void native_set_pud(pud_t *pudp, pud_t pudval) { *pudp = pudval; } -static fastcall void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) +fastcall void native_pte_clear(struct mm_struct *mm, u32 addr, pte_t *ptep) { ptep->pte_low =0 ;smp_wmb (); ptep->pte_high =0 ; } -static fastcall void native_pmd_clear(pmd_t *pmd) +fastcall void native_pmd_clear(pmd_t *pmd) {u32 *tmp = (u32 *)pmd; *tmp =0 ;smp_wmb (); *(tmp +1 ) =0 ; +} + +fastcall unsigned long long native_pte_val (pte_t pte) +{ +return pte.pte_low | ((unsigned long long )pte.pte_high <<32 ); +} + +fastcall unsigned long long native_pmd_val (pmd_t pmd) +{ +return pmd.pmd; +} + +fastcall unsigned long long native_pgd_val (pgd_t pgd) +{ +return pgd.pgd; +} + +fastcall pte_t native_make_pte(unsigned long long pte) +{ +return (pte_t ){ pte }; +} + +fastcall pmd_t native_make_pmd(unsigned long long pmd) +{ +return (pmd_t ){ pmd }; +} + +fastcall pgd_t native_make_pgd(unsigned long long pgd) +{ +return (pgd_t ){ pgd }; +} + +fastcall pte_t native_ptep_get_and_clear(pte_t *ptep) +{ +pte_t res; + +/* xchg acts as a barrier before the setting of the high bits */ + res.pte_low =xchg (&ptep->pte_low,0 ); + res.pte_high = ptep->pte_high; + ptep->pte_high =0 ; + +return res; }#endif /* CONFIG_X86_PAE */
@@ -564,6 +642,9 @@ struct paravirt_ops paravirt_ops = { .set_pmd = native_set_pmd, .pte_update = (void *)native_nop, .pte_update_defer = (void *)native_nop, + + .ptep_get_and_clear = native_ptep_get_and_clear, + #ifdef CONFIG_X86_PAE .set_pte_atomic = native_set_pte_atomic, .set_pte_present = native_set_pte_present,
@@ -572,6 +653,14 @@ struct paravirt_ops paravirt_ops = { .pmd_clear = native_pmd_clear, #endif + .pte_val = native_pte_val, + .pmd_val = native_pmd_val, + .pgd_val = native_pgd_val, + + .make_pte = native_make_pte, + .make_pmd = native_make_pmd, + .make_pgd = native_make_pgd, + .irq_enable_sysexit = native_irq_enable_sysexit, .iret = native_iret,
===================================================================
arch/i386/kernel/vmlinux.lds.S +3 -0
@@ -21,6 +21,9 @@ #include <asm/page.h> #include <asm/cache.h> #include <asm/boot.h> + +#undef ENTRY +#undef ALIGN OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386)
===================================================================
include/asm-i386/page.h +14 -4
@@ -11,7 +11,6 @@#ifdef __KERNEL__#ifndef __ASSEMBLY__ -#ifdef CONFIG_X86_USE_3DNOW
@@ -48,9 +47,11 @@ typedef struct { unsigned long long pmd;typedef struct {unsigned long long pmd; }pmd_t ;typedef struct {unsigned long long pgd; }pgd_t ;typedef struct {unsigned long long pgprot; }pgprot_t ; +#ifndef CONFIG_PARAVIRT #define pmd_val (x) ((x).pmd)#define pte_val (x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))#define __pmd (x) ((pmd_t) { (x) } ) +#endif /* CONFIG_PARAVIRT */ #define HPAGE_SHIFT 21#include <asm-generic/pgtable-nopud.h> #else
@@ -58,7 +59,9 @@ typedef struct { unsigned long pgd; } pgtypedef struct {unsigned long pgd; }pgd_t ;typedef struct {unsigned long pgprot; }pgprot_t ;#define boot_pte_t pte_t/* or would you rather have a typedef */ +#ifndef CONFIG_PARAVIRT #define pte_val (x) ((x).pte_low) +#endif #define HPAGE_SHIFT 22#include <asm-generic/pgtable-nopmd.h> #endif
@@ -71,12 +74,14 @@ typedef struct { unsigned long pgprot; }#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA #endif +#define pgprot_val (x) ((x).pgprot) +#define __pgprot (x) ((pgprot_t) { (x) } ) + +#ifndef CONFIG_PARAVIRT #define pgd_val (x) ((x).pgd) -#define pgprot_val (x) ((x).pgprot) -#define __pte (x) ((pte_t) { (x) } )#define __pgd (x) ((pgd_t) { (x) } ) -#define __pgprot (x) ((pgprot_t) { (x) } ) +#endif #endif /* !__ASSEMBLY__ */
@@ -143,6 +148,11 @@ extern int page_is_ram(unsigned long pag#include <asm-generic/memory_model.h> #include <asm-generic/page.h> +#ifdef CONFIG_PARAVIRT +/* After pte_t, etc, have been defined */ +#include <asm/paravirt.h> +#endif +#define __HAVE_ARCH_GATE_AREA 1#endif /* __KERNEL__ */
===================================================================
include/asm-i386/paravirt.h +66 -2
108 lines not on this page · raw message
===================================================================
include/asm-i386/pgtable-2level.h +2 -3
@@ -15,6 +15,7 @@#define set_pte (pteptr, pteval) (*(pteptr) = pteval)#define set_pte_at (mm,addr,ptep,pteval) set_pte(ptep,pteval)#define set_pmd (pmdptr, pmdval) (*(pmdptr) = (pmdval)) +#define raw_ptep_get_and_clear (xp) __pte(xchg(&(xp)->pte_low, 0))#endif #define set_pte_atomic (pteptr, pteval) set_pte(pteptr,pteval)
@@ -23,11 +24,9 @@#define pte_clear (mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)#define pmd_clear (xp) do { set_pmd(xp, __pmd(0)); } while (0) -#define raw_ptep_get_and_clear (xp) __pte(xchg(&(xp)->pte_low, 0)) -#define pte_page (x) pfn_to_page(pte_pfn(x))#define pte_none (x) (!(x).pte_low) -#define pte_pfn (x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT))) +#define pte_pfn (x) (pte_val(x) >> PAGE_SHIFT)#define pfn_pte (pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))#define pfn_pmd (pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
===================================================================
include/asm-i386/pgtable-3level.h +13 -14
@@ -98,6 +98,18 @@ static inline void pmd_clear(pmd_t *pmd)smp_wmb (); *(tmp + 1) = 0; } + +static inline pte_t raw_ptep_get_and_clear (pte_t *ptep) +{ +pte_t res; + +/* xchg acts as a barrier before the setting of the high bits */ + res.pte_low =xchg (&ptep->pte_low,0 ); + res.pte_high = ptep->pte_high; + ptep->pte_high =0 ; + +return res; +}#endif /*
@@ -119,18 +131,6 @@ static inline void pud_clear (pud_t * pu#define pmd_offset (pud, address) ((pmd_t *) pud_page(*(pud)) + \ pmd_index(address)) -static inline pte_t raw_ptep_get_and_clear (pte_t *ptep) -{ -pte_t res; - -/* xchg acts as a barrier before the setting of the high bits */ - res.pte_low =xchg (&ptep->pte_low,0 ); - res.pte_high = ptep->pte_high; - ptep->pte_high =0 ; - -return res; -} -#define __HAVE_ARCH_PTE_SAMEstatic inline int pte_same (pte_t a,pte_t b) {
@@ -146,8 +146,7 @@ static inline int pte_none(pte_t pte)static inline unsigned long pte_pfn (pte_t pte) { -return (pte.pte_low >>PAGE_SHIFT ) | - (pte.pte_high << (32 -PAGE_SHIFT )); +return pte_val (pte) >>PAGE_SHIFT ; }extern unsigned long long __supported_pte_mask;
PATCH 4/20 XEN-paravirt: paravirt pagetable init
In reply to Jeremy FitzhardingeAdd paravirt hooks into the initial pagetable setup. In the native case, the kernel builds itself a new initial pagetable from scratch. In the Xen case, the kernel starts with a pagetable provided by the hypervisor, which is used as the prototype for the kernel-generated pagetable. The hooks added in this patch allow either mode of operation without having special cases (the main change to the pagetable construction logic is a testing to make sure a pagetable slot is actually empty before populating it).
===================================================================
--- a/arch/i386/kernel/paravirt.c +++ b/arch/i386/kernel/paravirt.c @@ -379,6 +379,43 @@ static fastcall void native_io_delay(voi
{
asm volatile("outb %al,$0x80");
}
+
+void native_pagetable_setup_start(pgd_t *base)
+{
+#ifdef CONFIG_X86_PAE
+ int i;
+
+ /*
+ * Init entries of the first-level page table to the
+ * zero page, if they haven't already been set up.
+ *
+ * In a normal native boot, we'll be running on a
+ * pagetable rooted in swapper_pg_dir, but not in PAE
+ * mode, so this will end up clobbering the mappings
+ * for the lower 24Mbytes of the address space,
+ * without affecting the kernel address space.
+ */
+ for (i = 0; i < USER_PTRS_PER_PGD; i++)
+ set_pgd(&base[i],
+ __pgd(__pa(empty_zero_page) | _PAGE_PRESENT));
+ memset(&base[USER_PTRS_PER_PGD], 0, sizeof(pgd_t));
+#endif
+}
+
+void native_pagetable_setup_done(pgd_t *base)
+{
+#ifdef CONFIG_X86_PAE
+ /*
+ * Add low memory identity-mappings - SMP needs it when
+ * starting up on an AP from real-mode. In the non-PAE
+ * case we already have these mappings through head.S.
+ * All user-space mappings are explicitly cleared after
+ * SMP startup.
+ */
+ set_pgd(&base[0], base[USER_PTRS_PER_PGD]);
+#endif
+}
+
static fastcall void native_flush_tlb(void)
{
@@ -627,6 +664,9 @@ struct paravirt_ops paravirt_ops = {
#endif
.set_lazy_mode = (void *)native_nop,
+ .pagetable_setup_start = native_pagetable_setup_start,
+ .pagetable_setup_done = native_pagetable_setup_done,
+
.flush_tlb_user = native_flush_tlb, .flush_tlb_kernel = native_flush_tlb_global, .flush_tlb_single = native_flush_tlb_single,
===================================================================
arch/i386/mm/init.c +53 -36
@@ -42,6 +42,7 @@#include <asm/tlb.h> #include <asm/tlbflush.h> #include <asm/sections.h> +#include <asm/paravirt.h> unsigned int __VMALLOC_RESERVE =128 <<20 ;
@@ -62,6 +63,8 @@ static pmd_t * __init one_md_table_init(#ifdef CONFIG_X86_PAE pmd_table = (pmd_t *)alloc_bootmem_low_pages (PAGE_SIZE ); +memset (pmd_table,0 ,PAGE_SIZE ); +paravirt_alloc_pd (__pa (pmd_table) >>PAGE_SHIFT );set_pgd (pgd,__pgd (__pa (pmd_table) | _PAGE_PRESENT)); pud =pud_offset (pgd,0 );
@@ -83,12 +86,11 @@ static pte_t * __init one_page_table_ini {if (pmd_none (*pmd)) {pte_t *page_table = (pte_t *)alloc_bootmem_low_pages (PAGE_SIZE ); +memset (page_table,0 ,PAGE_SIZE ); +paravirt_alloc_pt (__pa (page_table) >>PAGE_SHIFT );set_pmd (pmd,__pmd (__pa (page_table) | _PAGE_TABLE)); -if (page_table !=pte_offset_kernel (pmd,0 )) -BUG (); - -return page_table; +BUG_ON (page_table !=pte_offset_kernel (pmd,0 )); }return pte_offset_kernel (pmd,0 );
@@ -119,7 +121,7 @@ static void __init page_table_range_init pgd = pgd_base + pgd_idx;for ( ; (pgd_idx <PTRS_PER_PGD ) && (vaddr != end); pgd++, pgd_idx++) { -if (pgd_none (*pgd)) +if (!(pgd_val (*pgd) & _PAGE_PRESENT))one_md_table_init (pgd); pud =pud_offset (pgd, vaddr); pmd =pmd_offset (pud, vaddr);
@@ -158,7 +160,11 @@ static void __init kernel_physical_mappi pfn =0 ;for (; pgd_idx <PTRS_PER_PGD ; pgd++, pgd_idx++) { - pmd =one_md_table_init (pgd); +if (!(pgd_val (*pgd) & _PAGE_PRESENT)) + pmd =one_md_table_init (pgd); +else + pmd =pmd_offset (pud_offset (pgd,PAGE_OFFSET ),PAGE_OFFSET ); +if (pfn >= max_low_pfn)continue ;for (pmd_idx =0 ; pmd_idx <PTRS_PER_PMD && pfn < max_low_pfn; pmd++, pmd_idx++) {
@@ -167,20 +173,26 @@ static void __init kernel_physical_mappi/* Map with big pages if possible, otherwise create normal page tables. */ if (cpu_has_pse) {unsigned int address2 = (pfn +PTRS_PER_PTE -1 ) *PAGE_SIZE +PAGE_OFFSET +PAGE_SIZE -1 ; - -if (is_kernel_text (address) ||is_kernel_text (address2)) -set_pmd (pmd,pfn_pmd (pfn,PAGE_KERNEL_LARGE_EXEC )); -else -set_pmd (pmd,pfn_pmd (pfn,PAGE_KERNEL_LARGE )); +if (!pmd_present (*pmd)) { +if (is_kernel_text (address) ||is_kernel_text (address2)) +set_pmd (pmd,pfn_pmd (pfn,PAGE_KERNEL_LARGE_EXEC )); +else +set_pmd (pmd,pfn_pmd (pfn,PAGE_KERNEL_LARGE )); + } pfn +=PTRS_PER_PTE ; }else { pte =one_page_table_init (pmd); -for (pte_ofs =0 ; pte_ofs <PTRS_PER_PTE && pfn < max_low_pfn; pte++, pfn++, pte_ofs++) { -if (is_kernel_text (address)) -set_pte (pte,pfn_pte (pfn,PAGE_KERNEL_EXEC )); -else -set_pte (pte,pfn_pte (pfn,PAGE_KERNEL )); +for (pte_ofs =0 ; + pte_ofs <PTRS_PER_PTE && pfn < max_low_pfn; + pte++, pfn++, pte_ofs++, address +=PAGE_SIZE ) { +if (pte_present (*pte)) +continue ; + +if (is_kernel_text (address)) +set_pte (pte,pfn_pte (pfn,PAGE_KERNEL_EXEC )); +else +set_pte (pte,pfn_pte (pfn,PAGE_KERNEL )); } } }
@@ -337,19 +349,32 @@ extern void __init remap_numa_kva(void);#define remap_numa_kva () do {} while (0)#endif +/* +* Build a proper pagetable for the kernel mappings. Up until this +* point, we've been running on some set of pagetables constructed by +* the boot process. +* +* If we're booting on native hardware, this will be a pagetable +* constructed in arch/i386/kernel/head.S, and not running in PAE mode +* (even if we'll end up running in PAE). The root of the pagetable +* will be swapper_pg_dir. +* +* If we're booting paravirtualized under a hypervisor, then there are +* more options: we may already be running PAE, and the pagetable may +* or may not be based in swapper_pg_dir. In any case, +* paravirt_pagetable_setup_start() will set up swapper_pg_dir +* appropriately for the rest of the initialization to work. +* +* In general, pagetable_init() assumes that the pagetable may already +* be partially populated, and so it avoids stomping on any existing +* mappings. +*/ static void __init pagetable_init (void ) { -unsigned long vaddr; +unsigned long vaddr, end;pgd_t *pgd_base = swapper_pg_dir; -#ifdef CONFIG_X86_PAE -int i; -/* Init entries of the first-level page table to the zero page */ -for (i =0 ; i <PTRS_PER_PGD ; i++) -set_pgd (pgd_base + i,__pgd (__pa (empty_zero_page) | _PAGE_PRESENT)); -#else -paravirt_alloc_pd (__pa (swapper_pg_dir) >>PAGE_SHIFT ); -#endif +paravirt_pagetable_setup_start (pgd_base);/* Enable PSE if available */ if (cpu_has_pse) {
@@ -371,20 +396,12 @@ static void __init pagetable_init (void)* created - mappings will be set by set_fixmap(): */ vaddr =__fix_to_virt (__end_of_fixed_addresses -1 ) &PMD_MASK ; -page_table_range_init (vaddr,0 , pgd_base); + end = (FIXADDR_TOP +PMD_SIZE -1 ) &PMD_MASK ; +page_table_range_init (vaddr, end, pgd_base);permanent_kmaps_init (pgd_base); -#ifdef CONFIG_X86_PAE -/* -* Add low memory identity-mappings - SMP needs it when -* starting up on an AP from real-mode. In the non-PAE -* case we already have these mappings through head.S. -* All user-space mappings are explicitly cleared after -* SMP startup. -*/ -set_pgd (&pgd_base[0 ], pgd_base[USER_PTRS_PER_PGD ]); -#endif +paravirt_pagetable_setup_done (pgd_base); }#if defined(CONFIG_SOFTWARE_SUSPEND ) || defined(CONFIG_ACPI_SLEEP )
===================================================================
include/asm-i386/paravirt.h +54 -0
77 lines not on this page · raw message
===================================================================
include/asm-i386/pgtable.h +3 -0
@@ -15,7 +15,10 @@#include <asm/processor.h> #include <asm/fixmap.h> #include <linux/threads.h> + +#ifdef CONFIG_PARAVIRT /* guarded to prevent cyclic dependency */ #include <asm/paravirt.h> +#endif #ifndef _I386_BITOPS_H#include <asm/bitops.h>
PATCH 5/20 XEN-paravirt: paravirt: reserve fixmap slot
In reply to Jeremy FitzhardingeReserve a new fixmap slot for paravirt backends. Xen uses this for mapping the hypervisor shared-info page, which doesn't really exist in the guest address space.
===================================================================
include/asm-i386/fixmap.h +3 -0
@@ -86,6 +86,9 @@ enum fixed_addresses {#ifdef CONFIG_PCI_MMCONFIG FIX_PCIE_MCFG,#endif +#ifdef CONFIG_PARAVIRT + FIX_PARAVIRT, +#endif __end_of_permanent_fixed_addresses,/* temporary boot-time mappings, used before ioremap() is functional */ #define NR_FIX_BTMAPS 16
PATCH 6/20 XEN-paravirt: remove pgd ctor
In reply to Jeremy FitzhardingeRemove the ctor for the pgd cache. There's no point in having the cache machinery do this via an indirect call when all pgd are freed in the one place anyway.
--
arch/i386/mm/init.c | 8 +++----- arch/i386/mm/pgtable.c | 15 +++++++++++---- include/asm-i386/pgtable.h | 2 -- 3 files changed, 14 insertions(+), 11 deletions(-)
===================================================================
arch/i386/mm/init.c +3 -5
@@ -739,11 +739,9 @@ void __init pgtable_cache_init(void)panic ("pgtable_cache_init(): cannot create pmd cache" ); } pgd_cache =kmem_cache_create ("pgd" , -PTRS_PER_PGD *sizeof (pgd_t), -PTRS_PER_PGD *sizeof (pgd_t), -0 , - pgd_ctor, -PTRS_PER_PMD ==1 ? pgd_dtor :NULL ); +PTRS_PER_PGD *sizeof (pgd_t), +PTRS_PER_PGD *sizeof (pgd_t), +0 ,NULL ,NULL );if (!pgd_cache)panic ("pgtable_cache_init(): Cannot create pgd cache" ); }
===================================================================
arch/i386/mm/pgtable.c +11 -4
@@ -236,7 +236,7 @@ static inline void pgd_list_del(pgd_t *pset_page_private (next, (unsigned long )pprev); } -void pgd_ctor (void *pgd,struct kmem_cache *cache,unsigned long unused) +static void pgd_ctor (pgd_t *pgd) {unsigned long flags;
@@ -245,7 +245,7 @@ void pgd_ctor(void *pgd, struct kmem_cacspin_lock_irqsave (&pgd_lock, flags); } -clone_pgd_range ((pgd_t *)pgd +USER_PTRS_PER_PGD , +clone_pgd_range (pgd +USER_PTRS_PER_PGD , swapper_pg_dir +USER_PTRS_PER_PGD ,KERNEL_PGD_PTRS );
@@ -261,10 +261,12 @@ void pgd_ctor(void *pgd, struct kmem_cacspin_unlock_irqrestore (&pgd_lock, flags); } -/* never called when PTRS_PER_PMD > 1 */ -void pgd_dtor (void *pgd,struct kmem_cache *cache,unsigned long unused) +static void pgd_dtor (pgd_t *pgd) {unsigned long flags;/* can be called from interrupt context */ + +if (PTRS_PER_PMD ==1 ) +return ;paravirt_release_pd (__pa (pgd) >>PAGE_SHIFT );spin_lock_irqsave (&pgd_lock, flags);
@@ -276,6 +278,9 @@ pgd_t *pgd_alloc(struct mm_struct *mm) {int i;pgd_t *pgd =kmem_cache_alloc (pgd_cache,GFP_KERNEL ); + +if (pgd) +pgd_ctor (pgd);if (PTRS_PER_PMD ==1 || !pgd)return pgd;
@@ -296,6 +301,7 @@ out_oom:paravirt_release_pd (__pa (pmd) >>PAGE_SHIFT );kmem_cache_free (pmd_cache, pmd); } +pgd_dtor (pgd);kmem_cache_free (pgd_cache, pgd);return NULL ; }
@@ -313,5 +319,6 @@ void pgd_free(pgd_t *pgd)kmem_cache_free (pmd_cache, pmd); }/* in the non-PAE case, free_pgtables() clears user pgd entries */ +pgd_dtor (pgd);kmem_cache_free (pgd_cache, pgd); }
===================================================================
include/asm-i386/pgtable.h +0 -2
@@ -41,8 +41,6 @@ extern struct page *pgd_list;extern struct page *pgd_list;void pmd_ctor (void *,struct kmem_cache *,unsigned long ); -void pgd_ctor (void *,struct kmem_cache *,unsigned long ); -void pgd_dtor (void *,struct kmem_cache *,unsigned long );void pgtable_cache_init (void );void paging_init (void );
PATCH 7/20 XEN-paravirt: paravirt shared kernel pmd flag
In reply to Jeremy FitzhardingeXen does not allow guests to have the kernel pmd shared between page tables, so parameterize pgtable.c to allow both modes of operation.
--
arch/i386/kernel/paravirt.c | 1 arch/i386/mm/fault.c | 6 +-- arch/i386/mm/pageattr.c | 2 - arch/i386/mm/pgtable.c | 61 ++++++++++++++++++++------------ include/asm-i386/page.h | 7 ++- include/asm-i386/paravirt.h | 1 include/asm-i386/pgtable-2level-defs.h | 2 + include/asm-i386/pgtable-2level.h | 2 - include/asm-i386/pgtable-3level-defs.h | 6 +++ include/asm-i386/pgtable-3level.h | 16 ++------ include/asm-i386/pgtable.h | 7 +++ 11 files changed, 68 insertions(+), 43 deletions(-)
===================================================================
arch/i386/kernel/paravirt.c +1 -0
@@ -572,6 +572,7 @@ struct paravirt_ops paravirt_ops = { .name = "bare hardware", .paravirt_enabled = 0, .kernel_rpl = 0, + .shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */ .patch = native_patch, .banner = default_banner,
===================================================================
arch/i386/mm/fault.c +3 -3
@@ -616,8 +616,7 @@ do_sigbus:force_sig_info_fault (SIGBUS ,BUS_ADRERR , address, tsk); } -#ifndef CONFIG_X86_PAE -void vmalloc_sync_all (void ) +void _vmalloc_sync_all (void ) {/* * Note that races in the updates of insync and start aren't
@@ -628,6 +627,8 @@ void vmalloc_sync_all(void) static DECLARE_BITMAP(insync, PTRS_PER_PGD);static unsigned long start =TASK_SIZE ;unsigned long address; + +BUG_ON (SHARED_KERNEL_PMD );BUILD_BUG_ON (TASK_SIZE & ~PGDIR_MASK );for (address = start; address >=TASK_SIZE ; address +=PGDIR_SIZE ) {
@@ -651,4 +652,3 @@ void vmalloc_sync_all(void) start = address +PGDIR_SIZE ; } } -#endif
===================================================================
arch/i386/mm/pageattr.c +1 -1
@@ -91,7 +91,7 @@ static void set_pmd_pte(pte_t *kpte, unsunsigned long flags;set_pte_atomic (kpte, pte);/* change init_mm */ -if (PTRS_PER_PMD >1 ) +if (SHARED_KERNEL_PMD )return ;spin_lock_irqsave (&pgd_lock, flags);
===================================================================
arch/i386/mm/pgtable.c +39 -22
96 lines not on this page · raw message
===================================================================
include/asm-i386/page.h +4 -3
@@ -50,21 +50,23 @@ typedef struct { unsigned long long pgpr#ifndef CONFIG_PARAVIRT #define pmd_val (x) ((x).pmd)#define pte_val (x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) +#define __pte (x) ((pte_t) { .pte_low = (x), .pte_high = ((x) >> 32) } )#define __pmd (x) ((pmd_t) { (x) } )#endif /* CONFIG_PARAVIRT */ #define HPAGE_SHIFT 21#include <asm-generic/pgtable-nopud.h> -#else +#else /* !CONFIG_X86_PAE */ typedef struct {unsigned long pte_low; }pte_t ;typedef struct {unsigned long pgd; }pgd_t ;typedef struct {unsigned long pgprot; }pgprot_t ;#define boot_pte_t pte_t/* or would you rather have a typedef */ #ifndef CONFIG_PARAVIRT +#define __pte (x) ((pte_t) { (x) })#define pte_val (x) ((x).pte_low)#endif #define HPAGE_SHIFT 22#include <asm-generic/pgtable-nopmd.h> -#endif +#endif /* CONFIG_X86_PAE */ #define PTE_MASK PAGE_MASK#ifdef CONFIG_HUGETLB_PAGE
@@ -79,7 +81,6 @@ typedef struct { unsigned long pgprot; }#ifndef CONFIG_PARAVIRT #define pgd_val (x) ((x).pgd) -#define __pte (x) ((pte_t) { (x) } )#define __pgd (x) ((pgd_t) { (x) } )#endif
===================================================================
include/asm-i386/paravirt.h +1 -0
@@ -34,6 +34,7 @@ struct paravirt_opsstruct paravirt_ops {unsigned int kernel_rpl; +int shared_kernel_pmd;int paravirt_enabled;const char *name;
===================================================================
include/asm-i386/pgtable-2level-defs.h +2 -0
@@ -1,5 +1,7 @@#ifndef _I386_PGTABLE_2LEVEL_DEFS_H#define _I386_PGTABLE_2LEVEL_DEFS_H + +#define SHARED_KERNEL_PMD 0/* * traditional i386 two-level paging structure:
===================================================================
include/asm-i386/pgtable-2level.h +0 -2
@@ -66,6 +66,4 @@ static inline int pte_exec_kernel(pte_t#define __pte_to_swp_entry (pte) ((swp_entry_t) { (pte).pte_low })#define __swp_entry_to_pte (x) ((pte_t) { (x).val }) -void vmalloc_sync_all (void ); -#endif /* _I386_PGTABLE_2LEVEL_H */
===================================================================
include/asm-i386/pgtable-3level-defs.h +6 -0
@@ -1,5 +1,11 @@#ifndef _I386_PGTABLE_3LEVEL_DEFS_H#define _I386_PGTABLE_3LEVEL_DEFS_H + +#ifdef CONFIG_PARAVIRT +#define SHARED_KERNEL_PMD (paravirt_ops.shared_kernel_pmd) +#else +#define SHARED_KERNEL_PMD 1 +#endif /* * PGDIR_SHIFT determines what a top-level page table entry can map
===================================================================
include/asm-i386/pgtable-3level.h +4 -12
@@ -153,20 +153,14 @@ extern unsigned long long __supported_ptstatic inline pte_t pfn_pte (unsigned long page_nr,pgprot_t pgprot) { -pte_t pte; - - pte.pte_high = (page_nr >> (32 -PAGE_SHIFT )) | \ - (pgprot_val (pgprot) >>32 ); - pte.pte_high &= (__supported_pte_mask >>32 ); - pte.pte_low = ((page_nr <<PAGE_SHIFT ) |pgprot_val (pgprot)) & \ - __supported_pte_mask; -return pte; +return __pte ((((unsigned long long )page_nr <<PAGE_SHIFT ) | +pgprot_val (pgprot)) & __supported_pte_mask); }static inline pmd_t pfn_pmd (unsigned long page_nr,pgprot_t pgprot) { -return __pmd ((((unsigned long long )page_nr <<PAGE_SHIFT ) | \ -pgprot_val (pgprot)) & __supported_pte_mask); +return __pmd ((((unsigned long long )page_nr <<PAGE_SHIFT ) | +pgprot_val (pgprot)) & __supported_pte_mask); }/*
@@ -186,6 +180,4 @@ static inline pmd_t pfn_pmd(unsigned lon#define __pmd_free_tlb (tlb, x) do { } while (0) -#define vmalloc_sync_all () ((void)0) -#endif /* _I386_PGTABLE_3LEVEL_H */
===================================================================
include/asm-i386/pgtable.h +7 -0
@@ -239,6 +239,13 @@ static inline pte_t pte_mkwrite(pte_t ptstatic inline pte_t pte_mkwrite (pte_t pte) { (pte).pte_low |= _PAGE_RW;return pte; }static inline pte_t pte_mkhuge (pte_t pte) { (pte).pte_low |= _PAGE_PSE;return pte; } +extern void _vmalloc_sync_all (void ); +static inline void vmalloc_sync_all (void ) +{ +if (!SHARED_KERNEL_PMD ) +_vmalloc_sync_all (); +} +#ifdef CONFIG_X86_PAE # include <asm/pgtable-3level.h> #else
PATCH 8/20 XEN-paravirt: paravirt pgd allocation alignment
In reply to Jeremy Fitzhardinge===================================================================
arch/i386/kernel/paravirt.c +1 -0
@@ -573,6 +573,7 @@ struct paravirt_ops paravirt_ops = { .paravirt_enabled = 0, .kernel_rpl = 0, .shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */ + .pgd_alignment = sizeof(pgd_t) * PTRS_PER_PGD, .patch = native_patch, .banner = default_banner,
===================================================================
arch/i386/mm/init.c +1 -1
@@ -745,7 +745,7 @@ void __init pgtable_cache_init(void) } pgd_cache =kmem_cache_create ("pgd" ,PTRS_PER_PGD *sizeof (pgd_t), -PTRS_PER_PGD *sizeof (pgd_t), +PGD_ALIGNMENT ,0 ,NULL ,NULL );if (!pgd_cache)panic ("pgtable_cache_init(): Cannot create pgd cache" );
===================================================================
include/asm-i386/paravirt.h +4 -1
@@ -33,9 +33,12 @@ struct mm_struct;struct mm_struct ;struct paravirt_ops { +int paravirt_enabled;unsigned int kernel_rpl; +int shared_kernel_pmd; -int paravirt_enabled; +int pgd_alignment; +const char *name;/*
===================================================================
include/asm-i386/pgtable.h +6 -0
@@ -270,6 +270,12 @@ static inline void vmalloc_sync_all(void#define pte_update_defer (mm, addr, ptep) do { } while (0)#endif +#ifdef CONFIG_PARAVIRT +#define PGD_ALIGNMENT (paravirt_ops.pgd_alignment) +#else +#define PGD_ALIGNMENT (sizeof(pgd_t) * PTRS_PER_PGD) +#endif +/* * We only update the dirty/accessed state if we set * the dirty bit by hand in the kernel, since the hardware
PATCH 9/20 XEN-paravirt: dont export paravirt_ops structure, do individual functions
In reply to Jeremy FitzhardingeWrap the paravirt_ops members we want to export in wrapper functions. Since we binary-patch the critical ones, this doesn't make a speed impact.
I moved drm_follow_page into the core, to avoid having to wrap the various pte ops. Unlining kernel_fpu_end and using that in the RAID6 code would remove the need to export clts/read_cr0/write_cr0 too.
===================================================================
arch/i386/kernel/paravirt.c +117 -8
@@ -596,6 +596,123 @@ static int __init print_banner(void)return 0 ; }core_initcall (print_banner); + +unsigned long paravirt_save_flags (void ) +{ +return paravirt_ops.save_fl (); +} +EXPORT_SYMBOL (paravirt_save_flags); + +void paravirt_restore_flags (unsigned long flags) +{ + paravirt_ops.restore_fl (flags); +} +EXPORT_SYMBOL (paravirt_restore_flags); + +void paravirt_irq_disable (void ) +{ + paravirt_ops.irq_disable (); +} +EXPORT_SYMBOL (paravirt_irq_disable); + +void paravirt_irq_enable (void ) +{ + paravirt_ops.irq_enable (); +} +EXPORT_SYMBOL (paravirt_irq_enable); + +void paravirt_io_delay (void ) +{ + paravirt_ops.io_delay (); +} +EXPORT_SYMBOL (paravirt_io_delay); + +void paravirt_const_udelay (unsigned long loops) +{ + paravirt_ops.const_udelay (loops); +} +EXPORT_SYMBOL (paravirt_const_udelay); + +u64 paravirt_read_msr (unsigned int msr,int *err) +{ +return paravirt_ops.read_msr (msr, err); +} +EXPORT_SYMBOL (paravirt_read_msr); + +int paravirt_write_msr (unsigned int msr,u64 val) +{ +return paravirt_ops.write_msr (msr, val); +} +EXPORT_SYMBOL (paravirt_write_msr); + +u64 paravirt_read_tsc (void ) +{ +return paravirt_ops.read_tsc (); +} +EXPORT_SYMBOL (paravirt_read_tsc); + +int paravirt_enabled (void ) +{ +return paravirt_ops.paravirt_enabled; +} +EXPORT_SYMBOL (paravirt_enabled); + +void clts (void ) +{ + paravirt_ops.clts (); +} +EXPORT_SYMBOL (clts); + +unsigned long read_cr0 (void ) +{ +return paravirt_ops.read_cr0 (); +} +EXPORT_SYMBOL_GPL (read_cr0); + +void write_cr0 (unsigned long cr0) +{ + paravirt_ops.write_cr0 (cr0); +} +EXPORT_SYMBOL_GPL (write_cr0); + +void wbinvd (void ) +{ + paravirt_ops.wbinvd (); +} +EXPORT_SYMBOL (wbinvd); + +void raw_safe_halt (void ) +{ + paravirt_ops.safe_halt (); +} +EXPORT_SYMBOL_GPL (raw_safe_halt); + +void halt (void ) +{ + paravirt_ops.safe_halt (); +} +EXPORT_SYMBOL_GPL (halt); + +#ifdef CONFIG_X86_LOCAL_APIC +void apic_write (unsigned long reg,unsigned long v) +{ + paravirt_ops.apic_write (reg,v); +} +EXPORT_SYMBOL_GPL (apic_write); + +unsigned long apic_read (unsigned long reg) +{ +return paravirt_ops.apic_read (reg); +} +EXPORT_SYMBOL_GPL (apic_read); +#endif + +void __cpuid (unsigned int *eax,unsigned int *ebx, +unsigned int *ecx,unsigned int *edx) +{ + paravirt_ops.cpuid (eax, ebx, ecx, edx); +} +EXPORT_SYMBOL (__cpuid);/* We simply declare start_kernel to be the paravirt probe of last resort. */ paravirt_probe (start_kernel);
@@ -712,11 +829,3 @@ struct paravirt_ops paravirt_ops = { .startup_ipi_hook = (void *)native_nop, }; - -/* -* NOTE: CONFIG_PARAVIRT is experimental and the paravirt_ops -* semantics are subject to change. Hence we only do this -* internal-only export of this, until it gets sorted out and -* all lowlevel CPU ops used by modules are separately exported. -*/ -EXPORT_SYMBOL_GPL (paravirt_ops);
===================================================================
include/asm-i386/delay.h +2 -2
@@ -17,9 +17,9 @@ extern void __delay(unsigned long loops)extern void __delay (unsigned long loops);#if defined(CONFIG_PARAVIRT ) && !defined(USE_REAL_TIME_DELAY ) -#define udelay (n) paravirt_ops.const_udelay((n) * 0x10c7ul) +#define udelay (n) paravirt_const_udelay((n) * 0x10c7ul) -#define ndelay (n) paravirt_ops.const_udelay((n) * 5ul) +#define ndelay (n) paravirt_const_udelay((n) * 5ul)#else /* !PARAVIRT || USE_REAL_TIME_DELAY */
===================================================================
include/asm-i386/paravirt.h +64 -79
254 lines not on this page · raw message
===================================================================
include/linux/irqflags.h +5 -5
@@ -74,11 +74,11 @@#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT -#define safe_halt () \ - do { \ - trace_hardirqs_on(); \ - raw_safe_halt(); \ - } while (0) +static inline void safe_halt (void ) +{ +trace_hardirqs_on (); +raw_safe_halt (); +}#define local_save_flags (flags) raw_local_save_flags(flags)
===================================================================
include/linux/mm.h +2 -0
@@ -1174,6 +1174,8 @@ struct page *follow_page(struct vm_area_#define FOLL_GET 0x04/* do get_page on page */ #define FOLL_ANON 0x08/* give ZERO_PAGE if no pgtable */ +unsigned long __follow_page (void *vaddr); +#ifdef CONFIG_PROC_FS void vm_stat_account (struct mm_struct *,unsigned long ,struct file *,long );#else
===================================================================
mm/memory.c +11 -0
@@ -976,6 +976,17 @@ no_page_table:return page; } +/* You don't want to use this function. It's for drm_memory.c. */ +unsigned long __follow_page (void *vaddr) +{ +pgd_t *pgd =pgd_offset_k ((unsigned long )vaddr); +pud_t *pud =pud_offset (pgd, (unsigned long )vaddr); +pmd_t *pmd =pmd_offset (pud, (unsigned long )vaddr); +pte_t *ptep =pte_offset_kernel (pmd, (unsigned long )vaddr); +return pte_pfn (*ptep) <<PAGE_SHIFT ; +} +EXPORT_SYMBOL_GPL (__follow_page); +int get_user_pages (struct task_struct *tsk,struct mm_struct *mm,unsigned long start,int len,int write,int force,struct page **pages,struct vm_area_struct **vmas)
PATCH 10/20 XEN-paravirt: mm lifetime hooks
In reply to Jeremy FitzhardingeAdd hooks to allow a paravirt implementation to track the lifetime of an mm. Unfortunately dup_mmap and exit_mmap are in generic code, so we need to #ifdef CONFIG_PARAVIRT.
--
arch/i386/kernel/paravirt.c | 4 ++++ include/asm-i386/mmu_context.h | 8 ++++++-- include/asm-i386/paravirt.h | 38 ++++++++++++++++++++++++++++++++++++++ kernel/fork.c | 3 +++ mm/mmap.c | 4 ++++ 5 files changed, 55 insertions(+), 2 deletions(-)
===================================================================
arch/i386/kernel/paravirt.c +4 -0
@@ -706,6 +706,10 @@ struct paravirt_ops paravirt_ops = { .irq_enable_sysexit = native_irq_enable_sysexit, .iret = native_iret, + .dup_mmap = (void *)native_nop, + .exit_mmap = (void *)native_nop, + .activate_mm = (void *)native_nop, + .startup_ipi_hook = (void *)native_nop, };
===================================================================
include/asm-i386/mmu_context.h +6 -2
@@ -5,6 +5,7 @@#include <asm/atomic.h> #include <asm/pgalloc.h> #include <asm/tlbflush.h> +#include <asm/paravirt.h> /* * Used for LDT copy/destruction.
@@ -65,7 +66,10 @@ static inline void switch_mm(struct mm_s#define deactivate_mm (tsk, mm) \ asm("movl %0,%%gs": :"r" (0)); -#define activate_mm (prev, next) \ - switch_mm((prev),(next),NULL) +#define activate_mm (prev, next) \ + do { \ + paravirt_activate_mm(prev, next); \ + switch_mm((prev),(next),NULL); \ + } while(0);#endif
===================================================================
include/asm-i386/paravirt.h +38 -0
@@ -126,6 +126,12 @@ struct paravirt_ops void (fastcall *io_delay)(void);void (*const_udelay)(unsigned long loops); + void (fastcall *activate_mm)(struct mm_struct *prev, +struct mm_struct *next); + void (fastcall *dup_mmap)(struct mm_struct *oldmm, +struct mm_struct *mm); + void (fastcall *exit_mmap)(struct mm_struct *mm); +#ifdef CONFIG_X86_LOCAL_APIC void (fastcall *apic_write)(unsigned long reg, unsigned long v); void (fastcall *apic_write_atomic)(unsigned long reg, unsigned long v);
@@ -429,6 +435,23 @@ static inline void startup_ipi_hook(int }#endif +static inline void paravirt_activate_mm (struct mm_struct *prev, +struct mm_struct *next) +{ + paravirt_ops.activate_mm (prev, next); +} + +static inline void paravirt_dup_mmap (struct mm_struct *oldmm, +struct mm_struct *mm) +{ + paravirt_ops.dup_mmap (oldmm, mm); +} + +static inline void paravirt_exit_mmap (struct mm_struct *mm) +{ + paravirt_ops.exit_mmap (mm); +} +#define __flush_tlb () paravirt_ops.flush_tlb_user()#define __flush_tlb_global () paravirt_ops.flush_tlb_kernel()#define __flush_tlb_single (addr) paravirt_ops.flush_tlb_single(addr)
@@ -673,5 +696,20 @@ static inline void paravirt_pagetable_seset_pgd (&base[0 ], base[USER_PTRS_PER_PGD ]);#endif } + +static inline void paravirt_activate_mm (struct mm_struct *prev, +struct mm_struct *next) +{ +} + +static inline void paravirt_dup_mmap (struct mm_struct *oldmm, +struct mm_struct *mm) +{ +} + +static inline void paravirt_exit_mmap (struct mm_struct *mm) +{ +} +#endif /* CONFIG_PARAVIRT */ #endif /* __ASM_PARAVIRT_H */
===================================================================
kernel/fork.c +3 -0
@@ -287,6 +287,9 @@ static inline int dup_mmap(struct mm_strif (retval) goto out; } +#ifdef CONFIG_PARAVIRT +paravirt_dup_mmap (oldmm, mm); +#endif retval =0 ; out:up_write (&mm->mmap_sem);
===================================================================
mm/mmap.c +4 -0
@@ -1969,6 +1969,10 @@ void exit_mmap(struct mm_struct *mm)struct vm_area_struct *vma = mm->mmap;unsigned long nr_accounted =0 ;unsigned long end; + +#ifdef CONFIG_PARAVIRT +paravirt_exit_mmap (mm); +#endif lru_add_drain ();flush_cache_mm (mm);
PATCH 11/20 XEN-paravirt: Add apply_to_page_range() which applies a function to a pte range.
In reply to Jeremy FitzhardingeAdd a new mm function apply_to_page_range() which applies a given function to every pte in a given virtual address range in a given mm structure. This is a generic alternative to cut-and-pasting the Linux idiomatic pagetable walking code in every place that a sequence of PTEs must be accessed.
Although this interface is intended to be useful in a wide range of situations, it is currently used specifically by several Xen subsystems, for example: to ensure that pagetables have been allocated for a virtual address range, and to construct batched special pagetable update requests to map I/O memory (in ioremap()).
--- include/linux/mm.h | 5 ++ mm/memory.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+)
===================================================================
include/linux/mm.h +5 -0
@@ -1130,6 +1130,11 @@ struct page *follow_page(struct vm_area_unsigned long __follow_page (void *vaddr); +typedef int (*pte_fn_t )(pte_t *pte,struct page *pmd_page,unsigned long addr, +void *data); +extern int apply_to_page_range (struct mm_struct *mm,unsigned long address, +unsigned long size,pte_fn_t fn,void *data); +#ifdef CONFIG_PROC_FS void vm_stat_account (struct mm_struct *,unsigned long ,struct file *,long );#else
===================================================================
mm/memory.c +94 -0
100 lines not on this page · raw message
PATCH 12/20 XEN-paravirt: Xen: Add nosegneg capability to the vsyscall page notes
In reply to Jeremy FitzhardingeAdd the "nosegneg" fake capabilty to the vsyscall page notes. This is used by the runtime linker to select a glibc version which then disables negative-offset accesses to the thread-local segment via %gs. These accesses require emulation in Xen (because segments are truncated to protect the hypervisor address space) and avoiding them provides a measurable performance boost.
--- arch/i386/kernel/vsyscall-note.S | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+)
===================================================================
arch/i386/kernel/vsyscall-note.S +28 -0
@@ -23,3 +24,31 @@ 3: .balign 4; /* pad out section */ ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0) .long LINUX_VERSION_CODE ASM_ELF_NOTE_END + +#ifdef CONFIG_XEN +/* + * Add a special note telling glibc's dynamic linker a fake hardware + * flavor that it will use to choose the search path for libraries in the + * same way it uses real hardware capabilities like "mmx". + * We supply "nosegneg" as the fake capability, to indicate that we + * do not like negative offsets in instructions using segment overrides, + * since we implement those inefficiently. This makes it possible to + * install libraries optimized to avoid those access patterns in someplace + * like /lib/i686/tls/nosegneg. Note that an /etc/ld.so.conf.d/file + * corresponding to the bits here is needed to make ldconfig work right. + * It should contain: + * hwcap 0 nosegneg + * to match the mapping of bit to name that we give here. + */ +#define NOTE_KERNELCAP_BEGIN(ncaps, mask) \ + ASM_ELF_NOTE_BEGIN(".note.kernelcap", "a", "GNU", 2) \ + .long ncaps, mask +#define NOTE_KERNELCAP(bit, name) \ + .byte bit; .asciz name +#define NOTE_KERNELCAP_END ASM_ELF_NOTE_END + +NOTE_KERNELCAP_BEGIN(1, 1) +NOTE_KERNELCAP(1, "nosegneg") +NOTE_KERNELCAP_END +#endif +
PATCH 13/20 XEN-paravirt: Xen: Add config options and disable unsupported config options.
In reply to Jeremy FitzhardingeThe XEN config option enables the Xen paravirt_ops interface, which is installed when the kernel finds itself running under Xen. (By some as-yet fully defined mechanism, implemented in a future patch.)
Xen is no longer a sub-architecture, so the X86_XEN subarch config option has gone.
The disabled config options are:
- PREEMPT: Xen doesn't support it
- HZ: set to 100Hz for now, to cut down on VCPU context switch rate. This will be adapted to use tickless later.
- kexec: not yet supported
--- arch/i386/Kconfig | 8 +++++--- arch/i386/Kconfig.debug | 1 + arch/i386/paravirt-xen/Kconfig | 17 +++++++++++++++++ kernel/Kconfig.hz | 4 ++-- kernel/Kconfig.preempt | 1 + 5 files changed, 26 insertions(+), 5 deletions(-)
===================================================================
arch/i386/Kconfig +5 -2
@@ -192,6 +192,8 @@ config PARAVIRT under a hypervisor, improving performance significantly. However, when run without a hypervisor the kernel is theoretically slower. If in doubt, say N. + +source "arch/i386/paravirt-xen/Kconfig" config ACPI_SRAT bool
@@ -298,12 +300,12 @@ config X86_UP_IOAPIC config X86_LOCAL_APIC bool - depends on X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH + depends on X86_UP_APIC || (((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH) default y config X86_IO_APIC bool - depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH + depends on X86_UP_IOAPIC || ((SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH) default y config X86_VISWS_APIC
@@ -743,6 +745,7 @@ source kernel/Kconfig.hz config KEXEC bool "kexec system call" + depends on !XEN help kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot
===================================================================
arch/i386/Kconfig.debug +1 -0
@@ -79,6 +79,7 @@ config DOUBLEFAULT config DOUBLEFAULT default y bool "Enable doublefault exception handler" if EMBEDDED + depends on !XEN help This option allows trapping of rare doublefault exceptions that would otherwise cause a system to silently reboot. Disabling this
===================================================================
arch/i386/paravirt-xen/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +# +# This Kconfig describes xen options +# + +config XEN + bool "Enable support for Xen hypervisor" + depends PARAVIRT + default y + help + This is the Linux Xen port.
===================================================================
kernel/Kconfig.hz +2 -2
@@ -3,7 +3,7 @@ # choice - prompt "Timer frequency" + prompt "Timer frequency" if !XEN default HZ_250 help Allows the configuration of the timer frequency. It is customary
@@ -49,7 +49,7 @@ endchoice config HZ int - default 100 if HZ_100 + default 100 if HZ_100 || XEN default 250 if HZ_250 default 300 if HZ_300 default 1000 if HZ_1000
===================================================================
kernel/Kconfig.preempt +1 -0
@@ -35,6 +35,7 @@ config PREEMPT_VOLUNTARY config PREEMPT bool "Preemptible Kernel (Low-Latency Desktop)" + depends on !XEN help This option reduces the latency of the kernel by making all kernel code (that is not executing in a critical section)
PATCH 14/20 XEN-paravirt: Xen: Add interface header files
In reply to Jeremy FitzhardingeAdd Xen interface header files. These are taken fairly directly from the Xen tree and hence the style is not entirely in accordance with Linux guidelines. There is a tension between fitting with Linux coding rules and ease of maintenance.
Define macros and inline functions for doing hypercalls into the hypervisor.
--
include/asm-i386/hypercall.h | 416 ++++++++++++++++++++++++++++++ include/asm-i386/hypervisor.h | 72 +++++ include/xen/interface/arch-x86_32.h | 187 +++++++++++++ include/xen/interface/elfnote.h | 133 +++++++++ include/xen/interface/event_channel.h | 195 ++++++++++++++ include/xen/interface/features.h | 43 +++ include/xen/interface/grant_table.h | 301 ++++++++++++++++++++++ include/xen/interface/io/blkif.h | 96 +++++++ include/xen/interface/io/console.h | 23 + include/xen/interface/io/netif.h | 152 +++++++++++ include/xen/interface/io/ring.h | 260 +++++++++++++++++++ include/xen/interface/io/xenbus.h | 42 +++ include/xen/interface/io/xs_wire.h | 87 ++++++ include/xen/interface/memory.h | 145 ++++++++++ include/xen/interface/physdev.h | 61 ++++ include/xen/interface/sched.h | 77 +++++ include/xen/interface/vcpu.h | 109 ++++++++ include/xen/interface/version.h | 60 ++++ include/xen/interface/xen.h | 445 +++++++++++++++++++++++++++++++++ 19 files changed, 2904 insertions(+)
===================================================================
include/asm-i386/hypercall.h new file +416 -0
@@ -0,0 +1,416 @@ +/****************************************************************************** +* hypercall.h +* +* Linux-specific hypervisor handling. +* +* Copyright (c) 2002-2004, K A Fraser +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation; or, when distributed +* separately from the Linux kernel or incorporated into other +* software packages, subject to the following license: +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this source file (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, copy, modify, +* merge, publish, distribute, sublicense, and/or sell copies of the Software, +* and to permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ + +#ifndef __HYPERCALL_H__ +#define __HYPERCALL_H__ + +#include <linux/errno.h> +#include <linux/string.h> + +#include <xen/interface/xen.h> +#include <xen/interface/sched.h> +#include <xen/interface/physdev.h> + +#define __STR (x) #x +#define STR (x) __STR(x) + +extern struct {char _entry[32 ]; } hypercall_page[]; + +#define _hypercall0 (type, name) \ +({ \ + long __res; \ + asm volatile ( \ + "call %[call]" \ + : "=a" (__res) \ + : [call] "m" (hypercall_page[__HYPERVISOR_##name]) \ + : "memory" ); \ + (type)__res; \ +}) + +#define _hypercall1 (type, name, a1) \ +({ \ + long __res, __ign1; \ + asm volatile ( \ + "call %[call]" \ + : "=a" (__res), "=b" (__ign1) \ + : "1" ((long)(a1)), \ + [call] "m" (hypercall_page[__HYPERVISOR_##name]) \ + : "memory" ); \ + (type)__res; \ +}) + +#define _hypercall2 (type, name, a1, a2) \ +({ \ + long __res, __ign1, __ign2; \ + asm volatile ( \ + "call %[call]" \ + : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \ + : "1" ((long)(a1)), "2" ((long)(a2)), \ + [call] "m" (hypercall_page[__HYPERVISOR_##name]) \ + : "memory" ); \ + (type)__res; \ +}) + +#define _hypercall3 (type, name, a1, a2, a3) \ +({ \ + long __res, __ign1, __ign2, __ign3; \ + asm volatile ( \ + "call %[call]" \ + : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ + "=d" (__ign3) \ + : "1" ((long)(a1)), "2" ((long)(a2)), \ + "3" ((long)(a3)), \ + [call] "m" (hypercall_page[__HYPERVISOR_##name]) \ + : "memory" ); \ + (type)__res; \ +}) + +#define _hypercall4 (type, name, a1, a2, a3, a4) \ +({ \ + long __res, __ign1, __ign2, __ign3, __ign4; \ + asm volatile ( \ + "call %[call]" \ + : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ + "=d" (__ign3), "=S" (__ign4) \ + : "1" ((long)(a1)), "2" ((long)(a2)), \ + "3" ((long)(a3)), "4" ((long)(a4)), \ + [call] "m" (hypercall_page[__HYPERVISOR_##name]) \ + : "memory" ); \ + (type)__res; \ +}) + +#define _hypercall5 (type, name, a1, a2, a3, a4, a5) \ +({ \ + long __res, __ign1, __ign2, __ign3, __ign4, __ign5; \ + asm volatile ( \ + "call %[call]" \ + : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ + "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \ + : "1" ((long)(a1)), "2" ((long)(a2)), \ + "3" ((long)(a3)), "4" ((long)(a4)), \ + "5" ((long)(a5)), \ + [call] "m" (hypercall_page[__HYPERVISOR_##name]) \ + : "memory" ); \ + (type)__res; \ +}) + +static inline int +HYPERVISOR_set_trap_table ( +struct trap_info *table) +{ +return _hypercall1 (int, set_trap_table, table); +} + +static inline int +HYPERVISOR_mmu_update ( +struct mmu_update *req,int count,int *success_count,domid_t domid) +{ +return _hypercall4 (int, mmu_update, req, count, success_count, domid); +} + +static inline int +HYPERVISOR_mmuext_op ( +struct mmuext_op *op,int count,int *success_count,domid_t domid) +{ +return _hypercall4 (int, mmuext_op, op, count, success_count, domid); +} + +static inline int +HYPERVISOR_set_gdt ( +unsigned long *frame_list,int entries) +{ +return _hypercall2 (int, set_gdt, frame_list, entries); +} + +static inline int +HYPERVISOR_stack_switch ( +unsigned long ss,unsigned long esp) +{ +return _hypercall2 (int, stack_switch, ss, esp); +} + +static inline int +HYPERVISOR_set_callbacks ( +unsigned long event_selector,unsigned long event_address, +unsigned long failsafe_selector,unsigned long failsafe_address) +{ +return _hypercall4 (int, set_callbacks, + event_selector, event_address, + failsafe_selector, failsafe_address); +} + +static inline int +HYPERVISOR_fpu_taskswitch ( +int set) +{ +return _hypercall1 (int, fpu_taskswitch, set); +} + +static inline int +HYPERVISOR_sched_op ( +int cmd,unsigned long arg) +{ +return _hypercall2 (int, sched_op, cmd, arg); +} + +static inline long +HYPERVISOR_set_timer_op ( +u64 timeout) +{ +unsigned long timeout_hi = (unsigned long )(timeout>>32 ); +unsigned long timeout_lo = (unsigned long )timeout; +return _hypercall2 (long, set_timer_op, timeout_lo, timeout_hi); +} + +static inline int +HYPERVISOR_set_debugreg ( +int reg,unsigned long value) +{ +return _hypercall2 (int, set_debugreg, reg, value); +} + +static inline unsigned long +HYPERVISOR_get_debugreg ( +int reg) +{ + return _hypercall1(unsigned long, get_debugreg, reg); +} + +static inline int +HYPERVISOR_update_descriptor ( +u64 ma,u64 desc) +{ +return _hypercall4 (int, update_descriptor, ma, ma>>32 , desc, desc>>32 ); +} + +static inline int +HYPERVISOR_memory_op ( +unsigned int cmd,void *arg) +{ +return _hypercall2 (int, memory_op, cmd, arg); +} + +static inline int +HYPERVISOR_multicall ( +void *call_list,int nr_calls) +{ +return _hypercall2 (int, multicall, call_list, nr_calls); +} + +static inline int +HYPERVISOR_update_va_mapping ( +unsigned long va,pte_t new_val,unsigned long flags) +{ +unsigned long pte_hi =0 ; +#ifdef CONFIG_X86_PAE + pte_hi = new_val.pte_high; +#endif +return _hypercall4 (int, update_va_mapping, va, + new_val.pte_low, pte_hi, flags); +} + +static inline int +HYPERVISOR_event_channel_op ( +int cmd,void *arg) +{ +int rc =_hypercall2 (int, event_channel_op, cmd, arg); +if (unlikely (rc == -ENOSYS )) { +struct evtchn_op op; + op.cmd = cmd; +memcpy (&op.u, arg,sizeof (op.u)); + rc =_hypercall1 (int, event_channel_op_compat, &op); +memcpy (arg, &op.u,sizeof (op.u)); + } +return rc; +} + +static inline int +HYPERVISOR_xen_version ( +int cmd,void *arg) +{ +return _hypercall2 (int, xen_version, cmd, arg); +} + +static inline int +HYPERVISOR_console_io ( +int cmd,int count,char *str) +{ +return _hypercall3 (int, console_io, cmd, count, str); +} + +static inline int +HYPERVISOR_physdev_op (int cmd,void *arg) +{ +int rc =_hypercall2 (int, physdev_op, cmd, arg); +if (unlikely (rc == -ENOSYS )) { +struct physdev_op op; + op.cmd = cmd; +memcpy (&op.u, arg,sizeof (op.u)); + rc =_hypercall1 (int, physdev_op_compat, &op); +memcpy (arg, &op.u,sizeof (op.u)); + } +return rc; +} + +static inline int +HYPERVISOR_grant_table_op ( +unsigned int cmd,void *uop,unsigned int count) +{ +return _hypercall3 (int, grant_table_op, cmd, uop, count); +} + +static inline int +HYPERVISOR_update_va_mapping_otherdomain ( +unsigned long va,pte_t new_val,unsigned long flags,domid_t domid) +{ +unsigned long pte_hi =0 ; +#ifdef CONFIG_X86_PAE + pte_hi = new_val.pte_high; +#endif +return _hypercall5 (int, update_va_mapping_otherdomain, va, + new_val.pte_low, pte_hi, flags, domid); +} + +static inline int +HYPERVISOR_vm_assist ( +unsigned int cmd,unsigned int type) +{ +return _hypercall2 (int, vm_assist, cmd, type); +} + +static inline int +HYPERVISOR_vcpu_op ( +int cmd,int vcpuid,void *extra_args) +{ +return _hypercall3 (int, vcpu_op, cmd, vcpuid, extra_args); +} + +static inline int +HYPERVISOR_suspend ( +unsigned long srec) +{ +return _hypercall3 (int, sched_op, SCHEDOP_shutdown, + SHUTDOWN_suspend, srec); +} + +static inline int +HYPERVISOR_nmi_op ( +unsigned long op, +unsigned long arg) +{ +return _hypercall2 (int, nmi_op, op, arg); +} + +static inline void +MULTI_update_va_mapping (struct multicall_entry *mcl,unsigned long va, +pte_t new_val,unsigned long flags) +{ + mcl->op = __HYPERVISOR_update_va_mapping; + mcl->args[0 ] = va; +#ifdef CONFIG_X86_PAE + mcl->args[1 ] = new_val.pte_low; + mcl->args[2 ] = new_val.pte_high; +#else + mcl->args[1 ] = new_val.pte_low; + mcl->args[2 ] =0 ; +#endif + mcl->args[3 ] = flags; +} + +static inline void +MULTI_grant_table_op (struct multicall_entry *mcl,unsigned int cmd, +void *uop,unsigned int count) +{ + mcl->op = __HYPERVISOR_grant_table_op; + mcl->args[0 ] = cmd; + mcl->args[1 ] = (unsigned long )uop; + mcl->args[2 ] = count; +} + +static inline void +MULTI_update_va_mapping_otherdomain (struct multicall_entry *mcl,unsigned long va, +pte_t new_val,unsigned long flags,domid_t domid) +{ + mcl->op = __HYPERVISOR_update_va_mapping_otherdomain; + mcl->args[0 ] = va; +#ifdef CONFIG_X86_PAE + mcl->args[1 ] = new_val.pte_low; + mcl->args[2 ] = new_val.pte_high; +#else + mcl->args[1 ] = new_val.pte_low; + mcl->args[2 ] =0 ; +#endif + mcl->args[3 ] = flags; + mcl->args[4 ] = domid; +} + +static inline void +MULTI_update_descriptor (struct multicall_entry *mcl,u64 maddr, +struct desc_struct desc) +{ + mcl->op = __HYPERVISOR_update_descriptor; + mcl->args[0 ] = maddr; + mcl->args[1 ] = maddr >>32 ; + mcl->args[2 ] = desc.a; + mcl->args[3 ] = desc.b; +} + +static inline void +MULTI_memory_op (struct multicall_entry *mcl,unsigned int cmd,void *arg) +{ + mcl->op = __HYPERVISOR_memory_op; + mcl->args[0 ] = cmd; + mcl->args[1 ] = (unsigned long )arg; +} + +static inline void +MULTI_mmu_update (struct multicall_entry *mcl,struct mmu_update *req, +int count,int *success_count,domid_t domid) +{ + mcl->op = __HYPERVISOR_mmu_update; + mcl->args[0 ] = (unsigned long )req; + mcl->args[1 ] = count; + mcl->args[2 ] = (unsigned long )success_count; + mcl->args[3 ] = domid; +} + +static inline void +MULTI_mmuext_op (struct multicall_entry *mcl,struct mmuext_op *op,int count, +int *success_count,domid_t domid) +{ + mcl->op = __HYPERVISOR_mmuext_op; + mcl->args[0 ] = (unsigned long )op; + mcl->args[1 ] = count; + mcl->args[2 ] = (unsigned long )success_count; + mcl->args[3 ] = domid; +} +#endif /* __HYPERCALL_H__ */
===================================================================
include/asm-i386/hypervisor.h new file +72 -0
72 lines not on this page · raw message
===================================================================
include/xen/interface/arch-x86_32.h new file +187 -0
187 lines not on this page · raw message
===================================================================
include/xen/interface/elfnote.h new file +133 -0
133 lines not on this page · raw message
===================================================================
include/xen/interface/event_channel.h new file +195 -0
195 lines not on this page · raw message
===================================================================
include/xen/interface/features.h new file +43 -0
43 lines not on this page · raw message
===================================================================
include/xen/interface/grant_table.h new file +301 -0
301 lines not on this page · raw message
===================================================================
include/xen/interface/io/blkif.h new file +96 -0
96 lines not on this page · raw message
===================================================================
include/xen/interface/io/console.h new file +23 -0
@@ -0,0 +1,23 @@ +/****************************************************************************** +* console.h +* +* Console I/O interface for Xen guest OSes. +* +* Copyright (c) 2005, Keir Fraser +*/ + +#ifndef __XEN_PUBLIC_IO_CONSOLE_H__ +#define __XEN_PUBLIC_IO_CONSOLE_H__ + +typedef uint32_t XENCONS_RING_IDX ; + +#define MASK_XENCONS_IDX (idx, ring) ((idx) & (sizeof(ring)-1)) + +struct xencons_interface { +char in[1024 ]; +char out[2048 ]; +XENCONS_RING_IDX in_cons, in_prod; +XENCONS_RING_IDX out_cons, out_prod; +}; + +#endif /* __XEN_PUBLIC_IO_CONSOLE_H__ */
===================================================================
include/xen/interface/io/netif.h new file +152 -0
152 lines not on this page · raw message
===================================================================
include/xen/interface/io/ring.h new file +260 -0
260 lines not on this page · raw message
===================================================================
include/xen/interface/io/xenbus.h new file +42 -0
42 lines not on this page · raw message
===================================================================
include/xen/interface/io/xs_wire.h new file +87 -0
87 lines not on this page · raw message
===================================================================
include/xen/interface/memory.h new file +145 -0
145 lines not on this page · raw message
===================================================================
include/xen/interface/physdev.h new file +61 -0
61 lines not on this page · raw message
===================================================================
include/xen/interface/sched.h new file +77 -0
77 lines not on this page · raw message
===================================================================
include/xen/interface/vcpu.h new file +109 -0
109 lines not on this page · raw message
===================================================================
include/xen/interface/version.h new file +60 -0
60 lines not on this page · raw message
===================================================================
include/xen/interface/xen.h new file +445 -0
445 lines not on this page · raw message
PATCH 15/20 XEN-paravirt: Xen: core paravirt guest changes
In reply to Jeremy FitzhardingeThis patch adds the core of the Xen implementation of the paravirt_ops interface. It consists of the following parts:
* Boot
The kernel provides Xen with a Xen-specific entrypoint. This entrypoint simply saves away the Xen boot-info structure pointer (initially in %esi), and jumps to the common paravirt entrypoint. This will do the normal paravirt probe; in the Xen case, the probe simply looks for a non-NULL xen start_info pointer.
The xen_start_kernel() function does the functional equivalent of head.S, and sets up the basic kernel environment before calling start_kernel(). This is simpler than the native case because the hypervisor has already started the kernel with a pagetable setup and paging enabled. A number of CPU feature checks are redundant because Xen's minimum CPU requirements are higher than a native Linux boot.
Having called start_kernel(), the bulk of the Xen backends interactions with the rest of the kernel are via the various paravirt_ops entrypoints.
* Memory management
This Xen guest code only implements direct pagetables (rather than shadow pagetables), so the guest is responsible for creating a suitable pagetable which can be directly used by the CPU.
This places a few constraints on how the initial pagetable is constructed vs native boots. In particular, if PAE is enabled, then Xen does not allow the guest to share the kernel PMD between multiple processes (since Xen has its own per-pagetable mappings in this page as well).
Also, Xen requires all pagetable pages to be mapped read-only in all pagetables. To achieve this, all processes share the kernelk pte pages; this way marking a kernel page read-only in one process will be automatically reflected in all other processes.
Since in this mode, all pagetable entries contains machine frame numbers (MFNs), all pagetable updates/reads must translate PFNs to/from MFNs. This is not complex, but there are rather a lot of little hook functions to perform this translation.
The Xen guest also implements late-pin/early-unpin for pagetables. This means that when creating a new pagetable (on fork or exec), as much setup is done as possible while the pages are just normal RW pages, and when pulling down a pagetable on exit, the pages are make RW before updating all the entries. This allows these operations to be peformed with as little hypervisor interaction as possible.
* Context switches
The Xen guest implements batched hypercalls, so that context switches can be done with a single hypercall. A typical context switch will update the kernel stack pointer, and then write the 3 TLS GDT entries; some context switches will also need to do an LDT update.
* Interrupts
Xen implements interrupts with general event channels. The Xen guest code maps these onto dynamically-allocated IRQs. When Xen wishes to raise an event, it makes a callback into the kernel code. This takes event number, maps it into an IRQ and then feeds it into the top of the normal interrupt delivery path.
* Time
The hypervisor maintains a nanosecond timebase. This is exposed to guests via the tsc; the guests can use the tsc to extrapolate the current nanosecond timebase without having to make a hypercall. This is exposed to the kernel timecode as a clocksource.
The guest also sets up a periodic timer event to drive the jiffies tick timebase. The timer tick is turned off while everything is idle, and replaced with a tick scheduled for the next timeout (if any).
* SMP
This code is UP-only at present, though almost everything here is already SMP-safe. All it really lacks is the means to start/stop new vcpus.
--- arch/i386/Makefile | 3 arch/i386/kernel/cpu/common.c | 3 arch/i386/kernel/entry.S | 77 +++ arch/i386/kernel/head.S | 12 arch/i386/kernel/paravirt.c | 48 +- arch/i386/kernel/vmlinux.lds.S | 1 arch/i386/mm/pgtable.c | 1 arch/i386/paravirt-xen/Makefile | 2 arch/i386/paravirt-xen/enlighten.c | 805 +++++++++++++++++++++++++++++++++++ arch/i386/paravirt-xen/events.c | 473 ++++++++++++++++++++ arch/i386/paravirt-xen/events.h | 28 + arch/i386/paravirt-xen/features.c | 29 + arch/i386/paravirt-xen/memory.c | 50 ++ arch/i386/paravirt-xen/mmu.c | 375 ++++++++++++++++ arch/i386/paravirt-xen/mmu.h | 51 ++ arch/i386/paravirt-xen/multicalls.c | 62 ++ arch/i386/paravirt-xen/multicalls.h | 13 arch/i386/paravirt-xen/setup.c | 96 ++++ arch/i386/paravirt-xen/time.c | 446 +++++++++++++++++++ arch/i386/paravirt-xen/xen-head.S | 29 + arch/i386/paravirt-xen/xen-ops.h | 20 arch/i386/paravirt-xen/xen-page.h | 175 +++++++ include/asm-i386/hypercall.h | 21 include/asm-i386/irq.h | 1 include/asm-i386/paravirt.h | 42 + include/asm-i386/pda.h | 11 include/xen/features.h | 26 + 27 files changed, 2871 insertions(+), 29 deletions(-)
===================================================================
arch/i386/Makefile +3 -0
@@ -93,6 +93,9 @@ mcore-$(CONFIG_X86_ES7000) := mach-defau mcore-$(CONFIG_X86_ES7000) := mach-default core-$(CONFIG_X86_ES7000) := arch/i386/mach-es7000/ +# Xen paravirtualization support +core-$(CONFIG_XEN) += arch/i386/paravirt-xen/ + # default subarch .h files mflags-y += -Iinclude/asm-i386/mach-default
===================================================================
arch/i386/kernel/cpu/common.c +3 -0
@@ -19,6 +19,7 @@#include <mach_apic.h> #endif #include <asm/pda.h> +#include <asm/paravirt.h> #include "cpu.h"
@@ -707,6 +708,8 @@ __cpuinit int init_gdt(int cpu, struct t pda->cpu_number = cpu; pda->pcurrent = idle; +paravirt_init_pda (pda, cpu); +return 1 ; }
===================================================================
arch/i386/kernel/entry.S +77 -0
83 lines not on this page · raw message
===================================================================
arch/i386/kernel/head.S +10 -2
@@ -530,6 +530,10 @@ 1: jmp 1b #endif +#ifdef CONFIG_XEN +#include "../paravirt-xen/xen-head.S" +#endif + /* * Real beginning of normal "text" segment */
@@ -539,7 +543,7 @@ ENTRY(_stext) /* * BSS section */ -.section ".bss.page_aligned","w" +.section ".bss.page_aligned" ENTRY(swapper_pg_dir) .fill 1024,4,0 ENTRY(empty_zero_page)
@@ -609,7 +613,8 @@ ENTRY(boot_gdt_table) /* * The Global Descriptor Table contains 28 quadwords, per-CPU. */ - .align L1_CACHE_BYTES + .section ".data.page_aligned" + .align PAGE_SIZE_asm ENTRY(cpu_gdt_table) .quad 0x0000000000000000 /* NULL descriptor */ .quad 0x0000000000000000 /* 0x0b reserved */
@@ -658,3 +663,6 @@ ENTRY(cpu_gdt_table) .quad 0x0000000000000000 /* 0xf0 - unused */ .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ + /* Be sure this is zeroed to avoid false validations in Xen */ + .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0 + .previous
===================================================================
arch/i386/kernel/paravirt.c +24 -24
162 lines not on this page · raw message
===================================================================
arch/i386/kernel/vmlinux.lds.S +1 -0
@@ -100,6 +100,7 @@ SECTIONS . = ALIGN(4096); .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { + *(.data.page_aligned) *(.data.idt) }
===================================================================
arch/i386/mm/pgtable.c +1 -0
@@ -267,6 +267,7 @@ static void pgd_ctor(pgd_t *pgd) swapper_pg_dir +USER_PTRS_PER_PGD , KERNEL_PGD_PTRS); }else { +memset (pgd,0 ,USER_PTRS_PER_PGD *sizeof (pgd_t));spin_lock_irqsave (&pgd_lock, flags);pgd_list_add (pgd);spin_unlock_irqrestore (&pgd_lock, flags);
===================================================================
arch/i386/paravirt-xen/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-y := enlighten.o setup.o events.o memory.o time.o \ + features.o mmu.o multicalls.o
===================================================================
arch/i386/paravirt-xen/enlighten.c new file +805 -0
805 lines not on this page · raw message
===================================================================
arch/i386/paravirt-xen/events.c new file +473 -0
473 lines not on this page · raw message
===================================================================
arch/i386/paravirt-xen/events.h new file +28 -0
@@ -0,0 +1,28 @@ +#ifndef _XEN_EVENTS_H +#define _XEN_EVENTS_H + +#include <linux/irq.h> + +int bind_evtchn_to_irqhandler (unsigned int evtchn, +irqreturn_t (*handler)(int ,void *), +unsigned long irqflags,const char *devname, +void *dev_id); +int bind_virq_to_irqhandler (unsigned int virq,unsigned int cpu, +irqreturn_t (*handler)(int ,void *), +unsigned long irqflags,const char *devname,void *dev_id); + +/* +* Common unbind function for all event sources. Takes IRQ to unbind from. +* Automatically closes the underlying event channel (even for bindings +* made with bind_evtchn_to_irqhandler()). +*/ +void unbind_from_irqhandler (unsigned int irq,void *dev_id); + +static inline void notify_remote_via_evtchn (int port) +{ +struct evtchn_send send = { .port = port }; + (void )HYPERVISOR_event_channel_op (EVTCHNOP_send, &send); +} + +extern void notify_remote_via_irq (int irq); +#endif /* _XEN_EVENTS_H */
===================================================================
arch/i386/paravirt-xen/features.c new file +29 -0
@@ -0,0 +1,29 @@ +/****************************************************************************** +* features.c +* +* Xen feature flags. +* +* Copyright (c) 2006, Ian Campbell, XenSource Inc. +*/ +#include <linux/types.h> +#include <linux/cache.h> +#include <linux/module.h> +#include <asm/hypervisor.h> +#include <xen/features.h> + +u8 xen_features[XENFEAT_NR_SUBMAPS *32 ]__read_mostly ; +EXPORT_SYMBOL_GPL (xen_features); + +void xen_setup_features (void ) +{ +struct xen_feature_info fi; +int i, j; + +for (i =0 ; i <XENFEAT_NR_SUBMAPS ; i++) { + fi.submap_idx = i; +if (HYPERVISOR_xen_version (XENVER_get_features, &fi) <0 ) +break ; +for (j=0 ; j<32 ; j++) + xen_features[i*32 +j] = !!(fi.submap &1 <<j); + } +}
===================================================================
arch/i386/paravirt-xen/memory.c new file +50 -0
50 lines not on this page · raw message
===================================================================
arch/i386/paravirt-xen/mmu.c new file +375 -0
375 lines not on this page · raw message
===================================================================
arch/i386/paravirt-xen/mmu.h new file +51 -0
51 lines not on this page · raw message
===================================================================
arch/i386/paravirt-xen/multicalls.c new file +62 -0
62 lines not on this page · raw message
===================================================================
arch/i386/paravirt-xen/multicalls.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef _XEN_MULTICALLS_H +#define _XEN_MULTICALLS_H + +struct multicall_space +{ +struct multicall_entry *mc; +void *args; +}; + +struct multicall_space xen_mc_entry (size_t args); +int xen_mc_flush (void ); + +#endif /* _XEN_MULTICALLS_H */
===================================================================
arch/i386/paravirt-xen/setup.c new file +96 -0
96 lines not on this page · raw message
===================================================================
arch/i386/paravirt-xen/time.c new file +446 -0
446 lines not on this page · raw message
===================================================================
arch/i386/paravirt-xen/xen-head.S new file +29 -0
@@ -0,0 +1,29 @@ +/* Xen-specific pieces of head.S, intended to be included in the right + place in head.S */ + +#include <linux/elfnote.h> +#include <asm/boot.h> +#include <xen/interface/elfnote.h> + +ENTRY(startup_xen) + movl %esi,xen_start_info + jmp startup_paravirt + +.pushsection ".bss.page_aligned" +ENTRY(hypercall_page) + .skip 0x1000 +.popsection + + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux") + ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6") + ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0") + ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long, __PAGE_OFFSET) + ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, startup_xen) + ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page) + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "!writable_page_tables|pae_pgdir_above_4gb") +#ifdef CONFIG_X86_PAE + ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes") +#else + ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "no") +#endif + ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic")
===================================================================
arch/i386/paravirt-xen/xen-ops.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef XEN_OPS_H +#define XEN_OPS_H + +#include <linux/init.h> + +extern struct start_info *xen_start_info; +extern struct shared_info *HYPERVISOR_shared_info; + +char *__init xen_memory_setup (void ); +void __init xen_arch_setup (void ); +void __init xen_init_IRQ (void ); + +void __init xen_time_init (void ); +unsigned long xen_get_wallclock (void ); +int xen_set_wallclock (unsigned long time); + +void stop_hz_timer (void ); +void start_hz_timer (void ); + +#endif /* XEN_OPS_H */
===================================================================
arch/i386/paravirt-xen/xen-page.h new file +175 -0
175 lines not on this page · raw message
===================================================================
include/asm-i386/hypercall.h +18 -3
@@ -39,9 +39,6 @@#include <xen/interface/xen.h> #include <xen/interface/sched.h> #include <xen/interface/physdev.h> - -#define __STR (x) #x -#define STR (x) __STR(x)extern struct {char _entry[32 ]; } hypercall_page[];
@@ -413,4 +410,22 @@ MULTI_mmuext_op(struct multicall_entry * mcl->args[2 ] = (unsigned long )success_count; mcl->args[3 ] = domid; } + +static inline void +MULTI_set_gdt (struct multicall_entry *mcl,unsigned long *frames,int entries) +{ + mcl->op = __HYPERVISOR_set_gdt; + mcl->args[0 ] = (unsigned long )frames; + mcl->args[1 ] = entries; +} + +static inline void +MULTI_stack_switch (struct multicall_entry *mcl, +unsigned long ss,unsigned long esp) +{ + mcl->op = __HYPERVISOR_stack_switch; + mcl->args[0 ] = ss; + mcl->args[1 ] = esp; +} +
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
===================================================================
include/asm-i386/irq.h +1 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
===================================================================
include/asm-i386/paravirt.h +42 -0
42 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
===================================================================
include/asm-i386/pda.h +11 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
===================================================================
include/xen/features.h new file +26 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 16/20 XEN-paravirt: Add the Xen virtual console driver.
In reply to Jeremy FitzhardingeThis provides a bootstrap and ongoing emergency console which is intended to be available from very early during boot and at all times thereafter, in contrast with alternatives such as UDP-based syslogd, or logging in via ssh. The protocol is based on a simple shared-memory ring buffer.
--- arch/i386/kernel/early_printk.c | 2 arch/i386/paravirt-xen/enlighten.c | 3 drivers/Makefile | 3 drivers/xen/Makefile | 1 drivers/xen/console/Makefile | 2 drivers/xen/console/console.c | 588 ++++++++++++++++++++++++++++++++++++ drivers/xen/console/xencons_ring.c | 144 ++++++++ include/xen/xencons.h | 14 init/main.c | 2 9 files changed, 759 insertions(+)
===================================================================
arch/i386/kernel/early_printk.c +2 -0
@@ -1,2 +1,4 @@ +#ifndef CONFIG_XEN #include "../../x86_64/kernel/early_printk.c" +#endif
===================================================================
arch/i386/paravirt-xen/enlighten.c +3 -0
@@ -798,6 +798,9 @@ static asmlinkage void __init xen_start_INITRD_START = xen_start_info->mod_start ?__pa (xen_start_info->mod_start) :0 ;INITRD_SIZE = xen_start_info->mod_len; +/* use Xen console */ + vgacon_enabled =0 ; +/* Start the world */ start_kernel (); }
===================================================================
drivers/Makefile +3 -0
@@ -14,6 +14,9 @@ obj-$(CONFIG_ACPI) += acpi/ # was used and do nothing if so obj-$(CONFIG_PNP) += pnp/ obj-$(CONFIG_ARM_AMBA) += amba/ + +# Xen is the default console when running as a guest +obj-$(CONFIG_XEN) += xen/ # char/ comes before serial/ etc so that the VT console is the boot-time # default.
===================================================================
drivers/xen/Makefile new file +1 -0
@@ -0,0 +1,1 @@ +obj-y += console/
===================================================================
drivers/xen/console/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-y := console.o xencons_ring.o
===================================================================
drivers/xen/console/console.c new file +588 -0
588 lines not on this page · raw message
===================================================================
drivers/xen/console/xencons_ring.c new file +144 -0
144 lines not on this page · raw message
===================================================================
include/xen/xencons.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef __ASM_XENCONS_H__ +#define __ASM_XENCONS_H__ + +void xencons_force_flush (void ); +void xencons_resume (void ); + +/* Interrupt work hooks. Receive data, or kick data out. */ +void xencons_rx (char *buf,unsigned len); +void xencons_tx (void ); + +int xencons_ring_init (void ); +int xencons_ring_send (const char *data,unsigned len); + +#endif /* __ASM_XENCONS_H__ */
===================================================================
init/main.c +2 -0
@@ -495,6 +495,8 @@ asmlinkage void __init start_kernel(voidunwind_init ();lockdep_init (); +//setup_early_printk(NULL); +local_irq_disable ();early_boot_irqs_off ();early_init_irq_lock_class ();
PATCH 17/20 XEN-paravirt: Add Xen grant table support
In reply to Jeremy FitzhardingeAdd Xen 'grant table' driver which allows granting of access to selected local memory pages by other virtual machines and, symmetrically, the mapping of remote memory pages which other virtual machines have granted access to.
This driver is a prerequisite for many of the Xen virtual device drivers, which grant the 'device driver domain' restricted and temporary access to only those memory pages that are currently involved in I/O operations.
--- drivers/xen/core/Makefile | 2 drivers/xen/core/gnttab.c | 422 ++++++++++++++++++++++++++++++++++++++++++++++ include/xen/gnttab.h | 105 +++++++++++ 3 files changed, 528 insertions(+), 1 deletion(-)
===================================================================
drivers/xen/Makefile +1 -0
@@ -1,1 +1,2 @@ obj-y += console/ +obj-y += core/ obj-y += console/
===================================================================
drivers/xen/core/Makefile new file +1 -0
@@ -0,0 +1,1 @@ +obj-y += grant_table.o
===================================================================
drivers/xen/core/grant_table.c new file +445 -0
445 lines not on this page · raw message
===================================================================
include/xen/grant_table.h new file +107 -0
107 lines not on this page · raw message
PATCH 18/20 XEN-paravirt: Add Xen driver utility functions.
In reply to Jeremy FitzhardingeAllocate/destroy a 'vmalloc' VM area: alloc_vm_area and free_vm_area The alloc function ensures that page tables are constructed for the region of kernel virtual address space and mapped into init_mm.
Lock an area so that PTEs are accessible in the current address space:lock_vm_area and unlock_vm_area
The lock function prevents context switches to a lazy mm that doesn't have the area mapped into its page tables. It also ensures that the page tables are mapped into the current mm by causing the page fault handler to copy the page directory pointers from init_mm into the current mm.
---
drivers/xen/Makefile | 2 + drivers/xen/util.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++ include/xen/driver_util.h | 16 ++++++++++ 3 files changed, 88 insertions(+)
===================================================================
drivers/xen/Makefile +2 -0
@@ -1,2 +1,4 @@ obj-y += core/ +obj-y += util.o + obj-y += core/ obj-y += console/
===================================================================
drivers/xen/util.c new file +69 -0
69 lines not on this page · raw message
===================================================================
include/xen/driver_util.h new file +15 -0
@@ -0,0 +1,15 @@ + +#ifndef __ASM_XEN_DRIVER_UTIL_H__ +#define __ASM_XEN_DRIVER_UTIL_H__ + +#include <linux/vmalloc.h> + +/* Allocate/destroy a 'vmalloc' VM area. */ +extern struct vm_struct *alloc_vm_area (unsigned long size); +extern void free_vm_area (struct vm_struct *area); + +/* Lock an area so that PTEs are accessible in the current address space. */ +extern void lock_vm_area (struct vm_struct *area); +extern void unlock_vm_area (struct vm_struct *area); + +#endif /* __ASM_XEN_DRIVER_UTIL_H__ */
PATCH 19/20 XEN-paravirt: Add the Xenbus sysfs and virtual device hotplug driver.
In reply to Jeremy FitzhardingeThis communicates with the machine control software via a registry residing in a controlling virtual machine. This allows dynamic creation, destruction and modification of virtual device configurations (network devices, block devices and CPUS, to name some examples).
--- drivers/xen/Makefile | 1 drivers/xen/xenbus/Makefile | 7 drivers/xen/xenbus/xenbus_client.c | 528 ++++++++++++++++++++ drivers/xen/xenbus/xenbus_comms.c | 222 ++++++++ drivers/xen/xenbus/xenbus_comms.h | 43 + drivers/xen/xenbus/xenbus_probe.c | 954 +++++++++++++++++++++++++++++++++++++ drivers/xen/xenbus/xenbus_xs.c | 828 ++++++++++++++++++++++++++++++++ include/xen/xenbus.h | 199 +++++++ 8 files changed, 2782 insertions(+)
===================================================================
arch/i386/paravirt-xen/Kconfig +5 -0
@@ -8,3 +8,8 @@ config XEN default y help This is the Linux Xen port. + +config XEN_BACKEND + bool + depends XEN + default n
===================================================================
arch/i386/paravirt-xen/events.h +2 -0
@@ -2,6 +2,8 @@#define _XEN_EVENTS_H#include <linux/irq.h> + +#include <asm/hypercall.h> int bind_evtchn_to_irqhandler(unsigned int evtchn, irqreturn_t (*handler)(int, void *),
===================================================================
drivers/xen/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-y += util.o obj-y += core/ obj-y += console/ +obj-y += xenbus/
===================================================================
drivers/xen/xenbus/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +obj-y += xenbus.o + +xenbus-objs = +xenbus-objs += xenbus_client.o +xenbus-objs += xenbus_comms.o +xenbus-objs += xenbus_xs.o +xenbus-objs += xenbus_probe.o + +obj-$(CONFIG_XEN_BACKEND) += xenbus_probe_backend.o
===================================================================
drivers/xen/xenbus/xenbus_client.c new file +565 -0
565 lines not on this page · raw message
===================================================================
drivers/xen/xenbus/xenbus_comms.c new file +218 -0
218 lines not on this page · raw message
===================================================================
drivers/xen/xenbus/xenbus_comms.h new file +44 -0
44 lines not on this page · raw message
===================================================================
drivers/xen/xenbus/xenbus_probe.c new file +891 -0
891 lines not on this page · raw message
===================================================================
drivers/xen/xenbus/xenbus_probe.h new file +72 -0
72 lines not on this page · raw message
===================================================================
drivers/xen/xenbus/xenbus_probe_backend.c new file +269 -0
269 lines not on this page · raw message
===================================================================
drivers/xen/xenbus/xenbus_xs.c new file +840 -0
840 lines not on this page · raw message
===================================================================
include/xen/xenbus.h new file +208 -0
72 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 20/20 XEN-paravirt: Add Xen virtual block device driver.
In reply to Jeremy FitzhardingeThe block device frontend driver allows the kernel to access block devices exported exported by a virtual machine containing a physical block device driver.
--- drivers/block/Kconfig | 1 drivers/block/Makefile | 1 drivers/block/xen/Kconfig | 14 drivers/block/xen/Makefile | 5 drivers/block/xen/blkfront.c | 812 +++++++++++++++++++++++++++++++++++++++++++ drivers/block/xen/block.h | 155 ++++++++ drivers/block/xen/vbd.c | 214 +++++++++++ 7 files changed, 1202 insertions(+)
===================================================================
drivers/block/Kconfig +1 -0
@@ -461,6 +461,7 @@ config CDROM_PKTCDVD_WCACHE don't do deferred write error handling yet. source "drivers/s390/block/Kconfig" +source "drivers/block/xen/Kconfig" config ATA_OVER_ETH tristate "ATA over Ethernet support"
===================================================================
drivers/block/Makefile +1 -0
@@ -30,3 +30,4 @@ obj-$(CONFIG_BLK_DEV_SX8) += sx8.o obj-$(CONFIG_BLK_DEV_SX8) += sx8.o obj-$(CONFIG_BLK_DEV_UB) += ub.o +obj-$(CONFIG_XEN) += xen/
===================================================================
include/linux/major.h +2 -0
@@ -156,6 +156,8 @@#define VXSPEC_MAJOR 200/* VERITAS volume config driver */ #define VXDMP_MAJOR 201/* VERITAS volume multipath driver */ +#define XENVBD_MAJOR 202/* Xen virtual block device */ +#define MSR_MAJOR 202#define CPUID_MAJOR 203
===================================================================
drivers/block/xen/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +menu "Xen block device drivers" + depends on XEN + +config XEN_BLKDEV_FRONTEND + tristate "Block device frontend driver" + depends on XEN + default y + help + The block device frontend driver allows the kernel to access block + devices exported from a device driver virtual machine. Unless you + are building a dedicated device driver virtual machine, then you + almost certainly want to say Y here. + +endmenu
===================================================================
drivers/block/xen/Makefile new file +5 -0
@@ -0,0 +1,5 @@ + +obj-$(CONFIG_XEN_BLKDEV_FRONTEND) := xenblk.o + +xenblk-objs := blkfront.o vbd.o +
===================================================================
drivers/block/xen/blkfront.c new file +870 -0
870 lines not on this page · raw message
===================================================================
drivers/block/xen/block.h new file +157 -0
157 lines not on this page · raw message
===================================================================
drivers/block/xen/vbd.c new file +231 -0
231 lines not on this page · raw message
Re: [Xen-devel] [patch 02/20] XEN-paravirt: Add a flag to allow the VGA console to be disabled
In reply to Jeremy FitzhardingeQuoted 3 lines · On Fri, 12 Jan 2007 17:45:41 -0800 Jeremy Fitzhardinge <[email protected]> wrote:
Add a flag to allow the VGA console to be disabled. The VGA code will spin forever if there isn't any real VGA hardware, which will happen under Xen.
If it is doing this then the real bug should be fixed so that it doesn't hang in the same way on a physical system which has no VGA.
Re: [patch 16/20] XEN-paravirt: Add the Xen virtual console driver.
In reply to Jeremy Fitzhardingedrivers/xen/console/console.c line 289
Quoted 2 lines
drivers/xen/console/console.c new file +2
-0+#endif +tty_insert_flip_char (xencons_tty, buf[i],0 );
Please use the defines like TTY_NORMAL not just 0.
drivers/xen/console/console.c line 333
Quoted 4 lines
drivers/xen/console/console.c new file +4
-0+if ((xencons_tty->flags & (1 <<TTY_DO_WRITE_WAKEUP )) && + (xencons_tty->ldisc.write_wakeup !=NULL )) + (xencons_tty->ldisc.write_wakeup)(xencons_tty); + }
You are't allowed to derefence and call ldisc methods without holding the lock. You can replace that chunk with a call to the helper function tty_wakeup(tty). Small but real race condition otherwise as you xencons_tty->ldisc may be changing as you call it.
drivers/xen/console/console.c line 411
Quoted 8 lines
drivers/xen/console/console.c new file +8
-0+static inline int __xencons_put_char (int ch) +{ +char _ch = (char )ch; +if ((wp - wc) == wbuf_size) +return 0 ; + wbuf[WBUF_MASK (wp++)] = _ch; +return 1 ; +}
A lot of very confusing sign stuff here - you turn an int into a char and put it into a uchar array
drivers/xen/console/console.c line 425
Quoted 3 lines
drivers/xen/console/console.c new file +3
-0+for (i =0 ; i < count; i++) +if (!__xencons_put_char (buf[i])) +break ;
The int coming from a uchar array
Don't think its wrong - just acutely weird and perhaps could be tidier
drivers/xen/console/console.c line 487
Quoted 5 lines
drivers/xen/console/console.c new file +5
-0+static void xencons_close (struct tty_struct *tty,struct file *filp) +{ +unsigned long flags; + +mutex_lock (&tty_mutex);
It would be good in future if you could avoid using tty_mutex and use a private lock. At the moment vt "borrows" it and there are a couple of incestuous spots but the plan is to eventually fix them and make it private to tty_io.
Andrew: No objection to this tty stuff being merged provided the bugs noted above (not worried about the sign stuff) are fixed before it goes on to Linus.
Alan
Re: [patch 16/20] XEN-paravirt: Add the Xen virtual console driver.
Quoted 4 lines · Alan
Andrew: No objection to this tty stuff being merged provided the bugs noted above (not worried about the sign stuff) are fixed before it goes on to Linus.
Thanks for the comments. I'll see if I can put together a fixup patch before LCA, but possibly not.
J
Re: [patch 09/20] XEN-paravirt: dont export paravirt_ops structure, do individual functions
In reply to Jeremy FitzhardingeQuoted 1 line · Jeremy Fitzhardinge
Wrap the
paravirt_opsmembers we want to export in wrapper functions.
Andrew, the removal of paravirt_ops export here will break kvm. Feel free to re-add "EXPORT_SYMBOL_GPL(paravirt_ops)" at the bottom of arch/i386/kernel/paravirt.c; I'm working on a cleaner way for modules like kvm / lguest (which want to use the native versions directly anyway).
Thanks,
Rusty.
Re: [patch 20/20] XEN-paravirt: Add Xen virtual block device driver.
In reply to Jeremy Fitzhardingedrivers/block/xen/blkfront.c line 48
Quoted 2 lines
drivers/block/xen/blkfront.c new file +2
-0+#include "../../../arch/i386/paravirt-xen/events.h" +#include "../../../arch/i386/paravirt-xen/xen-page.h"
this shows the headers are clearly in the wrong place...
drivers/block/xen/blkfront.c line 168
Quoted 3 lines
drivers/block/xen/blkfront.c new file +3
-0+ + err =xenbus_printf (xbt, dev->nodename, +"ring-ref" ,"%u" , info->ring_ref);
why do you need your own printf?
Quoted 1 line
+static inline int GET_ID_FROM_FREELIST(
does this really need screaming?
Quoted 12 lines
drivers/block/xen/blkfront.c new file +12
-0+ +int blkif_ioctl (struct inode *inode,struct file *filep, +unsigned command,unsigned long argument) +{ +int i; + +DPRINTK_IOCTL ("command: 0x%x, argument: 0x%lx, dev: 0x%04x\n" , + command, (long )argument, inode->i_rdev); + +switch (command) { +case CDROMMULTISESSION : +DPRINTK ("FIXME: support multisession CDs later\n" );
drivers/block/xen/blkfront.c line 491
Quoted 10 lines
drivers/block/xen/blkfront.c new file +10
-0+for (i =0 ; i <sizeof (struct cdrom_multisession ); i++) +if (put_user (0 , (char __user *)(argument + i))) +return -EFAULT ; +return 0 ; + +default : +/*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n", +command);*/ +return -EINVAL ;/* same return as native Linux */ + }
eh so you implement no ioctls.. why then implement the ioctl method at all?
drivers/block/xen/blkfront.c line 848
Quoted 9 lines
drivers/block/xen/blkfront.c new file +9
-0+static struct xenbus_driver blkfront = { + .name ="vbd" , + .owner =THIS_MODULE , + .ids = blkfront_ids, + .probe = blkfront_probe, + .remove = blkfront_remove, + .resume = blkfront_resume, + .otherend_changed = backend_changed, +};
this can be const
drivers/block/xen/block.h line 73
Quoted 2 lines
drivers/block/xen/block.h new file +2
-0+ +#define DPRINTK(_f, _a...) pr_debug(_f, ## _a)
why this silly abstraction? Just use pr_debug in the code directly
Re: [patch 18/20] XEN-paravirt: Add Xen driver utility functions.
In reply to Jeremy FitzhardingeQuoted 3 lines · Jeremy Fitzhardinge
Allocate/destroy a 'vmalloc' VM area:
alloc_vm_areaandfree_vm_areaThe alloc function ensures that page tables are constructed for the region of kernel virtual address space and mapped intoinit_mm.
Shouldn't these functions go into the core mm/ kernel code if they are needed, instead of living in the xen directories?
thanks,
greg k-h
Re: [patch 20/20] XEN-paravirt: Add Xen virtual block device driver.
In reply to Arjan van de VenQuoted 4 lines · Arjan van de Ven
drivers/block/xen/block.h line 73
Quoted 2 lines
drivers/block/xen/block.h new file +2
-0+ +#define DPRINTK(_f, _a...) pr_debug(_f, ## _a)why this silly abstraction? Just use
pr_debugin the code directly
Actually, for drivers, like this one, you should use the dev_printk() and friends (dev_dbg, dev_err, etc.) instead so that userspace knows exactly which device and driver the message comes from.
thanks,
greg k-h
Re: [patch 20/20] XEN-paravirt: Add Xen virtual block device driver.
In reply to Jeremy FitzhardingeQuoted 4 lines · Jeremy Fitzhardinge
The block device frontend driver allows the kernel to access block devices exported exported by a virtual machine containing a physical block device driver.
Is this significantly different from ubd/hostfs that it actually warrants a reinvention?
Review
Quoted 1 line
(quoted diff) +1
-0+ (void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
Cast remove, if xenbus_switch_state does not have __must_check. Also elsewhere.
-`J'
Re: [patch 20/20] XEN-paravirt: Add Xen virtual block device driver.
Quoted 4 lines · Jan Engelhardt
Review
Quoted 1 line
(quoted diff) +1
-0+ (void)xenbus_switch_state(info->xbdev, XenbusStateConnected);Cast remove, if
xenbus_switch_statedoes not have__must_check. Also elsewhere.
Hmm, why? this way you know that the programmer isn't checking the return value *on purpose*. More information is good.
Cheers,
Muli
Re: [patch 20/20] XEN-paravirt: Add Xen virtual block device driver.
Quoted 9 lines · Muli Ben-Yehuda
Quoted 4 lines · Jan Engelhardt
Review
Quoted 1 line
(quoted diff) +1
-0+ (void)xenbus_switch_state(info->xbdev, XenbusStateConnected);Cast remove, if
xenbus_switch_statedoes not have__must_check. Also elsewhere.Hmm, why? this way you know that the programmer isn't checking the return value *on purpose*. More information is good.
Then I'd prefer a comment. Plus, you don't do (void) on every xenbus_switch_state, so I have to assume (1) you either forgot to check the return value or (2) you don't follow your own "on purpose" policy. If you really want to enforce to use the return value and explicitly not in some places, then please tag it __must_check. http://lkml.org/lkml/2006/12/21/282
might be something to read.
-`J'
Re: [patch 20/20] XEN-paravirt: Add Xen virtual block device driver.
In reply to Jan EngelhardtQuoted 6 lines · Jan Engelhardt
Quoted 3 lines
The block device frontend driver allows the kernel to access block devices exported exported by a virtual machine containing a physical block device driver.
Is this significantly different from ubd/hostfs that it actually warrants a reinvention?
It is certainly unlike hostfs because hostfs provides file-level access to host storage, not block-level. It's unlike both ubd and hostfs in that both of those (I believe) make significant use of the syscall interface (and so assume they run in a process on a Linux host). Also our driver appears to be lower level, pushing more responsibility for features like CoW into the VMM. Arguably that's a more generically reusable and flexible strategy although it requires more VMM run-time support (which a Xen system provides).
Quoted 4 lines
Quoted 1 line
+ (void)xenbus_switch_state(info->xbdev, XenbusStateConnected);
Cast remove, if
xenbus_switch_statedoes not have__must_check. Also elsewhere.
Okay, we should certainly follow the general rule here.
Thanks,
Keir
Re: [Xen-devel] [patch 07/20] XEN-paravirt: paravirt shared kernel pmd flag
In reply to Jeremy FitzhardingeQuoted 3 lines
Quoted 1 line
Quoted 1 line
Jeremy Fitzhardinge <[email protected]> 13.01.07 02:45 >>>
Xen does not allow guests to have the kernel pmd shared between page tables, so parameterize
pgtable.cto allow both modes of operation.
I don't think the change to vmalloc_sync_all in this patch is necessary - the mechanism exists solely for dealing with modular users of the die notifier in the NMI case. Since there's no NMI visible to guests, I don't think the mechanism is necessary; it could even be completely circumvented for paravirtual guests.
Jan
Re: [patch 16/20] XEN-paravirt: Add the Xen virtual console driver.
In reply to Jeremy FitzhardingeHi!
Quoted 10 lines
This provides a bootstrap and ongoing emergency console which is intended to be available from very early during boot and at all times thereafter, in contrast with alternatives such as UDP-based syslogd, or logging in via ssh. The protocol is based on a simple shared-memory ring buffer.
Signed-off-by Ian Pratt <[email protected]>Signed-off-by Christian Limpach <[email protected]>Signed-off-by Chris Wright <[email protected]>
Quoted 5 lines
--- arch/i386/kernel/early_printk.c | 2 arch/i386/paravirt-xen/enlighten.c | 3 drivers/Makefile | 3 drivers/xen/Makefile | 1
You have drivers/xen... so maybe arch/i386/xen is easier to type? arch/i386/paravirt/xen would make some sense, too, but it looks too deep to me.
Pavel
Signature · 1 line
Thanks for all the (sleeping) penguins.
Re: [patch 17/20] XEN-paravirt: Add Xen grant table support
In reply to Jeremy FitzhardingeHi!
Quoted 4 lines
drivers/xen/core/Makefile | 2 drivers/xen/core/gnttab.c | 422 ++++++++++++++++++++++++++++++++++++++++++++++ include/xen/gnttab.h | 105 +++++++++++ 3 files changed, 528 insertions(+), 1 deletion(-)
...
drivers/xen/core/grant_table.c
Quoted 3 lines
===================================================================
drivers/xen/core/grant_table.c new file +0
-0
What is going on? Diffstat does not seem to match the diff.
Pavel
Signature · 1 line
Thanks for all the (sleeping) penguins.
Re: [patch 19/20] XEN-paravirt: Add the Xenbus sysfs and virtual device hotplug driver.
In reply to Jeremy FitzhardingeHi!
Quoted 10 lines
This communicates with the machine control software via a registry residing in a controlling virtual machine. This allows dynamic creation, destruction and modification of virtual device configurations (network devices, block devices and CPUS, to name some examples).
Signed-off-by Ian Pratt <[email protected]>Signed-off-by Christian Limpach <[email protected]>Signed-off-by Jeremy Fitzhardinge <[email protected]>Signed-off-by Chris Wright <[email protected]>
Quoted 8 lines
--- drivers/xen/Makefile | 1 drivers/xen/xenbus/Makefile | 7 drivers/xen/xenbus/xenbus_client.c | 528 ++++++++++++++++++++ drivers/xen/xenbus/xenbus_comms.c | 222 ++++++++ drivers/xen/xenbus/xenbus_comms.h | 43 + drivers/xen/xenbus/xenbus_probe.c | 954 +++++++++++++++++++++++++++++++++++++ drivers/xen/xenbus/xenbus_xs.c | 828 ++++++++++++++++++++++++++++++++
Hmm, you have word 'xen' three times in this pathname, and then the file is name 'xs'. Trying to do xen advertising in path names? :-)
Quoted 13 lines
drivers/xen/xenbus/xenbus_client.c new file +12
-0@@ -0,0 +1,565 @@ +/****************************************************************************** +* Client-facing interface for the Xenbus driver. In other words, the +* interface between the Xenbus and the device-specific code, be it the +* frontend or the backend of that driver. +* +* Copyright (C) 2005 XenSource Ltd +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation; or, when distributed +* separately from the Linux kernel or incorporated into other +* software packages, subject to the following license:
drivers/xen/xenbus/xenbus_client.c line 22
Quoted 10 lines
drivers/xen/xenbus/xenbus_client.c new file +10
-0+* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this source file (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, copy, modify, +* merge, publish, distribute, sublicense, and/or sell copies of the Software, +* and to permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software.
So this is dual BSD/GPL?
drivers/xen/xenbus/xenbus_client.c line 44
Quoted 12 lines
drivers/xen/xenbus/xenbus_client.c new file +12
-0+#include <linux/types.h> +#include <xen/interface/xen.h> +#include <xen/interface/event_channel.h> +#include "../../../arch/i386/paravirt-xen/events.h" +#include <xen/grant_table.h> +#include <xen/xenbus.h> +#include <xen/driver_util.h> + +char *xenbus_strstate (enum xenbus_state state) +{ +static char *name[] = { + [ XenbusStateUnknown ] ="Unknown" ,
Constants are normally XENBUS_STATE_UNKNOWN in linux...
Can we get description of its kernel-user interface in Documentation/ somewhere?
drivers/xen/xenbus/xenbus_probe_backend.c line 56
Quoted 11 lines
drivers/xen/xenbus/xenbus_probe_backend.c new file +11
-0+#include <asm/io.h> +#include <asm/page.h> +//#include <asm/maddr.h> +#include <asm/pgtable.h> +#include <asm/hypervisor.h> +#include <xen/xenbus.h> +//#include <xen/xen_proc.h> +//#include <xen/evtchn.h> +#include <xen/features.h> +//#include <xen/hvm.h> +
Just delete the lines.
drivers/xen/xenbus/xenbus_probe_backend.c line 62
Quoted 3 lines
drivers/xen/xenbus/xenbus_probe_backend.c new file +3
-0+#ifdef HAVE_XEN_PLATFORM_COMPAT_H +#include <xen/platform-compat.h> +#endif
Is this really neccessary?
drivers/xen/xenbus/xenbus_probe_backend.c line 124
Quoted 6 lines
drivers/xen/xenbus/xenbus_probe_backend.c new file +6
-0+ .bus = { + .name = "xen-backend", + .match = xenbus_match, + .probe = xenbus_dev_probe, + .remove = xenbus_dev_remove, +// .shutdown = xenbus_dev_shutdown,
Delete.
drivers/xen/xenbus/xenbus_xs.c line 5
Quoted 8 lines
drivers/xen/xenbus/xenbus_xs.c new file +5
-0@@ -0,0 +1,840 @@ +/****************************************************************************** +* xenbus_xs.c +* +* This is the kernel equivalent of the "xs" library. We don't need everything +* and we use xenbus_comms for communication.
One line explanation what xs is would be nice.
Pavel
Signature · 1 line
Thanks for all the (sleeping) penguins.
Re: [Xen-devel] Re: [patch 20/20] XEN-paravirt: Add Xen virtual block device driver.
In reply to Arjan van de VenQuoted 5 lines
drivers/block/xen/blkfront.c line 168
Quoted 3 lines
drivers/block/xen/blkfront.c new file +3
-0+ + err =xenbus_printf (xbt, dev->nodename, +"ring-ref" ,"%u" , info->ring_ref);why do you need your own printf?
xenbus_printf isn't a printf replacement - it is used for writing a formatted string into XenStore (which contains VM configuration data in a human-readable form).
Internally it does a vsnprintf into a buffer and writes the resulting string to the XenStore.
Cheers,
Mark
Quoted 21 lines
Quoted 1 line
+static inline int GET_ID_FROM_FREELIST(
does this really need screaming?
Quoted 17 lines
drivers/block/xen/blkfront.c new file +17
-0+ +int blkif_ioctl (struct inode *inode,struct file *filep, +unsigned command,unsigned long argument) +{ +int i; + +DPRINTK_IOCTL ("command: 0x%x, argument: 0x%lx, dev: 0x%04x\n" , + command, (long )argument, inode->i_rdev); + +switch (command) { +case CDROMMULTISESSION : +DPRINTK ("FIXME: support multisession CDs later\n" ); +for (i =0 ; i <sizeof (struct cdrom_multisession ); i++) +if (put_user (0 , (char __user *)(argument + i))) +return -EFAULT ; +return 0 ; +
Quoted 8 lines
drivers/block/xen/blkfront.c line 491
Quoted 5 lines
drivers/block/xen/blkfront.c new file +5
-0+default : +/*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n", +command);*/ +return -EINVAL ;/* same return as native Linux */ + }eh so you implement no ioctls.. why then implement the ioctl method at all?
I'm not familiar with this code... but perhaps the (fake) multisession handling is to keep userspace that queries this happy? I can't really think of anywhere this would apply off the top of my head, though.
Cheers,
Mark
Quoted 24 lines
drivers/block/xen/blkfront.c line 848
Quoted 9 lines
drivers/block/xen/blkfront.c new file +9
-0+static struct xenbus_driver blkfront = { + .name ="vbd" , + .owner =THIS_MODULE , + .ids = blkfront_ids, + .probe = blkfront_probe, + .remove = blkfront_remove, + .resume = blkfront_resume, + .otherend_changed = backend_changed, +};this can be const
drivers/block/xen/block.h line 73
Quoted 2 lines
drivers/block/xen/block.h new file +2
-0+ +#define DPRINTK(_f, _a...) pr_debug(_f, ## _a)why this silly abstraction? Just use
pr_debugin the code directly_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 4 lines
Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel!
Re: [patch 17/20] XEN-paravirt: Add Xen grant table support
In reply to Pavel MachekQuoted 1 line · Pavel Machek
What is going on? Diffstat does not seem to match the diff.
Sorry, forgot to update the diffstat for this one:
drivers/xen/Makefile | 1 drivers/xen/core/Makefile | 1 drivers/xen/core/grant_table.c | 445 ++++++++++++++++++++++++++++++++++++++++ include/xen/grant_table.h | 107 +++++++++ 4 files changed, 554 insertions(+)
J
Re: [patch 16/20] XEN-paravirt: Add the Xen virtual console driver.
In reply to Pavel MachekQuoted 3 lines · Pavel Machek
You have
drivers/xen... so maybearch/i386/xenis easier to type?arch/i386/paravirt/xenwould make some sense, too, but it looks too deep to me.
I think the exact placement of these files needs a bit of work. I don't much care about xen/ vs paravirt/xen vs paravirt-xen/, but placement of headers needs a bit more thought. lhype, er, lguest and vmi are in kernel/, but I think it would be nice to put them near Xen.
J