Skip to contentSkip to conversation

haveged: fix CPU cache size detection

PATCH In review Stefan Agner 2 participants 2 messages Jun 6, 2019 – Jun 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 haveged: fix CPU cache size detection

From: Stefan Agner <[email protected]>

Fix ENOMEM error in case the kernel reports cache size of -1. This lead to the following error when starting haveged:
haveged starting up
haveged: Couldn't initialize HAVEGE rng 5

---
 .../haveged/fix-cpu-cache-size-detection.patch       | 20 ++++++++++++++++++++
 meta-oe/recipes-extended/haveged/haveged_1.9.4.bb    |  1 +
 2 files changed, 21 insertions(+)
 create mode 100644 meta-oe/recipes-extended/haveged/haveged/fix-cpu-cache-size-detection.patch
meta-oe/recipes-extended/haveged/haveged/fix-cpu-cache-size-detection.patch new file +20 -0
new file mode 100644
index 000000000..5b68f1966
@@ -0,0 +1,20 @@
+Some ARM cpus does not report the cache size or say it is -1
+
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866306
+
+Upstream-status: Pending
+
+Index: haveged-1.9.2/src/havegetune.c
+===================================================================
+--- haveged-1.9.2.orig/src/havegetune.c
++++ haveged-1.9.2/src/havegetune.c
+@@ -795,6 +795,9 @@ static int vfs_configInfoCache(
+          ctype = vfs_configFile(pAnchor, path, vfs_configType);
+          strcpy(path+plen, "size");
+          size  = vfs_configFile(pAnchor, path, vfs_configInt);
++         if (size == -1) {
++             size = ctype == 'I' ? GENERIC_ICACHE : GENERIC_DCACHE;
++         }
+          cfg_cacheAdd(pAnchor, SRC_VFS_INDEX,  pArgs[1], level, ctype, size);
+          }
+      }
meta-oe/recipes-extended/haveged/haveged_1.9.4.bb +1 -0
index 32aab59f1..d0e1a29dd 100644
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM="file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 SRCREV = "faa40ff345af194d3253f5fb030403e3c9831c36"
 SRC_URI = "git://github.com/jirka-h/haveged.git \
            file://haveged-init.d-Makefile.am-add-missing-dependency.patch \
+           file://fix-cpu-cache-size-detection.patch \
 "
 S = "${WORKDIR}/git"
 
Signature · 1 line
2.13.6
#1 lore raw
Quoted 20 lines · Stefan Agner

From: Stefan Agner <[email protected]>

Fix ENOMEM error in case the kernel reports cache size of -1. This lead to the following error when starting haveged:
haveged starting up
haveged: Couldn't initialize HAVEGE rng 5

---
 .../haveged/fix-cpu-cache-size-detection.patch       | 20 ++++++++++++++++++++
 meta-oe/recipes-extended/haveged/haveged_1.9.4.bb    |  1 +
 2 files changed, 21 insertions(+)
 create mode 100644 meta-oe/recipes-extended/haveged/haveged/fix-cpu-cache-size-detection.patch
meta-oe/recipes-extended/haveged/haveged/fix-cpu-cache-size-detection.patch new file +0 -0
new file mode 100644
index 000000000..5b68f1966

meta-oe/recipes-extended/haveged/haveged/fix-cpu-cache-size-detection.patch line 5

Quoted 5 lines
meta-oe/recipes-extended/haveged/haveged/fix-cpu-cache-size-detection.patch new file +5 -0
@@ -0,0 +1,20 @@
+Some ARM cpus does not report the cache size or say it is -1
+
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866306
+
+Upstream-status: Pending

missing "Singed-off-by" per patch process

Quoted 27 lines
meta-oe/recipes-extended/haveged/haveged/fix-cpu-cache-size-detection.patch new file +15 -0
+
+Index: haveged-1.9.2/src/havegetune.c
+===================================================================
+--- haveged-1.9.2.orig/src/havegetune.c
++++ haveged-1.9.2/src/havegetune.c
+@@ -795,6 +795,9 @@ static int vfs_configInfoCache(
+          ctype = vfs_configFile(pAnchor, path, vfs_configType);
+          strcpy(path+plen, "size");
+          size  = vfs_configFile(pAnchor, path, vfs_configInt);
++         if (size == -1) {
++             size = ctype == 'I' ? GENERIC_ICACHE : GENERIC_DCACHE;
++         }
+          cfg_cacheAdd(pAnchor, SRC_VFS_INDEX,  pArgs[1], level, ctype, size);
+          }
+      }
meta-oe/recipes-extended/haveged/haveged_1.9.4.bb +1 -0
index 32aab59f1..d0e1a29dd 100644
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM="file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 SRCREV = "faa40ff345af194d3253f5fb030403e3c9831c36"
 SRC_URI = "git://github.com/jirka-h/haveged.git \
            file://haveged-init.d-Makefile.am-add-missing-dependency.patch \
+           file://fix-cpu-cache-size-detection.patch \
 "
 S = "${WORKDIR}/git"