Skip to content

Commit

Permalink
Move precessing of MCE queued event out from syscall exit path.
Browse files Browse the repository at this point in the history
Huge Dickins reported an issue that b5ff421
"powerpc/book3s: Queue up and process delayed MCE events" breaks the
PowerMac G5 boot. This patch fixes it by moving the mce even processing
away from syscall exit, which was wrong to do that in first place, and
using irq work framework to delay processing of mce event.

Reported-by: Hugh Dickins <hughd@google.com
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Mahesh Salgaonkar authored and Benjamin Herrenschmidt committed Jan 15, 2014
1 parent c0c4301 commit 30c8263
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion arch/powerpc/include/asm/mce.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ extern void save_mce_event(struct pt_regs *regs, long handled,
extern int get_mce_event(struct machine_check_event *mce, bool release);
extern void release_mce_event(void);
extern void machine_check_queue_event(void);
extern void machine_check_process_queued_event(void);
extern void machine_check_print_event_info(struct machine_check_event *evt);
extern uint64_t get_mce_fault_addr(struct machine_check_event *evt);

Expand Down
5 changes: 0 additions & 5 deletions arch/powerpc/kernel/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,6 @@ syscall_exit:
#ifdef SHOW_SYSCALLS
bl .do_show_syscall_exit
ld r3,RESULT(r1)
#endif
#ifdef CONFIG_PPC_BOOK3S_64
BEGIN_FTR_SECTION
bl .machine_check_process_queued_event
END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
#endif
CURRENT_THREAD_INFO(r12, r1)

Expand Down
13 changes: 10 additions & 3 deletions arch/powerpc/kernel/mce.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/ptrace.h>
#include <linux/percpu.h>
#include <linux/export.h>
#include <linux/irq_work.h>
#include <asm/mce.h>

static DEFINE_PER_CPU(int, mce_nest_count);
Expand All @@ -35,6 +36,11 @@ static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT], mce_event);
static DEFINE_PER_CPU(int, mce_queue_count);
static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT], mce_event_queue);

static void machine_check_process_queued_event(struct irq_work *work);
struct irq_work mce_event_process_work = {
.func = machine_check_process_queued_event,
};

static void mce_set_error_info(struct machine_check_event *mce,
struct mce_error_info *mce_err)
{
Expand Down Expand Up @@ -185,17 +191,19 @@ void machine_check_queue_event(void)
return;
}
__get_cpu_var(mce_event_queue[index]) = evt;

/* Queue irq work to process this event later. */
irq_work_queue(&mce_event_process_work);
}

/*
* process pending MCE event from the mce event queue. This function will be
* called during syscall exit.
*/
void machine_check_process_queued_event(void)
static void machine_check_process_queued_event(struct irq_work *work)
{
int index;

preempt_disable();
/*
* For now just print it to console.
* TODO: log this error event to FSP or nvram.
Expand All @@ -206,7 +214,6 @@ void machine_check_process_queued_event(void)
&__get_cpu_var(mce_event_queue[index]));
__get_cpu_var(mce_queue_count)--;
}
preempt_enable();
}

void machine_check_print_event_info(struct machine_check_event *evt)
Expand Down

0 comments on commit 30c8263

Please sign in to comment.