From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>,
Linux Kernel ML <linux-kernel@vger.kernel.org>,
robert.picco@hp.com, venkatesh.pallipadi@intel.com,
vojtech@suse.cz, mingo@redhat.com
Subject: Re: [Patch] Fix the possibility of insane return value of hpet_calibrate() against SMI. (take 2)
Date: Wed, 18 Mar 2009 11:32:19 -0400 [thread overview]
Message-ID: <49C11403.6010305@windriver.com> (raw)
In-Reply-To: <49C10F1B.9050809@ladisch.de>
Clemens Ladisch wrote:
> Paul Gortmaker wrote:
>
>> Yasunori Goto wrote:
>>
>>> + /*
>>> + * Try to calibrate until return value becomes stable small value.
>>> + * If SMI interruption occurs in calibration loop, the return value
>>> + * will be big. This avoids its impact.
>>> + */
>>> + do {
>>> + tmp = __hpet_calibrate(hpetp);
>>> + if (ret <= tmp)
>>> + break;
>>> + ret = tmp;
>>> + } while (1);
>>>
>> For what it is worth, if a situation arose where continued calls to
>> hpet_calibrate() represented a monotonically decreasing function,
>> (perhaps some insane power management?) you could be stuck
>> in this function for an unbounded amount of time.
>>
>
> On my machine, the number of iterations of the loop in __hpet_calibarate
> (the value of i) is about 400, and since HPET reads/writes go to the
> southbridge, it cannot get much higher than about 1000 even on faster
> machines.
>
> The value of (m - start) is approximately constant, as long as the loop
> runs for about 1 ms, so there cannot be too many distinct return values.
>
> Consequently, the only way for perverse SMIs to produce more
> monotonically decreasing calibration values is to introduce delays that
> make the loop run longer than 1 ms, i.e., to eat most of the CPU time
> for at least several seconds (or longer if you want unbounded time).
> Even in the real world ;-), no laptop manufacturer is that insane.
>
Right - as I said, I didn't expect that it could ever happen, and your
analysis
above seems to help reinforce that, so we probably should be OK.
Thanks,
Paul.
>
> Best regards,
> Clemens
>
next prev parent reply other threads:[~2009-03-18 15:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-13 5:00 [Patch] Fix the possibility of insane return value of hpet_calibrate() against SMI Yasunori Goto
2009-03-14 8:23 ` Rik van Riel
2009-03-15 19:56 ` Paul Gortmaker
2009-03-16 2:34 ` Yasunori Goto
2009-03-16 8:59 ` Vojtech Pavlik
2009-03-16 9:52 ` Clemens Ladisch
2009-03-17 10:12 ` Yasunori Goto
2009-03-17 13:12 ` Paul Gortmaker
2009-03-18 0:45 ` Yasunori Goto
2009-03-18 2:47 ` [Patch] Fix the possibility of insane return value of hpet_calibrate() against SMI. (take 2) Yasunori Goto
2009-03-18 7:44 ` Clemens Ladisch
2009-03-18 8:25 ` Vojtech Pavlik
2009-03-18 13:55 ` Paul Gortmaker
2009-03-18 15:11 ` Clemens Ladisch
2009-03-18 15:32 ` Paul Gortmaker [this message]
2009-03-30 21:06 ` Andrew Morton
2009-03-30 21:23 ` Paul Gortmaker
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=49C11403.6010305@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=clemens@ladisch.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=robert.picco@hp.com \
--cc=venkatesh.pallipadi@intel.com \
--cc=vojtech@suse.cz \
--cc=y-goto@jp.fujitsu.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
Powered by JetHome