Re: [PATCH V4 12/23] RISC-V: cpufeature: Avoid calling riscv_of_processor_hartid()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 04, 2023 at 11:50:26PM +0530, Sunil V L wrote:
> riscv_fill_hwcap() finds hartid of each cpu but never really uses
> it. So, remove this unnecessary call.

"Never uses it" or "never really uses it"?
This commit message misses the point though I think - is this here to
get the hartid, or is it here to do all the property validation that
riscv_of_processor_hartid() does for a cpu node?

This was added all the way back in 4.20 in commit 732e8e4130ff ("RISC-V:
properly determine hardware caps").
As the loop is a for_each_of_cpu_node(), I don't think this change is
actually valid - there's no guarantee that the cpu we are iterating over
is actually available and the riscv_of_processor_hartid() check is used
to skip "bad" cpus AFAICT.

Perhaps I am missing something, I don't think you can do this until you
switch the loop to use something that only uses cpus that you know are
valid.

Cheers,
Conor.

> Signed-off-by: Sunil V L <sunilvl@xxxxxxxxxxxxxxxx>
> ---
>  arch/riscv/kernel/cpufeature.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> index 59d58ee0f68d..63e56ce04162 100644
> --- a/arch/riscv/kernel/cpufeature.c
> +++ b/arch/riscv/kernel/cpufeature.c
> @@ -91,7 +91,6 @@ void __init riscv_fill_hwcap(void)
>  	char print_str[NUM_ALPHA_EXTS + 1];
>  	int i, j, rc;
>  	unsigned long isa2hwcap[26] = {0};
> -	unsigned long hartid;
>  
>  	isa2hwcap['i' - 'a'] = COMPAT_HWCAP_ISA_I;
>  	isa2hwcap['m' - 'a'] = COMPAT_HWCAP_ISA_M;
> @@ -109,10 +108,6 @@ void __init riscv_fill_hwcap(void)
>  		DECLARE_BITMAP(this_isa, RISCV_ISA_EXT_MAX);
>  		const char *temp;
>  
> -		rc = riscv_of_processor_hartid(node, &hartid);
> -		if (rc < 0)
> -			continue;
> -
>  		if (of_property_read_string(node, "riscv,isa", &isa)) {
>  			pr_warn("Unable to find \"riscv,isa\" devicetree entry\n");
>  			continue;
> -- 
> 2.34.1
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-riscv

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux