Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patches 2 upstream systemd #32430

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,14 @@ static int invoke_main_loop(
assert(ret_switch_root_init);
assert(ret_error_message);

log_warning("sd: i=userspace, inactive_exit="USEC_FMT, m->timestamps[MANAGER_TIMESTAMP_USERSPACE].monotonic);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anything, these definitely shouldn't be logged at the warning level (debug seems to be appropriate).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and they can all be queried at runtime, and some are already logged later, so doesn't seem worth adding any of these

log_warning("sd: i=security, inactive_exit="USEC_FMT, m->timestamps[MANAGER_TIMESTAMP_SECURITY_START].monotonic);
log_warning("sd: i=security, active_enter="USEC_FMT, m->timestamps[MANAGER_TIMESTAMP_SECURITY_FINISH].monotonic);
log_warning("sd: i=generators, inactive_exit="USEC_FMT, m->timestamps[MANAGER_TIMESTAMP_GENERATORS_START].monotonic);
log_warning("sd: i=generators, active_enter="USEC_FMT, m->timestamps[MANAGER_TIMESTAMP_GENERATORS_FINISH].monotonic);
log_warning("sd: i=units_load, inactive_exit="USEC_FMT, m->timestamps[MANAGER_TIMESTAMP_UNITS_LOAD_START].monotonic);
log_warning("sd: i=units_load, active_enter="USEC_FMT, m->timestamps[MANAGER_TIMESTAMP_UNITS_LOAD_FINISH].monotonic);

for (;;) {
int objective = manager_loop(m);
if (objective < 0) {
Expand Down Expand Up @@ -3002,6 +3010,8 @@ int main(int argc, char *argv[]) {
kernel_timestamp = DUAL_TIMESTAMP_NULL;
}

log_warning("sd: status changed: INITIALIZING, t="USEC_FMT, userspace_timestamp.monotonic);

initialize_coredump(skip_setup);

r = fixup_environment();
Expand Down
9 changes: 9 additions & 0 deletions src/core/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -3785,6 +3785,11 @@ static void manager_notify_finished(Manager *m) {
FORMAT_TIMESPAN(total_usec, USEC_PER_MSEC)));
}

log_warning("sd: i=userspace, active_enter="USEC_FMT, m->timestamps[MANAGER_TIMESTAMP_FINISH].monotonic);
log_warning("sd: status changed: %s, t="USEC_FMT,
(set_size(m->failed_units) > 0) ? "DEGRADED(startdone)": "RUNNING",
m->timestamps[MANAGER_TIMESTAMP_FINISH].monotonic);

bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec);

log_taint_string(m);
Expand Down Expand Up @@ -4552,6 +4557,10 @@ int manager_update_failed_units(Manager *m, Unit *u, bool failed) {
size = set_size(m->failed_units);

if (failed) {
log_warning("sd: status changed: %s, t="USEC_FMT,
dual_timestamp_is_set(m->timestamps + MANAGER_TIMESTAMP_FINISH) ? "DEGRADED"
: "STARTING(degraded)",
u->inactive_enter_timestamp.monotonic);
r = set_ensure_put(&m->failed_units, NULL, u);
if (r < 0)
return log_oom();
Expand Down
24 changes: 20 additions & 4 deletions src/core/unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2622,15 +2622,31 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
if (!MANAGER_IS_RELOADING(m)) {
dual_timestamp_now(&u->state_change_timestamp);

if (UNIT_IS_INACTIVE_OR_FAILED(os) && !UNIT_IS_INACTIVE_OR_FAILED(ns))
if (UNIT_IS_INACTIVE_OR_FAILED(os) && !UNIT_IS_INACTIVE_OR_FAILED(ns)) {
u->inactive_exit_timestamp = u->state_change_timestamp;
else if (!UNIT_IS_INACTIVE_OR_FAILED(os) && UNIT_IS_INACTIVE_OR_FAILED(ns))
log_warning("sd: u=%s, inactive_exit="USEC_FMT,
u->id, u->inactive_exit_timestamp.monotonic);
}
else if (!UNIT_IS_INACTIVE_OR_FAILED(os) && UNIT_IS_INACTIVE_OR_FAILED(ns)) {
u->inactive_enter_timestamp = u->state_change_timestamp;
log_warning("sd: u=%s, inactive_enter="USEC_FMT,
u->id, u->inactive_enter_timestamp.monotonic);
}

if (!UNIT_IS_ACTIVE_OR_RELOADING(os) && UNIT_IS_ACTIVE_OR_RELOADING(ns))
if (!UNIT_IS_ACTIVE_OR_RELOADING(os) && UNIT_IS_ACTIVE_OR_RELOADING(ns)) {
u->active_enter_timestamp = u->state_change_timestamp;
else if (UNIT_IS_ACTIVE_OR_RELOADING(os) && !UNIT_IS_ACTIVE_OR_RELOADING(ns))
log_warning("sd: u=%s, active_enter="USEC_FMT,
u->id, u->active_enter_timestamp.monotonic);
if (unit_has_name(u, SPECIAL_BASIC_TARGET)) {
log_warning("sd: status changed: STARTING, t="USEC_FMT,
u->active_enter_timestamp.monotonic);
}
}
else if (UNIT_IS_ACTIVE_OR_RELOADING(os) && !UNIT_IS_ACTIVE_OR_RELOADING(ns)) {
u->active_exit_timestamp = u->state_change_timestamp;
log_warning("sd: u=%s, active_exit="USEC_FMT,
u->id, u->active_exit_timestamp.monotonic);
}
}

/* Keep track of failed units */
Expand Down