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 1B524C433F5 for ; Mon, 7 Feb 2022 11:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GV5UQSq1Uulh3DMyrZFSLdeTMUr7YeT8Dvl+i6lKFXQ=; b=HPTtMPNkeCy0Yk O3B512ZE74UbcSGjphA9CTvPP0zCB79l6ZRG6ycFot5fIByjIKf9DjV4SrjoCE5C+zw2itdh/duA7 Y8AkllL8P3GBzaNf2P2etn85IMpJBs3Fl9LvPBRRQBwKufnUrB0J0lmb2SjEtd4JrJc6WgogHoUbG KcUXSQ/2Bo2QocQWMw+Hjlh2QKp7FnoTcFzvMip2mfSLl7yRg8MheJBF8AX1SbtHLZVNv8I4OJOc4 V7fh2kq7IX6S8/vTXlHh4NZqxE6Hp1nBOKYmTKyJWNG2U12vtoNYbvlCTKtPQW0shErTR9hZKo1Wd AaHyjQb0LHI4I/1Sp0xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH2cQ-00A3KQ-Re; Mon, 07 Feb 2022 11:55:42 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH2cM-00A3Ic-R2 for linux-arm-kernel@lists.infradead.org; Mon, 07 Feb 2022 11:55:40 +0000 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220207_035539_217139_F3616350 X-CRM114-Status: GOOD ( 17.02 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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); > +} > + _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel