Re: [PATCH v5 08/14] ARM: tegra: Make outer_disable() open-coded

From: Dmitry Osipenko
Date: Mon Sep 30 2019 - 10:29:21 EST


30.09.2019 11:05, Thierry Reding ÐÐÑÐÑ:
> On Sun, Sep 29, 2019 at 08:59:46PM +0300, Dmitry Osipenko wrote:
>> The outer_disable() of Tegra's suspend code is open-coded now since
>> that helper produces spurious warning message about secondary CPUs being
>> online. The secondaries are actually halted by the cpuidle driver on
>> entering into LP2 idle-state. This fixes a storm of warnings once LP2
>> idling state is enabled on Tegra30.
>
> If the cpuidle driver halts the secondaries, shouldn't it set it offline
> then so that outer_disable() can still work correctly?

No.. how would you know what CPU's should be resumed?

AFAIK, the online status should be only changed by the hotplug code and
nothing else. I don't think that it's a good idea to manually touch the
online mask.

It looks to me that the only purpose of outer_disable() checking for the
num_online_cpus is to prevent people from doing wrong things by
disabling L2 in a random places in their code. Hence it should be
absolutely fine to open code when you know what you're doing, which is
the case here.

We can check the rail status in tegra_sleep_cpu():

if (trusted_foundations_registered() && outer_cache.disable) {
if (WARN_ON(!tegra_cpu_rail_off_ready()))
return -EBUSY;

outer_cache.disable();
}

Which is equal to the check for num_online_cpus. Does it sound good?