linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: Huang Ying <ying.huang@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	Andi Kleen <ak@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/5] x86, mce: rename finished to valid in struct mce
Date: Mon, 28 Sep 2009 15:51:40 +0900	[thread overview]
Message-ID: <4AC05CFC.4020702@jp.fujitsu.com> (raw)
In-Reply-To: <4AC05BBF.3010102@jp.fujitsu.com>

The straightforward name is easier to understand.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
 arch/x86/include/asm/mce.h              |    6 +++---
 arch/x86/kernel/cpu/mcheck/mce-inject.c |   14 +++++++-------
 arch/x86/kernel/cpu/mcheck/mce.c        |   16 ++++++++--------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 4a48344..995dfd2 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -58,12 +58,12 @@ struct mce {
 	__u64 time;	/* wall time_t when error was detected */
 	__u8  cpuvendor;	/* cpu vendor as encoded in system.h */
 	__u8  inject_flags;	/* software inject flags */
-	__u16  pad;
+	__u16 pad;
 	__u32 cpuid;	/* CPUID 1 EAX */
-	__u8  cs;		/* code segment */
+	__u8  cs;	/* code segment */
 	__u8  bank;	/* machine check bank */
 	__u8  cpu;	/* cpu number; obsolete; use extcpu now */
-	__u8  finished;   /* entry is valid */
+	__u8  valid;	/* entry is valid */
 	__u32 extcpu;	/* linux cpu number that detected the error */
 	__u32 socketid;	/* CPU socket ID */
 	__u32 apicid;	/* CPU initial apic ID */
diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
index 2c1fc5a..5bac818 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -31,9 +31,9 @@ static void inject_mce(struct mce *m)
 	struct mce *i = &per_cpu(injectm, m->extcpu);
 
 	/* Make sure noone reads partially written injectm */
-	i->finished = 0;
+	i->valid = 0;
 	mb();
-	m->finished = 0;
+	m->valid = 0;
 	/* First set the fields after finished */
 	i->extcpu = m->extcpu;
 	mb();
@@ -41,7 +41,7 @@ static void inject_mce(struct mce *m)
 	memcpy(i, m, sizeof(struct mce));
 	/* Finally activate it */
 	mb();
-	i->finished = 1;
+	i->valid = 1;
 }
 
 static void raise_poll(struct mce *m)
@@ -53,7 +53,7 @@ static void raise_poll(struct mce *m)
 	local_irq_save(flags);
 	machine_check_poll(0, &b);
 	local_irq_restore(flags);
-	m->finished = 0;
+	m->valid = 0;
 }
 
 static void raise_exception(struct mce *m, struct pt_regs *pregs)
@@ -71,7 +71,7 @@ static void raise_exception(struct mce *m, struct pt_regs *pregs)
 	local_irq_save(flags);
 	do_machine_check(pregs, 0);
 	local_irq_restore(flags);
-	m->finished = 0;
+	m->valid = 0;
 }
 
 static cpumask_t mce_inject_cpumask;
@@ -129,7 +129,7 @@ static int raise_local(void)
 		mce_notify_irq();
 		printk(KERN_INFO "Machine check poll done on CPU %d\n", cpu);
 	} else
-		m->finished = 0;
+		m->valid = 0;
 
 	return ret;
 }
@@ -152,7 +152,7 @@ static void raise_mce(struct mce *m)
 		cpu_clear(get_cpu(), mce_inject_cpumask);
 		for_each_online_cpu(cpu) {
 			struct mce *mcpu = &per_cpu(injectm, cpu);
-			if (!mcpu->finished || MCE_INJ_CTX(mcpu->inject_flags)
+			if (!mcpu->valid || MCE_INJ_CTX(mcpu->inject_flags)
 							!= MCE_INJ_CTX_RANDOM)
 				cpu_clear(cpu, mce_inject_cpumask);
 		}
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 4b2af86..ac4f478 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -129,7 +129,7 @@ void mce_log(struct mce *mce)
 {
 	unsigned next, entry;
 
-	mce->finished = 0;
+	mce->valid = 0;
 	wmb();
 	for (;;) {
 		entry = rcu_dereference(mcelog.next);
@@ -145,7 +145,7 @@ void mce_log(struct mce *mce)
 				return;
 			}
 			/* Old left over entry. Skip: */
-			if (mcelog.entry[entry].finished) {
+			if (mcelog.entry[entry].valid) {
 				entry++;
 				continue;
 			}
@@ -158,10 +158,10 @@ void mce_log(struct mce *mce)
 	}
 	memcpy(mcelog.entry + entry, mce, sizeof(struct mce));
 	wmb();
-	mcelog.entry[entry].finished = 1;
+	mcelog.entry[entry].valid = 1;
 	wmb();
 
-	mce->finished = 1;
+	mce->valid = 1;
 	set_bit(0, &mce_need_notify);
 }
 
@@ -306,7 +306,7 @@ static u64 mce_rdmsrl(u32 msr)
 {
 	u64 v;
 
-	if (__get_cpu_var(injectm).finished) {
+	if (__get_cpu_var(injectm).valid) {
 		int offset = msr_to_offset(msr);
 
 		if (offset < 0)
@@ -329,7 +329,7 @@ static u64 mce_rdmsrl(u32 msr)
 
 static void mce_wrmsrl(u32 msr, u64 v)
 {
-	if (__get_cpu_var(injectm).finished) {
+	if (__get_cpu_var(injectm).valid) {
 		int offset = msr_to_offset(msr);
 
 		if (offset >= 0)
@@ -1488,7 +1488,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize,
 		for (i = prev; i < next; i++) {
 			unsigned long start = jiffies;
 
-			while (!mcelog.entry[i].finished) {
+			while (!mcelog.entry[i].valid) {
 				if (time_after_eq(jiffies, start + 2)) {
 					memset(mcelog.entry + i, 0,
 					       sizeof(struct mce));
@@ -1519,7 +1519,7 @@ timeout:
 	on_each_cpu(collect_tscs, cpu_tsc, 1);
 
 	for (i = next; i < MCE_LOG_LEN; i++) {
-		if (mcelog.entry[i].finished &&
+		if (mcelog.entry[i].valid &&
 		    mcelog.entry[i].tsc < cpu_tsc[mcelog.entry[i].cpu]) {
 			err |= copy_to_user(buf, mcelog.entry+i,
 					    sizeof(struct mce));
-- 
1.6.4.3



  parent reply	other threads:[~2009-09-28  6:52 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-28  1:21 [BUGFIX -v2] x86, mce, inject: Make injected mce valid only during faked handler call Huang Ying
2009-09-28  6:40 ` Hidetoshi Seto
2009-09-28  7:09   ` Huang Ying
2009-09-28  8:02     ` Hidetoshi Seto
2009-09-28  8:27       ` Huang Ying
2009-09-28  8:59         ` Hidetoshi Seto
2009-09-28  9:15           ` Huang Ying
2009-09-28  6:46 ` [PATCH 0/5] x86, mce-inject: misc fix Hidetoshi Seto
2009-09-28  6:51   ` [PATCH 1/5] mce-inject: replace MCJ_ to MCE_INJ_ Hidetoshi Seto
2009-09-28  6:51   ` Hidetoshi Seto [this message]
2009-09-28 18:24     ` [PATCH 2/5] x86, mce: rename finished to valid in struct mce Andi Kleen
2009-09-29  8:40       ` Hidetoshi Seto
2009-09-29 23:02         ` Andi Kleen
2009-09-29 23:04         ` [PATCH 2/5] x86, mce: rename finished to valid in struct mce II Andi Kleen
2009-09-29 23:20           ` H. Peter Anvin
2009-09-30  4:39             ` Andi Kleen
2009-10-01 11:08               ` Ingo Molnar
2009-09-28  6:52   ` [PATCH 3/5] mce-inject: make injected mce valid only during faked handler call Hidetoshi Seto
2009-09-28  7:27     ` Huang Ying
2009-09-28 18:50     ` Andi Kleen
2009-09-29  8:42       ` Hidetoshi Seto
2009-09-29 20:45         ` Andi Kleen
2009-09-28  6:53   ` [PATCH 4/5] mce-inject: no wait on write with MCE_INJ_CTX_RANDOM Hidetoshi Seto
2009-09-28  6:54   ` [PATCH 5/5] mce-inject: allow injecting status=0 to poll handler Hidetoshi Seto
2009-10-05  2:52 ` [PATCH 0/6] x86, mce, mce-inject: misc fix v2 Hidetoshi Seto
2009-10-05  3:05   ` [PATCH 1/6] x86, mce: replace MCJ_ to MCE_INJ_ Hidetoshi Seto
2009-10-05  3:06   ` [PATCH 2/6] x86, mce: replace MCM_ to MCI_MISC_ Hidetoshi Seto
2009-10-05  3:07   ` [PATCH 3/6] mce-inject: no wait on write with MCE_INJ_CTX_RANDOM Hidetoshi Seto
2009-10-05  3:07   ` [PATCH 4/6] mce-inject: allow injecting status=0 to poll handler Hidetoshi Seto
2009-10-05  3:08   ` [PATCH 5/6] mce-inject: add a barrier to raise_mce() Hidetoshi Seto
2009-10-05  3:10   ` [PATCH 6/6] mce-inject: use injected mce only during faked handler call Hidetoshi Seto
2009-10-09  1:54     ` Huang Ying
2009-10-09  5:38       ` Hidetoshi Seto
2009-10-09  5:44         ` [PATCH 1/4] mce-inject: make raise_global() Hidetoshi Seto
2009-10-09  5:45         ` [PATCH 2/4] mce-inject: use individual members instead of struct mce Hidetoshi Seto
2009-10-09  6:50           ` Huang Ying
2009-10-09  7:18             ` Hidetoshi Seto
2009-10-09  5:45         ` [PATCH 3/4] mce-inject: change msr_to_offset() to mce_get_fake_reg() Hidetoshi Seto
2009-10-09  5:46         ` [PATCH 4/4] mce-inject: support injecting multiple error to a CPU Hidetoshi Seto
2009-10-09  7:14     ` [PATCH 6/6] mce-inject: use injected mce only during faked handler call Huang Ying
2009-10-09  7:27       ` Hidetoshi Seto
2009-10-09  7:44         ` Huang Ying
2009-10-09  8:31           ` Hidetoshi Seto
2009-10-09  9:11             ` Huang Ying
2009-10-13  2:34               ` Hidetoshi Seto
2009-10-13  3:28                 ` Huang Ying
2009-10-13  6:00                   ` Hidetoshi Seto
2009-10-13  6:19                     ` Huang Ying
2009-10-13  6:29                       ` Ingo Molnar
2009-10-13  7:19                         ` [RFC] x86, mce: use of TRACE_EVENT for mce Hidetoshi Seto
2009-10-13  8:43                           ` Ingo Molnar
2009-10-13  8:46                           ` [tip:perf/mce] perf_event, x86, mce: Use TRACE_EVENT() for MCE logging tip-bot for Hidetoshi Seto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AC05CFC.4020702@jp.fujitsu.com \
    --to=seto.hidetoshi@jp.fujitsu.com \
    --cc=ak@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).