diff options
Diffstat (limited to 'drivers/s390/s390mach.c')
-rw-r--r-- | drivers/s390/s390mach.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c index 3bf466603512..f99e55308b32 100644 --- a/drivers/s390/s390mach.c +++ b/drivers/s390/s390mach.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
16 | #include <linux/time.h> | ||
16 | 17 | ||
17 | #include <asm/lowcore.h> | 18 | #include <asm/lowcore.h> |
18 | 19 | ||
@@ -362,12 +363,19 @@ s390_revalidate_registers(struct mci *mci) | |||
362 | return kill_task; | 363 | return kill_task; |
363 | } | 364 | } |
364 | 365 | ||
366 | #define MAX_IPD_COUNT 29 | ||
367 | #define MAX_IPD_TIME (5 * 60 * USEC_PER_SEC) /* 5 minutes */ | ||
368 | |||
365 | /* | 369 | /* |
366 | * machine check handler. | 370 | * machine check handler. |
367 | */ | 371 | */ |
368 | void | 372 | void |
369 | s390_do_machine_check(struct pt_regs *regs) | 373 | s390_do_machine_check(struct pt_regs *regs) |
370 | { | 374 | { |
375 | static DEFINE_SPINLOCK(ipd_lock); | ||
376 | static unsigned long long last_ipd; | ||
377 | static int ipd_count; | ||
378 | unsigned long long tmp; | ||
371 | struct mci *mci; | 379 | struct mci *mci; |
372 | struct mcck_struct *mcck; | 380 | struct mcck_struct *mcck; |
373 | int umode; | 381 | int umode; |
@@ -404,11 +412,27 @@ s390_do_machine_check(struct pt_regs *regs) | |||
404 | s390_handle_damage("processing backup machine " | 412 | s390_handle_damage("processing backup machine " |
405 | "check with damage."); | 413 | "check with damage."); |
406 | } | 414 | } |
407 | if (!umode) | 415 | |
408 | s390_handle_damage("processing backup machine " | 416 | /* |
409 | "check in kernel mode."); | 417 | * Nullifying exigent condition, therefore we might |
410 | mcck->kill_task = 1; | 418 | * retry this instruction. |
411 | mcck->mcck_code = *(unsigned long long *) mci; | 419 | */ |
420 | |||
421 | spin_lock(&ipd_lock); | ||
422 | |||
423 | tmp = get_clock(); | ||
424 | |||
425 | if (((tmp - last_ipd) >> 12) < MAX_IPD_TIME) | ||
426 | ipd_count++; | ||
427 | else | ||
428 | ipd_count = 1; | ||
429 | |||
430 | last_ipd = tmp; | ||
431 | |||
432 | if (ipd_count == MAX_IPD_COUNT) | ||
433 | s390_handle_damage("too many ipd retries."); | ||
434 | |||
435 | spin_unlock(&ipd_lock); | ||
412 | } | 436 | } |
413 | else { | 437 | else { |
414 | /* Processing damage -> stopping machine */ | 438 | /* Processing damage -> stopping machine */ |