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]
Message-ID: <81bc47a8-ded7-be55-60c2-73bd1d363fd2@redhat.com>
Date:   Wed, 1 Jun 2022 10:51:41 +0800
From:   Gavin Shan <gshan@...hat.com>
To:     Sudeep Holla <sudeep.holla@....com>, linux-kernel@...r.kernel.org
Cc:     Atish Patra <atishp@...shpatra.org>,
        Atish Patra <atishp@...osinc.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Morten Rasmussen <morten.rasmussen@....com>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Qing Wang <wangqing@...o.com>,
        linux-arm-kernel@...ts.infradead.org,
        linux-riscv@...ts.infradead.org, Rob Herring <robh+dt@...nel.org>
Subject: Re: [PATCH v3 03/16] cacheinfo: Move cache_leaves_are_shared out of
 CONFIG_OF

Hi Sudeep,

On 5/25/22 4:14 PM, Sudeep Holla wrote:
> cache_leaves_are_shared is already used even with ACPI and PPTT. It checks
> if the cache leaves are the shared based on fw_token pointer. However it is
> defined conditionally only if CONFIG_OF is enabled which is wrong.
> 
> Move the function cache_leaves_are_shared out of CONFIG_OF and keep it
> generic. It also handles the case where both OF and ACPI is not defined.
> 
> Signed-off-by: Sudeep Holla <sudeep.holla@....com>
> ---
>   drivers/base/cacheinfo.c | 20 +++++++++-----------
>   1 file changed, 9 insertions(+), 11 deletions(-)
> 

With below nits fixed:

Reviewed-by: Gavin Shan <gshan@...hat.com>

> diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
> index c4547d8ac6f3..417e1ebf5525 100644
> --- a/drivers/base/cacheinfo.c
> +++ b/drivers/base/cacheinfo.c
> @@ -33,13 +33,21 @@ struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu)
>   	return ci_cacheinfo(cpu);
>   }
>   
> -#ifdef CONFIG_OF
>   static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf,
>   					   struct cacheinfo *sib_leaf)
>   {
> +	/*
> +	 * For non DT/ACPI systems, assume unique level 1 caches,
> +	 * system-wide shared caches for all other levels. This will be used
> +	 * only if arch specific code has not populated shared_cpu_map
> +	 */
> +	if (!IS_ENABLED(CONFIG_OF) && !(IS_ENABLED(CONFIG_ACPI)))
> +		return !(this_leaf->level == 1);
> +
>   	return sib_leaf->fw_token == this_leaf->fw_token;
>   }
>   

	if (!IS_ENABLED(CONFIG_OF) && !IS_ENABLED(CONFIG_ACPI))

         or

	if (!(IS_ENABLED(CONFIG_OF) || IS_ENABLED(CONFIG_ACPI)))

> +#ifdef CONFIG_OF
>   /* OF properties to query for a given cache type */
>   struct cache_type_info {
>   	const char *size_prop;
> @@ -193,16 +201,6 @@ static int cache_setup_of_node(unsigned int cpu)
>   }
>   #else
>   static inline int cache_setup_of_node(unsigned int cpu) { return 0; }
> -static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf,
> -					   struct cacheinfo *sib_leaf)
> -{
> -	/*
> -	 * For non-DT/ACPI systems, assume unique level 1 caches, system-wide
> -	 * shared caches for all other levels. This will be used only if
> -	 * arch specific code has not populated shared_cpu_map
> -	 */
> -	return !(this_leaf->level == 1);
> -}
>   #endif
>   
>   int __weak cache_setup_acpi(unsigned int cpu)
> 

Thanks,
Gavin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ