Bug 1762679

Summary: Rules in 40-redhat.rules file for SUBSYSTEM==memory are suboptimal and may lead to timing issues
Product: Red Hat Enterprise Linux 8 Reporter: Jan Synacek <jsynacek>
Component: systemdAssignee: Jan Synacek <jsynacek>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.1CC: bugproxy, hannsj_uhl, rmetrich, systemd-maint-list
Target Milestone: rc   
Target Release: 8.2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-239-19.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:45:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1711971, 1748051    

Description Jan Synacek 2019-10-17 08:48:16 UTC
This bug was initially created as a copy of Bug #1748051

I am copying this bug because: 



Description of problem:

The /lib/udev/rules.d/40-redhat.rules file defines the following rules for "memory" subsystem:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# Memory hotadd request
SUBSYSTEM!="memory", GOTO="memory_hotplug_end"
ACTION!="add", GOTO="memory_hotplug_end"
PROGRAM="/bin/uname -p", RESULT=="s390*", GOTO="memory_hotplug_end"

ENV{.state}="online"
PROGRAM="/bin/systemd-detect-virt", RESULT=="none", ENV{.state}="online_movable"
ATTR{state}=="offline", ATTR{state}="$env{.state}"

LABEL="memory_hotplug_end"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

On system that have many Memory devices (in some cases, I can see up to 1000 or 12000 memory devices!!!), these rules will spawn tons of "uname -p" / "systemd-detect-virt" processes which will kill the system.

This issue affects multiple packages as well, for example trace-cmd ("/lib/udev/rules.d/98-trace-cmd.rules") and kexec-tools ("/lib/udev/rules.d/98-kexec.rules").


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

systemd-219-67.el7_7.1


How reproducible:

Always


Steps to Reproduce:
1. Enable debugging in udev: "udev.log-priority=debug" while booting

2. Check the number of times a command executed

  # journalctl -b | egrep '(PROGRAM|RUN)' | cut -f2- -d"'" | sort | uniq -c | sort -nr


Actual results:

    168 /usr/bin/systemctl is-active trace-cmd.service' /usr/lib/udev/rules.d/98-trace-cmd.rules:1
    124 kmod load $env{MODALIAS}' /usr/lib/udev/rules.d/80-drivers.rules:5
     32 /bin/uname -p' /usr/lib/udev/rules.d/40-redhat.rules:9
     32 /bin/systemd-detect-virt' /usr/lib/udev/rules.d/40-redhat.rules:12
    ...

Expected results:

  1 call to "systemd-detect-virt"
  1 call to "uname -p"

Additional info:

This was observed on a system with 16 memory devices (2GB VM with 1 CPU).
On large physical systems, it can be just crazy.

Comment 1 Jan Synacek 2019-10-17 09:56:35 UTC
https://github.com/systemd-rhel/rhel-8/pull/28

Comment 3 Lukáš Nykrýn 2019-10-21 10:10:44 UTC
fix merged to github master branch -> https://github.com/systemd-rhel/rhel-8/pull/28 -> post

Comment 5 Jan Synacek 2019-12-03 08:57:11 UTC
*** Bug 1748053 has been marked as a duplicate of this bug. ***

Comment 8 errata-xmlrpc 2020-04-28 16:45:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1794