[RFC PATCH v4 12/15] perf stat: Handle NMI in hardware-grouping

weilin.wang@intel.com posted 15 patches 2 years ago
There is a newer version of this series
[RFC PATCH v4 12/15] perf stat: Handle NMI in hardware-grouping
Posted by weilin.wang@intel.com 2 years ago
From: Weilin Wang <weilin.wang@intel.com>

Add an easy nmi watchdog support in grouping. When nmi watchdog is enabled,
we reduce the total num of events could be assigned to one group by 1. A
more efficient solution will be added in later.

Signed-off-by: Weilin Wang <weilin.wang@intel.com>
---
 tools/perf/util/metricgroup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 95d3868819e3..f1eb73957765 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -1947,6 +1947,10 @@ static int insert_new_group(struct list_head *head,
 			   size_t num_fixed_counters)
 {
 	INIT_LIST_HEAD(&new_group->event_head);
+	if (sysctl__nmi_watchdog_enabled()) {
+		pr_debug("NMI watchdog is enabled. Reduce num of counters by 1\n");
+		num_counters -= 1;
+	}
 	fill_counter_bitmap(new_group->gp_counters, 0, num_counters);
 	fill_counter_bitmap(new_group->fixed_counters, 0, num_fixed_counters);
 	new_group->taken_alone = false;
-- 
2.42.0
Re: [RFC PATCH v4 12/15] perf stat: Handle NMI in hardware-grouping
Posted by Ian Rogers 1 year, 10 months ago
On Thu, Feb 8, 2024 at 7:14 PM <weilin.wang@intel.com> wrote:
>
> From: Weilin Wang <weilin.wang@intel.com>
>
> Add an easy nmi watchdog support in grouping. When nmi watchdog is enabled,
> we reduce the total num of events could be assigned to one group by 1. A
> more efficient solution will be added in later.
>
> Signed-off-by: Weilin Wang <weilin.wang@intel.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/util/metricgroup.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index 95d3868819e3..f1eb73957765 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -1947,6 +1947,10 @@ static int insert_new_group(struct list_head *head,
>                            size_t num_fixed_counters)
>  {
>         INIT_LIST_HEAD(&new_group->event_head);
> +       if (sysctl__nmi_watchdog_enabled()) {
> +               pr_debug("NMI watchdog is enabled. Reduce num of counters by 1\n");
> +               num_counters -= 1;
> +       }
>         fill_counter_bitmap(new_group->gp_counters, 0, num_counters);
>         fill_counter_bitmap(new_group->fixed_counters, 0, num_fixed_counters);
>         new_group->taken_alone = false;
> --
> 2.42.0
>