[Patch V1 2/3] x86, mce: Refactor parts of mce_log() to reuse when logging from offline CPUs

Ashok Raj
2015-09-24T04:50:08Z

Simply refactoring part of mce_log() to facilitate logging from offline
CPUs.

Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
---
arch/x86/kernel/cpu/mcheck/mce.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 48bd244..2df073d 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -152,16 +152,10 @@ static struct mce_log mcelog = {
.recordlen = sizeof(struct mce),
};

-void mce_log(struct mce *mce)
+static void mce_log_add(struct mce *mce)
{
unsigned next, entry;

- /* Emit the trace record: */
- trace_mce_record(mce);
-
- if (!mce_gen_pool_add(mce))
- irq_work_queue(&mce_irq_work);
-
mce->finished = 0;
wmb();
for (;;) {
@@ -199,6 +193,19 @@ void mce_log(struct mce *mce)
set_bit(0, &mce_need_notify);
}

+void mce_log(struct mce *mce)
+{
+ unsigned next, entry;
+
+ /* Emit the trace record: */
+ trace_mce_record(mce);
+
+ if (!mce_gen_pool_add(mce))
+ irq_work_queue(&mce_irq_work);
+
+ mce_log_add(mce);
+}
+
void mce_inject_log(struct mce *m)
{
mutex_lock(&mce_chrdev_read_mutex);
--
2.4.3