Skip to content

Commit 869c34f

Browse files
committed
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
2 parents 52d3c03 + 0315017 commit 869c34f

File tree

9 files changed

+45
-37
lines changed

9 files changed

+45
-37
lines changed

arch/x86/include/asm/ce4100.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef _ASM_CE4100_H_
2+
#define _ASM_CE4100_H_
3+
4+
int ce4100_pci_init(void);
5+
6+
#endif

arch/x86/kernel/check.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ void __init setup_bios_corruption_check(void)
106106
addr += size;
107107
}
108108

109-
printk(KERN_INFO "Scanning %d areas for low memory corruption\n",
110-
num_scan_areas);
109+
if (num_scan_areas)
110+
printk(KERN_INFO "Scanning %d areas for low memory corruption\n", num_scan_areas);
111111
}
112112

113113

@@ -143,12 +143,12 @@ static void check_corruption(struct work_struct *dummy)
143143
{
144144
check_for_bios_corruption();
145145
schedule_delayed_work(&bios_check_work,
146-
round_jiffies_relative(corruption_check_period*HZ));
146+
round_jiffies_relative(corruption_check_period*HZ));
147147
}
148148

149149
static int start_periodic_check_for_corruption(void)
150150
{
151-
if (!memory_corruption_check || corruption_check_period == 0)
151+
if (!num_scan_areas || !memory_corruption_check || corruption_check_period == 0)
152152
return 0;
153153

154154
printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",

arch/x86/mm/fault.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,14 @@ void vmalloc_sync_all(void)
229229
for (address = VMALLOC_START & PMD_MASK;
230230
address >= TASK_SIZE && address < FIXADDR_TOP;
231231
address += PMD_SIZE) {
232-
233-
unsigned long flags;
234232
struct page *page;
235233

236-
spin_lock_irqsave(&pgd_lock, flags);
234+
spin_lock(&pgd_lock);
237235
list_for_each_entry(page, &pgd_list, lru) {
238236
spinlock_t *pgt_lock;
239237
pmd_t *ret;
240238

239+
/* the pgt_lock only for Xen */
241240
pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
242241

243242
spin_lock(pgt_lock);
@@ -247,7 +246,7 @@ void vmalloc_sync_all(void)
247246
if (!ret)
248247
break;
249248
}
250-
spin_unlock_irqrestore(&pgd_lock, flags);
249+
spin_unlock(&pgd_lock);
251250
}
252251
}
253252

@@ -828,6 +827,13 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
828827
unsigned long address, unsigned int fault)
829828
{
830829
if (fault & VM_FAULT_OOM) {
830+
/* Kernel mode? Handle exceptions or die: */
831+
if (!(error_code & PF_USER)) {
832+
up_read(&current->mm->mmap_sem);
833+
no_context(regs, error_code, address);
834+
return;
835+
}
836+
831837
out_of_memory(regs, error_code, address);
832838
} else {
833839
if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|

arch/x86/mm/init_64.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,18 @@ void sync_global_pgds(unsigned long start, unsigned long end)
105105

106106
for (address = start; address <= end; address += PGDIR_SIZE) {
107107
const pgd_t *pgd_ref = pgd_offset_k(address);
108-
unsigned long flags;
109108
struct page *page;
110109

111110
if (pgd_none(*pgd_ref))
112111
continue;
113112

114-
spin_lock_irqsave(&pgd_lock, flags);
113+
spin_lock(&pgd_lock);
115114
list_for_each_entry(page, &pgd_list, lru) {
116115
pgd_t *pgd;
117116
spinlock_t *pgt_lock;
118117

119118
pgd = (pgd_t *)page_address(page) + pgd_index(address);
119+
/* the pgt_lock only for Xen */
120120
pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
121121
spin_lock(pgt_lock);
122122

@@ -128,7 +128,7 @@ void sync_global_pgds(unsigned long start, unsigned long end)
128128

129129
spin_unlock(pgt_lock);
130130
}
131-
spin_unlock_irqrestore(&pgd_lock, flags);
131+
spin_unlock(&pgd_lock);
132132
}
133133
}
134134

arch/x86/mm/pageattr.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ static unsigned long direct_pages_count[PG_LEVEL_NUM];
5757

5858
void update_page_count(int level, unsigned long pages)
5959
{
60-
unsigned long flags;
61-
6260
/* Protect against CPA */
63-
spin_lock_irqsave(&pgd_lock, flags);
61+
spin_lock(&pgd_lock);
6462
direct_pages_count[level] += pages;
65-
spin_unlock_irqrestore(&pgd_lock, flags);
63+
spin_unlock(&pgd_lock);
6664
}
6765

6866
static void split_page_count(int level)
@@ -394,7 +392,7 @@ static int
394392
try_preserve_large_page(pte_t *kpte, unsigned long address,
395393
struct cpa_data *cpa)
396394
{
397-
unsigned long nextpage_addr, numpages, pmask, psize, flags, addr, pfn;
395+
unsigned long nextpage_addr, numpages, pmask, psize, addr, pfn;
398396
pte_t new_pte, old_pte, *tmp;
399397
pgprot_t old_prot, new_prot, req_prot;
400398
int i, do_split = 1;
@@ -403,7 +401,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
403401
if (cpa->force_split)
404402
return 1;
405403

406-
spin_lock_irqsave(&pgd_lock, flags);
404+
spin_lock(&pgd_lock);
407405
/*
408406
* Check for races, another CPU might have split this page
409407
* up already:
@@ -498,14 +496,14 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
498496
}
499497

500498
out_unlock:
501-
spin_unlock_irqrestore(&pgd_lock, flags);
499+
spin_unlock(&pgd_lock);
502500

503501
return do_split;
504502
}
505503

506504
static int split_large_page(pte_t *kpte, unsigned long address)
507505
{
508-
unsigned long flags, pfn, pfninc = 1;
506+
unsigned long pfn, pfninc = 1;
509507
unsigned int i, level;
510508
pte_t *pbase, *tmp;
511509
pgprot_t ref_prot;
@@ -519,7 +517,7 @@ static int split_large_page(pte_t *kpte, unsigned long address)
519517
if (!base)
520518
return -ENOMEM;
521519

522-
spin_lock_irqsave(&pgd_lock, flags);
520+
spin_lock(&pgd_lock);
523521
/*
524522
* Check for races, another CPU might have split this page
525523
* up for us already:
@@ -591,7 +589,7 @@ static int split_large_page(pte_t *kpte, unsigned long address)
591589
*/
592590
if (base)
593591
__free_page(base);
594-
spin_unlock_irqrestore(&pgd_lock, flags);
592+
spin_unlock(&pgd_lock);
595593

596594
return 0;
597595
}

arch/x86/mm/pgtable.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,12 @@ static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd)
121121

122122
static void pgd_dtor(pgd_t *pgd)
123123
{
124-
unsigned long flags; /* can be called from interrupt context */
125-
126124
if (SHARED_KERNEL_PMD)
127125
return;
128126

129-
spin_lock_irqsave(&pgd_lock, flags);
127+
spin_lock(&pgd_lock);
130128
pgd_list_del(pgd);
131-
spin_unlock_irqrestore(&pgd_lock, flags);
129+
spin_unlock(&pgd_lock);
132130
}
133131

134132
/*
@@ -260,7 +258,6 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
260258
{
261259
pgd_t *pgd;
262260
pmd_t *pmds[PREALLOCATED_PMDS];
263-
unsigned long flags;
264261

265262
pgd = (pgd_t *)__get_free_page(PGALLOC_GFP);
266263

@@ -280,12 +277,12 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
280277
* respect to anything walking the pgd_list, so that they
281278
* never see a partially populated pgd.
282279
*/
283-
spin_lock_irqsave(&pgd_lock, flags);
280+
spin_lock(&pgd_lock);
284281

285282
pgd_ctor(mm, pgd);
286283
pgd_prepopulate_pmd(mm, pgd, pmds);
287284

288-
spin_unlock_irqrestore(&pgd_lock, flags);
285+
spin_unlock(&pgd_lock);
289286

290287
return pgd;
291288

arch/x86/pci/ce4100.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <linux/pci.h>
3535
#include <linux/init.h>
3636

37+
#include <asm/ce4100.h>
3738
#include <asm/pci_x86.h>
3839

3940
struct sim_reg {
@@ -306,10 +307,10 @@ struct pci_raw_ops ce4100_pci_conf = {
306307
.write = ce4100_conf_write,
307308
};
308309

309-
static int __init ce4100_pci_init(void)
310+
int __init ce4100_pci_init(void)
310311
{
311312
init_sim_regs();
312313
raw_pci_ops = &ce4100_pci_conf;
313-
return 0;
314+
/* Indicate caller that it should invoke pci_legacy_init() */
315+
return 1;
314316
}
315-
subsys_initcall(ce4100_pci_init);

arch/x86/platform/ce4100/ce4100.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/serial_reg.h>
1616
#include <linux/serial_8250.h>
1717

18+
#include <asm/ce4100.h>
1819
#include <asm/setup.h>
1920
#include <asm/io.h>
2021

@@ -129,4 +130,5 @@ void __init x86_ce4100_early_setup(void)
129130
x86_init.resources.probe_roms = x86_init_noop;
130131
x86_init.mpparse.get_smp_config = x86_init_uint_noop;
131132
x86_init.mpparse.find_smp_config = sdv_find_smp_config;
133+
x86_init.pci.init = ce4100_pci_init;
132134
}

arch/x86/xen/mmu.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -986,10 +986,9 @@ static void xen_pgd_pin(struct mm_struct *mm)
986986
*/
987987
void xen_mm_pin_all(void)
988988
{
989-
unsigned long flags;
990989
struct page *page;
991990

992-
spin_lock_irqsave(&pgd_lock, flags);
991+
spin_lock(&pgd_lock);
993992

994993
list_for_each_entry(page, &pgd_list, lru) {
995994
if (!PagePinned(page)) {
@@ -998,7 +997,7 @@ void xen_mm_pin_all(void)
998997
}
999998
}
1000999

1001-
spin_unlock_irqrestore(&pgd_lock, flags);
1000+
spin_unlock(&pgd_lock);
10021001
}
10031002

10041003
/*
@@ -1099,10 +1098,9 @@ static void xen_pgd_unpin(struct mm_struct *mm)
10991098
*/
11001099
void xen_mm_unpin_all(void)
11011100
{
1102-
unsigned long flags;
11031101
struct page *page;
11041102

1105-
spin_lock_irqsave(&pgd_lock, flags);
1103+
spin_lock(&pgd_lock);
11061104

11071105
list_for_each_entry(page, &pgd_list, lru) {
11081106
if (PageSavePinned(page)) {
@@ -1112,7 +1110,7 @@ void xen_mm_unpin_all(void)
11121110
}
11131111
}
11141112

1115-
spin_unlock_irqrestore(&pgd_lock, flags);
1113+
spin_unlock(&pgd_lock);
11161114
}
11171115

11181116
void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next)

0 commit comments

Comments
 (0)