* [PATCH] RISC-V: cacheinfo: add init_cache_level() @ 2024-01-22 1:35 Yunhui Cui 2024-01-22 8:09 ` Conor Dooley 0 siblings, 1 reply; 6+ messages in thread From: Yunhui Cui @ 2024-01-22 1:35 UTC (permalink / raw) To: paul.walmsley, palmer, aou, cuiyunhui, conor.dooley, robh, sudeep.holla, pierre.gondois, suagrfillet, linux-riscv, linux-kernel When cacheinfo_sysfs_init() is executed, the general weak function init_cache_level() returns -ENOENT, causing failure to add the "cache" node to /sys/devices/system/cpu/cpux/. Implement the init_cache_level() function on RISC-V to fix it. Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> --- arch/riscv/kernel/cacheinfo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/riscv/kernel/cacheinfo.c b/arch/riscv/kernel/cacheinfo.c index 09e9b88110d1..be9169a38bac 100644 --- a/arch/riscv/kernel/cacheinfo.c +++ b/arch/riscv/kernel/cacheinfo.c @@ -71,6 +71,12 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, this_leaf->type = type; } +int init_cache_level(unsigned int cpu) +{ + /* The topology has been parsed by acpi or dt, return true. */ + return 0; +} + int populate_cache_leaves(unsigned int cpu) { struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); -- 2.20.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] RISC-V: cacheinfo: add init_cache_level() 2024-01-22 1:35 [PATCH] RISC-V: cacheinfo: add init_cache_level() Yunhui Cui @ 2024-01-22 8:09 ` Conor Dooley 2024-01-22 8:32 ` [External] " yunhui cui 0 siblings, 1 reply; 6+ messages in thread From: Conor Dooley @ 2024-01-22 8:09 UTC (permalink / raw) To: Yunhui Cui Cc: paul.walmsley, palmer, aou, conor.dooley, robh, sudeep.holla, pierre.gondois, suagrfillet, linux-riscv, linux-kernel [-- Attachment #1.1: Type: text/plain, Size: 1186 bytes --] On Mon, Jan 22, 2024 at 09:35:10AM +0800, Yunhui Cui wrote: > When cacheinfo_sysfs_init() is executed, the general weak function > init_cache_level() returns -ENOENT, causing failure to add the "cache" > node to /sys/devices/system/cpu/cpux/. Implement the init_cache_level() > function on RISC-V to fix it. If you recall correctly, I asked you to explain how to reproduce this when you sent the patch. Thanks, Conor. > > Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> > --- > arch/riscv/kernel/cacheinfo.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/arch/riscv/kernel/cacheinfo.c b/arch/riscv/kernel/cacheinfo.c > index 09e9b88110d1..be9169a38bac 100644 > --- a/arch/riscv/kernel/cacheinfo.c > +++ b/arch/riscv/kernel/cacheinfo.c > @@ -71,6 +71,12 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, > this_leaf->type = type; > } > > +int init_cache_level(unsigned int cpu) > +{ > + /* The topology has been parsed by acpi or dt, return true. */ > + return 0; > +} > + > int populate_cache_leaves(unsigned int cpu) > { > struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); > -- > 2.20.1 > > [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 161 bytes --] _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Re: [PATCH] RISC-V: cacheinfo: add init_cache_level() 2024-01-22 8:09 ` Conor Dooley @ 2024-01-22 8:32 ` yunhui cui 2024-01-22 8:55 ` Conor Dooley 0 siblings, 1 reply; 6+ messages in thread From: yunhui cui @ 2024-01-22 8:32 UTC (permalink / raw) To: Conor Dooley Cc: paul.walmsley, palmer, aou, conor.dooley, robh, sudeep.holla, pierre.gondois, suagrfillet, linux-riscv, linux-kernel Hi Conor, On Mon, Jan 22, 2024 at 4:09 PM Conor Dooley <conor@kernel.org> wrote: > > On Mon, Jan 22, 2024 at 09:35:10AM +0800, Yunhui Cui wrote: > > When cacheinfo_sysfs_init() is executed, the general weak function > > init_cache_level() returns -ENOENT, causing failure to add the "cache" > > node to /sys/devices/system/cpu/cpux/. Implement the init_cache_level() > > function on RISC-V to fix it. > > If you recall correctly, I asked you to explain how to reproduce this > when you sent the patch. In fact, the reason has been explained in the commit log. As for how to reproduce it, you can check whether there is a "cache" node in /sys/devices/system/cpu/cpux/ on the riscv platform. Thanks, Yunhui _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Re: [PATCH] RISC-V: cacheinfo: add init_cache_level() 2024-01-22 8:32 ` [External] " yunhui cui @ 2024-01-22 8:55 ` Conor Dooley 2024-01-22 10:57 ` yunhui cui 0 siblings, 1 reply; 6+ messages in thread From: Conor Dooley @ 2024-01-22 8:55 UTC (permalink / raw) To: yunhui cui Cc: paul.walmsley, palmer, aou, conor.dooley, robh, sudeep.holla, pierre.gondois, suagrfillet, linux-riscv, linux-kernel [-- Attachment #1.1: Type: text/plain, Size: 1271 bytes --] On Mon, Jan 22, 2024 at 04:32:15PM +0800, yunhui cui wrote: > Hi Conor, > > On Mon, Jan 22, 2024 at 4:09 PM Conor Dooley <conor@kernel.org> wrote: > > > > On Mon, Jan 22, 2024 at 09:35:10AM +0800, Yunhui Cui wrote: > > > When cacheinfo_sysfs_init() is executed, the general weak function > > > init_cache_level() returns -ENOENT, causing failure to add the "cache" > > > node to /sys/devices/system/cpu/cpux/. Implement the init_cache_level() > > > function on RISC-V to fix it. > > > > If you recall correctly, I asked you to explain how to reproduce this > > when you sent the patch. > > In fact, the reason has been explained in the commit log. As for how > to reproduce it, you can check whether there is a "cache" node in > /sys/devices/system/cpu/cpux/ on the riscv platform. That's the thing - I tried to reproduce this several times and either: a) The system had cache information in DT and the directory was created. If I hot unplugged and re-plugged the directory was re-created. b) The system had no cache information in DT and the directory was never created. You said in your original report that you came across this problem in qemu - can you share the qemu command required to reproduce please? Thanks, Conor. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 161 bytes --] _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Re: [PATCH] RISC-V: cacheinfo: add init_cache_level() 2024-01-22 8:55 ` Conor Dooley @ 2024-01-22 10:57 ` yunhui cui 2024-01-22 17:02 ` Sudeep Holla 0 siblings, 1 reply; 6+ messages in thread From: yunhui cui @ 2024-01-22 10:57 UTC (permalink / raw) To: Conor Dooley Cc: paul.walmsley, palmer, aou, conor.dooley, robh, sudeep.holla, pierre.gondois, suagrfillet, linux-riscv, linux-kernel Hi Conor, On Mon, Jan 22, 2024 at 4:55 PM Conor Dooley <conor@kernel.org> wrote: > > On Mon, Jan 22, 2024 at 04:32:15PM +0800, yunhui cui wrote: > > Hi Conor, > > > > On Mon, Jan 22, 2024 at 4:09 PM Conor Dooley <conor@kernel.org> wrote: > > > > > > On Mon, Jan 22, 2024 at 09:35:10AM +0800, Yunhui Cui wrote: > > > > When cacheinfo_sysfs_init() is executed, the general weak function > > > > init_cache_level() returns -ENOENT, causing failure to add the "cache" > > > > node to /sys/devices/system/cpu/cpux/. Implement the init_cache_level() > > > > function on RISC-V to fix it. > > > > > > If you recall correctly, I asked you to explain how to reproduce this > > > when you sent the patch. > > > > In fact, the reason has been explained in the commit log. As for how > > to reproduce it, you can check whether there is a "cache" node in > > /sys/devices/system/cpu/cpux/ on the riscv platform. > > That's the thing - I tried to reproduce this several times and either: > a) The system had cache information in DT and the directory was > created. If I hot unplugged and re-plugged the directory was > re-created. > b) The system had no cache information in DT and the directory was never > created. Indeed, I verified it again, it’s because there is no cache node in dts, thank you for reminding me. Thanks, Yunhui _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [External] Re: [PATCH] RISC-V: cacheinfo: add init_cache_level() 2024-01-22 10:57 ` yunhui cui @ 2024-01-22 17:02 ` Sudeep Holla 0 siblings, 0 replies; 6+ messages in thread From: Sudeep Holla @ 2024-01-22 17:02 UTC (permalink / raw) To: yunhui cui Cc: Conor Dooley, paul.walmsley, palmer, aou, conor.dooley, robh, pierre.gondois, suagrfillet, linux-riscv, Sudeep Holla, linux-kernel On Mon, Jan 22, 2024 at 06:57:49PM +0800, yunhui cui wrote: > Hi Conor, > > On Mon, Jan 22, 2024 at 4:55 PM Conor Dooley <conor@kernel.org> wrote: > > > > On Mon, Jan 22, 2024 at 04:32:15PM +0800, yunhui cui wrote: > > > Hi Conor, > > > > > > On Mon, Jan 22, 2024 at 4:09 PM Conor Dooley <conor@kernel.org> wrote: > > > > > > > > On Mon, Jan 22, 2024 at 09:35:10AM +0800, Yunhui Cui wrote: > > > > > When cacheinfo_sysfs_init() is executed, the general weak function > > > > > init_cache_level() returns -ENOENT, causing failure to add the "cache" > > > > > node to /sys/devices/system/cpu/cpux/. Implement the init_cache_level() > > > > > function on RISC-V to fix it. > > > > > > > > If you recall correctly, I asked you to explain how to reproduce this > > > > when you sent the patch. > > > > > > In fact, the reason has been explained in the commit log. As for how > > > to reproduce it, you can check whether there is a "cache" node in > > > /sys/devices/system/cpu/cpux/ on the riscv platform. > > > > That's the thing - I tried to reproduce this several times and either: > > a) The system had cache information in DT and the directory was > > created. If I hot unplugged and re-plugged the directory was > > re-created. > > b) The system had no cache information in DT and the directory was never > > created. > > Indeed, I verified it again, it’s because there is no cache node in > dts, thank you for reminding me. > That's good. I wasn't able to figure out why the issue could occur without issues in DT/ACPI. -- Regards, Sudeep _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-22 17:03 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-01-22 1:35 [PATCH] RISC-V: cacheinfo: add init_cache_level() Yunhui Cui 2024-01-22 8:09 ` Conor Dooley 2024-01-22 8:32 ` [External] " yunhui cui 2024-01-22 8:55 ` Conor Dooley 2024-01-22 10:57 ` yunhui cui 2024-01-22 17:02 ` Sudeep Holla
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox