direct-io.hg

changeset 8029:78b5e590be34

Merged.
author emellor@leeni.uk.xensource.com
date Thu Nov 24 19:57:01 2005 +0000 (2005-11-24)
parents d1e1d6493d1d f887ddae2b03
children b0338759544e 42474df9b248
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Thu Nov 24 19:56:38 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Thu Nov 24 19:57:01 2005 +0000
     1.3 @@ -35,7 +35,6 @@ CONFIG_EXPERIMENTAL=y
     1.4  # CONFIG_CLEAN_COMPILE is not set
     1.5  CONFIG_BROKEN=y
     1.6  CONFIG_BROKEN_ON_SMP=y
     1.7 -CONFIG_LOCK_KERNEL=y
     1.8  CONFIG_INIT_ENV_ARG_LIMIT=32
     1.9  
    1.10  #
    1.11 @@ -125,8 +124,6 @@ CONFIG_X86_USE_PPRO_CHECKSUM=y
    1.12  # CONFIG_HPET_TIMER is not set
    1.13  # CONFIG_HPET_EMULATE_RTC is not set
    1.14  # CONFIG_SMP is not set
    1.15 -CONFIG_PREEMPT=y
    1.16 -CONFIG_PREEMPT_BKL=y
    1.17  # CONFIG_X86_REBOOTFIXUPS is not set
    1.18  CONFIG_MICROCODE=y
    1.19  CONFIG_X86_CPUID=y
    1.20 @@ -141,7 +138,6 @@ CONFIG_HIGHMEM4G=y
    1.21  # CONFIG_HIGHMEM64G is not set
    1.22  CONFIG_HIGHMEM=y
    1.23  CONFIG_MTRR=y
    1.24 -CONFIG_HAVE_DEC_LOCK=y
    1.25  # CONFIG_REGPARM is not set
    1.26  CONFIG_X86_LOCAL_APIC=y
    1.27  CONFIG_X86_IO_APIC=y
    1.28 @@ -1259,7 +1255,6 @@ CONFIG_MAGIC_SYSRQ=y
    1.29  CONFIG_LOG_BUF_SHIFT=14
    1.30  # CONFIG_SCHEDSTATS is not set
    1.31  # CONFIG_DEBUG_SLAB is not set
    1.32 -# CONFIG_DEBUG_PREEMPT is not set
    1.33  # CONFIG_DEBUG_SPINLOCK is not set
    1.34  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
    1.35  # CONFIG_DEBUG_KOBJECT is not set
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Thu Nov 24 19:56:38 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Thu Nov 24 19:57:01 2005 +0000
     2.3 @@ -90,7 +90,6 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y
     2.4  CONFIG_X86_GOOD_APIC=y
     2.5  # CONFIG_HPET_TIMER is not set
     2.6  # CONFIG_SMP is not set
     2.7 -# CONFIG_PREEMPT is not set
     2.8  CONFIG_MICROCODE=y
     2.9  # CONFIG_X86_CPUID is not set
    2.10  CONFIG_SWIOTLB=y
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Thu Nov 24 19:56:38 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Thu Nov 24 19:57:01 2005 +0000
     3.3 @@ -125,8 +125,6 @@ CONFIG_SMP=y
     3.4  CONFIG_SMP_ALTERNATIVES=y
     3.5  CONFIG_NR_CPUS=8
     3.6  # CONFIG_SCHED_SMT is not set
     3.7 -CONFIG_PREEMPT=y
     3.8 -CONFIG_PREEMPT_BKL=y
     3.9  # CONFIG_X86_REBOOTFIXUPS is not set
    3.10  CONFIG_X86_CPUID=y
    3.11  
    3.12 @@ -550,7 +548,6 @@ CONFIG_MAGIC_SYSRQ=y
    3.13  CONFIG_LOG_BUF_SHIFT=14
    3.14  # CONFIG_SCHEDSTATS is not set
    3.15  # CONFIG_DEBUG_SLAB is not set
    3.16 -# CONFIG_DEBUG_PREEMPT is not set
    3.17  # CONFIG_DEBUG_SPINLOCK is not set
    3.18  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
    3.19  # CONFIG_DEBUG_KOBJECT is not set
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Thu Nov 24 19:56:38 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Thu Nov 24 19:57:01 2005 +0000
     4.3 @@ -92,7 +92,6 @@ CONFIG_X86_GOOD_APIC=y
     4.4  CONFIG_SMP=y
     4.5  CONFIG_NR_CPUS=8
     4.6  # CONFIG_SCHED_SMT is not set
     4.7 -# CONFIG_PREEMPT is not set
     4.8  # CONFIG_MICROCODE is not set
     4.9  CONFIG_X86_CPUID=y
    4.10  # CONFIG_NUMA is not set
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Thu Nov 24 19:56:38 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Thu Nov 24 19:57:01 2005 +0000
     5.3 @@ -132,8 +132,6 @@ CONFIG_SMP=y
     5.4  CONFIG_SMP_ALTERNATIVES=y
     5.5  CONFIG_NR_CPUS=8
     5.6  # CONFIG_SCHED_SMT is not set
     5.7 -CONFIG_PREEMPT=y
     5.8 -CONFIG_PREEMPT_BKL=y
     5.9  # CONFIG_X86_REBOOTFIXUPS is not set
    5.10  CONFIG_MICROCODE=y
    5.11  CONFIG_X86_CPUID=m
    5.12 @@ -2951,7 +2949,6 @@ CONFIG_MAGIC_SYSRQ=y
    5.13  CONFIG_LOG_BUF_SHIFT=14
    5.14  # CONFIG_SCHEDSTATS is not set
    5.15  # CONFIG_DEBUG_SLAB is not set
    5.16 -CONFIG_DEBUG_PREEMPT=y
    5.17  # CONFIG_DEBUG_SPINLOCK is not set
    5.18  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
    5.19  # CONFIG_DEBUG_KOBJECT is not set
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64	Thu Nov 24 19:56:38 2005 +0000
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64	Thu Nov 24 19:57:01 2005 +0000
     6.3 @@ -95,7 +95,6 @@ CONFIG_X86_GOOD_APIC=y
     6.4  CONFIG_SMP=y
     6.5  CONFIG_NR_CPUS=8
     6.6  # CONFIG_SCHED_SMT is not set
     6.7 -# CONFIG_PREEMPT is not set
     6.8  CONFIG_MICROCODE=y
     6.9  # CONFIG_X86_CPUID is not set
    6.10  # CONFIG_NUMA is not set
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/Kconfig	Thu Nov 24 19:56:38 2005 +0000
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/Kconfig	Thu Nov 24 19:57:01 2005 +0000
     7.3 @@ -415,17 +415,17 @@ config SCHED_SMT
     7.4  	  cost of slightly increased overhead in some places. If unsure say
     7.5  	  N here.
     7.6  
     7.7 -config PREEMPT
     7.8 -	bool "Preemptible Kernel"
     7.9 -	help
    7.10 -	  This option reduces the latency of the kernel when reacting to
    7.11 -	  real-time or interactive events by allowing a low priority process to
    7.12 -	  be preempted even if it is in kernel mode executing a system call.
    7.13 -	  This allows applications to run more reliably even when the system is
    7.14 -	  under load.
    7.15 -
    7.16 -	  Say Y here if you are building a kernel for a desktop, embedded
    7.17 -	  or real-time system.  Say N if you are unsure.
    7.18 +#config PREEMPT
    7.19 +#	bool "Preemptible Kernel"
    7.20 +#	help
    7.21 +#	  This option reduces the latency of the kernel when reacting to
    7.22 +#	  real-time or interactive events by allowing a low priority process to
    7.23 +#	  be preempted even if it is in kernel mode executing a system call.
    7.24 +#	  This allows applications to run more reliably even when the system is
    7.25 +#	  under load.
    7.26 +#
    7.27 +#	  Say Y here if you are building a kernel for a desktop, embedded
    7.28 +#	  or real-time system.  Say N if you are unsure.
    7.29  
    7.30  config PREEMPT_BKL
    7.31  	bool "Preempt The Big Kernel Lock"
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c	Thu Nov 24 19:56:38 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c	Thu Nov 24 19:57:01 2005 +0000
     8.3 @@ -27,8 +27,9 @@
     8.4  #include <asm-xen/foreign_page.h>
     8.5  #include <asm/hypervisor.h>
     8.6  
     8.7 -static void __pgd_pin(pgd_t *pgd);
     8.8 -static void __pgd_unpin(pgd_t *pgd);
     8.9 +static void pgd_test_and_unpin(pgd_t *pgd);
    8.10 +#define suspend_disable	preempt_disable
    8.11 +#define suspend_enable	preempt_enable
    8.12  
    8.13  void show_mem(void)
    8.14  {
    8.15 @@ -284,33 +285,32 @@ void pgd_ctor(void *pgd, kmem_cache_t *c
    8.16  	BUG_ON(rc);
    8.17  #endif
    8.18  
    8.19 -	if (!HAVE_SHARED_KERNEL_PMD)
    8.20 -		spin_lock_irqsave(&pgd_lock, flags);
    8.21 +	if (HAVE_SHARED_KERNEL_PMD) {
    8.22 +		memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD,
    8.23 +		       swapper_pg_dir + USER_PTRS_PER_PGD,
    8.24 +		       (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
    8.25 +		return;
    8.26 +	}
    8.27  
    8.28 -	memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD,
    8.29 -			swapper_pg_dir + USER_PTRS_PER_PGD,
    8.30 -			(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
    8.31 +	memset(pgd, 0, PTRS_PER_PGD*sizeof(pgd_t));
    8.32  
    8.33 -	if (HAVE_SHARED_KERNEL_PMD)
    8.34 -		return;
    8.35 -
    8.36 +	spin_lock_irqsave(&pgd_lock, flags);
    8.37  	pgd_list_add(pgd);
    8.38  	spin_unlock_irqrestore(&pgd_lock, flags);
    8.39 -	memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t));
    8.40  }
    8.41  
    8.42  void pgd_dtor(void *pgd, kmem_cache_t *cache, unsigned long unused)
    8.43  {
    8.44  	unsigned long flags; /* can be called from interrupt context */
    8.45  
    8.46 -	BUG_ON(test_bit(PG_pinned, &virt_to_page(pgd)->flags));
    8.47 -
    8.48  	if (HAVE_SHARED_KERNEL_PMD)
    8.49  		return;
    8.50  
    8.51  	spin_lock_irqsave(&pgd_lock, flags);
    8.52  	pgd_list_del(pgd);
    8.53  	spin_unlock_irqrestore(&pgd_lock, flags);
    8.54 +
    8.55 +	pgd_test_and_unpin(pgd);
    8.56  }
    8.57  
    8.58  pgd_t *pgd_alloc(struct mm_struct *mm)
    8.59 @@ -318,7 +318,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
    8.60  	int i = 0;
    8.61  	pgd_t *pgd = kmem_cache_alloc(pgd_cache, GFP_KERNEL);
    8.62  
    8.63 -	BUG_ON(test_bit(PG_pinned, &virt_to_page(pgd)->flags));
    8.64 +	pgd_test_and_unpin(pgd);
    8.65  
    8.66  	if (PTRS_PER_PMD == 1 || !pgd)
    8.67  		return pgd;
    8.68 @@ -345,7 +345,11 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
    8.69  		pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
    8.70  		if (!pmd)
    8.71  			goto out_oom;
    8.72 +		suspend_disable();
    8.73 +		if (test_bit(PG_pinned, &virt_to_page(pgd)->flags))
    8.74 +			make_lowmem_page_readonly(pmd);
    8.75  		set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
    8.76 +		suspend_enable();
    8.77  	}
    8.78  	return pgd;
    8.79  
    8.80 @@ -360,23 +364,28 @@ void pgd_free(pgd_t *pgd)
    8.81  {
    8.82  	int i;
    8.83  
    8.84 -	if (test_bit(PG_pinned, &virt_to_page(pgd)->flags))
    8.85 -		__pgd_unpin(pgd);
    8.86 +	suspend_disable();
    8.87 +	pgd_test_and_unpin(pgd);
    8.88  
    8.89  	/* in the PAE case user pgd entries are overwritten before usage */
    8.90  	if (PTRS_PER_PMD > 1) {
    8.91  		for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
    8.92  			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
    8.93 +			set_pgd(&pgd[i], __pgd(0));
    8.94  			make_lowmem_page_writable(pmd);
    8.95  			kmem_cache_free(pmd_cache, pmd);
    8.96  		}
    8.97  		if (!HAVE_SHARED_KERNEL_PMD) {
    8.98  			pmd_t *pmd = (void *)__va(pgd_val(pgd[USER_PTRS_PER_PGD])-1);
    8.99 +			set_pgd(&pgd[USER_PTRS_PER_PGD], __pgd(0));
   8.100  			make_lowmem_page_writable(pmd);
   8.101  			memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
   8.102  			kmem_cache_free(pmd_cache, pmd);
   8.103  		}
   8.104  	}
   8.105 +
   8.106 +	suspend_enable();
   8.107 +
   8.108  	/* in the non-PAE case, free_pgtables() clears user pgd entries */
   8.109  	kmem_cache_free(pgd_cache, pgd);
   8.110  }
   8.111 @@ -501,6 +510,9 @@ static void pgd_walk(pgd_t *pgd_base, pg
   8.112  
   8.113  static void __pgd_pin(pgd_t *pgd)
   8.114  {
   8.115 +	/* PAE PGDs with no kernel PMD cannot be pinned. Bail right now. */
   8.116 +	if ((PTRS_PER_PMD > 1) && pgd_none(pgd[USER_PTRS_PER_PGD]))
   8.117 +		return;
   8.118  	pgd_walk(pgd, PAGE_KERNEL_RO);
   8.119  	xen_pgd_pin(__pa(pgd));
   8.120  	set_bit(PG_pinned, &virt_to_page(pgd)->flags);
   8.121 @@ -513,6 +525,14 @@ static void __pgd_unpin(pgd_t *pgd)
   8.122  	clear_bit(PG_pinned, &virt_to_page(pgd)->flags);
   8.123  }
   8.124  
   8.125 +static void pgd_test_and_unpin(pgd_t *pgd)
   8.126 +{
   8.127 +	suspend_disable();
   8.128 +	if (test_bit(PG_pinned, &virt_to_page(pgd)->flags))
   8.129 +		__pgd_unpin(pgd);
   8.130 +	suspend_enable();
   8.131 +}
   8.132 +
   8.133  void mm_pin(struct mm_struct *mm)
   8.134  {
   8.135  	spin_lock(&mm->page_table_lock);
     9.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/Kconfig	Thu Nov 24 19:56:38 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/Kconfig	Thu Nov 24 19:57:01 2005 +0000
     9.3 @@ -224,21 +224,21 @@ config SMP
     9.4  
     9.5  	  If you don't know what to do here, say N.
     9.6  
     9.7 -config PREEMPT
     9.8 -	bool "Preemptible Kernel"
     9.9 -	---help---
    9.10 -	  This option reduces the latency of the kernel when reacting to
    9.11 -	  real-time or interactive events by allowing a low priority process to
    9.12 -	  be preempted even if it is in kernel mode executing a system call.
    9.13 -	  This allows applications to run more reliably even when the system is
    9.14 -	  under load. On contrary it may also break your drivers and add
    9.15 -	  priority inheritance problems to your system. Don't select it if
    9.16 -	  you rely on a stable system or have slightly obscure hardware.
    9.17 -	  It's also not very well tested on x86-64 currently.
    9.18 -	  You have been warned.
    9.19 -
    9.20 -	  Say Y here if you are feeling brave and building a kernel for a
    9.21 -	  desktop, embedded or real-time system.  Say N if you are unsure.
    9.22 +#config PREEMPT
    9.23 +#	bool "Preemptible Kernel"
    9.24 +#	---help---
    9.25 +#	  This option reduces the latency of the kernel when reacting to
    9.26 +#	  real-time or interactive events by allowing a low priority process to
    9.27 +#	  be preempted even if it is in kernel mode executing a system call.
    9.28 +#	  This allows applications to run more reliably even when the system is
    9.29 +#	  under load. On contrary it may also break your drivers and add
    9.30 +#	  priority inheritance problems to your system. Don't select it if
    9.31 +#	  you rely on a stable system or have slightly obscure hardware.
    9.32 +#	  It's also not very well tested on x86-64 currently.
    9.33 +#	  You have been warned.
    9.34 +#
    9.35 +#	  Say Y here if you are feeling brave and building a kernel for a
    9.36 +#	  desktop, embedded or real-time system.  Say N if you are unsure.
    9.37  
    9.38  config SCHED_SMT
    9.39  	bool "SMT (Hyperthreading) scheduler support"
    10.1 --- a/xen/common/grant_table.c	Thu Nov 24 19:56:38 2005 +0000
    10.2 +++ b/xen/common/grant_table.c	Thu Nov 24 19:57:01 2005 +0000
    10.3 @@ -726,10 +726,11 @@ gnttab_transfer(
    10.4               unlikely(e->tot_pages >= e->max_pages) ||
    10.5               unlikely(!gnttab_prepare_for_transfer(e, d, gop.ref)) )
    10.6          {
    10.7 -            DPRINTK("gnttab_transfer: Transferee has no reservation headroom "
    10.8 -                    "(%d,%d) or provided a bad grant ref (%08x) or "
    10.9 -                    "is dying (%lx)\n",
   10.10 -                    e->tot_pages, e->max_pages, gop.ref, e->domain_flags);
   10.11 +            if ( !test_bit(_DOMF_dying, &e->domain_flags) )
   10.12 +                DPRINTK("gnttab_transfer: Transferee has no reservation "
   10.13 +                        "headroom (%d,%d) or provided a bad grant ref (%08x) "
   10.14 +                        "or is dying (%lx)\n",
   10.15 +                        e->tot_pages, e->max_pages, gop.ref, e->domain_flags);
   10.16              spin_unlock(&e->page_alloc_lock);
   10.17              put_domain(e);
   10.18              (void)__put_user(GNTST_general_error, &uop[i].status);
    11.1 --- a/xen/include/asm-x86/flushtlb.h	Thu Nov 24 19:56:38 2005 +0000
    11.2 +++ b/xen/include/asm-x86/flushtlb.h	Thu Nov 24 19:57:01 2005 +0000
    11.3 @@ -97,7 +97,7 @@ extern void write_cr3(unsigned long cr3)
    11.4  extern void flush_tlb_all_pge(void);
    11.5  extern void __flush_tlb_mask(cpumask_t mask, unsigned long va);
    11.6  #define flush_tlb_mask(mask)       __flush_tlb_mask(mask,FLUSHVA_ALL)
    11.7 -#define flush_tlb_one_mask(mask,v) __flush_tlb_mask(mask,v)
    11.8 +#define flush_tlb_one_mask(mask,v) __flush_tlb_mask(mask,(unsigned long)(v))
    11.9  #endif
   11.10  
   11.11  #endif /* __FLUSHTLB_H__ */