From: Thomas Gleixner <tglx@linutronix.de>
To: Chen Gong <gong.chen@linux.intel.com>
Cc: "Luck, Tony" <tony.luck@intel.com>, "bp@amd64.org" <bp@amd64.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [tip:x86/urgent] x86/mce: Fix the MCE poll timer logic
Date: Wed, 6 Jun 2012 11:27:18 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.02.1206061120270.3086@ionos> (raw)
In-Reply-To: <4FCF0C03.9010400@linux.intel.com>
On Wed, 6 Jun 2012, Chen Gong wrote:
> In fact, there still exists another potential issue:
>
> static void __mcheck_cpu_init_timer(void)
> {
> struct timer_list *t = &__get_cpu_var(mce_timer);
> unsigned long iv = __this_cpu_read(mce_next_interval);
>
> setup_timer(t, mce_timer_fn, smp_processor_id());
>
> if (mce_ignore_ce)
> return;
>
> __this_cpu_write(mce_next_interval, iv);
> if (!iv)
> return;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Because the 2nd patch is not merged yet, so here iv is zero when this
> function is called, which means at the beginning, the poll timers are
> not registered until some other conditions trigger *add_timer_on*.
Dammit. I dropped the
iv = check_interval * HZ;
line before __this_cpu_write() and nobody noticed. :(
> t->expires = round_jiffies(jiffies + iv);
> add_timer_on(t, smp_processor_id());
> }
>
> Another potential issue is in this function two smp_processor_id()
> are called. If conext changes during this procedure (I'm not sure
> if it can hapen, besides secondary_cpu kickoff, online/offline will
No. This code is always called with preemption disabled.
> call these functions, even in virtualization envrionment, etc.).
What has virtualization to do with that ?
> So I think it will be better saving the value in the beginning of
> this function. Make sense?
No. Otherwise all the __this_cpu_read/write accesses are bogus as
well.
Thanks,
tglx
next prev parent reply other threads:[~2012-06-06 9:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-05 2:35 [PATCH] fix the MCE poll timer logic Chen Gong
2012-06-05 9:39 ` Thomas Gleixner
2012-06-06 7:10 ` [tip:x86/urgent] x86/mce: Fix " tip-bot for Chen Gong
2012-06-06 7:51 ` Chen Gong
2012-06-06 9:27 ` Thomas Gleixner [this message]
2012-06-06 9:52 ` Chen Gong
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=alpine.LFD.2.02.1206061120270.3086@ionos \
--to=tglx@linutronix.de \
--cc=bp@amd64.org \
--cc=gong.chen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@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