Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1573951pxb; Tue, 8 Feb 2022 22:46:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyC/7V3YrYl0F1LVoiUU6bIyX9uzR0ZmLz8BXJM/sbLidsZgAWjHijbhWH/Qo++5FYbo4bx X-Received: by 2002:aa7:8241:: with SMTP id e1mr866095pfn.86.1644389204552; Tue, 08 Feb 2022 22:46:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644389204; cv=none; d=google.com; s=arc-20160816; b=PzjV0P7HioyKCA/95Ga0TAM8jbWMIlx67s2ZzR6BcJ/Xhp6cd8BIulo+TM7z7MXO+R ad2jovla4r9odY0GqD78ntSDcgBNry05pFX4+ovR+fYHdrlRMkC/PPfKCHk4NWVpxX9m CUlmxXjiX9StDnfeZqKXfKB3lS5udztibLc6cvPEVxxBtf1vComq7LFHL6Ssg9DBWDut oRrYwyKszqyrp8m6n/DjHYofna93ZYJpljDKE1S3BCTrmarkuhPwVmODwpXqiKUYyy3g 3oGpoYu3N1mLI61lDjgTrkb4nhUTvQSagX0fzmnsN5UGTmmgiG4hkrZpYEt6K32QoUSK oERg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=fDjJsXja6MDVAhlX4iixe239jAR9S8VbVg2spvPq8C8=; b=p3qVDbtJpig5Zc37PWfKipUI4l7+OfUXaO9Lcham8kEAP4LcwYvpd+6utjXXrovuxf G5LiICalGqE/qyifD5K0XHWbKatUK6if9rUExFRaRorzosp2eEL2CMd/VeOBL66cPoOa TI5kV2jfw5IErPo5s6RNyltlOpxDRh43DpeXejti51er7JfOfFKP/BcMTbfMCPcXAM2u v/d+3T7QebUFpRpL00RGliZ6GiLJ+qgx20ypr4VWgS1lit4UiANc4CHuSjy5WA/TZvtz AmSeea9lV4Fh5N05M54YdflCfIBo2znxPhoIGXHGfVuTZc6ktXfo+FZwqA/l2Q5ZwlTs LxiA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bv22si4419382pjb.111.2022.02.08.22.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 22:46:44 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B100CE01CCBB; Tue, 8 Feb 2022 22:23:43 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448520AbiBGNLp (ORCPT + 99 others); Mon, 7 Feb 2022 08:11:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442753AbiBGMVi (ORCPT ); Mon, 7 Feb 2022 07:21:38 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5054C03F93B; Mon, 7 Feb 2022 04:12:16 -0800 (PST) Received: from fraeml713-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Jskxw4YZZz67lbv; Mon, 7 Feb 2022 19:51:32 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml713-chm.china.huawei.com (10.206.15.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 7 Feb 2022 12:55:34 +0100 Received: from localhost (10.202.226.41) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 7 Feb 2022 11:55:32 +0000 Date: Mon, 7 Feb 2022 11:55:31 +0000 From: Jonathan Cameron To: Yicong Yang CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v3 5/8] perf tool: Add support for HiSilicon PCIe Tune and Trace device driver Message-ID: <20220207115531.0000392f@Huawei.com> In-Reply-To: <20220124131118.17887-6-yangyicong@hisilicon.com> References: <20220124131118.17887-1-yangyicong@hisilicon.com> <20220124131118.17887-6-yangyicong@hisilicon.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.41] X-ClientProxiedBy: lhreml733-chm.china.huawei.com (10.201.108.84) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Jan 2022 21:11:15 +0800 Yicong Yang wrote: > From: Qi Liu > > 'perf record' and 'perf report --dump-raw-trace' supported in this > patch. > > Example usage: > > Output will contain raw PTT data and its textual representation, such > as: > > 0 0 0x5810 [0x30]: PERF_RECORD_AUXTRACE size: 0x400000 offset: 0 > ref: 0xa5d50c725 idx: 0 tid: -1 cpu: 0 > . > . ... HISI PTT data: size 4194304 bytes > . 00000000: 00 00 00 00 Prefix > . 00000004: 08 20 00 60 Header DW0 > . 00000008: ff 02 00 01 Header DW1 > . 0000000c: 20 08 00 00 Header DW2 > . 00000010: 10 e7 44 ab Header DW3 > . 00000014: 2a a8 1e 01 Time > . 00000020: 00 00 00 00 Prefix > . 00000024: 01 00 00 60 Header DW0 > . 00000028: 0f 1e 00 01 Header DW1 > . 0000002c: 04 00 00 00 Header DW2 > . 00000030: 40 00 81 02 Header DW3 > . 00000034: ee 02 00 00 Time > .... > > Signed-off-by: Qi Liu > Signed-off-by: Yicong Yang Hi. This is unfortunately out of my areas of expertise, so I just took a quick glance and noticed one generic c thing that could be tidied up. > diff --git a/tools/perf/util/hisi_ptt.c b/tools/perf/util/hisi_ptt.c > new file mode 100644 > index 000000000000..75fa89f3fae3 > --- /dev/null > +++ b/tools/perf/util/hisi_ptt.c ... > + > +static void hisi_ptt_free_queue(void *priv) > +{ > + struct hisi_ptt_queue *pttq = priv; > + > + if (!pttq) > + return; > + > + free(pttq); free() is safe against a null ptr, so you don't need the if (!pttq) return; See free(3) man page. > +} > + > +static void hisi_ptt_free_events(struct perf_session *session) > +{ > + struct hisi_ptt *ptt = container_of(session->auxtrace, struct hisi_ptt, > + auxtrace); > + struct auxtrace_queues *queues = &ptt->queues; > + unsigned int i; > + > + for (i = 0; i < queues->nr_queues; i++) { > + hisi_ptt_free_queue(queues->queue_array[i].priv); > + queues->queue_array[i].priv = NULL; > + } > + auxtrace_queues__free(queues); > +} > +