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: Update the rmid reallocation limit

resctrl's limbo code needs to be told when the data left in a cache is
small enough for the partid+pmg value to be re-allocated.

x86 uses the cache size divided by the number of rmid users the cache may
have. Do the same, but for the smallest cache, and with the number of
partid-and-pmg users.

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>
Co-developed-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>

+39
+39
drivers/resctrl/mpam_resctrl.c
··· 438 438 closid, rmid, val); 439 439 } 440 440 441 + /* 442 + * The rmid realloc threshold should be for the smallest cache exposed to 443 + * resctrl. 444 + */ 445 + static int update_rmid_limits(struct mpam_class *class) 446 + { 447 + u32 num_unique_pmg = resctrl_arch_system_num_rmid_idx(); 448 + struct mpam_props *cprops = &class->props; 449 + struct cacheinfo *ci; 450 + 451 + lockdep_assert_cpus_held(); 452 + 453 + if (!mpam_has_feature(mpam_feat_msmon_csu, cprops)) 454 + return 0; 455 + 456 + /* 457 + * Assume cache levels are the same size for all CPUs... 458 + * The check just requires any online CPU and it can't go offline as we 459 + * hold the cpu lock. 460 + */ 461 + ci = get_cpu_cacheinfo_level(raw_smp_processor_id(), class->level); 462 + if (!ci || ci->size == 0) { 463 + pr_debug("Could not read cache size for class %u\n", 464 + class->level); 465 + return -EINVAL; 466 + } 467 + 468 + if (!resctrl_rmid_realloc_limit || 469 + ci->size < resctrl_rmid_realloc_limit) { 470 + resctrl_rmid_realloc_limit = ci->size; 471 + resctrl_rmid_realloc_threshold = ci->size / num_unique_pmg; 472 + } 473 + 474 + return 0; 475 + } 476 + 441 477 static bool cache_has_usable_cpor(struct mpam_class *class) 442 478 { 443 479 struct mpam_props *cprops = &class->props; ··· 886 850 /* CSU counters only make sense on a cache. */ 887 851 switch (class->type) { 888 852 case MPAM_CLASS_CACHE: 853 + if (update_rmid_limits(class)) 854 + break; 855 + 889 856 counter_update_class(QOS_L3_OCCUP_EVENT_ID, class); 890 857 break; 891 858 default: