ia64/xen-unstable

changeset 7102:7598dc3ed0cb

Fix preemptible uses of smp_processor_id() in page fault
handler.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Sep 28 15:00:48 2005 +0100 (2005-09-28)
parents eae0c4f0aafd
children 3eda5c985d67
files linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Wed Sep 28 14:29:35 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Wed Sep 28 15:00:48 2005 +0100
     1.3 @@ -209,7 +209,10 @@ static void dump_fault_path(unsigned lon
     1.4  {
     1.5  	unsigned long *p, page;
     1.6  
     1.7 -        page = __pa(per_cpu(cur_pgd, smp_processor_id()));
     1.8 +	preempt_disable();
     1.9 +	page = __pa(per_cpu(cur_pgd, smp_processor_id()));
    1.10 +	preempt_enable();
    1.11 +
    1.12  	p  = (unsigned long *)__va(page);
    1.13  	p += (address >> 30) * 2;
    1.14  	printk(KERN_ALERT "%08lx -> *pde = %08lx:%08lx\n", page, p[1], p[0]);
    1.15 @@ -237,8 +240,13 @@ static void dump_fault_path(unsigned lon
    1.16  {
    1.17  	unsigned long page;
    1.18  
    1.19 +	preempt_disable();
    1.20  	page = ((unsigned long *) per_cpu(cur_pgd, smp_processor_id()))
    1.21  	    [address >> 22];
    1.22 +	preempt_enable();
    1.23 +
    1.24 +	page = ((unsigned long *) per_cpu(cur_pgd, get_cpu()))
    1.25 +	    [address >> 22];
    1.26  	printk(KERN_ALERT "*pde = ma %08lx pa %08lx\n", page,
    1.27  	       machine_to_phys(page));
    1.28  	/*
    1.29 @@ -567,7 +575,9 @@ vmalloc_fault:
    1.30  		pmd_t *pmd, *pmd_k;
    1.31  		pte_t *pte_k;
    1.32  
    1.33 +		preempt_disable();
    1.34  		pgd = index + per_cpu(cur_pgd, smp_processor_id());
    1.35 +		preempt_enable();
    1.36  		pgd_k = init_mm.pgd + index;
    1.37  
    1.38  		if (!pgd_present(*pgd_k))
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Wed Sep 28 14:29:35 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Wed Sep 28 15:00:48 2005 +0100
     2.3 @@ -149,7 +149,9 @@ void dump_pagetable(unsigned long addres
     2.4  	pmd_t *pmd;
     2.5  	pte_t *pte;
     2.6  
     2.7 +	preempt_disable();
     2.8  	pgd = (pgd_t *)per_cpu(cur_pgd, smp_processor_id());
     2.9 +	preempt_enable();
    2.10  	pgd += pgd_index(address);
    2.11  
    2.12  	printk("PGD %lx ", pgd_val(*pgd));
    2.13 @@ -252,7 +254,9 @@ static int vmalloc_fault(unsigned long a
    2.14  
    2.15  	/* On Xen the line below does not always work. Needs investigating! */
    2.16  	/*pgd = pgd_offset(current->mm ?: &init_mm, address);*/
    2.17 +	preempt_disable();
    2.18  	pgd = (pgd_t *)per_cpu(cur_pgd, smp_processor_id());
    2.19 +	preempt_enable();
    2.20  	pgd += pgd_index(address);
    2.21  
    2.22  	pgd_ref = pgd_offset_k(address);