From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11CC3C3DA5D for ; Mon, 22 Jul 2024 20:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=e2wKEyLRiNB6KE1XAiHZU5Cf53rDv5W8x1+ss56lD90=; b=rhf8aRpkSCs4VrHEvjLtBnkNCH velMoLAWpXfo1nGvkstg78zVCgIz3JQnnEsdEdZtEkbn0IEGGSfGR5sowWXF3fF8ZeexZrN3pTE8M ru2Xdid+QSK6jL1mUDxnhBpEDeZLpqm8SjuTvAmQvmX+5Dm13k+t+FxnG7wS55xTjCGuyhiLG/kJ9 sPnvATXxvU+NSOmW94mlkunrwKq2p4pI37dsElhdNXd3HD345S9ocnpeGZu/v0yRKjTpqnrrPc7WK y2voGSXSvWRZzd2cPQ1mu7nv/SLkrMp2t1p5L1SgaHz2OuCCHiI8ukA/fTdBwq7RAP6ToNFGs6Jd2 WveGA+PQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sW01z-0000000AXNw-1ri6; Mon, 22 Jul 2024 20:53:15 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sW01c-0000000AXJR-0aEa for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2024 20:52:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 529CC1007; Mon, 22 Jul 2024 13:53:13 -0700 (PDT) Received: from [10.57.12.31] (unknown [10.57.12.31]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4C4A53F5A1; Mon, 22 Jul 2024 13:52:45 -0700 (PDT) Message-ID: <951fc660-58a2-4b8a-a763-5a1e4d807c75@arm.com> Date: Mon, 22 Jul 2024 21:52:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 4/6] perf auxtrace: Iterate all AUX events when finish reading To: Adrian Hunter , Arnaldo Carvalho de Melo , Namhyung Kim , Ian Rogers , James Clark , Suzuki K Poulose , Mike Leach , John Garry , Will Deacon , Jiri Olsa , Mark Rutland , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240721202113.380750-1-leo.yan@arm.com> <20240721202113.380750-5-leo.yan@arm.com> <9f08c5cb-fb4b-4994-9128-0484aa6c06d7@intel.com> <9f301b09-e040-456c-9bd3-6d5e96ebc8f4@arm.com> <1cb6fdfc-0405-4bfb-acd4-ed3b24744c8b@intel.com> Content-Language: en-US From: Leo Yan In-Reply-To: <1cb6fdfc-0405-4bfb-acd4-ed3b24744c8b@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240722_135252_375303_20E26CF2 X-CRM114-Status: GOOD ( 23.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 7/22/2024 4:59 PM, Adrian Hunter wrote: [...] >>>> @@ -670,18 +670,25 @@ static int evlist__enable_event_idx(struct evlist *evlist, struct evsel *evsel, >>>> int auxtrace_record__read_finish(struct auxtrace_record *itr, int idx) >>>> { >>>> struct evsel *evsel; >>>> + int ret = -EINVAL; >>>> >>>> if (!itr->evlist || !itr->pmu) >>>> return -EINVAL; >>>> >>>> evlist__for_each_entry(itr->evlist, evsel) { >>>> - if (evsel->core.attr.type == itr->pmu->type) { >>>> + if (evsel__is_aux_event(evsel)) { >>> >>> If the type is the same, then there is no need to >>> change the logic here? >> >> No, the type is not same for AUX events. Every event has its own type >> value, this is likely related to recent refactoring. >> >> As a result, 'itr->pmu' only maintains the first registered AUX event, >> comparing to it the tool will find _only_ one AUX event. This is why here >> changes to use the evsel__is_aux_event() to detect AUX event. >> >>> Otherwise, maybe that should be a separate patch >> >> Could you explain what is a separate patch for? > > No need. > >> >> After this change, the field 'itr->pmu' will be redundant (at least this >> is the case for Arm SPE). I am preparing a refactoring patches for cleaning up >> and see if can totally remove the field 'itr->pmu' (if all AUX events >> have no issue. > > For this function, 'itr->pmu' could be removed in this patch > since it is not used anymore. Thanks for confirmation. I will use a separate patch for removing 'itr-pmu' after it is not used anymore. >>>> if (evsel->disabled) >>>> - return 0; >>>> - return evlist__enable_event_idx(itr->evlist, evsel, idx); >>>> + continue; >>>> + ret = evlist__enable_event_idx(itr->evlist, evsel, idx); >>>> + if (ret >= 0) >>> >>> Should this be: >>> >>> if (ret < 0) >> >> Here the logic is to iterate all AUX events, even if an AUX event fails to >> find the buffer index, it will continue to next AUX event. >> >> So it directly bails out for success (as we have found the matched AUX >> event and enabled it). For the failure cause, it will continue for checking >> next event - until all events have been checked and no event is matched >> for buffer index, the failure will be handled at the end of the function. > > Thanks for the explanation. Could probably use a small comment. Will do. Thanks, Leo