Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp798839pxv; Thu, 1 Jul 2021 09:27:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQc1dlEgTd9L+KOhvC9o/BfqPCW26EHHftrvenwmAJ5bBtHxiBG03wGKo5xqpoWfimi5q/ X-Received: by 2002:aa7:c301:: with SMTP id l1mr861259edq.215.1625156857003; Thu, 01 Jul 2021 09:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625156856; cv=none; d=google.com; s=arc-20160816; b=wjh7EU1V59t+paFgjDGalTZ+uKSUHnfIZMttsvWsLpS1hoEnqYuWysY/nNx6Dodf+I m0wsXs4A3JtScz0Rylbp9PcKjPhdpg4b7YTv7KjDOQO11QB0/rBp7B2LWdLfPJ1w1LuL 3pVxS7uM24G1Tc7eE2uvWMkUTNe92aouSiv0UZkAdgwvi0dLVrpZS+WACvk+vyAnkhQf Iv0AWY4ay/bvCiTlVg/mhPNnDt/tqjTNutRzqOHHepfa9p4BnFsqVt6tAudMq90kPp1z t2DJ0z04XUsLKqI0GGW8UseE/4/SlzYveyFRPZJ/+HmEynkgisZD9SMiuKWc2kWnlaIU RBog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=se/F9I8YFezJrY3v0wM4BUXDfT7TPM02XuNiUYzd6t8=; b=rUG+o/DaF0+zU4A3UiD01EM8d840UAGF9qk40GH0d+5rNKnBo9VJs2UkWTJvjdVCv0 8tu3BpBfZWO8b+00TW4mVKi7W3wNoCZPfA9w9C2ARTnpL5qqaIGnboVl66avrD0TgeyY nBjepA9d7VTEkMEwHZ3+hPz6Z4PNS1c88OO3X+MtyV6egKacZ1fm1BzFL/ZKShehOyVK Yu85t39lwTEzdAmwDKC2B9tXhQmBzNLB5g67zZk5JxMK42qhxQ4zOjFWfO6+ngSb/xs/ /iklCTaKSFcU1Wav5jQOsS0usROVCtCSsqGBu8Q5MNujdr61tda6R6HpQGkylFIDoXwH OnUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jddlJiix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 1si416067ejm.532.2021.07.01.09.27.12; Thu, 01 Jul 2021 09:27:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jddlJiix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231698AbhGAQ1t (ORCPT + 99 others); Thu, 1 Jul 2021 12:27:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:35322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbhGAQ1t (ORCPT ); Thu, 1 Jul 2021 12:27:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7841B61002; Thu, 1 Jul 2021 16:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625156718; bh=ZmaGe0iXayTRZaJF/nPOquGquNqVUil8wsuyblDFl4Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jddlJiix0SdqH9jrizHCWh/mUHvPmjro7TrFB/wNP+yEcUs4kxSTzDTgefVuyIY5H KYhUHwtDSs5yH15LLMiQyCm5NbkIHk/qQQ6jeRu5nxsBZwlofCb/XTXOqu4rUgv0Gg FPTRGgplyRrD/3cN919VbqYW+aJNMrCnAum5uWYwyKBXRZg/CqGAh0ex9yNSnA+cK3 pQ/ywFH8kBBDuQPoYAT5eA80cBZcs75oPEws5tYmvXbnEOBCxaLfYmK1pHSWT353Eb CH9MSaD5uko4gYVJ3WmCLnZJHbBA3qTaIAYmtwN3SaFuiQuRU9e0z7Ep/1TpHj/Ge0 gk1L5zbFlFCKQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 2D55140B1A; Thu, 1 Jul 2021 13:25:14 -0300 (-03) Date: Thu, 1 Jul 2021 13:25:14 -0300 From: Arnaldo Carvalho de Melo To: Leo Yan Cc: Mathieu Poirier , Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , Namhyung Kim , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Daniel Kiss , Denis Nikitin Subject: Re: [PATCH v2 2/3] perf cs-etm: Remove callback cs_etm_find_snapshot() Message-ID: References: <20210701093537.90759-1-leo.yan@linaro.org> <20210701093537.90759-3-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210701093537.90759-3-leo.yan@linaro.org> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Jul 01, 2021 at 05:35:36PM +0800, Leo Yan escreveu: > The callback cs_etm_find_snapshot() is invoked for snapshot mode, its > main purpose is to find the correct AUX trace data and returns "head" > and "old" (we can call "old" as "old head") to the caller, the caller > __auxtrace_mmap__read() uses these two pointers to decide the AUX trace > data size. > > This patch removes cs_etm_find_snapshot() with below reasons: > > - The first thing in cs_etm_find_snapshot() is to check if the head has > wrapped around, if it is not, directly bails out. The checking is > pointless, this is because the "head" and "old" pointers both are > monotonical increasing so they never wrap around. > > - cs_etm_find_snapshot() adjusts the "head" and "old" pointers and > assumes the AUX ring buffer is fully filled with the hardware trace > data, so it always subtracts the difference "mm->len" from "head" to > get "old". Let's imagine the snapshot is taken in very short > interval, the tracers only fill a small chunk of the trace data into > the AUX ring buffer, in this case, it's wrongly to copy the whole the > AUX ring buffer to perf file. > > - As the "head" and "old" pointers are monotonically increased, the > function __auxtrace_mmap__read() handles these two pointers properly. > It calculates the reminders for these two pointers, and the size is > clamped to be never more than "snapshot_size". We can simply reply on > the function __auxtrace_mmap__read() to calculate the correct result > for data copying, it's not necessary to add Arm CoreSight specific > callback. Thanks, applied. - Arnaldo