[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f1cdd17717cef7ec33af096e104db03c@linux.dev>
Date: Wed, 15 Jun 2022 01:29:55 +0000
From: "Yajun Deng" <yajun.deng@...ux.dev>
To: "Namhyung Kim" <namhyung@...nel.org>
Cc: "Peter Zijlstra" <peterz@...radead.org>,
"Ingo Molnar" <mingo@...hat.com>,
"Arnaldo Carvalho de Melo" <acme@...nel.org>,
"Mark Rutland" <mark.rutland@....com>,
"Alexander Shishkin" <alexander.shishkin@...ux.intel.com>,
"Jiri Olsa" <jolsa@...nel.org>,
"Stephane Eranian" <eranian@...gle.com>,
"linux-perf-users" <linux-perf-users@...r.kernel.org>,
"linux-kernel" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf/core: fix perf_event_mux_interval_ms when set
zero
June 15, 2022 6:08 AM, "Namhyung Kim" <namhyung@...nel.org> wrote:
> Hello,
>
> On Tue, Jun 14, 2022 at 3:38 AM Yajun Deng <yajun.deng@...ux.dev> wrote:
>
>> The perf_event_mux_interval_ms is set to zero or one by default.
>
> I see that __perf_mux_hrtimer_init() sets it to PERF_CPU_HRTIMER
> if it's less than 1.
>
Yes, pmu->hrtimer_interval_ms was set to PERF_CPU_HRTIMER, but perf_event_mux_interval_ms didn't.
We can execute 'cat /sys/devices/intel_pt/perf_event_mux_interval_ms' see that.
> Thanks,
> Namhyung
>
>> It can't change back when someone changes it from zero to another
>> value.
>>
>> Make perf_event_mux_interval_ms to PERF_CPU_HRTIMER when set zero.
>>
>> Fixes: 62b856397927 ("perf: Add sysfs entry to adjust multiplexing interval per PMU")
>> Signed-off-by: Yajun Deng <yajun.deng@...ux.dev>
>> ---
>> kernel/events/core.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/events/core.c b/kernel/events/core.c
>> index 61ad10862c21..73c8c7462bbf 100644
>> --- a/kernel/events/core.c
>> +++ b/kernel/events/core.c
>> @@ -10954,9 +10954,12 @@ perf_event_mux_interval_ms_store(struct device *dev,
>> if (ret)
>> return ret;
>>
>> - if (timer < 1)
>> + if (timer < 0)
>> return -EINVAL;
>>
>> + if (timer < 1)
>> + timer = PERF_CPU_HRTIMER;
>> +
>> /* same value, noting to do */
>> if (timer == pmu->hrtimer_interval_ms)
>> return count;
>> --
>> 2.25.1
Powered by blists - more mailing lists