mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yicong Yang <yangyicong@huawei.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
	<mathieu.poirier@linaro.org>, <jonathan.cameron@huawei.com>,
	<linux-kernel@vger.kernel.org>
Cc: <yangyicong@hisilicon.com>, <alexander.shishkin@linux.intel.com>,
	<helgaas@kernel.org>, <linux-pci@vger.kernel.org>,
	<prime.zeng@hisilicon.com>, <linuxarm@huawei.com>,
	<hejunhao3@huawei.com>
Subject: Re: [PATCH v2 5/5] hwtracing: hisi_ptt: Add dummy callback pmu::read()
Date: Tue, 19 Sep 2023 21:03:14 +0800	[thread overview]
Message-ID: <75b93d15-f099-5d17-caa9-94b0390773cf@huawei.com> (raw)
In-Reply-To: <73655f9b-9ea4-cb46-d712-20f1c4ac7c95@arm.com>

On 2023/9/15 20:53, Suzuki K Poulose wrote:
> On 14/09/2023 12:22, Yicong Yang wrote:
>> From: Junhao He <hejunhao3@huawei.com>
>>
>> When start trace with perf option "-C $cpu" and immediately stop it
>> with SIGTERM or others, the perf core will invoke pmu::read() while
>> the driver doesn't implement it. Add a dummy pmu::read() to avoid
>> any issues.
> 
> What issues are we talking about here ? Shouldn't the core perf
> skip the call, if pmu::read() is not available ?
> 

Actually no, the core doesn't check it. So I think that's why some PMUs
like SPE implements a dummy pmu::read() callback. Otherwise we'll
dereference a NULL pointer.

Currently we only met this on emulated platforms with very slow CPUs,
follow the instructions in the commit above.

> Suzuki
> 
>>
>> Signed-off-by: Junhao He <hejunhao3@huawei.com>
>> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
>> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>> ---
>>   drivers/hwtracing/ptt/hisi_ptt.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c
>> index 62a444f5228e..c1b5fd2b8974 100644
>> --- a/drivers/hwtracing/ptt/hisi_ptt.c
>> +++ b/drivers/hwtracing/ptt/hisi_ptt.c
>> @@ -1184,6 +1184,10 @@ static void hisi_ptt_pmu_del(struct perf_event *event, int flags)
>>       hisi_ptt_pmu_stop(event, PERF_EF_UPDATE);
>>   }
>>   +static void hisi_ptt_pmu_read(struct perf_event *event)
>> +{
>> +}
>> +
>>   static void hisi_ptt_remove_cpuhp_instance(void *hotplug_node)
>>   {
>>       cpuhp_state_remove_instance_nocalls(hisi_ptt_pmu_online, hotplug_node);
>> @@ -1227,6 +1231,7 @@ static int hisi_ptt_register_pmu(struct hisi_ptt *hisi_ptt)
>>           .stop        = hisi_ptt_pmu_stop,
>>           .add        = hisi_ptt_pmu_add,
>>           .del        = hisi_ptt_pmu_del,
>> +        .read        = hisi_ptt_pmu_read,
>>       };
>>         reg = readl(hisi_ptt->iobase + HISI_PTT_LOCATION);
> 
> 
> .

  reply	other threads:[~2023-09-19 13:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 11:22 [PATCH v2 0/5] Several updates for PTT driver Yicong Yang
2023-09-14 11:22 ` [PATCH v2 1/5] hwtracing: hisi_ptt: Disable interrupt after trace end Yicong Yang
2023-09-14 11:22 ` [PATCH v2 2/5] hwtracing: hisi_ptt: Handle the interrupt in hardirq context Yicong Yang
2023-09-14 11:22 ` [PATCH v2 3/5] hwtracing: hisi_ptt: Optimize the trace data committing Yicong Yang
2023-09-15 14:44   ` Suzuki K Poulose
2023-09-19 13:19     ` Yicong Yang
2023-09-14 11:22 ` [PATCH v2 4/5] hwtracing: hisi_ptt: Don't try to attach a task Yicong Yang
2023-09-14 11:22 ` [PATCH v2 5/5] hwtracing: hisi_ptt: Add dummy callback pmu::read() Yicong Yang
2023-09-15 12:53   ` Suzuki K Poulose
2023-09-19 13:03     ` Yicong Yang [this message]
2023-09-19 17:01       ` Suzuki K Poulose
2023-09-20  7:10         ` Yicong Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75b93d15-f099-5d17-caa9-94b0390773cf@huawei.com \
    --to=yangyicong@huawei.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=hejunhao3@huawei.com \
    --cc=helgaas@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=prime.zeng@hisilicon.com \
    --cc=suzuki.poulose@arm.com \
    --cc=yangyicong@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®