Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1045015rbb; Sun, 25 Feb 2024 17:06:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWftc5fPpMt0rqapAdhv3dvXXHItf2EOdj0cGs6Vp4gJPCQUynr2F/ZmHmIP+T37UTFKzKUniEglOz8KQdloABYGP5ROUhXA5PGqu5wTw== X-Google-Smtp-Source: AGHT+IEYeoY/l8gMX7TiAlCPmfMwVrjHGf65UOgto+rV8UBcyj9RQmtyyCbk6ZP55V03wrpNH+BP X-Received: by 2002:a05:6358:4c50:b0:175:4f0f:bbb6 with SMTP id lc16-20020a0563584c5000b001754f0fbbb6mr3364984rwc.25.1708909614557; Sun, 25 Feb 2024 17:06:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708909614; cv=pass; d=google.com; s=arc-20160816; b=qlzj0QS9GYFRwdn3yU1u/ttBi26LEueO8GVR8QC1UBTpzM8R2B62183NbUdXP9/DRU keAy0C/PhTEoEbx9tb+CejeUYLKWFyigZANnpgf4WvmjvxXysnbQTIliPA42Mmol4TKc Cx0tG2H3Ul9lIoZpPgTp5MFa5ARSxHz/7RHDOBdyvq8JgON3etc9jp9ckyTqNf5qClgB 38EGDvKnPvkkQc52YZZL1U6Q4ezRpSVgJ1tmrvNr4ucc7IvpcvMNE7gtNu4OHCu9HJjq pZZJmakqlmisbdE9XafM25UTr4wpaexsP5lkA7tceZ6zdeBJ85IAGLx++y37q5cDauiu AULQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=FT2Ga/f+hMREMdXH5Hquz4f64xl7PvqZHQx/6A0hQHY=; fh=mp51IuY5tL5mA5zOIT8+FlslqyFyYBLLNHeJTKXgpOM=; b=iDF8YtGayct+UN2nVR9VRmfPbMG7O85asM3qaoKVA5v/zhcWHy61M164gOYbwiBN6s DDmzi4E9eejrneiEpGrc2ZXJ9eHjaTdu4lbWl3aBB+wUbEjhxSWC9xNn9/Do/e/7B4oB KAM4bYkF7r+6g9Uw/tLAs3WkLQYKnBN9xohoGWivxN28Am0gm+/bRiUv/LPTazQNd+9u UD5YmlSw2XQS1aNLC3cJn44tgbfU5gTXGns0tom5R+TjsLcDcITFtz/HjEMv3EDLouGu 5ij8fUGfTMNVr3FTlSAoWDZWtzKjHJR1bezFk3FwGBNlc5AgSGyPW0qFB0MceyAtu0On FMvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-80369-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80369-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 r3-20020a63fc43000000b005dc958db2ffsi2798559pgk.470.2024.02.25.17.06.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 17:06:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80369-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; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-80369-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80369-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 280B32810A5 for ; Mon, 26 Feb 2024 01:06:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDDBB8BF1; Mon, 26 Feb 2024 01:06:48 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 75B38323D for ; Mon, 26 Feb 2024 01:06:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708909608; cv=none; b=pU38ZBNe6ZZhM/G5JmP8f2v3lzGhCpSwX8kG32Ga8vokLy30EM/vdCfcSqB/tFTbp/WduzsXbTtJABDUZ46bxfb22QcjBBASgpJUpcxhUmwmZP9GUrELnPuPTvdTeW014AYk0/qBycI3+WPhO/pUI63UUIIxCIQpTeOSlfHLYZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708909608; c=relaxed/simple; bh=SEXPvnaY7yd34ru/qiOeLlmHyc5xD9+6IPA0q8XSUK4=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=F0TtZiv64lI3Sw24fvgQnLcC/LHSusyqALS4rJ+/f4u2AeELDvYeYALtcAZAM1F1Z3lbpxV5vkVRwUdJvsX2NpJFtOco2bRXyr9Mz9wYd7F4oATz4doEPK2e0HpTKBQZ3uego3iQgUUDXwuQQ6kgswO2CoI3E/jFtQCGdJ+N/Jk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 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.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Tjj8N4PHwz1xpNJ; Mon, 26 Feb 2024 09:05:08 +0800 (CST) Received: from kwepemm600003.china.huawei.com (unknown [7.193.23.202]) by mail.maildlp.com (Postfix) with ESMTPS id 2EAC214040F; Mon, 26 Feb 2024 09:06:36 +0800 (CST) Received: from [10.67.111.205] (10.67.111.205) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 26 Feb 2024 09:06:35 +0800 Subject: Re: [PATCH v2] hwtracing: hisi_ptt: Move type check to the beginning of hisi_ptt_pmu_event_init() To: Suzuki Poulouse CC: , , , , , , , References: <20240108121906.3514820-1-yangjihong1@huawei.com> From: Yang Jihong Message-ID: <979bdbe5-f01a-dfa8-6550-0f684d8f3b08@huawei.com> Date: Mon, 26 Feb 2024 09:06:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240108121906.3514820-1-yangjihong1@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600003.china.huawei.com (7.193.23.202) Hello, PING. Thanks, Yang On 2024/1/8 20:19, 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. > > Fixes: ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device") > Signed-off-by: Yang Jihong > --- > > Changes since v1: > - Add fixes tag. > > 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; >