• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

xapi-project / xen-api / 11571363638
78%
master: 80%

Build:
Build:
LAST BUILD BRANCH: dev/pau/majmin
DEFAULT BRANCH: master
Ran 29 Oct 2024 09:54AM UTC
Jobs 1
Files 37
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Oct 2024 09:52AM UTC coverage: 78.273%. Remained the same
11571363638

push

github

web-flow
CA-400199: open /dev/urandom on first use and use an input channel to reduce number of syscalls (#6085)

This is an alternative to
https://github.com/xapi-project/xen-api/pull/6077

2 recent optimizations have changed the Uuidx module to open
  /dev/urandom once on startup, instead of every time a value was
  requested.

However 'networkd_db' runs in the installer environment, inside a chroot
where /dev/urandom is not available.

Open /dev/urandom on first use instead.

Simplify the code and use a single implementation for both fast and
secure urandom generation:
* use a mutex to protect accesses to global urandom state
* use an input channel, rather than a Unix file descriptor, this allows
us to read many bytes in one go, and then generate multiple random
numbers without having to make syscalls that often

(syscalls are slow in this case because they require releasing the
runtime mutex, which gives another thread the opportunity to run for
50ms).

Fixes: a0176da73 ("CP-49135: open /dev/urandom just once")
Fixes: a2d9fbe39 ("IH-577 Implement v7 UUID generation")
Fixes: 6635a00d6 ("CP-49136: Introduce PRNG for generating non-secret
UUIDs")

This is slightly slower than before, but still fast enough:
```
│  uuidx creation/Uuidx.make            │             0.0004 mjw/run│            16.0001 mnw/run│            105.8801 ns/run│
│  uuidx creation/Uuidx.make_uuid_urnd  │             0.0004 mjw/run│            16.0001 mnw/run│            105.1474 ns/run│
```

Previously this used to take ~88ns, so in fact the difference is barely
noticable.

Also remove the feature flag: the previous change was feature flagged
too, but broke master anyway (I wouldn't have though anything *doesn't*
have /dev/urandom available, and didn't feature flag that part, because
in general it is not possible to feature flag startup code without
races).

`networkd_db` now doesn't try to open this anymore:
```
strace -e openat -e open networkd_db
open("/etc/ld.so.cache", O_RDONLY|O_CLO... (continued)

3462 of 4423 relevant lines covered (78.27%)

0.78 hits per line

Jobs
ID Job ID Ran Files Coverage
1 python3.11 - 11571363638.1 29 Oct 2024 09:54AM UTC 37
78.27
GitHub Action Run
Source Files on build 11571363638
  • Tree
  • List 37
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #11571363638
  • 137160e5 on github
  • Prev Build on master (#11499537040)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc