Peter Marheine submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Anastasia Klimchuk: Looks good to me, approved
reduce DELAY_MINIMUM_SLEEP_US to 100 by default

This makes flashrom sleep more eagerly rather than busy-waiting,
observing that most delays in flashrom are either less than 100
microseconds (barely enough time to get any work done, even on a fast
machine) or much more than 1 millisecond (very wasteful to busy-loop).
Since we believe most systems offer good timer resolution that should
provide sleep latency on the order of 100 microseconds, this is a
reasonable default.

For DOS, the default is set to 50ms because the best available timing
source on DOS only ticks at about 20 Hz.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: I0f431d240c670446218b14811ef62a34e4c83da2
Reviewed-on: https://review.coreboot.org/c/flashrom/+/81608
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
---
M meson_cross/i586_djgpp_dos.txt
M meson_options.txt
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/meson_cross/i586_djgpp_dos.txt b/meson_cross/i586_djgpp_dos.txt
index 3d97aab..a1f2401 100644
--- a/meson_cross/i586_djgpp_dos.txt
+++ b/meson_cross/i586_djgpp_dos.txt
@@ -30,6 +30,8 @@
[project options]
tests = 'disabled'
ich_descriptors_tool = 'disabled'
+# DOS time resolution is only about 50ms
+delay_minimum_sleep_us = 50000

[properties]
sys_root = '/usr/local/djgpp'
diff --git a/meson_options.txt b/meson_options.txt
index 0f56e26..6df95ba 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -21,6 +21,6 @@
option('documentation', type : 'feature', value : 'auto', description : 'build the html documentation')
option('ni845x_search_path', type : 'string', value : 'C:\Program Files (x86)\National Instruments\Ni-845x\MS Visual C',
description : 'Path to search for the proprietary ni845x library and header (32-bit Windows only)')
-option('delay_minimum_sleep_us', type : 'integer', min : 0, value : 100000,
+option('delay_minimum_sleep_us', type : 'integer', min : 0, value : 100,
description : 'Minimum time in microseconds to suspend execution for (rather than polling) when a delay is required.'
+ ' Larger values may perform better on machines with low timer resolution, at the cost of increased power.')

To view, visit change 81608. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I0f431d240c670446218b14811ef62a34e4c83da2
Gerrit-Change-Number: 81608
Gerrit-PatchSet: 3
Gerrit-Owner: Peter Marheine <pmarheine@chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine@chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src@posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>