Bug 1956248 - rngd uses 100% CPU while in a yield() loop
Summary: rngd uses 100% CPU while in a yield() loop
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: rng-tools
Version: 8.3
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Vladis Dronov
QA Contact: Vilém Maršík
Depends On:
TreeView+ depends on / blocked
Reported: 2021-05-03 10:01 UTC by Renaud Métrich
Modified: 2021-05-05 13:05 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:
Type: Bug
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3098661 0 None None None 2021-05-03 10:19:25 UTC

Description Renaud Métrich 2021-05-03 10:01:29 UTC
This bug was initially created as a copy of Bug #1781346

I am copying this bug because: 

Some customers hit this on RHEL8 as well.
Backtrace of 1 coredump taken shows rngd spins on sched_yield():
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
(gdb) list
447		cpus = NULL;
449		/* Make sure all our threads are doing their jobs */
450		for (i=0; i < num_threads; i++) {
451			while (tdata[i].active == 0)
452				sched_yield();               <<<<<< HERE
453			message(LOG_DAEMON|LOG_DEBUG, "CPU Thread %d is ready\n", i);
454		}
456		flags = fcntl(pipefds[0], F_GETFL, 0);

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Please backport Upstream commit 62aa34f8f8a567b99b03079aebda8bac71c334bd.

Description of problem:

On my laptop (but not my desktop - related to TPM?) rngd spends 100% of CPU time and keeps the fan running.

Interim solution: kill it.

Version-Release number of selected component (if applicable):


How reproducible:

Steps to Reproduce:
1. Boot up-to-date Fedora 30
2. Wait
3. Profit! If you're the power company, or a fan manufacturer, that is.

Actual results:

A load average of 1.0 when the laptop is otherwise idle, and a noisy spinning fan

Expected results:

Maybe rngd can _occasionally_ spin in a yield loop for jitter entropy or whatever, but doing it enough that the fan stays on for hours at a time isn't great.

Additional info:

As mentioned, this seems to be somewhat hw-specific for unknown reasons. It doesn't happen on my desktop, despite rng-tools being installed there too, and the configuration being pretty much the same (ie up-to-date F30 with my -git kernel, of course).

Comment 2 Vladis Dronov 2021-05-04 14:13:02 UTC
hello, Renaud,
thank you for bringing this up. indeed, 62aa34f8f8a5 ("Move jitter to use proper state locking/thread signaling")
is in the v6.9 of rng-tools while RHEL8 has 6.8-3.el8 version. we will look into backporting the fix or rebasing
rng-tools in the RHEL8.5 and probably earlier minor versions.

Comment 4 Vladis Dronov 2021-05-04 14:15:05 UTC

Note You need to log in before you can comment on or make changes to this bug.