Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm_mpam: resctrl: Wait for cacheinfo to be ready

In order to calculate the rmid realloc threshold the size of the cache
needs to be known. Cache domains will also be named after the cache id. So
that this information can be extracted from cacheinfo we need to wait for
it to be ready. The cacheinfo information is populated in device_initcall()
so we wait for that.

Tested-by: Gavin Shan <gshan@redhat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Peter Newman <peternewman@google.com>
Tested-by: Zeng Heng <zengheng4@huawei.com>
Tested-by: Punit Agrawal <punit.agrawal@oss.qualcomm.com>
Tested-by: Jesse Chick <jessechick@os.amperecomputing.com>
Reviewed-by: Zeng Heng <zengheng4@huawei.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>

authored by

Ben Horgan and committed by
James Morse
1c1e2968 3e9b3582

+19
+19
drivers/resctrl/mpam_resctrl.c
··· 16 16 #include <linux/resctrl.h> 17 17 #include <linux/slab.h> 18 18 #include <linux/types.h> 19 + #include <linux/wait.h> 19 20 20 21 #include <asm/mpam.h> 21 22 ··· 42 41 * This applies globally to all traffic the CPU generates. 43 42 */ 44 43 static bool cdp_enabled; 44 + 45 + /* 46 + * We use cacheinfo to discover the size of the caches and their id. cacheinfo 47 + * populates this from a device_initcall(). mpam_resctrl_setup() must wait. 48 + */ 49 + static bool cacheinfo_ready; 50 + static DECLARE_WAIT_QUEUE_HEAD(wait_cacheinfo_ready); 45 51 46 52 bool resctrl_arch_alloc_capable(void) 47 53 { ··· 765 757 struct mpam_resctrl_res *res; 766 758 enum resctrl_res_level rid; 767 759 760 + wait_event(wait_cacheinfo_ready, cacheinfo_ready); 761 + 768 762 cpus_read_lock(); 769 763 for_each_mpam_resctrl_control(res, rid) { 770 764 INIT_LIST_HEAD_RCU(&res->resctrl_res.ctrl_domains); ··· 804 794 805 795 return 0; 806 796 } 797 + 798 + static int __init __cacheinfo_ready(void) 799 + { 800 + cacheinfo_ready = true; 801 + wake_up(&wait_cacheinfo_ready); 802 + 803 + return 0; 804 + } 805 + device_initcall_sync(__cacheinfo_ready);