x86/mce: Rename mce_log to mce_log_buffer
It is confusing when staring at "struct mce_log mcelog" and then there's also a function called mce_log(). So call the buffer what it is. No functionality change. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/20170327093304.10683-4-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Родитель
fe3ed20fdd
Коммит
e64edfcce9
|
@ -128,7 +128,7 @@
|
||||||
* debugging tools. Each entry is only valid when its finished flag
|
* debugging tools. Each entry is only valid when its finished flag
|
||||||
* is set.
|
* is set.
|
||||||
*/
|
*/
|
||||||
struct mce_log {
|
struct mce_log_buffer {
|
||||||
char signature[12]; /* "MACHINECHECK" */
|
char signature[12]; /* "MACHINECHECK" */
|
||||||
unsigned len; /* = MCE_LOG_LEN */
|
unsigned len; /* = MCE_LOG_LEN */
|
||||||
unsigned next;
|
unsigned next;
|
||||||
|
|
|
@ -152,7 +152,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(injectm);
|
||||||
* separate MCEs from kernel messages to avoid bogus bug reports.
|
* separate MCEs from kernel messages to avoid bogus bug reports.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct mce_log mcelog = {
|
static struct mce_log_buffer mcelog_buf = {
|
||||||
.signature = MCE_LOG_SIGNATURE,
|
.signature = MCE_LOG_SIGNATURE,
|
||||||
.len = MCE_LOG_LEN,
|
.len = MCE_LOG_LEN,
|
||||||
.recordlen = sizeof(struct mce),
|
.recordlen = sizeof(struct mce),
|
||||||
|
@ -170,7 +170,7 @@ void mce_log(struct mce *m)
|
||||||
|
|
||||||
wmb();
|
wmb();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
entry = mce_log_get_idx_check(mcelog.next);
|
entry = mce_log_get_idx_check(mcelog_buf.next);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -180,11 +180,11 @@ void mce_log(struct mce *m)
|
||||||
*/
|
*/
|
||||||
if (entry >= MCE_LOG_LEN) {
|
if (entry >= MCE_LOG_LEN) {
|
||||||
set_bit(MCE_OVERFLOW,
|
set_bit(MCE_OVERFLOW,
|
||||||
(unsigned long *)&mcelog.flags);
|
(unsigned long *)&mcelog_buf.flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Old left over entry. Skip: */
|
/* Old left over entry. Skip: */
|
||||||
if (mcelog.entry[entry].finished) {
|
if (mcelog_buf.entry[entry].finished) {
|
||||||
entry++;
|
entry++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -192,12 +192,12 @@ void mce_log(struct mce *m)
|
||||||
}
|
}
|
||||||
smp_rmb();
|
smp_rmb();
|
||||||
next = entry + 1;
|
next = entry + 1;
|
||||||
if (cmpxchg(&mcelog.next, entry, next) == entry)
|
if (cmpxchg(&mcelog_buf.next, entry, next) == entry)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memcpy(mcelog.entry + entry, m, sizeof(struct mce));
|
memcpy(mcelog_buf.entry + entry, m, sizeof(struct mce));
|
||||||
wmb();
|
wmb();
|
||||||
mcelog.entry[entry].finished = 1;
|
mcelog_buf.entry[entry].finished = 1;
|
||||||
wmb();
|
wmb();
|
||||||
|
|
||||||
set_bit(0, &mce_need_notify);
|
set_bit(0, &mce_need_notify);
|
||||||
|
@ -1958,7 +1958,7 @@ static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
next = mce_log_get_idx_check(mcelog.next);
|
next = mce_log_get_idx_check(mcelog_buf.next);
|
||||||
|
|
||||||
/* Only supports full reads right now */
|
/* Only supports full reads right now */
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
|
@ -1970,7 +1970,7 @@ static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf,
|
||||||
do {
|
do {
|
||||||
for (i = prev; i < next; i++) {
|
for (i = prev; i < next; i++) {
|
||||||
unsigned long start = jiffies;
|
unsigned long start = jiffies;
|
||||||
struct mce *m = &mcelog.entry[i];
|
struct mce *m = &mcelog_buf.entry[i];
|
||||||
|
|
||||||
while (!m->finished) {
|
while (!m->finished) {
|
||||||
if (time_after_eq(jiffies, start + 2)) {
|
if (time_after_eq(jiffies, start + 2)) {
|
||||||
|
@ -1986,10 +1986,10 @@ timeout:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(mcelog.entry + prev, 0,
|
memset(mcelog_buf.entry + prev, 0,
|
||||||
(next - prev) * sizeof(struct mce));
|
(next - prev) * sizeof(struct mce));
|
||||||
prev = next;
|
prev = next;
|
||||||
next = cmpxchg(&mcelog.next, prev, 0);
|
next = cmpxchg(&mcelog_buf.next, prev, 0);
|
||||||
} while (next != prev);
|
} while (next != prev);
|
||||||
|
|
||||||
synchronize_sched();
|
synchronize_sched();
|
||||||
|
@ -2001,7 +2001,7 @@ timeout:
|
||||||
on_each_cpu(collect_tscs, cpu_tsc, 1);
|
on_each_cpu(collect_tscs, cpu_tsc, 1);
|
||||||
|
|
||||||
for (i = next; i < MCE_LOG_LEN; i++) {
|
for (i = next; i < MCE_LOG_LEN; i++) {
|
||||||
struct mce *m = &mcelog.entry[i];
|
struct mce *m = &mcelog_buf.entry[i];
|
||||||
|
|
||||||
if (m->finished && m->tsc < cpu_tsc[m->cpu]) {
|
if (m->finished && m->tsc < cpu_tsc[m->cpu]) {
|
||||||
err |= copy_to_user(buf, m, sizeof(*m));
|
err |= copy_to_user(buf, m, sizeof(*m));
|
||||||
|
@ -2024,7 +2024,7 @@ out:
|
||||||
static unsigned int mce_chrdev_poll(struct file *file, poll_table *wait)
|
static unsigned int mce_chrdev_poll(struct file *file, poll_table *wait)
|
||||||
{
|
{
|
||||||
poll_wait(file, &mce_chrdev_wait, wait);
|
poll_wait(file, &mce_chrdev_wait, wait);
|
||||||
if (READ_ONCE(mcelog.next))
|
if (READ_ONCE(mcelog_buf.next))
|
||||||
return POLLIN | POLLRDNORM;
|
return POLLIN | POLLRDNORM;
|
||||||
if (!mce_apei_read_done && apei_check_mce())
|
if (!mce_apei_read_done && apei_check_mce())
|
||||||
return POLLIN | POLLRDNORM;
|
return POLLIN | POLLRDNORM;
|
||||||
|
@ -2048,8 +2048,8 @@ static long mce_chrdev_ioctl(struct file *f, unsigned int cmd,
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
flags = mcelog.flags;
|
flags = mcelog_buf.flags;
|
||||||
} while (cmpxchg(&mcelog.flags, flags, 0) != flags);
|
} while (cmpxchg(&mcelog_buf.flags, flags, 0) != flags);
|
||||||
|
|
||||||
return put_user(flags, p);
|
return put_user(flags, p);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче