Bug 1841455

Summary: Stop updating the watchdog every time an event is processed
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: systemdAssignee: systemd maint <systemd-maint>
Status: NEW --- QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: dtardon, systemd-maint-list
Target Milestone: rcKeywords: Performance, Triaged
Target Release: 8.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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:

Description Renaud Métrich 2020-05-29 07:51:20 UTC
This bug was initially created as a copy of Bug #1841451

I am copying this bug because: 

Also applies to RHEL 8.


Description of problem:

In current systemd code (including Upstream), the hardware watchdog is updated every time an event is processed in manager_loop():

RHEL 8.2:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
2782 int manager_loop(Manager *m) {
 :
2800         while (m->exit_code == MANAGER_OK) {
2801                 usec_t wait_usec;
2802 
2803                 if (m->runtime_watchdog > 0 && m->runtime_watchdog != USEC_INFINITY && MANAGER_IS_SY     STEM(m))
2804                         watchdog_ping();
 :
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Upstream:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
2888 int manager_loop(Manager *m) {
 :
2905                 watchdog_usec = manager_get_watchdog(m, WATCHDOG_RUNTIME);
2906                 if (timestamp_is_set(watchdog_usec))
2907                         watchdog_ping();
 :
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This is overkill, in particular this can create issues depending on the watchdog implementation (e.g. when it goes through IPMI, which may be slow).
The update should be done every half period only.

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

systemd-219 and later (including Upstream)