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.

fs/resctrl: Introduce counter ID read, reset calls in mbm_event mode

When supported, "mbm_event" counter assignment mode allows users to assign
a hardware counter to an RMID, event pair and monitor the bandwidth usage as
long as it is assigned. The hardware continues to track the assigned counter
until it is explicitly unassigned by the user.

Introduce the architecture calls resctrl_arch_cntr_read() and
resctrl_arch_reset_cntr() to read and reset event counters when "mbm_event"
mode is supported. Function names match existing resctrl_arch_rmid_read() and
resctrl_arch_reset_rmid().

Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lore.kernel.org/cover.1757108044.git.babu.moger@amd.com

authored by

Babu Moger and committed by
Borislav Petkov (AMD)
862314fd bc53eea6

+38
+38
include/linux/resctrl.h
··· 613 613 enum resctrl_event_id evtid, u32 rmid, u32 closid, 614 614 u32 cntr_id, bool assign); 615 615 616 + /** 617 + * resctrl_arch_cntr_read() - Read the event data corresponding to the counter ID 618 + * assigned to the RMID, event pair for this resource 619 + * and domain. 620 + * @r: Resource that the counter should be read from. 621 + * @d: Domain that the counter should be read from. 622 + * @closid: CLOSID that matches the RMID. 623 + * @rmid: The RMID to which @cntr_id is assigned. 624 + * @cntr_id: The counter to read. 625 + * @eventid: The MBM event to which @cntr_id is assigned. 626 + * @val: Result of the counter read in bytes. 627 + * 628 + * Called on a CPU that belongs to domain @d when "mbm_event" mode is enabled. 629 + * Called from a non-migrateable process context via smp_call_on_cpu() unless all 630 + * CPUs are nohz_full, in which case it is called via IPI (smp_call_function_any()). 631 + * 632 + * Return: 633 + * 0 on success, or -EIO, -EINVAL etc on error. 634 + */ 635 + int resctrl_arch_cntr_read(struct rdt_resource *r, struct rdt_mon_domain *d, 636 + u32 closid, u32 rmid, int cntr_id, 637 + enum resctrl_event_id eventid, u64 *val); 638 + 639 + /** 640 + * resctrl_arch_reset_cntr() - Reset any private state associated with counter ID. 641 + * @r: The domain's resource. 642 + * @d: The counter ID's domain. 643 + * @closid: CLOSID that matches the RMID. 644 + * @rmid: The RMID to which @cntr_id is assigned. 645 + * @cntr_id: The counter to reset. 646 + * @eventid: The MBM event to which @cntr_id is assigned. 647 + * 648 + * This can be called from any CPU. 649 + */ 650 + void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_mon_domain *d, 651 + u32 closid, u32 rmid, int cntr_id, 652 + enum resctrl_event_id eventid); 653 + 616 654 extern unsigned int resctrl_rmid_realloc_threshold; 617 655 extern unsigned int resctrl_rmid_realloc_limit; 618 656