Commit 869c34f5 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-fixes-for-linus' of...

Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: ce4100: Set pci ops via callback instead of module init
  x86/mm: Fix pgd_lock deadlock
  x86/mm: Handle mm_fault_error() in kernel space
  x86: Don't check for BIOS corruption in first 64K when there's no need to
parents 52d3c036 03150171
#ifndef _ASM_CE4100_H_
#define _ASM_CE4100_H_
int ce4100_pci_init(void);
#endif
...@@ -106,8 +106,8 @@ void __init setup_bios_corruption_check(void) ...@@ -106,8 +106,8 @@ void __init setup_bios_corruption_check(void)
addr += size; addr += size;
} }
printk(KERN_INFO "Scanning %d areas for low memory corruption\n", if (num_scan_areas)
num_scan_areas); printk(KERN_INFO "Scanning %d areas for low memory corruption\n", num_scan_areas);
} }
...@@ -148,7 +148,7 @@ static void check_corruption(struct work_struct *dummy) ...@@ -148,7 +148,7 @@ static void check_corruption(struct work_struct *dummy)
static int start_periodic_check_for_corruption(void) static int start_periodic_check_for_corruption(void)
{ {
if (!memory_corruption_check || corruption_check_period == 0) if (!num_scan_areas || !memory_corruption_check || corruption_check_period == 0)
return 0; return 0;
printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n", printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
......
...@@ -229,15 +229,14 @@ void vmalloc_sync_all(void) ...@@ -229,15 +229,14 @@ void vmalloc_sync_all(void)
for (address = VMALLOC_START & PMD_MASK; for (address = VMALLOC_START & PMD_MASK;
address >= TASK_SIZE && address < FIXADDR_TOP; address >= TASK_SIZE && address < FIXADDR_TOP;
address += PMD_SIZE) { address += PMD_SIZE) {
unsigned long flags;
struct page *page; struct page *page;
spin_lock_irqsave(&pgd_lock, flags); spin_lock(&pgd_lock);
list_for_each_entry(page, &pgd_list, lru) { list_for_each_entry(page, &pgd_list, lru) {
spinlock_t *pgt_lock; spinlock_t *pgt_lock;
pmd_t *ret; pmd_t *ret;
/* the pgt_lock only for Xen */
pgt_lock = &pgd_page_get_mm(page)->page_table_lock; pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
spin_lock(pgt_lock); spin_lock(pgt_lock);
...@@ -247,7 +246,7 @@ void vmalloc_sync_all(void) ...@@ -247,7 +246,7 @@ void vmalloc_sync_all(void)
if (!ret) if (!ret)
break; break;
} }
spin_unlock_irqrestore(&pgd_lock, flags); spin_unlock(&pgd_lock);
} }
} }
...@@ -828,6 +827,13 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, ...@@ -828,6 +827,13 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
unsigned long address, unsigned int fault) unsigned long address, unsigned int fault)
{ {
if (fault & VM_FAULT_OOM) { if (fault & VM_FAULT_OOM) {
/* Kernel mode? Handle exceptions or die: */
if (!(error_code & PF_USER)) {
up_read(&current->mm->mmap_sem);
no_context(regs, error_code, address);
return;
}
out_of_memory(regs, error_code, address); out_of_memory(regs, error_code, address);
} else { } else {
if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON| if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|
......
...@@ -105,18 +105,18 @@ void sync_global_pgds(unsigned long start, unsigned long end) ...@@ -105,18 +105,18 @@ void sync_global_pgds(unsigned long start, unsigned long end)
for (address = start; address <= end; address += PGDIR_SIZE) { for (address = start; address <= end; address += PGDIR_SIZE) {
const pgd_t *pgd_ref = pgd_offset_k(address); const pgd_t *pgd_ref = pgd_offset_k(address);
unsigned long flags;
struct page *page; struct page *page;
if (pgd_none(*pgd_ref)) if (pgd_none(*pgd_ref))
continue; continue;
spin_lock_irqsave(&pgd_lock, flags); spin_lock(&pgd_lock);
list_for_each_entry(page, &pgd_list, lru) { list_for_each_entry(page, &pgd_list, lru) {
pgd_t *pgd; pgd_t *pgd;
spinlock_t *pgt_lock; spinlock_t *pgt_lock;
pgd = (pgd_t *)page_address(page) + pgd_index(address); pgd = (pgd_t *)page_address(page) + pgd_index(address);
/* the pgt_lock only for Xen */
pgt_lock = &pgd_page_get_mm(page)->page_table_lock; pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
spin_lock(pgt_lock); spin_lock(pgt_lock);
...@@ -128,7 +128,7 @@ void sync_global_pgds(unsigned long start, unsigned long end) ...@@ -128,7 +128,7 @@ void sync_global_pgds(unsigned long start, unsigned long end)
spin_unlock(pgt_lock); spin_unlock(pgt_lock);
} }
spin_unlock_irqrestore(&pgd_lock, flags); spin_unlock(&pgd_lock);
} }
} }
......
...@@ -57,12 +57,10 @@ static unsigned long direct_pages_count[PG_LEVEL_NUM]; ...@@ -57,12 +57,10 @@ static unsigned long direct_pages_count[PG_LEVEL_NUM];
void update_page_count(int level, unsigned long pages) void update_page_count(int level, unsigned long pages)
{ {
unsigned long flags;
/* Protect against CPA */ /* Protect against CPA */
spin_lock_irqsave(&pgd_lock, flags); spin_lock(&pgd_lock);
direct_pages_count[level] += pages; direct_pages_count[level] += pages;
spin_unlock_irqrestore(&pgd_lock, flags); spin_unlock(&pgd_lock);
} }
static void split_page_count(int level) static void split_page_count(int level)
...@@ -394,7 +392,7 @@ static int ...@@ -394,7 +392,7 @@ static int
try_preserve_large_page(pte_t *kpte, unsigned long address, try_preserve_large_page(pte_t *kpte, unsigned long address,
struct cpa_data *cpa) struct cpa_data *cpa)
{ {
unsigned long nextpage_addr, numpages, pmask, psize, flags, addr, pfn; unsigned long nextpage_addr, numpages, pmask, psize, addr, pfn;
pte_t new_pte, old_pte, *tmp; pte_t new_pte, old_pte, *tmp;
pgprot_t old_prot, new_prot, req_prot; pgprot_t old_prot, new_prot, req_prot;
int i, do_split = 1; int i, do_split = 1;
...@@ -403,7 +401,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, ...@@ -403,7 +401,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
if (cpa->force_split) if (cpa->force_split)
return 1; return 1;
spin_lock_irqsave(&pgd_lock, flags); spin_lock(&pgd_lock);
/* /*
* Check for races, another CPU might have split this page * Check for races, another CPU might have split this page
* up already: * up already:
...@@ -498,14 +496,14 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, ...@@ -498,14 +496,14 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
} }
out_unlock: out_unlock:
spin_unlock_irqrestore(&pgd_lock, flags); spin_unlock(&pgd_lock);
return do_split; return do_split;
} }
static int split_large_page(pte_t *kpte, unsigned long address) static int split_large_page(pte_t *kpte, unsigned long address)
{ {
unsigned long flags, pfn, pfninc = 1; unsigned long pfn, pfninc = 1;
unsigned int i, level; unsigned int i, level;
pte_t *pbase, *tmp; pte_t *pbase, *tmp;
pgprot_t ref_prot; pgprot_t ref_prot;
...@@ -519,7 +517,7 @@ static int split_large_page(pte_t *kpte, unsigned long address) ...@@ -519,7 +517,7 @@ static int split_large_page(pte_t *kpte, unsigned long address)
if (!base) if (!base)
return -ENOMEM; return -ENOMEM;
spin_lock_irqsave(&pgd_lock, flags); spin_lock(&pgd_lock);
/* /*
* Check for races, another CPU might have split this page * Check for races, another CPU might have split this page
* up for us already: * up for us already:
...@@ -591,7 +589,7 @@ static int split_large_page(pte_t *kpte, unsigned long address) ...@@ -591,7 +589,7 @@ static int split_large_page(pte_t *kpte, unsigned long address)
*/ */
if (base) if (base)
__free_page(base); __free_page(base);
spin_unlock_irqrestore(&pgd_lock, flags); spin_unlock(&pgd_lock);
return 0; return 0;
} }
......
...@@ -121,14 +121,12 @@ static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd) ...@@ -121,14 +121,12 @@ static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd)
static void pgd_dtor(pgd_t *pgd) static void pgd_dtor(pgd_t *pgd)
{ {
unsigned long flags; /* can be called from interrupt context */
if (SHARED_KERNEL_PMD) if (SHARED_KERNEL_PMD)
return; return;
spin_lock_irqsave(&pgd_lock, flags); spin_lock(&pgd_lock);
pgd_list_del(pgd); pgd_list_del(pgd);
spin_unlock_irqrestore(&pgd_lock, flags); spin_unlock(&pgd_lock);
} }
/* /*
...@@ -260,7 +258,6 @@ pgd_t *pgd_alloc(struct mm_struct *mm) ...@@ -260,7 +258,6 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
{ {
pgd_t *pgd; pgd_t *pgd;
pmd_t *pmds[PREALLOCATED_PMDS]; pmd_t *pmds[PREALLOCATED_PMDS];
unsigned long flags;
pgd = (pgd_t *)__get_free_page(PGALLOC_GFP); pgd = (pgd_t *)__get_free_page(PGALLOC_GFP);
...@@ -280,12 +277,12 @@ pgd_t *pgd_alloc(struct mm_struct *mm) ...@@ -280,12 +277,12 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
* respect to anything walking the pgd_list, so that they * respect to anything walking the pgd_list, so that they
* never see a partially populated pgd. * never see a partially populated pgd.
*/ */
spin_lock_irqsave(&pgd_lock, flags); spin_lock(&pgd_lock);
pgd_ctor(mm, pgd); pgd_ctor(mm, pgd);
pgd_prepopulate_pmd(mm, pgd, pmds); pgd_prepopulate_pmd(mm, pgd, pmds);
spin_unlock_irqrestore(&pgd_lock, flags); spin_unlock(&pgd_lock);
return pgd; return pgd;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/ce4100.h>
#include <asm/pci_x86.h> #include <asm/pci_x86.h>
struct sim_reg { struct sim_reg {
...@@ -306,10 +307,10 @@ struct pci_raw_ops ce4100_pci_conf = { ...@@ -306,10 +307,10 @@ struct pci_raw_ops ce4100_pci_conf = {
.write = ce4100_conf_write, .write = ce4100_conf_write,
}; };
static int __init ce4100_pci_init(void) int __init ce4100_pci_init(void)
{ {
init_sim_regs(); init_sim_regs();
raw_pci_ops = &ce4100_pci_conf; raw_pci_ops = &ce4100_pci_conf;
return 0; /* Indicate caller that it should invoke pci_legacy_init() */
return 1;
} }
subsys_initcall(ce4100_pci_init);
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <asm/ce4100.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -129,4 +130,5 @@ void __init x86_ce4100_early_setup(void) ...@@ -129,4 +130,5 @@ void __init x86_ce4100_early_setup(void)
x86_init.resources.probe_roms = x86_init_noop; x86_init.resources.probe_roms = x86_init_noop;
x86_init.mpparse.get_smp_config = x86_init_uint_noop; x86_init.mpparse.get_smp_config = x86_init_uint_noop;
x86_init.mpparse.find_smp_config = sdv_find_smp_config; x86_init.mpparse.find_smp_config = sdv_find_smp_config;
x86_init.pci.init = ce4100_pci_init;
} }
...@@ -986,10 +986,9 @@ static void xen_pgd_pin(struct mm_struct *mm) ...@@ -986,10 +986,9 @@ static void xen_pgd_pin(struct mm_struct *mm)
*/ */
void xen_mm_pin_all(void) void xen_mm_pin_all(void)
{ {
unsigned long flags;
struct page *page; struct page *page;
spin_lock_irqsave(&pgd_lock, flags); spin_lock(&pgd_lock);
list_for_each_entry(page, &pgd_list, lru) { list_for_each_entry(page, &pgd_list, lru) {
if (!PagePinned(page)) { if (!PagePinned(page)) {
...@@ -998,7 +997,7 @@ void xen_mm_pin_all(void) ...@@ -998,7 +997,7 @@ void xen_mm_pin_all(void)
} }
} }
spin_unlock_irqrestore(&pgd_lock, flags); spin_unlock(&pgd_lock);
} }
/* /*
...@@ -1099,10 +1098,9 @@ static void xen_pgd_unpin(struct mm_struct *mm) ...@@ -1099,10 +1098,9 @@ static void xen_pgd_unpin(struct mm_struct *mm)
*/ */
void xen_mm_unpin_all(void) void xen_mm_unpin_all(void)
{ {
unsigned long flags;
struct page *page; struct page *page;
spin_lock_irqsave(&pgd_lock, flags); spin_lock(&pgd_lock);
list_for_each_entry(page, &pgd_list, lru) { list_for_each_entry(page, &pgd_list, lru) {
if (PageSavePinned(page)) { if (PageSavePinned(page)) {
...@@ -1112,7 +1110,7 @@ void xen_mm_unpin_all(void) ...@@ -1112,7 +1110,7 @@ void xen_mm_unpin_all(void)
} }
} }
spin_unlock_irqrestore(&pgd_lock, flags); spin_unlock(&pgd_lock);
} }
void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next) void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment