[ipxe-devel] [patch] preserve CPU in virtualized environment.

Alessandro Salvatori sandr8 at gmail.com
Thu Jul 26 02:53:09 UTC 2012


Michael,

  [resending text-only]

that doesn't seem to help.

Here are three CPU utilization plots.

What you can observe in the plots is a virtual machine attempting to
boot 8 or 9 times, waiting ~7.5 seconds between attempts then
rebooting and trying again.

The first one http://imagebin.org/222150 is the baseline and is built off:

commit 27fdb9557266eaaadfb39a2eddfb06d2aade9661
Author: Michael Brown <mcb30 at ipxe.org>
Date:   Sat Nov 12 00:34:55 2011 +0000

The second one http://imagebin.org/222151 is built off that same
commit, with my "sleeping beauty" patch. Note the different scale due
to the much lower CPU utilization (0.7% in the idle times as compared
to 60% from baseline iPXE).

The third one http://imagebin.org/222152 is built off that same
commit, plus your getkey cpu nap edit. I can't see any significant
improvement. But I was expecting that, since we have an embedded
script.

If you want to be more conservative, you can initialize do_not_sleep
to 1 instead of 0, and let the beauty bite the apple right before it
parses the embedded scripts or autoboots. But even the way it is, it
works like a charm for me and doesn't seem to slow down the normal
booting by any measurable amount.

We thought it'd be good to contribute back, but feel free not to
include it if you still have some concerns, or to adjust it as you
feel it needs (like only linking it for some configuration parameter),
or take the idea and re-implement it in a way you like better.

thank you!
-Alessandro-
 Here i am, A young man,
 A crashing computer program,
 Here is a pen, write out my name...

(from: The Servant - Orchestra)


baseline iPXE CPU utilization when bootserver is missing in action
http://imagebin.org/222150


iPXE CPU utilization when bootserver is missing in action, with
sleeping beauty patch.
http://imagebin.org/222151


iPXE CPU utilization when bootserver is missing in action, getkey patch.
http://imagebin.org/222152


On Tue, Jul 24, 2012 at 2:59 AM, Michael Brown <mbrown at fensystems.co.uk> wrote:
> On Tuesday 24 Jul 2012 02:26:41 Alessandro Salvatori wrote:
>>   if the server is missing in action, one may want to retry at regular
>> intervals (via sleep and goto) but until a download starts making
>> progress, all that polling is a bit overkill, since we'd be just receiving
>> a few seldom packets.
>
> Thanks for clarifying.
>
> iPXE already calls cpu_nap() during sleep_exec(); it should use almost no CPU
> in the middle of a "sleep"
>
> However, in the process of investigating this, I was surprised to discover
> that iPXE doesn't call cpu_nap() while waiting for user input (e.g. at the
> shell prompt).  This is now fixed:
>
>   http://git.ipxe.org/ipxe.git/commitdiff/183a70e
>
> Michael



More information about the ipxe-devel mailing list