From: Chen Gong <gong.chen@linux.intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
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, 06 Jun 2012 17:52:11 +0800 [thread overview]
Message-ID: <4FCF284B.7050902@linux.intel.com> (raw)
In-Reply-To: <alpine.LFD.2.02.1206061120270.3086@ionos>
于 2012/6/6 17:27, Thomas Gleixner 写道:
> 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.
>
>
Oh, yes, since __this_cpu_read/write can be used here, there no context
issue.
Please ignore my over-thinking.
prev parent reply other threads:[~2012-06-06 9:52 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
2012-06-06 9:52 ` Chen Gong [this message]
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=4FCF284B.7050902@linux.intel.com \
--to=gong.chen@linux.intel.com \
--cc=bp@amd64.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--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 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.