Message ID | 20230914112223.27165-6-yangyicong@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp276469vqi; Thu, 14 Sep 2023 04:27:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFb0nRmo5jMErtn0gUoadnyXscUq5/HQMLJcsNXMEjgA/cwCD6O20iV3CU2tA2v7UKkO1jk X-Received: by 2002:a05:6a00:a90:b0:68e:45df:4648 with SMTP id b16-20020a056a000a9000b0068e45df4648mr5813076pfl.23.1694690845110; Thu, 14 Sep 2023 04:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694690845; cv=none; d=google.com; s=arc-20160816; b=mqHABSEhGhGAM52rUe/UiAMFs2+DFrWz3Mn1neCcmcFhAxR+48XQD2wJh2E1tngrBL inz6pUMYDjxQQ4Dv2V0QQpjseenrtUExWbBJx5ubQBVJwgM4nHP8DxjxEf02aP7cAxPy +1NLfzQRQ/HVsSjHffG0PhffdNyD3APWx/umsKxZpP/RQXxMjaN1WOmVpKQBY66N+wfb +L9Jh32uUygJnoWb6jWxPiaFDotU9C1BkxBCA/ldxtOAiMOX+YGlH869BmhXvR41Jr3l kBgNScSNhx9dXA0W+C1Fi37AzH8p0C3a3McmSmVt1ldhMCgqTye+yQq4SGbdfpo5FATo mtQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PSDhbGLLxQXYsgdn5W0IdRgWH88HuV+nuj5zNAStHuM=; fh=ko8w2iEBByNlWLnAg6bNI5pex73wZFG+4jwxERcD8TA=; b=ldAIj9s10wvniZwihN2clUN23iQApZOK4E0r3cqDqUz7bkyzjk9Anfqg9sp2hwAcj4 yR9jo86J66gaHoUpD/94483v4gQ1pRu8Vu/pkGfcPzjil/okWNZnIbrvZDE7haO8gfP1 8pra67EaxCjFqb3+UlGN2rxuAZll0WxWtreyTHhrJExzqMVfCewBPjp8sbY2GkI+65UJ EJ1BtCvksuzmQgSScO6N8GOSzlp4gcqbR6b8VbGK4fW4/PTNn4D6QNrDODa7p5OMefgn JidPIJVeUGLUMbzf9q799mquf0BtWzCxMJWLJFsiAuiRcD4SrtsatKk3R2F5WGVV+rZc qiUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id v70-20020a638949000000b00573f867019fsi1274761pgd.443.2023.09.14.04.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 04:27:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 5267981C4A93; Thu, 14 Sep 2023 04:25:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233218AbjINLZj (ORCPT <rfc822;chrisfriedt@gmail.com> + 35 others); Thu, 14 Sep 2023 07:25:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbjINLZi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Sep 2023 07:25:38 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1610C1FCA; Thu, 14 Sep 2023 04:25:33 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RmZgY48Rzz1N83N; Thu, 14 Sep 2023 19:23:05 +0800 (CST) Received: from localhost.localdomain (10.50.163.32) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 14 Sep 2023 19:25:03 +0800 From: Yicong Yang <yangyicong@huawei.com> To: <suzuki.poulose@arm.com>, <mathieu.poirier@linaro.org>, <jonathan.cameron@huawei.com>, <linux-kernel@vger.kernel.org> CC: <alexander.shishkin@linux.intel.com>, <helgaas@kernel.org>, <linux-pci@vger.kernel.org>, <prime.zeng@hisilicon.com>, <linuxarm@huawei.com>, <yangyicong@hisilicon.com>, <hejunhao3@huawei.com> Subject: [PATCH v2 5/5] hwtracing: hisi_ptt: Add dummy callback pmu::read() Date: Thu, 14 Sep 2023 19:22:23 +0800 Message-ID: <20230914112223.27165-6-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230914112223.27165-1-yangyicong@huawei.com> References: <20230914112223.27165-1-yangyicong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 14 Sep 2023 04:25:43 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777012147636282946 X-GMAIL-MSGID: 1777012147636282946 |
Series |
Several updates for PTT driver
|
|
Commit Message
Yicong Yang
Sept. 14, 2023, 11:22 a.m. UTC
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. 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(+)
Comments
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 ? 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);
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); > > > .
On 19/09/2023 14:03, Yicong Yang wrote: > 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. Ok, then it calls for a Fixes tag. Please tag it to the commit that introduced the PMU. Suzuki
On 2023/9/20 1:01, Suzuki K Poulose wrote: > On 19/09/2023 14:03, Yicong Yang wrote: >> 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. > > Ok, then it calls for a Fixes tag. Please tag it to the commit that > introduced the PMU. > Sure. I'll add the tag in v3. Thanks.
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);