Skip to content

Commit 6396fc5

Browse files
aeglbp3tk0v
authored andcommitted
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
1 parent 0d64476 commit 6396fc5

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

  • arch/x86/kernel/cpu/resctrl

arch/x86/kernel/cpu/resctrl/core.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,7 @@ static void domain_remove_cpu_ctrl(int cpu, struct rdt_resource *r)
631631
static void domain_remove_cpu_mon(int cpu, struct rdt_resource *r)
632632
{
633633
int id = get_domain_id_from_scope(cpu, r->mon_scope);
634-
struct rdt_hw_mon_domain *hw_dom;
635634
struct rdt_domain_hdr *hdr;
636-
struct rdt_mon_domain *d;
637635

638636
lockdep_assert_held(&domain_list_lock);
639637

@@ -650,20 +648,29 @@ static void domain_remove_cpu_mon(int cpu, struct rdt_resource *r)
650648
return;
651649
}
652650

653-
if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, r->rid))
651+
cpumask_clear_cpu(cpu, &hdr->cpu_mask);
652+
if (!cpumask_empty(&hdr->cpu_mask))
654653
return;
655654

656-
d = container_of(hdr, struct rdt_mon_domain, hdr);
657-
hw_dom = resctrl_to_arch_mon_dom(d);
655+
switch (r->rid) {
656+
case RDT_RESOURCE_L3: {
657+
struct rdt_hw_mon_domain *hw_dom;
658+
struct rdt_mon_domain *d;
658659

659-
cpumask_clear_cpu(cpu, &d->hdr.cpu_mask);
660-
if (cpumask_empty(&d->hdr.cpu_mask)) {
660+
if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3))
661+
return;
662+
663+
d = container_of(hdr, struct rdt_mon_domain, hdr);
664+
hw_dom = resctrl_to_arch_mon_dom(d);
661665
resctrl_offline_mon_domain(r, d);
662-
list_del_rcu(&d->hdr.list);
666+
list_del_rcu(&hdr->list);
663667
synchronize_rcu();
664668
mon_domain_free(hw_dom);
665-
666-
return;
669+
break;
670+
}
671+
default:
672+
pr_warn_once("Unknown resource rid=%d\n", r->rid);
673+
break;
667674
}
668675
}
669676

0 commit comments

Comments
 (0)