projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fa505db
)
kmod-setup: bypass heavy virtio-rng check if we are not running in a VM anyway
author
Lennart Poettering
<lennart@poettering.net>
Tue, 18 Apr 2023 08:48:54 +0000
(10:48 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 18 Apr 2023 08:52:04 +0000
(10:52 +0200)
detect_vm() is cheap, because cached, let's hence do that early before
we get out the big guns and sweep through sysfs.
src/core/kmod-setup.c
patch
|
blob
|
history
diff --git
a/src/core/kmod-setup.c
b/src/core/kmod-setup.c
index 949b1a5854a041647880765b57f88b5b5df4c833..adf817800f449fd78176f2afa07093d2399d728b 100644
(file)
--- a/
src/core/kmod-setup.c
+++ b/
src/core/kmod-setup.c
@@
-67,6
+67,10
@@
static int has_virtio_rng_recurse_dir_cb(
static bool has_virtio_rng(void) {
int r;
+ /* Directory traversal might be slow, hence let's do a cheap check first if it's even worth it */
+ if (detect_vm() == VIRTUALIZATION_NONE)
+ return false;
+
r = recurse_dir_at(
AT_FDCWD,
"/sys/devices/pci0000:00",