Thread (11 messages) 11 messages, 2 authors, 2024-08-01

Re: [PATCH v2 3/6] rtla/utils: Add idle state disabling via libcpupower

From: Tomas Glozar <tglozar@redhat.com>
Date: 2024-08-01 09:45:08
Also in: lkml

Need to check if the calloc failed and return an error if it did.
Definitely, I completely missed that.
Hmm, should this warn if state is not zero and disabled is negative.
rtla timerlat hist/top will error out if save_cpu_idle_disable_state
returns a negative value, so I don't think a warning is necessary
here.
            if (save_cpu_idle_disable_state(i) < 0) {
                err_msg("Could not save cpu idle state.\n");
                goto out_free;
            }
Should probably have a check to see if saved_cpu_idle_disable exists.
quoted
+     nr_states = cpuidle_state_count(cpu);
+
+     if (nr_states == 0)
+             return 0;
+
As well as saved_cpu_idle_disable_state[cpu] exists.

Just for robustness.
Right, that would help catch some possible bugs if
restore_cpu_idle_disable_state is ever called before
save_cpu_idle_disable_state. The values of
saved_cpu_idle_disable_state and saved_cpu_idle_disable_state[cpu]
have to be read anyway, checking for zero should not make any
noticeable difference.
No need to check here. free() works fine with passing NULL to it.
Ah, I see, I need to check that for saved_cpu_idle_disable_state so
that I won't be accessing null memory in the for loop, but not for
saved_cpu_idle_disable_state[cpu], where I just call free().

Tomas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help