blob: 7462aebd3eb638f769545f8bd723664809757563 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * arch/s390/mm/fault.c
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com)
7 * Ulrich Weigand (uweigand@de.ibm.com)
8 *
9 * Derived from "arch/i386/mm/fault.c"
10 * Copyright (C) 1995 Linus Torvalds
11 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/signal.h>
14#include <linux/sched.h>
15#include <linux/kernel.h>
16#include <linux/errno.h>
17#include <linux/string.h>
18#include <linux/types.h>
19#include <linux/ptrace.h>
20#include <linux/mman.h>
21#include <linux/mm.h>
22#include <linux/smp.h>
23#include <linux/smp_lock.h>
24#include <linux/init.h>
25#include <linux/console.h>
26#include <linux/module.h>
27#include <linux/hardirq.h>
Michael Grundy4ba069b2006-09-20 15:58:39 +020028#include <linux/kprobes.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
30#include <asm/system.h>
31#include <asm/uaccess.h>
32#include <asm/pgtable.h>
Michael Grundy4ba069b2006-09-20 15:58:39 +020033#include <asm/kdebug.h>
Heiko Carstens29b08d22006-12-04 15:40:40 +010034#include <asm/s390_ext.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -080036#ifndef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#define __FAIL_ADDR_MASK 0x7ffff000
38#define __FIXUP_MASK 0x7fffffff
39#define __SUBCODE_MASK 0x0200
40#define __PF_RES_FIELD 0ULL
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -080041#else /* CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#define __FAIL_ADDR_MASK -4096L
43#define __FIXUP_MASK ~0L
44#define __SUBCODE_MASK 0x0600
45#define __PF_RES_FIELD 0x8000000000000000ULL
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -080046#endif /* CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48#ifdef CONFIG_SYSCTL
49extern int sysctl_userprocess_debug;
50#endif
51
52extern void die(const char *,struct pt_regs *,long);
53
Michael Grundy4ba069b2006-09-20 15:58:39 +020054#ifdef CONFIG_KPROBES
Heiko Carstens2b67fc42007-02-05 21:16:47 +010055static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
Michael Grundy4ba069b2006-09-20 15:58:39 +020056int register_page_fault_notifier(struct notifier_block *nb)
57{
58 return atomic_notifier_chain_register(&notify_page_fault_chain, nb);
59}
60
61int unregister_page_fault_notifier(struct notifier_block *nb)
62{
63 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
64}
65
66static inline int notify_page_fault(enum die_val val, const char *str,
67 struct pt_regs *regs, long err, int trap, int sig)
68{
69 struct die_args args = {
70 .regs = regs,
71 .str = str,
72 .err = err,
73 .trapnr = trap,
74 .signr = sig
75 };
76 return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
77}
78#else
79static inline int notify_page_fault(enum die_val val, const char *str,
80 struct pt_regs *regs, long err, int trap, int sig)
81{
82 return NOTIFY_DONE;
83}
84#endif
85
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
87/*
88 * Unlock any spinlocks which will prevent us from getting the
Kirill Korotaevcefc8be2007-02-10 01:46:18 -080089 * message out.
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 */
91void bust_spinlocks(int yes)
92{
93 if (yes) {
94 oops_in_progress = 1;
95 } else {
96 int loglevel_save = console_loglevel;
97 console_unblank();
98 oops_in_progress = 0;
99 /*
100 * OK, the message is on the console. Now we call printk()
101 * without oops_in_progress set so that printk will give klogd
102 * a poke. Hold onto your hats...
103 */
104 console_loglevel = 15;
105 printk(" ");
106 console_loglevel = loglevel_save;
107 }
108}
109
110/*
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100111 * Returns the address space associated with the fault.
112 * Returns 0 for kernel space, 1 for user space and
113 * 2 for code execution in user space with noexec=on.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 */
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100115static inline int check_space(struct task_struct *tsk)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116{
117 /*
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100118 * The lowest two bits of S390_lowcore.trans_exc_code
119 * indicate which paging table was used.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 */
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100121 int desc = S390_lowcore.trans_exc_code & 3;
122
123 if (desc == 3) /* Home Segment Table Descriptor */
124 return switch_amode == 0;
125 if (desc == 2) /* Secondary Segment Table Descriptor */
126 return tsk->thread.mm_segment.ar4;
127#ifdef CONFIG_S390_SWITCH_AMODE
128 if (unlikely(desc == 1)) { /* STD determined via access register */
129 /* %a0 always indicates primary space. */
130 if (S390_lowcore.exc_access_id != 0) {
131 save_access_regs(tsk->thread.acrs);
132 /*
133 * An alet of 0 indicates primary space.
134 * An alet of 1 indicates secondary space.
135 * Any other alet values generate an
136 * alen-translation exception.
137 */
138 if (tsk->thread.acrs[S390_lowcore.exc_access_id])
139 return tsk->thread.mm_segment.ar4;
140 }
141 }
142#endif
143 /* Primary Segment Table Descriptor */
144 return switch_amode << s390_noexec;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145}
146
147/*
148 * Send SIGSEGV to task. This is an external routine
149 * to keep the stack usage of do_page_fault small.
150 */
151static void do_sigsegv(struct pt_regs *regs, unsigned long error_code,
152 int si_code, unsigned long address)
153{
154 struct siginfo si;
155
156#if defined(CONFIG_SYSCTL) || defined(CONFIG_PROCESS_DEBUG)
157#if defined(CONFIG_SYSCTL)
158 if (sysctl_userprocess_debug)
159#endif
160 {
161 printk("User process fault: interruption code 0x%lX\n",
162 error_code);
163 printk("failing address: %lX\n", address);
164 show_regs(regs);
165 }
166#endif
167 si.si_signo = SIGSEGV;
168 si.si_code = si_code;
Heiko Carstensd2c993d2006-07-12 16:41:55 +0200169 si.si_addr = (void __user *) address;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 force_sig_info(SIGSEGV, &si, current);
171}
172
Gerald Schaeferc1821c22007-02-05 21:18:17 +0100173#ifdef CONFIG_S390_EXEC_PROTECT
174extern long sys_sigreturn(struct pt_regs *regs);
175extern long sys_rt_sigreturn(struct pt_regs *regs);
176extern long sys32_sigreturn(struct pt_regs *regs);
177extern long sys32_rt_sigreturn(struct pt_regs *regs);
178
179static inline void do_sigreturn(struct mm_struct *mm, struct pt_regs *regs,
180 int rt)
181{
182 up_read(&mm->mmap_sem);
183 clear_tsk_thread_flag(current, TIF_SINGLE_STEP);
184#ifdef CONFIG_COMPAT
185 if (test_tsk_thread_flag(current, TIF_31BIT)) {
186 if (rt)
187 sys32_rt_sigreturn(regs);
188 else
189 sys32_sigreturn(regs);
190 return;
191 }
192#endif /* CONFIG_COMPAT */
193 if (rt)
194 sys_rt_sigreturn(regs);
195 else
196 sys_sigreturn(regs);
197 return;
198}
199
200static int signal_return(struct mm_struct *mm, struct pt_regs *regs,
201 unsigned long address, unsigned long error_code)
202{
203 pgd_t *pgd;
204 pmd_t *pmd;
205 pte_t *pte;
206 u16 *instruction;
207 unsigned long pfn, uaddr = regs->psw.addr;
208
209 spin_lock(&mm->page_table_lock);
210 pgd = pgd_offset(mm, uaddr);
211 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
212 goto out_fault;
213 pmd = pmd_offset(pgd, uaddr);
214 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
215 goto out_fault;
216 pte = pte_offset_map(pmd_offset(pgd_offset(mm, uaddr), uaddr), uaddr);
217 if (!pte || !pte_present(*pte))
218 goto out_fault;
219 pfn = pte_pfn(*pte);
220 if (!pfn_valid(pfn))
221 goto out_fault;
222 spin_unlock(&mm->page_table_lock);
223
224 instruction = (u16 *) ((pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE-1)));
225 if (*instruction == 0x0a77)
226 do_sigreturn(mm, regs, 0);
227 else if (*instruction == 0x0aad)
228 do_sigreturn(mm, regs, 1);
229 else {
230 printk("- XXX - do_exception: task = %s, primary, NO EXEC "
231 "-> SIGSEGV\n", current->comm);
232 up_read(&mm->mmap_sem);
233 current->thread.prot_addr = address;
234 current->thread.trap_no = error_code;
235 do_sigsegv(regs, error_code, SEGV_MAPERR, address);
236 }
237 return 0;
238out_fault:
239 spin_unlock(&mm->page_table_lock);
240 return -EFAULT;
241}
242#endif /* CONFIG_S390_EXEC_PROTECT */
243
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244/*
245 * This routine handles page faults. It determines the address,
246 * and the problem, and then passes it off to one of the appropriate
247 * routines.
248 *
249 * error_code:
250 * 04 Protection -> Write-Protection (suprression)
251 * 10 Segment translation -> Not present (nullification)
252 * 11 Page translation -> Not present (nullification)
253 * 3b Region third trans. -> Not present (nullification)
254 */
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100255static inline void
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256do_exception(struct pt_regs *regs, unsigned long error_code, int is_protection)
257{
258 struct task_struct *tsk;
259 struct mm_struct *mm;
260 struct vm_area_struct * vma;
261 unsigned long address;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 const struct exception_table_entry *fixup;
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100263 int si_code;
264 int space;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265
266 tsk = current;
267 mm = tsk->mm;
268
Michael Grundy4ba069b2006-09-20 15:58:39 +0200269 if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
270 SIGSEGV) == NOTIFY_STOP)
271 return;
272
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 /*
274 * Check for low-address protection. This needs to be treated
275 * as a special case because the translation exception code
276 * field is not guaranteed to contain valid data in this case.
277 */
278 if (is_protection && !(S390_lowcore.trans_exc_code & 4)) {
279
280 /* Low-address protection hit in kernel mode means
281 NULL pointer write access in kernel mode. */
282 if (!(regs->psw.mask & PSW_MASK_PSTATE)) {
283 address = 0;
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100284 space = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 goto no_context;
286 }
287
288 /* Low-address protection hit in user mode 'cannot happen'. */
289 die ("Low-address protection", regs, error_code);
290 do_exit(SIGKILL);
291 }
292
293 /*
294 * get the failing address
295 * more specific the segment and page table portion of
296 * the address
297 */
298 address = S390_lowcore.trans_exc_code & __FAIL_ADDR_MASK;
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100299 space = check_space(tsk);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300
301 /*
302 * Verify that the fault happened in user space, that
303 * we are not in an interrupt and that there is a
304 * user context.
305 */
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100306 if (unlikely(space == 0 || in_atomic() || !mm))
307 goto no_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308
309 /*
310 * When we get here, the fault happened in the current
311 * task's user address space, so we can switch on the
312 * interrupts again and then search the VMAs
313 */
314 local_irq_enable();
315
316 down_read(&mm->mmap_sem);
317
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100318 si_code = SEGV_MAPERR;
319 vma = find_vma(mm, address);
320 if (!vma)
321 goto bad_area;
Gerald Schaeferc1821c22007-02-05 21:18:17 +0100322
323#ifdef CONFIG_S390_EXEC_PROTECT
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100324 if (unlikely((space == 2) && !(vma->vm_flags & VM_EXEC)))
Gerald Schaeferc1821c22007-02-05 21:18:17 +0100325 if (!signal_return(mm, regs, address, error_code))
326 /*
327 * signal_return() has done an up_read(&mm->mmap_sem)
328 * if it returns 0.
329 */
330 return;
331#endif
332
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333 if (vma->vm_start <= address)
334 goto good_area;
335 if (!(vma->vm_flags & VM_GROWSDOWN))
336 goto bad_area;
337 if (expand_stack(vma, address))
338 goto bad_area;
339/*
340 * Ok, we have a good vm_area for this memory access, so
341 * we can handle it..
342 */
343good_area:
344 si_code = SEGV_ACCERR;
345 if (!is_protection) {
346 /* page not present, check vm flags */
347 if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
348 goto bad_area;
349 } else {
350 if (!(vma->vm_flags & VM_WRITE))
351 goto bad_area;
352 }
353
354survive:
355 /*
356 * If for any reason at all we couldn't handle the fault,
357 * make sure we exit gracefully rather than endlessly redo
358 * the fault.
359 */
360 switch (handle_mm_fault(mm, vma, address, is_protection)) {
361 case VM_FAULT_MINOR:
362 tsk->min_flt++;
363 break;
364 case VM_FAULT_MAJOR:
365 tsk->maj_flt++;
366 break;
367 case VM_FAULT_SIGBUS:
368 goto do_sigbus;
369 case VM_FAULT_OOM:
370 goto out_of_memory;
371 default:
372 BUG();
373 }
374
375 up_read(&mm->mmap_sem);
376 /*
377 * The instruction that caused the program check will
378 * be repeated. Don't signal single step via SIGTRAP.
379 */
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100380 clear_tsk_thread_flag(tsk, TIF_SINGLE_STEP);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381 return;
382
383/*
384 * Something tried to access memory that isn't in our memory map..
385 * Fix it, but check if it's kernel or user first..
386 */
387bad_area:
388 up_read(&mm->mmap_sem);
389
390 /* User mode accesses just cause a SIGSEGV */
391 if (regs->psw.mask & PSW_MASK_PSTATE) {
392 tsk->thread.prot_addr = address;
393 tsk->thread.trap_no = error_code;
394 do_sigsegv(regs, error_code, si_code, address);
395 return;
396 }
397
398no_context:
399 /* Are we prepared to handle this kernel fault? */
400 fixup = search_exception_tables(regs->psw.addr & __FIXUP_MASK);
401 if (fixup) {
402 regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE;
403 return;
404 }
405
406/*
407 * Oops. The kernel tried to access some bad page. We'll have to
408 * terminate things with extreme prejudice.
409 */
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100410 if (space == 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 printk(KERN_ALERT "Unable to handle kernel pointer dereference"
412 " at virtual kernel address %p\n", (void *)address);
413 else
414 printk(KERN_ALERT "Unable to handle kernel paging request"
415 " at virtual user address %p\n", (void *)address);
416
417 die("Oops", regs, error_code);
418 do_exit(SIGKILL);
419
420
421/*
422 * We ran out of memory, or some other thing happened to us that made
423 * us unable to handle the page fault gracefully.
424*/
425out_of_memory:
426 up_read(&mm->mmap_sem);
Sukadev Bhattiproluf400e192006-09-29 02:00:07 -0700427 if (is_init(tsk)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 yield();
Akinobu Mitabac9c662006-09-28 16:55:18 +0200429 down_read(&mm->mmap_sem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430 goto survive;
431 }
432 printk("VM: killing process %s\n", tsk->comm);
433 if (regs->psw.mask & PSW_MASK_PSTATE)
434 do_exit(SIGKILL);
435 goto no_context;
436
437do_sigbus:
438 up_read(&mm->mmap_sem);
439
440 /*
441 * Send a sigbus, regardless of whether we were in kernel
442 * or user mode.
443 */
444 tsk->thread.prot_addr = address;
445 tsk->thread.trap_no = error_code;
446 force_sig(SIGBUS, tsk);
447
448 /* Kernel mode? Handle exceptions or die */
449 if (!(regs->psw.mask & PSW_MASK_PSTATE))
450 goto no_context;
451}
452
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100453void __kprobes do_protection_exception(struct pt_regs *regs,
454 unsigned long error_code)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455{
456 regs->psw.addr -= (error_code >> 16);
457 do_exception(regs, 4, 1);
458}
459
Gerald Schaefer482b05d2007-03-05 23:35:54 +0100460void __kprobes do_dat_exception(struct pt_regs *regs, unsigned long error_code)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461{
462 do_exception(regs, error_code & 0xff, 0);
463}
464
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465#ifdef CONFIG_PFAULT
466/*
467 * 'pfault' pseudo page faults routines.
468 */
Heiko Carstens29b08d22006-12-04 15:40:40 +0100469static ext_int_info_t ext_int_pfault;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470static int pfault_disable = 0;
471
472static int __init nopfault(char *str)
473{
474 pfault_disable = 1;
475 return 1;
476}
477
478__setup("nopfault", nopfault);
479
480typedef struct {
481 __u16 refdiagc;
482 __u16 reffcode;
483 __u16 refdwlen;
484 __u16 refversn;
485 __u64 refgaddr;
486 __u64 refselmk;
487 __u64 refcmpmk;
488 __u64 reserved;
489} __attribute__ ((packed)) pfault_refbk_t;
490
491int pfault_init(void)
492{
493 pfault_refbk_t refbk =
494 { 0x258, 0, 5, 2, __LC_CURRENT, 1ULL << 48, 1ULL << 48,
495 __PF_RES_FIELD };
496 int rc;
497
Heiko Carstens29b08d22006-12-04 15:40:40 +0100498 if (!MACHINE_IS_VM || pfault_disable)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 return -1;
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +0200500 asm volatile(
501 " diag %1,%0,0x258\n"
502 "0: j 2f\n"
503 "1: la %0,8\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504 "2:\n"
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +0200505 EX_TABLE(0b,1b)
506 : "=d" (rc) : "a" (&refbk), "m" (refbk) : "cc");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 __ctl_set_bit(0, 9);
508 return rc;
509}
510
511void pfault_fini(void)
512{
513 pfault_refbk_t refbk =
514 { 0x258, 1, 5, 2, 0ULL, 0ULL, 0ULL, 0ULL };
515
Heiko Carstens29b08d22006-12-04 15:40:40 +0100516 if (!MACHINE_IS_VM || pfault_disable)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517 return;
518 __ctl_clear_bit(0,9);
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +0200519 asm volatile(
520 " diag %0,0,0x258\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521 "0:\n"
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +0200522 EX_TABLE(0b,0b)
523 : : "a" (&refbk), "m" (refbk) : "cc");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524}
525
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100526static void pfault_interrupt(__u16 error_code)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527{
528 struct task_struct *tsk;
529 __u16 subcode;
530
531 /*
532 * Get the external interruption subcode & pfault
533 * initial/completion signal bit. VM stores this
534 * in the 'cpu address' field associated with the
535 * external interrupt.
536 */
537 subcode = S390_lowcore.cpu_addr;
538 if ((subcode & 0xff00) != __SUBCODE_MASK)
539 return;
540
541 /*
542 * Get the token (= address of the task structure of the affected task).
543 */
544 tsk = *(struct task_struct **) __LC_PFAULT_INTPARM;
545
546 if (subcode & 0x0080) {
547 /* signal bit is set -> a page has been swapped in by VM */
548 if (xchg(&tsk->thread.pfault_wait, -1) != 0) {
549 /* Initial interrupt was faster than the completion
550 * interrupt. pfault_wait is valid. Set pfault_wait
551 * back to zero and wake up the process. This can
552 * safely be done because the task is still sleeping
Martin Schwidefskyb6d09442005-09-03 15:58:02 -0700553 * and can't produce new pfaults. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 tsk->thread.pfault_wait = 0;
555 wake_up_process(tsk);
Martin Schwidefskyb6d09442005-09-03 15:58:02 -0700556 put_task_struct(tsk);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 }
558 } else {
559 /* signal bit not set -> a real page is missing. */
Martin Schwidefskyb6d09442005-09-03 15:58:02 -0700560 get_task_struct(tsk);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
562 if (xchg(&tsk->thread.pfault_wait, 1) != 0) {
563 /* Completion interrupt was faster than the initial
564 * interrupt (swapped in a -1 for pfault_wait). Set
565 * pfault_wait back to zero and exit. This can be
566 * done safely because tsk is running in kernel
567 * mode and can't produce new pfaults. */
568 tsk->thread.pfault_wait = 0;
569 set_task_state(tsk, TASK_RUNNING);
Martin Schwidefskyb6d09442005-09-03 15:58:02 -0700570 put_task_struct(tsk);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 } else
572 set_tsk_need_resched(tsk);
573 }
574}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575
Heiko Carstens29b08d22006-12-04 15:40:40 +0100576void __init pfault_irq_init(void)
577{
578 if (!MACHINE_IS_VM)
579 return;
580
581 /*
582 * Try to get pfault pseudo page faults going.
583 */
584 if (register_early_external_interrupt(0x2603, pfault_interrupt,
585 &ext_int_pfault) != 0)
586 panic("Couldn't request external interrupt 0x2603");
587
588 if (pfault_init() == 0)
589 return;
590
591 /* Tough luck, no pfault. */
592 pfault_disable = 1;
593 unregister_early_external_interrupt(0x2603, pfault_interrupt,
594 &ext_int_pfault);
595}
596#endif