lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 20 Jul 2022 17:00:54 +0800
From:   Huacai Chen <chenhuacai@...nel.org>
To:     Bibo Mao <maobibo@...ngson.cn>
Cc:     WANG Xuerui <kernel@...0n.name>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        loongarch@...ts.linux.dev, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] LoongArch: Remove clock setting during cpu hotplug stage

Hi, Bibo,

This series looks good to me, but I want to wait for some time to see
if others have comments. Thanks.

Huacai

On Wed, Jul 20, 2022 at 3:22 PM Bibo Mao <maobibo@...ngson.cn> wrote:
>
> On physical machine we can save power by disabling clock of hot removed cpu.
> However there will be problem, since different platforms have different clock
> setting methods, the code is platform relative. Also it can be in firmware/pmu
> compoments or cpu regulator driver, rather than general loongarch cpu booting
> flow.
>
> Also on qemu virt machine, device clock/freq setting is not
> emulated, there is no such registers.
>
> This patch removes hard-coded register accessing in generic
> loongarch cpu boot flow.
>
> Signed-off-by: Bibo Mao <maobibo@...ngson.cn>
> ---
>  arch/loongarch/kernel/smp.c | 29 -----------------------------
>  include/linux/cpuhotplug.h  |  1 -
>  2 files changed, 30 deletions(-)
>
> diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c
> index 73cec62504fb..98b3e059d344 100644
> --- a/arch/loongarch/kernel/smp.c
> +++ b/arch/loongarch/kernel/smp.c
> @@ -359,35 +359,6 @@ void play_dead(void)
>         play_dead_uncached(state_addr);
>  }
>
> -static int loongson3_enable_clock(unsigned int cpu)
> -{
> -       uint64_t core_id = cpu_data[cpu].core;
> -       uint64_t package_id = cpu_data[cpu].package;
> -
> -       LOONGSON_FREQCTRL(package_id) |= 1 << (core_id * 4 + 3);
> -
> -       return 0;
> -}
> -
> -static int loongson3_disable_clock(unsigned int cpu)
> -{
> -       uint64_t core_id = cpu_data[cpu].core;
> -       uint64_t package_id = cpu_data[cpu].package;
> -
> -       LOONGSON_FREQCTRL(package_id) &= ~(1 << (core_id * 4 + 3));
> -
> -       return 0;
> -}
> -
> -static int register_loongson3_notifier(void)
> -{
> -       return cpuhp_setup_state_nocalls(CPUHP_LOONGARCH_SOC_PREPARE,
> -                                        "loongarch/loongson:prepare",
> -                                        loongson3_enable_clock,
> -                                        loongson3_disable_clock);
> -}
> -early_initcall(register_loongson3_notifier);
> -
>  #endif
>
>  /*
> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> index 19f0dbfdd7fe..b66c5f389159 100644
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -130,7 +130,6 @@ enum cpuhp_state {
>         CPUHP_ZCOMP_PREPARE,
>         CPUHP_TIMERS_PREPARE,
>         CPUHP_MIPS_SOC_PREPARE,
> -       CPUHP_LOONGARCH_SOC_PREPARE,
>         CPUHP_BP_PREPARE_DYN,
>         CPUHP_BP_PREPARE_DYN_END                = CPUHP_BP_PREPARE_DYN + 20,
>         CPUHP_BRINGUP_CPU,
> --
> 2.31.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ