[PATCH bpf] cacheinfo: move get_cpu_cacheinfo_id() back out

James Morse james.morse at arm.com
Tue Nov 23 10:48:43 PST 2021


Hello,

On 23/11/2021 17:45, Song Liu wrote:
> On Sat, Nov 20, 2021 at 6:55 AM Jakub Kicinski <kuba at kernel.org> wrote:
>>
>> This commit more or less reverts commit 709c4362725a ("cacheinfo:
>> Move resctrl's get_cache_id() to the cacheinfo header file").
>>
>> There are no users of the static inline helper outside of resctrl/core.c
>> and cpu.h is a pretty heavy include, it pulls in device.h etc. This
>> trips up architectures like riscv which want to access cacheinfo
>> in low level headers like elf.h.
>>
>> Link: https://lore.kernel.org/all/20211120035253.72074-1-kuba@kernel.org/
>> Signed-off-by: Jakub Kicinski <kuba at kernel.org>
>> ---

>> x86 resctrl folks, does this look okay?
>>
>> I'd like to do some bpf header cleanups in -next which this is blocking.
>> How would you like to handle that? This change looks entirely harmless,
>> can I get an ack and take this via bpf/netdev to Linus ASAP so it
>> propagates to all trees?
> 
> Does this patch target the bpf tree, or the bpf-next tree? If we want to unblock
> bpf header cleanup in -next, we can simply include it in a set for bpf-next.


Some background: this is part of the mpam tree that wires up resctrl for arm64. This patch
floated to the top and got merged with some cleanup as it was independent of the wider
resctrl changes.

If the cpu.h include is the problem, I can't see what that is needed for. It almost
certainly came in with a lockdep annotation that got replaced by a comment instead.


Thanks,

James


>> diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h
>> index 2f909ed084c6..c8c71eea237d 100644
>> --- a/include/linux/cacheinfo.h
>> +++ b/include/linux/cacheinfo.h
>> @@ -3,7 +3,6 @@
>>  #define _LINUX_CACHEINFO_H
>>
>>  #include <linux/bitops.h>
>> -#include <linux/cpu.h>
>>  #include <linux/cpumask.h>
>>  #include <linux/smp.h>
>>
>> @@ -102,24 +101,4 @@ int acpi_find_last_cache_level(unsigned int cpu);
>>
>>  const struct attribute_group *cache_get_priv_group(struct cacheinfo *this_leaf);
>>
>> -/*
>> - * Get the id of the cache associated with @cpu at level @level.
>> - * cpuhp lock must be held.
>> - */
>> -static inline int get_cpu_cacheinfo_id(int cpu, int level)
>> -{
>> -       struct cpu_cacheinfo *ci = get_cpu_cacheinfo(cpu);
>> -       int i;
>> -
>> -       for (i = 0; i < ci->num_leaves; i++) {
>> -               if (ci->info_list[i].level == level) {
>> -                       if (ci->info_list[i].attributes & CACHE_ID)
>> -                               return ci->info_list[i].id;
>> -                       return -1;
>> -               }
>> -       }
>> -
>> -       return -1;
>> -}
>> -
>>  #endif /* _LINUX_CACHEINFO_H */
>> --
>> 2.31.1
>>




More information about the linux-riscv mailing list