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 X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECA54C47089 for ; Thu, 27 May 2021 07:52:38 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B6E646101E for ; Thu, 27 May 2021 07:52:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6E646101E Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=i9EW37C6mo8r2fpvP5BIfnfSR1/96oVY8Mi5APA7de8=; b=4Vs80MFW4OPjqY nLi3PX9bYEbB/i/74Ae0IKI+/DryOQ/ucvxCDV9VrDhByeIAb8mmjVPlVrErkXA7Um0fsn1WGOZx6 vpGtfru1RNYON3K5qliIIwPjyS75HPAp3yxscRWtPKlVZqYHGqYJBuac9xc3sYcLByqGTpo7leEmJ /AEQpDylHH3E+6UTxY7DFAAOpXkQLQEOogkCtpNPVmuCnt1khnS2+scgnKjYekSpljnyDNqNlm0ff v75j8B0jsnz/btv2canx1QjDqC01mz3NStRjCC/JrOe5DApYMtHu8Ir7Ycacmi4fHbss+WWyuIL/r pDnSHRUkVPWfwpTIwrNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAnF-003WI8-Dq; Thu, 27 May 2021 07:51:01 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAmw-003WBn-5A for linux-arm-kernel@lists.infradead.org; Thu, 27 May 2021 07:50:43 +0000 Received: by mail-pg1-x529.google.com with SMTP id 27so3087231pgy.3 for ; Thu, 27 May 2021 00:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d35Z55JT0hYk8NnQr7T1whEZ7rTnavFeCto9PQdKjtY=; b=MRAokhQv7ysfcJZNlWBGR2Iw+xwZQKOHZD+0Xvw3gsUDYL3+kPxxA1Q4jSxdNUZKNY 1SFuY/VpGVA5LOZRcI0sEetF9+AVFBRk6qCM6kByhejlAfvB4gRvuzqq1qa7oGDmsyMk NbRVjzcGsRwgoj52azRL4el/xdXA+VKqVLAXwyHKyYvndeUUsURqVu+EXiCuHbVedGei c8tL9RK6WzxgPcXK99nXEGHKhd/dO65/dYt9w+/Stw6gKY6Lhi4iqsCrxF6c9O49D3Ov yGVSST+DBSA7EswaWBGflQEct4jQ/UcSNXtqXKok6KoPNycvZR439eDCiIwSBd85SD0k JhRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d35Z55JT0hYk8NnQr7T1whEZ7rTnavFeCto9PQdKjtY=; b=JnCs4i+M4WjPo1HjWsUhW3VpW8UjzU/qzt213Jzm+8xO3Y1iPkEOlQy/CAKkoD2Hya sqEpujO2k90KWzZckHATAs8NLKTsVRYq7xBGrOZXqWlacfqH4GDceB+0lzdAYrwDp5FM dX6JxegVMGtfv+1lPcU4OuuqaLHoX8U1R31tegQmXy7PInzI138V2BHI6WINB2P3QAQQ 0cQXjYCv4h9IJQBHs8dJp79O1t7eSP1C1Rv+Z3iVn1w2TX2azErkuHbdRmDfHNZ7Y6CW QwmlcHyf12U7XaZgzPgtB4tifYVHA9+qujS/Z4mL1ClQtFrHQzX/s5Y4d98VjwE8vyTc gGMA== X-Gm-Message-State: AOAM533LYkNPm6sPMtZwkABgRcbRNfUCa0wxF4I9LYJ3QL7lSarLjTFU 09DEAPByxH6AJg7BbdiH3LEp7m90yYEK1pKI8jV/FQ== X-Google-Smtp-Source: ABdhPJw8uLMTcQnJtQ6AxLi7avnt+7b2i9gQiUi3PaXOv/nabhNmnRSBCpCw/bHQRC13y6Et1BJLF23o9nA5yVqIe/o= X-Received: by 2002:a63:e18:: with SMTP id d24mr2572766pgl.118.1622101839866; Thu, 27 May 2021 00:50:39 -0700 (PDT) MIME-Version: 1.0 References: <20210421120413.3110775-1-daniel.kiss@arm.com> <20210426175425.GA1391779@xps15> <20210427154746.GA1422814@xps15> <20210427160443.GA208852@leoy-ThinkPad-X240s> <20210505152919.GA1766375@xps15> <20210523084552.GA23254@leoy-ThinkPad-X240s> In-Reply-To: <20210523084552.GA23254@leoy-ThinkPad-X240s> From: Denis Nikitin Date: Thu, 27 May 2021 00:50:28 -0700 Message-ID: Subject: Re: [PATCH 0/4] coresight: Add ETR-PERF polling. To: Leo Yan Cc: Mathieu Poirier , Mike Leach , "coresight@lists.linaro.org" , "linux-arm-kernel@lists.infradead.org" , Daniel Kiss X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_005042_251878_F60D6D3D X-CRM114-Status: GOOD ( 34.04 ) 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 Hi Leo, On Sun, May 23, 2021 at 1:45 AM Leo Yan wrote: > > On Fri, May 14, 2021 at 02:02:25AM -0700, Denis Nikitin wrote: > > [...] > > > We could probably utilize the ETM strobing feature and reduce frequency > > of data collection but I see a problem when I'm using both. > > Within a minute of profiling the ETM generates a reasonable profile size > > (with strobing autofdo,preset=9 with period 0x1000 it is up to 20MB). > > But then the size grows unproportionally. > > With a 4 minute run I got a 6.3GB profile. > > I don't see such a problem with the ETR polling patch. > > I found there have a potential bug in the perf tool for calculation the > buffer size for snapshot mode. > > In the function cs_etm_find_snapshot of perf code [1], after the "head" > has wrapped around, it always return the "old" and "head" with the > difference "mm->len", that means the trace data will be copied with > length "mm->len". If the buffer size is 4MB, it always copies trace > data with 4MB for every time. > > This is incorrect for the snapshot with very small interval, even after > wrapped around, it still have chance to only generate very small amount > trace data (e.g. for 10ms), so I think we should fix this code like: > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > index d942f118d32c..8a60e65c6651 100644 > --- a/tools/perf/arch/arm/util/cs-etm.c > +++ b/tools/perf/arch/arm/util/cs-etm.c > @@ -849,6 +849,13 @@ static int cs_etm_find_snapshot(struct auxtrace_record *itr, > if (!wrapped) > return 0; > > + /* > + * If the difference between the head and old is less than mm->len, > + * it means the new trace data is small so doesn't need ajust them. > + */ > + if (*head - *old < mm->len) > + return 0; > + > /* > * *head has wrapped around - adjust *head and *old to pickup the > * entire content of the AUX buffer. > > I will do more testing and send formal patch for this. Thanks for looking into this problem. Initially I said that the issue with the excessive profile size was not reproducible when I applied https://lists.linaro.org/pipermail/coresight/2021-April/006254.html. But after a couple of runs the issue came back. Reproducibility depends on the system workload and it happens more often if we run any workload. I tried the fix you shared and so far I don't see the issue anymore. Thanks, Denis > > Thanks, > Leo > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/arch/arm/util/cs-etm.c#n853 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel