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>,
Thomas Gleixner <tglx@linutronix.de>,
Andi Kleen <ak@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -v4] x86: MCE: Re-implement MCE log ring buffer as per-CPU ring buffer
Date: Fri, 05 Jun 2009 16:01:54 +0900 [thread overview]
Message-ID: <4A28C2E2.4090309@jp.fujitsu.com> (raw)
In-Reply-To: <1244085090.8361.360.camel@yhuang-dev.sh.intel.com>
Huang Ying wrote:
> Re-implement MCE log ring buffer as per-CPU ring buffer for better
> scalability. Basic design is as follow:
That would be great. This should be in .31, I think.
Some minor points:
> struct mce_log {
> - char signature[12]; /* "MACHINECHECK" */
> + char signature[12]; /* "MACHINECHEC2" */
> unsigned len; /* = MCE_LOG_LEN */
> - unsigned next;
> unsigned flags;
> unsigned pad0;
> - struct mce entry[MCE_LOG_LEN];
> + struct mce_log_cpu *mcelog_cpus;
> };
What is this *mcelog_cpus to be used for?
It seems it will point one of per-CPU buffers (maybe cpu#0's buffer)
if I have read the following mce_log_init() correctly.
> @@ -642,6 +669,16 @@ static int mce_cap_init(void)
> return 0;
> }
>
> +/*
> + * Initialize MCE per-CPU log buffer
> + */
> +static __cpuinit void mce_log_init(void)
> +{
> + if (mcelog.mcelog_cpus)
> + return;
> + mcelog.mcelog_cpus = &per_cpu_var(mce_log_cpus);
> +}
> +
> static void mce_init(void)
> {
> mce_banks_t all_banks;
Next,
> +static int mce_empty_cpu(struct mce_log_cpu *mcelog_cpu)
> +{
> + int head, tail;
> + head = mcelog_cpu->head;
> + tail = mcelog_cpu->tail;
> + return head == tail;
> +}
Are there any race condition?
Why we cannot have "return (mcelog_cpu->head == mcelog_cpu->tail);"?
Last,
> +static ssize_t mce_read(struct file *filp, char __user *inubuf, size_t usize,
> + loff_t *off)
> +{
> + char __user *ubuf = inubuf;
> + struct mce_log_cpu *mcelog_cpu;
> + int cpu, new_mce, err = 0;
> + static DEFINE_MUTEX(mce_read_mutex);
> +
(snip)
> + return err ? : ubuf - inubuf;
> }
It would be better to put "static DEFINE_MUTEX(mce_read_mutex)" to outside of
the function.
And it looks work, but I'd prefer:
return err ? err : ubuf - inubuf;
Overall it looks good.
Unfortunately there were updates on tip/mce3 so I could not apply this
patch on the top of the branch. I'd appreciate it if you could rebase
this patch again.
Thanks,
H.Seto
next prev parent reply other threads:[~2009-06-05 7:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-04 3:11 [PATCH -v4] x86: MCE: Re-implement MCE log ring buffer as per-CPU ring buffer Huang Ying
2009-06-04 5:56 ` Andi Kleen
2009-06-05 7:01 ` Hidetoshi Seto [this message]
2009-06-05 8:08 ` Huang Ying
2009-06-05 8:28 ` Hidetoshi Seto
2009-06-05 8:39 ` Huang Ying
2009-06-08 1:17 ` Hidetoshi Seto
2009-06-08 2:05 ` Huang Ying
2009-06-08 3:09 ` 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=4A28C2E2.4090309@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=tglx@linutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.