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_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 9F8E7C4707A for ; Sun, 23 May 2021 08:50:01 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 0C3FD61175 for ; Sun, 23 May 2021 08:50:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C3FD61175 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: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=UvTvOL7i92WXUrGoHHp9aT343ZoGz2QnqE5KyI35A54=; b=bqDhDjVv7zJdWcIo3tiH5Kg3Uk Bo3rYwg9mlkOlbSJAD+d/5L06gJWkM8+MZHcN+QA2IT9l3Fp2TpRH29O6+XOWviRdu0vzadIr/fcy 1Nav4aug6h4UmWe2qrD7WMf71IP1s/w+//lI42/RRMULI7CfNWBiYROvvWNMTGzzHuh78deL8OiJU r/0fjqLFK0DbSc3waSngngzgoLDyOk8se/YSzj0ywiNfrXI5UhtBmD6dIt45zdgXHcus1b8AHM5Rq zc5xxX6MGX12il6GsoR6YAdmJ9MM2tVD5pphtQTHkoyzYOx9IcmN+dMy7GLpb8w66BzrZAim0Tc3z XGFcsTVg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lkjkd-0045SS-Eb; Sun, 23 May 2021 08:46:25 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lkjkI-0045QF-BD for linux-arm-kernel@desiato.infradead.org; Sun, 23 May 2021 08:46:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AtIDI7SP5dRXHmoNUsWdbKwmKhCB11UkypX8kt1Nwpk=; b=YqnESghEwewbObHlhnSjl/FSwJ OHR1NvQGd6IPByOW/b1IaW/1Pergt+e99flXeE6BsSvH75EYJPkWztjn7ODJnMroF+psAjZpYjtEi NRlhX1NCxzpjoempnvvLYVIbJzoAHlasT3fR9xkkvL4lBQRO0eFDs9pTfeFHdGIGP0z+Tn9hNgnRc PJlO4JU4wJLf/GW5rswjL0bjOGO3jNHlfmX2DqJcw7X/UWvOZV6nvautGGO7du05sB1BfryndhgK5 P3XY2Hcowp2bKd3h2JmJJjcPnOE+JG/6+DJ2bP12PkXJmBN3mzZyDx3mChTmMdcBoNEsCdVXhy5CC sjj6K8DQ==; Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lkjkF-000NiS-Bo for linux-arm-kernel@lists.infradead.org; Sun, 23 May 2021 08:46:00 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 29so6729308pgu.11 for ; Sun, 23 May 2021 01:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AtIDI7SP5dRXHmoNUsWdbKwmKhCB11UkypX8kt1Nwpk=; b=D7vuiUUUEoo4nqkfi2PqbgJN/7MiGDOxE30KkAKX/dVRodFHVzOqHQ5lg6oVpSOeh/ 97CAGAUN/sz4HtkR4vfoBiHL83CQCELGwxZU/bxLeOjfYt91Ja05ypzBbeC0dTJzws8p uurVKY2bPjwM9D6/20DUF6qifOB7noXRJNlT72R6bk+NX07KW0qy8mNgtwlc5Nks5BXZ uD60ltb3CGnNcm6J4lEAAW4u1aDmBAXzqsPbAKxCTnTYCAWPEJvZORJSS2HNZ8qp6XpT BHmuMkv8fR+NwU2AmplA7MSJeN8HotTvorXlLOhW2KQxQM8pOdnktdBUBZUksa77U+7y MeAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AtIDI7SP5dRXHmoNUsWdbKwmKhCB11UkypX8kt1Nwpk=; b=d//iMzbbZD/Zmol46irEOFzm5B8isdpiNqm51pIYBrcntoe8VrcZOz+UrgQcn9e/eh 1zZVv/95tGAn1Fd0ZB2N4NGtqF0nBp8mMXH56W4p/qg86y0GRwxgk5zkGdmE/UZGpND8 PP/01z1GB/yx3NB4VV4qbu0nGq9TsS8lkZD9WUtuRUELc5tTi8PMqDhHDyiVso47kG6m jVFNDZRrJBYqV9TspBz3swZwDFnrQCOYgtlT58yMjywtMHBvhN7/kIMZsFrVHxKueEqH mZTkXzYNYsMmmi86fCa7AwujEQy75xEGLIrfaI5b745boyEJnwdt3M15Kw1Rfi8LCDSu LbGQ== X-Gm-Message-State: AOAM531vQQF+yQ9Qa+51cWG7EBJC5gB/6FgcGaUK38r1TAOB5p1S9pk9 pCZbEparYx0fGc1fnN6fReYwfQ== X-Google-Smtp-Source: ABdhPJyfbp0QXczDcJoYD3hmc6oucCwpqSSIBtHGjJNg2H4yQdM6Qm54GxQdtqiXT8SymLShouL9WQ== X-Received: by 2002:a63:1559:: with SMTP id 25mr4187818pgv.384.1621759557128; Sun, 23 May 2021 01:45:57 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([103.207.71.35]) by smtp.gmail.com with ESMTPSA id x187sm2857362pfc.104.2021.05.23.01.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 May 2021 01:45:56 -0700 (PDT) Date: Sun, 23 May 2021 16:45:52 +0800 From: Leo Yan To: Denis Nikitin Cc: Mathieu Poirier , Mike Leach , "coresight@lists.linaro.org" , "linux-arm-kernel@lists.infradead.org" , Daniel Kiss Subject: Re: [PATCH 0/4] coresight: Add ETR-PERF polling. Message-ID: <20210523084552.GA23254@leoy-ThinkPad-X240s> References: <20210421120413.3110775-1-daniel.kiss@arm.com> <20210426175425.GA1391779@xps15> <20210427154746.GA1422814@xps15> <20210427160443.GA208852@leoy-ThinkPad-X240s> <20210505152919.GA1766375@xps15> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210523_014559_463589_068F7699 X-CRM114-Status: GOOD ( 21.37 ) 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 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, 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