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.

x86/resctrl: Refactor domain_remove_cpu_mon() ready for new domain types

New telemetry events will be associated with a new package scoped resource
with a new domain structure.

Refactor domain_remove_cpu_mon() so all the L3 domain processing is separate
from the general domain action of clearing the CPU bit in the mask.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lore.kernel.org/20251217172121.12030-1-tony.luck@intel.com

authored by

Tony Luck and committed by
Borislav Petkov (AMD)
6396fc53 0d644762

+17 -10
+17 -10
arch/x86/kernel/cpu/resctrl/core.c
··· 631 631 static void domain_remove_cpu_mon(int cpu, struct rdt_resource *r) 632 632 { 633 633 int id = get_domain_id_from_scope(cpu, r->mon_scope); 634 - struct rdt_hw_mon_domain *hw_dom; 635 634 struct rdt_domain_hdr *hdr; 636 - struct rdt_mon_domain *d; 637 635 638 636 lockdep_assert_held(&domain_list_lock); 639 637 ··· 648 650 return; 649 651 } 650 652 651 - if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, r->rid)) 653 + cpumask_clear_cpu(cpu, &hdr->cpu_mask); 654 + if (!cpumask_empty(&hdr->cpu_mask)) 652 655 return; 653 656 654 - d = container_of(hdr, struct rdt_mon_domain, hdr); 655 - hw_dom = resctrl_to_arch_mon_dom(d); 657 + switch (r->rid) { 658 + case RDT_RESOURCE_L3: { 659 + struct rdt_hw_mon_domain *hw_dom; 660 + struct rdt_mon_domain *d; 656 661 657 - cpumask_clear_cpu(cpu, &d->hdr.cpu_mask); 658 - if (cpumask_empty(&d->hdr.cpu_mask)) { 662 + if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 663 + return; 664 + 665 + d = container_of(hdr, struct rdt_mon_domain, hdr); 666 + hw_dom = resctrl_to_arch_mon_dom(d); 659 667 resctrl_offline_mon_domain(r, d); 660 - list_del_rcu(&d->hdr.list); 668 + list_del_rcu(&hdr->list); 661 669 synchronize_rcu(); 662 670 mon_domain_free(hw_dom); 663 - 664 - return; 671 + break; 672 + } 673 + default: 674 + pr_warn_once("Unknown resource rid=%d\n", r->rid); 675 + break; 665 676 } 666 677 } 667 678