Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1567585rdb; Mon, 8 Jan 2024 03:37:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5ALYSZvW2iso43lKEl/AfQfyoJ2gxPObzNeIT2eCvyoHGXDULwgky67jTBQaBfKiA8Ktz X-Received: by 2002:a17:90b:882:b0:28d:2d5:ffec with SMTP id bj2-20020a17090b088200b0028d02d5ffecmr1535538pjb.93.1704713874918; Mon, 08 Jan 2024 03:37:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704713874; cv=none; d=google.com; s=arc-20160816; b=zjY0ZtGqtTRNAHy3vsW+mpEQPLPVLH4u4d/HglW5S9NB0jUe1Oral7ZBGWeC0LlXY/ pHAshAxoIAaSej5PWTIiDLTA01V0N3J5vSZG88LPvnt/wOpydltA5WIo21/hr4y1VCGD /SfmhM/pICHbEIH5Z97rWrafbzm1LRXcTWm8Blejp6jdN9YGhY2w8cDnVsutn+JY03Wv 7ozetI21KP4fZbC+0+I36eQJlMUmhpko66mIgus4ohsW03h3cjOwR9Z7Oazoe0ozy0KH eCD3vFcDMB1uDN+pNKfsKyRlufJ6qp7WWpAbb004xEHkdKgi8afK6i02LGv5Tj0W1u+X YY3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=5bPBkiWOa/pddbtxChdY0lUf5SMeR1visGVwfDo4PqQ=; fh=eVNelPVliKjsRErHpHTuUEqwHpbm3MNXQXPSmNeb4t4=; b=haXT49EnTB6shmjK5Y64lff7BqmMrT1rHCmSNdClDC7gsJnWUppVdHkdurIj8O2PC5 ib2fNlGKNRAnbIbX2RM464gc7B3s0LOdh7nLaxF86ABttzUCBLMSBm4kHXE2VKE/UR3e oPW0xEhm5jE8McDJn/C/fMG9/0DF1UYrnjF3RfCOezdcnYEQFQ2iKOp6rcWCsCIAz3ge 1T0dyc7PBWK3TjyEpNLVPCgroFRpmb1fV2fOuZ6vzHmCd1K2+fOMnZmsO3Y/c7p6FS94 Ek7LFi4HJTVvyzHFV3/MXU+MeCVEzXiwD0KYaGuAVW1uwV/XjZULmuIlc/BkuekvtZ/p IPIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-19443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19443-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v14-20020a17090a898e00b0028c5375ed45si5551521pjn.35.2024.01.08.03.37.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 03:37:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-19443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19443-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 926D3283094 for ; Mon, 8 Jan 2024 11:37:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07FC329426; Mon, 8 Jan 2024 11:37:32 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBB3C29419 for ; Mon, 8 Jan 2024 11:37:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4T7sSp4LbGz1Q7tv; Mon, 8 Jan 2024 19:35:54 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 31C101A0192; Mon, 8 Jan 2024 19:37:25 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 8 Jan 2024 19:37:24 +0800 Message-ID: <52ac2f13-6439-490f-98a6-79f79b9897e9@huawei.com> Date: Mon, 8 Jan 2024 19:37:23 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] hwtracing: hisi_ptt: Move type check to the beginning of hisi_ptt_pmu_event_init() Content-Language: en-US To: Yang Jihong , , , , References: <20240108112024.3514498-1-yangjihong1@huawei.com> From: Kefeng Wang In-Reply-To: <20240108112024.3514498-1-yangjihong1@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) On 2024/1/8 19:20, Yang Jihong wrote: > When perf_init_event() calls perf_try_init_event() to init pmu driver, > searches for the next pmu driver only when the return value is -ENOENT. > Therefore, hisi_ptt_pmu_event_init() needs to check the type at the > beginning of the function. > Otherwise, in the case of perf-task mode, perf_try_init_event() returns > -EOPNOTSUPP and skips subsequent pmu drivers, causes perf_init_event() to > fail. > Maybe Fixes: ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device") It fixes my non hw event issue(perf list hw), thanks. > Signed-off-by: Yang Jihong > --- > drivers/hwtracing/ptt/hisi_ptt.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c > index a991ecb7515a..24a1f7797aeb 100644 > --- a/drivers/hwtracing/ptt/hisi_ptt.c > +++ b/drivers/hwtracing/ptt/hisi_ptt.c > @@ -995,6 +995,9 @@ static int hisi_ptt_pmu_event_init(struct perf_event *event) > int ret; > u32 val; > > + if (event->attr.type != hisi_ptt->hisi_ptt_pmu.type) > + return -ENOENT; > + > if (event->cpu < 0) { > dev_dbg(event->pmu->dev, "Per-task mode not supported\n"); > return -EOPNOTSUPP; > @@ -1003,9 +1006,6 @@ static int hisi_ptt_pmu_event_init(struct perf_event *event) > if (event->attach_state & PERF_ATTACH_TASK) > return -EOPNOTSUPP; > > - if (event->attr.type != hisi_ptt->hisi_ptt_pmu.type) > - return -ENOENT; > - > ret = hisi_ptt_trace_valid_filter(hisi_ptt, event->attr.config); > if (ret < 0) > return ret;