New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 650897 link

Starred by 3 users

Issue metadata

Status: Archived
Owner:
Last visit > 30 days ago
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocked on:
issue 652039



Sign in to add a comment

dump_vpd_log is slow and called too often

Project Member Reported by smbar...@chromium.org, Sep 28 2016

Issue description

dump_vpd_log is used by many, many scripts on boot. It's called 8 separate times while booting including 4x by regulatory-domain.conf, 2x for accelerometer init. And unfortunately, it's very very slow. In fact, it's slower with VPD cached on disk than just running vpd -l and hitting SPI flash.

time dump_vpd_log --full --stdout
"serial_number"="1234567890"

real    0m0.290s
user    0m0.107s
sys     0m0.163s

localhost ~ # time vpd -l
"serial_number"="1234567890"

real    0m0.187s
user    0m0.023s
sys     0m0.163s


I hacked out some places that used this script and just accessed the cached VPD directly; this speeds up overall boot by 112ms (to login-prompt-visible).

The bulk of this time is being spent in shflags argument parsing. Maybe dump_vpd_log needs to be rewritten in not-shell-script form, but there are some improvements that could be done in other places too. regulatory-domain.conf for instance, will call dump_vpd_log up to 4 times instead of calling once and caching the result.
 
Blockedon: 652039
Project Member

Comment 2 by bugdroid1@chromium.org, Oct 5 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/ade45fd7d7b19fa357bc6bbc01e0ead76eb80795

commit ade45fd7d7b19fa357bc6bbc01e0ead76eb80795
Author: Stephen Barber <smbarber@chromium.org>
Date: Fri Sep 30 23:55:21 2016

init: regulatory-domain.conf: only call dump_vpd_log once

dump_vpd_log is currently a pretty slow shell script, even with
cached VPD. Modify regulatory-domain.conf to call dump_vpd_log
only once and cache the result.

BUG= chromium:650897 
TEST=use perf timechart during boot to check that dump_vpd_log isn't
called multiple times in succession

Change-Id: I8de945c6e0475ce20fa7030adc8473670f7b1c41
Reviewed-on: https://chromium-review.googlesource.com/391667
Commit-Ready: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/ade45fd7d7b19fa357bc6bbc01e0ead76eb80795/init/regulatory-domain.conf

Cc: charliemooney@chromium.org
Components: OS>Firmware
Hey Steve, I ran into this issue just now too -- this script was taking crazy long to look up vpd values and I ended up on this bug.

I took your observation in comment #0, and was able to drastically reduce the amount of time the dump_vpd_log script takes by replacing the shflags script with a simple case statement.  Admittedly, it's not the prettiest way to do things, but it almost halved the amount of time the script took on my system.

I've got the CL up here:
https://chromium-review.googlesource.com/#/c/414241/

I'm not familiar with all the places/ways this script is called so I tried to simply copy over the exact same parameters and didn't touch any of the script's real functionality.  I don't think it should change anything as long as scripts are calling it with reasonable arguments (eg: I'm not sure how something like including both --noclean --clean would be handled, but barring weird situations like that it should be all the same)
Cc: dhend...@chromium.org
Why do those boot scripts call dump_vpd_log? Are they simply calling it for reading some value?

I think in comparison to changing dump_vpd_log (and make it harder to maintain), maybe it's better to create a more boot time friendly script. For example, maybe it's easier to have a single script

read_vpd_value.sh NAME

And it can be simple, without extra param parsing as:

read_vpd_value() {
 local name="$1"
 # try VPD from sysfs, available on 3.10+ ARM and 4.4+ x86.
 if [ -f "/sys/firmware/vpd/ro/${name}" ]; then
   cat "/sys/firmware/vpd/ro/${name}"
   return
 elif [ -f "/sys/firmware/vpd/rw/${name}" ]; then
   cat "/sys/firmware/vpd/rw/${name}"
   return
 fi
 
 sed -n "s/^\"${name}\"="\(.*\)"/\1/p" /mnt/stateful_partition/unencrypted/cache/vpd/full-v2.txt

}

main() {
  if [ "$#" != 1 ]; then
     echo "usage: $0 name" >&2
     exit 1
  fi
 read_vpd_value "$1"
}

main "$@"

I don't know all the places/ways that this dump_vpd_log script is used so I didn't feel comfortable (or have the time to attempt) trying to make serious changes to this system.  I just noticed that Steve was right about the argument parsing wasting a lot of time so I thought we could get an easy chunk of speedup by removing it.

If your idea in comment #4 works, wouldn't you need to track down every script that uses dump_vpd_log to modify them as well?

Your suggestion is probably better long-term, but while you work on it maybe my new parser would be a suitable adjustment in the meantime?  I feel like it's only marginally more difficult to maintain that when using shflags since the command line arguments it takes are so simple (there's no complex parsing going on at all).

Comment 6 Deleted

Yeah, I think we should update dump_vpd_log to check sysfs so that callers don't need to worry about where the data comes from. Optimizing dump_vpd_log can be a follow-up.

For this bug Charlie's patch to replace shflags seems appropriate.
Project Member

Comment 8 by bugdroid1@chromium.org, Dec 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vpd/+/7445e10f95657dddc71271014a359c0b39eac600

commit 7445e10f95657dddc71271014a359c0b39eac600
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Dec 08 02:07:45 2016

util: Add a new utility 'vpd_get_value' that speeds up value reading.

There may be more and more upstart jobs (or scripts) need to fetch
VPD values. In comparison to the huge dump_vpd_log, which was solely
designed for creating the cache (and full-report), many scripts simply
want to read one single value and needs an optimized version of utility
helping to read from VPD, no matter if it's from /sys (available on
recent devices) or legacy cache.

This script tries to optimize and hide all logic so it should be the
fastest way to read one single VPD entry.

BRANCH=none
BUG= chromium:650897 
TEST=time vpd_get_value serial_number # on Link, real = 0.005s
     time (dump_vpd_log --full --stdout | grep 'serial_number') # 0.085s

Change-Id: Ie231cb539f9da8fd03c1dc31e54994f461c1c916
Reviewed-on: https://chromium-review.googlesource.com/417461
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>

[add] https://crrev.com/7445e10f95657dddc71271014a359c0b39eac600/util/vpd_get_value

Project Member

Comment 9 by bugdroid1@chromium.org, Dec 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/d0b6bdeb1ee9772544d4947664bfb489f793ca87

commit d0b6bdeb1ee9772544d4947664bfb489f793ca87
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Dec 08 02:27:59 2016

chromeos-base/vpd: Add new utility 'vpd_get_value'.

A new optimized script 'vpd_get_value' helps reading single vpd entry
with minimal cost (identical to 'vpd -g key', but it will use whatever
cache that is available).

BUG= chromium:650897 
TEST=emerge-link vpd
CQ-DEPEND=CL:417461

Change-Id: I1f08a741c9a33b5a40467c0937b5abb537d9a82f
Reviewed-on: https://chromium-review.googlesource.com/417722
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>

[modify] https://crrev.com/d0b6bdeb1ee9772544d4947664bfb489f793ca87/chromeos-base/vpd/vpd-9999.ebuild

Project Member

Comment 10 by bugdroid1@chromium.org, Dec 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/c6887fb2c06009bf5a3479a161d93ff8dfdea1f0

commit c6887fb2c06009bf5a3479a161d93ff8dfdea1f0
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Dec 08 14:19:27 2016

chromeos-base/chromeos-activate-date: Speed up reading VPD cache value.

When checking if ActivateDate VPD is already set or not, using the
optimized vpd_get_value (0.005s) is better than dump_vpd_log (0.08s).

Also removed the unused variable PARTITION.

BUG= chromium:650897 
TEST=Boot device and see activate date set.

Change-Id: I3e5a69acc4dd8232cba86d40133197037e24f536
Reviewed-on: https://chromium-review.googlesource.com/417444
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>

[rename] https://crrev.com/c6887fb2c06009bf5a3479a161d93ff8dfdea1f0/chromeos-base/chromeos-activate-date/chromeos-activate-date-0.0.1-r7.ebuild
[modify] https://crrev.com/c6887fb2c06009bf5a3479a161d93ff8dfdea1f0/chromeos-base/chromeos-activate-date/files/activate_date.sh

Project Member

Comment 11 by bugdroid1@chromium.org, Dec 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/touch_updater/+/c362fc3e0822fd864033d2fd10b804e81c1ce04e

commit c362fc3e0822fd864033d2fd10b804e81c1ce04e
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Dec 08 14:45:25 2016

Speed up reading customization ID from VPD.

Replace the heavy dump_vpd_log (~0.08s) by new vpd_get_value (~0.005s).

BUG= chromium:650897 
TEST=None
CQ-DEPEND=CL:417461

Change-Id: I74cd18c917669a169752afd7e46a27c1159a019d
Reviewed-on: https://chromium-review.googlesource.com/418100
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>

[modify] https://crrev.com/c362fc3e0822fd864033d2fd10b804e81c1ce04e/scripts/chromeos-touch-common.sh

Project Member

Comment 12 by bugdroid1@chromium.org, Dec 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/aosp/platform/system/connectivity/shill/+/b8ab59eb2547e21fcf077e64cb1afb67d3bdcb71

commit b8ab59eb2547e21fcf077e64cb1afb67d3bdcb71
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Dec 08 14:33:58 2016

shill: Optimize VPD access in set_wifi_regulatory.

'dump_vpd_log' was slow (~0.08s) and can be replaced by the lightweight
'vpd_get_value' (~0.05s) since we only need 'region'.

Execution time tested on link:
 before change = real 0.087s
  after change = real 0.010s

BUG= chromium:650897 
TEST=vpd -s region=nordic; dump_vpd_log --force; set_wifi_regulatory
     # see regulatory set to SE.
     test_set_wifi_regulatory; # PASS
CQ-DEPEND=CL:417461

Change-Id: I2ea18ce56f60d0e02973bc661c477d8b06e263b8
Reviewed-on: https://chromium-review.googlesource.com/417464
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/b8ab59eb2547e21fcf077e64cb1afb67d3bdcb71/bin/set_wifi_regulatory
[modify] https://crrev.com/b8ab59eb2547e21fcf077e64cb1afb67d3bdcb71/bin/test_set_wifi_regulatory

Project Member

Comment 13 by bugdroid1@chromium.org, Dec 13 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/3981ca5a6f74f7b5a56c3c3ad94a2b6d15ef6ea1

commit 3981ca5a6f74f7b5a56c3c3ad94a2b6d15ef6ea1
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Dec 08 15:23:55 2016

regions: Support sysfs-based VPD in cros_region_data.

On recent systems VPD is also provided by kernel driver, which is easier
and faster for retrieval.

This change helps cros_region_data to read directly from /sys/firmware,
just like vpd_get_value.

The reasons to add sys support here instead of using vpd_get_value are:
1. vpd_get_value works better for single value, but cros_region_data
   needs to access multiple values (so it needs full cache).
2. vpd_get_value expects dump_vpd_log to work while cros_region_data
   may need to run inside initramfs or mount-failure (no stateful
   partition, no cache folder).

BUG= chromium:650897 
TEST=cros_region_data regulatory_domain se

Change-Id: I1ecb3205d4e2eea7c7790d29d0eb175a71e99f45
Reviewed-on: https://chromium-review.googlesource.com/418140
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>

[modify] https://crrev.com/3981ca5a6f74f7b5a56c3c3ad94a2b6d15ef6ea1/regions/cros_region_data

Project Member

Comment 14 by bugdroid1@chromium.org, Dec 14 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/fa8918fed45a767c5140905ca2e0b64fe8bf7778

commit fa8918fed45a767c5140905ca2e0b64fe8bf7778
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu Dec 08 14:01:14 2016

init: Optimize regulatory domain init time.

regulatory-domain was using "dump_vpd_log" to retrieve all VPD values,
which is pretty slow (0.08s per invocation) and should be replaced by
the new lightweight vpd_get_value (0.005s).

Also changed the for-loop into a single switch-case so the string
comparison is done automatically, and will be more efficient when the
constrained regdomain increases.

BUG= chromium:650897 
TEST=Restarted and see right regdomain set.
CQ-DEPEND=CL:417722

Change-Id: I7dc4865e0c651dfd741657dda6cdbb4950e00a13
Reviewed-on: https://chromium-review.googlesource.com/417644
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/fa8918fed45a767c5140905ca2e0b64fe8bf7778/init/regulatory-domain.conf

Status: Fixed (was: Started)
Project Member

Comment 16 by bugdroid1@chromium.org, Feb 10 2017

Labels: merge-merged-factory-gru-9017.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vpd/+/3fa85ac9b7616f2e1826ea416efad3a7066bdb79

commit 3fa85ac9b7616f2e1826ea416efad3a7066bdb79
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Feb 10 09:14:55 2017

util: Add a new utility 'vpd_get_value' that speeds up value reading.

There may be more and more upstart jobs (or scripts) need to fetch
VPD values. In comparison to the huge dump_vpd_log, which was solely
designed for creating the cache (and full-report), many scripts simply
want to read one single value and needs an optimized version of utility
helping to read from VPD, no matter if it's from /sys (available on
recent devices) or legacy cache.

This script tries to optimize and hide all logic so it should be the
fastest way to read one single VPD entry.

BRANCH=none
BUG= chromium:650897 
TEST=time vpd_get_value serial_number # on Link, real = 0.005s
     time (dump_vpd_log --full --stdout | grep 'serial_number') # 0.085s

Change-Id: Ie231cb539f9da8fd03c1dc31e54994f461c1c916
Reviewed-on: https://chromium-review.googlesource.com/417461
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
(cherry picked from commit 7445e10f95657dddc71271014a359c0b39eac600)
Reviewed-on: https://chromium-review.googlesource.com/440890
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

[add] https://crrev.com/3fa85ac9b7616f2e1826ea416efad3a7066bdb79/util/vpd_get_value

Project Member

Comment 17 by bugdroid1@chromium.org, Feb 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/4b2a611949967661d559a4924bfeb69a5bd9318f

commit 4b2a611949967661d559a4924bfeb69a5bd9318f
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Feb 10 09:17:19 2017

chromeos-base/vpd: Add new utility 'vpd_get_value'.

A new optimized script 'vpd_get_value' helps reading single vpd entry
with minimal cost (identical to 'vpd -g key', but it will use whatever
cache that is available).

BUG= chromium:650897 
TEST=emerge-link vpd
CQ-DEPEND=CL:417461

Change-Id: I1f08a741c9a33b5a40467c0937b5abb537d9a82f
Reviewed-on: https://chromium-review.googlesource.com/417722
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
(cherry picked from commit d0b6bdeb1ee9772544d4947664bfb489f793ca87)
Reviewed-on: https://chromium-review.googlesource.com/440869
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/4b2a611949967661d559a4924bfeb69a5bd9318f/chromeos-base/vpd/vpd-9999.ebuild

Project Member

Comment 18 by bugdroid1@chromium.org, Feb 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/4b2a611949967661d559a4924bfeb69a5bd9318f

commit 4b2a611949967661d559a4924bfeb69a5bd9318f
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Feb 10 09:17:19 2017

chromeos-base/vpd: Add new utility 'vpd_get_value'.

A new optimized script 'vpd_get_value' helps reading single vpd entry
with minimal cost (identical to 'vpd -g key', but it will use whatever
cache that is available).

BUG= chromium:650897 
TEST=emerge-link vpd
CQ-DEPEND=CL:417461

Change-Id: I1f08a741c9a33b5a40467c0937b5abb537d9a82f
Reviewed-on: https://chromium-review.googlesource.com/417722
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
(cherry picked from commit d0b6bdeb1ee9772544d4947664bfb489f793ca87)
Reviewed-on: https://chromium-review.googlesource.com/440869
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/4b2a611949967661d559a4924bfeb69a5bd9318f/chromeos-base/vpd/vpd-9999.ebuild

Project Member

Comment 19 by bugdroid1@chromium.org, Feb 10 2017

Labels: merge-merged-factory-reef-8811.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vpd/+/ff7d70f2361c9c440fdb09d0702c3580e23b3cf2

commit ff7d70f2361c9c440fdb09d0702c3580e23b3cf2
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Feb 10 09:19:46 2017

util: Add a new utility 'vpd_get_value' that speeds up value reading.

There may be more and more upstart jobs (or scripts) need to fetch
VPD values. In comparison to the huge dump_vpd_log, which was solely
designed for creating the cache (and full-report), many scripts simply
want to read one single value and needs an optimized version of utility
helping to read from VPD, no matter if it's from /sys (available on
recent devices) or legacy cache.

This script tries to optimize and hide all logic so it should be the
fastest way to read one single VPD entry.

BRANCH=none
BUG= chromium:650897 
TEST=time vpd_get_value serial_number # on Link, real = 0.005s
     time (dump_vpd_log --full --stdout | grep 'serial_number') # 0.085s

Change-Id: Ie231cb539f9da8fd03c1dc31e54994f461c1c916
Reviewed-on: https://chromium-review.googlesource.com/417461
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
(cherry picked from commit 7445e10f95657dddc71271014a359c0b39eac600)
Reviewed-on: https://chromium-review.googlesource.com/440889
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[add] https://crrev.com/ff7d70f2361c9c440fdb09d0702c3580e23b3cf2/util/vpd_get_value

Project Member

Comment 20 by bugdroid1@chromium.org, Feb 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/49b1012f4fb4ed5ab476e77eab3793b1293bdccd

commit 49b1012f4fb4ed5ab476e77eab3793b1293bdccd
Author: Ting Shen <phoenixshen@google.com>
Date: Fri Feb 10 09:24:37 2017

CHERRY-PICK: chromeos-base/vpd: Add new utility 'vpd_get_value'.

A new optimized script 'vpd_get_value' helps reading single vpd entry
with minimal cost (identical to 'vpd -g key', but it will use whatever
cache that is available).

BUG= chromium:650897 
TEST=emerge-reef vpd

Change-Id: I5e48c9fbb813956e687635d67117607e08e26ad7
Reviewed-on: https://chromium-review.googlesource.com/440712
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>

[modify] https://crrev.com/49b1012f4fb4ed5ab476e77eab3793b1293bdccd/chromeos-base/vpd/vpd-9999.ebuild

Project Member

Comment 21 by bugdroid1@chromium.org, Feb 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/45a44168b57d63d6acf6c754bd6ebb7ec9de2dd3

commit 45a44168b57d63d6acf6c754bd6ebb7ec9de2dd3
Author: Hung-Te Lin <hungte@chromium.org>
Date: Mon Feb 13 07:07:31 2017

chromeos-{bsp,activate-date}-*: Speed up reading VPD cache value.

When checking if ActivateDate or als_cal_data VPD value is already set or not,
using the optimized vpd_get_value (0.005s) is better than dump_vpd_log (0.08s).

BUG= chromium:650897 
TEST=Manually set VPD values (ActivateData, als_cal_data) and run the
     scripts, seeing proper values.

Change-Id: I6ae3dae9093129c98ecb63332e404da5880d39d8
Reviewed-on: https://chromium-review.googlesource.com/440006
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/45a44168b57d63d6acf6c754bd6ebb7ec9de2dd3/overlay-glimmer/chromeos-base/chromeos-activate-date-glimmer/files/activate_date.conf
[modify] https://crrev.com/45a44168b57d63d6acf6c754bd6ebb7ec9de2dd3/overlay-link/chromeos-base/chromeos-bsp-link/files/light-sensor-set-multiplier.sh
[modify] https://crrev.com/45a44168b57d63d6acf6c754bd6ebb7ec9de2dd3/overlay-ultima/chromeos-base/chromeos-activate-date-ultima/files/activate_date.conf
[modify] https://crrev.com/45a44168b57d63d6acf6c754bd6ebb7ec9de2dd3/overlay-sentry/chromeos-base/chromeos-activate-date-sentry/files/activate_date.conf
[modify] https://crrev.com/45a44168b57d63d6acf6c754bd6ebb7ec9de2dd3/overlay-peppy/chromeos-base/chromeos-bsp-peppy/files/light-sensor-set-multiplier.sh
[modify] https://crrev.com/45a44168b57d63d6acf6c754bd6ebb7ec9de2dd3/overlay-pyro/chromeos-base/chromeos-activate-date-pyro/files/activate_date.conf

Project Member

Comment 22 by bugdroid1@chromium.org, Feb 17 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/d8dab7eb2476bee3c14d1acf330d69e2e34d4788

commit d8dab7eb2476bee3c14d1acf330d69e2e34d4788
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Feb 17 12:09:38 2017

chromeos-accelerometer-init: Improve VPD reading by vpd_get_value.

Improve accelerometer initialization by replacing dump_vpd_log to the
new efficient vpd_get_value, and revise the logic of setting calibration
data.

vpd_get_value (~5ms) is faster than dump_vpd_log (~80ms). In the worst
case, we have to call it multiple times (3 axis * 2 locations * 2 types
= ~60ms), but still better than dump_vpd_log. With the new logic,
for devices with kernel >3.18 we can even reduce to ~30ms (no need to
read calibscale).

BUG= chromium:650897 
TEST=None

Change-Id: I1636c8a929dca7e894c6de6fa0c893db551f2009
Reviewed-on: https://chromium-review.googlesource.com/424255
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>

[modify] https://crrev.com/d8dab7eb2476bee3c14d1acf330d69e2e34d4788/chromeos-base/chromeos-accelerometer-init/files/udev/accelerometer-init.sh

Project Member

Comment 23 by bugdroid1@chromium.org, Mar 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/ec7cbdfd37dcb5438bc0eaafe4d070483fae3214

commit ec7cbdfd37dcb5438bc0eaafe4d070483fae3214
Author: Gwendal Grignou <gwendal@chromium.org>
Date: Thu Mar 02 02:42:16 2017

init: Move cros-ec accelerometers setup to its own .conf

Move the .conf file for setting accelerometers in chromeos-accelerometer-init
package.
Accelerometers set up script needs chromeos-startup to complete, now
start the setup when ui is being started.

BUG= chromium:650897 , chromium:652039 
CQ-DEPEND=CL:447882
TEST=Done in CL:447882

Change-Id: Ied77752ae7039507be5ee3ea21e658364d13c8d5
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/448158
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/ec7cbdfd37dcb5438bc0eaafe4d070483fae3214/init/udev-trigger-early.conf

Project Member

Comment 24 by bugdroid1@chromium.org, Mar 3 2017

Labels: merge-merged-release-R57-9202.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/1f9435ed6a50d7b9b25b1dd6cfcabe3584af3f4b

commit 1f9435ed6a50d7b9b25b1dd6cfcabe3584af3f4b
Author: Gwendal Grignou <gwendal@chromium.org>
Date: Fri Mar 03 17:26:04 2017

init: Move cros-ec accelerometers setup to its own .conf

Move the .conf file for setting accelerometers in chromeos-accelerometer-init
package.
Accelerometers set up script needs chromeos-startup to complete, now
start the setup when ui is being started.

BUG= chromium:650897 , chromium:652039 
CQ-DEPEND=CL:447882
TEST=Done in CL:447882

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/448158
Reviewed-by: Mike Frysinger <vapier@chromium.org>
(cherry picked from commit ec7cbdfd37dcb5438bc0eaafe4d070483fae3214)
Change-Id: Ied77752ae7039507be5ee3ea21e658364d13c8d5
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/448250

[modify] https://crrev.com/1f9435ed6a50d7b9b25b1dd6cfcabe3584af3f4b/init/udev-trigger-early.conf

Project Member

Comment 25 by bugdroid1@chromium.org, Mar 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/986b1ee4ce0765c01d736153dfa60a7ef95a9dd5

commit 986b1ee4ce0765c01d736153dfa60a7ef95a9dd5
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Mar 03 17:26:04 2017

chromeos-accelerometer-init: Improve VPD reading by vpd_get_value.

Improve accelerometer initialization by replacing dump_vpd_log to the
new efficient vpd_get_value, and revise the logic of setting calibration
data.

vpd_get_value (~5ms) is faster than dump_vpd_log (~80ms). In the worst
case, we have to call it multiple times (3 axis * 2 locations * 2 types
= ~60ms), but still better than dump_vpd_log. With the new logic,
for devices with kernel >3.18 we can even reduce to ~30ms (no need to
read calibscale).

BUG= chromium:650897 
TEST=None

Reviewed-on: https://chromium-review.googlesource.com/424255
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
(cherry picked from commit d8dab7eb2476bee3c14d1acf330d69e2e34d4788)
Change-Id: I1636c8a929dca7e894c6de6fa0c893db551f2009
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/448843

[modify] https://crrev.com/986b1ee4ce0765c01d736153dfa60a7ef95a9dd5/chromeos-base/chromeos-accelerometer-init/files/udev/accelerometer-init.sh

Comment 26 by dchan@google.com, Mar 4 2017

Labels: VerifyIn-58

Comment 27 by dchan@google.com, Apr 17 2017

Labels: VerifyIn-59

Comment 28 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61

Comment 30 by dchan@chromium.org, Oct 14 2017

Status: Archived (was: Fixed)
Project Member

Comment 31 by bugdroid1@chromium.org, Oct 5

Labels: merge-merged-factory-oak-8182.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/vpd/+/c1d22580a39c175232131ccdb538893fbae056b1

commit c1d22580a39c175232131ccdb538893fbae056b1
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Oct 05 00:22:11 2018

util: Add a new utility 'vpd_get_value' that speeds up value reading.

There may be more and more upstart jobs (or scripts) need to fetch
VPD values. In comparison to the huge dump_vpd_log, which was solely
designed for creating the cache (and full-report), many scripts simply
want to read one single value and needs an optimized version of utility
helping to read from VPD, no matter if it's from /sys (available on
recent devices) or legacy cache.

This script tries to optimize and hide all logic so it should be the
fastest way to read one single VPD entry.

BRANCH=none
BUG= chromium:650897 
TEST=time vpd_get_value serial_number # on Link, real = 0.005s
     time (dump_vpd_log --full --stdout | grep 'serial_number') # 0.085s

Change-Id: Ie231cb539f9da8fd03c1dc31e54994f461c1c916
Reviewed-on: https://chromium-review.googlesource.com/417461
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
(cherry picked from commit 7445e10f95657dddc71271014a359c0b39eac600)
Reviewed-on: https://chromium-review.googlesource.com/440889
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
(cherry picked from commit ff7d70f2361c9c440fdb09d0702c3580e23b3cf2)
Reviewed-on: https://chromium-review.googlesource.com/c/1263024
Reviewed-by: Philip Chen <philipchen@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Trybot-Ready: Philip Chen <philipchen@chromium.org>

[add] https://crrev.com/c1d22580a39c175232131ccdb538893fbae056b1/util/vpd_get_value

Project Member

Comment 32 by bugdroid1@chromium.org, Oct 5

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/36d6484b58e38bf966065a97e4d48d6c3848c49e

commit 36d6484b58e38bf966065a97e4d48d6c3848c49e
Author: Ting Shen <phoenixshen@google.com>
Date: Fri Oct 05 00:47:38 2018

CHERRY-PICK: chromeos-base/vpd: Add new utility 'vpd_get_value'.

A new optimized script 'vpd_get_value' helps reading single vpd entry
with minimal cost (identical to 'vpd -g key', but it will use whatever
cache that is available).

BUG= chromium:650897 
TEST=emerge-reef vpd

Change-Id: I5e48c9fbb813956e687635d67117607e08e26ad7
Reviewed-on: https://chromium-review.googlesource.com/440712
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
(cherry picked from commit 49b1012f4fb4ed5ab476e77eab3793b1293bdccd)
Reviewed-on: https://chromium-review.googlesource.com/c/1263179
Reviewed-by: Philip Chen <philipchen@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Trybot-Ready: Philip Chen <philipchen@chromium.org>

[modify] https://crrev.com/36d6484b58e38bf966065a97e4d48d6c3848c49e/chromeos-base/vpd/vpd-9999.ebuild

Sign in to add a comment