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=-6.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 DEB09C11F64 for ; Thu, 1 Jul 2021 16:25:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7AB3613E3 for ; Thu, 1 Jul 2021 16:25:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229978AbhGAQ1t (ORCPT ); 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-perf-users@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 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=-4.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 46225C11F64 for ; Thu, 1 Jul 2021 16:26:55 +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 0CC11613E3 for ; Thu, 1 Jul 2021 16:26:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CC11613E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.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=bombadil.20210309; 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=0v5TNQld8m4GOfbP9tHre03nt1jJGe/SXD4EKfVervU=; b=O8BGR3uTLeOSCS ojnzwpepYAdKDv3HxXiOAS8R9WgPATZ/siOSSxp05jmloaMpMLh0nxASxp372fZ6z4iqZhsjfrbeY 4O+61ZopgEFJ+aptJ6+uDkcDeFx0xt1I/Y2zWyA493Xn3R1Qw3LvxHUklGy9EFt3ZiPTnhhTANlMC 6/WydXp+r/u4MAbywPfCS6YpKh0A+mNhOTOOb5F2mjszvanFq+U8aCTrxjqXU754cj+3ktNrJyfM5 k4COYhuBrnh69T4avl9B8codpxYojI2VHp5D6ygHFBChTDTFFeBawLicMWWbYZ4CCGC8sBemzohTV lQTRuomaheIBvLG3BTWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyzVC-000QO7-NN; Thu, 01 Jul 2021 16:25:22 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyzVA-000QNk-Ma for linux-arm-kernel@bombadil.infradead.org; Thu, 01 Jul 2021 16:25:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=se/F9I8YFezJrY3v0wM4BUXDfT7TPM02XuNiUYzd6t8=; b=K66uYIcaDX8IrRl98eX82R6Dqn /UHn9w18CkKlpjc9UwMLLQ/L8JbNkoq8kxo0TVNWCh3Ke3pUJSD0Mi+6kGzOG1kaO5D0IXMdECnXJ prqSGlL2UR56WUeR08t2hOxwHRPKL4CgiRHKGKZ/5NI7DNWokmC355pzTzMLc83UJ9EIIuGHWyK9W en3/I/GeKdt6Nf6KP1KtqUK2BY1qWblfM1QdZFE1Om3/qYX8U4uiuF1fL55sCo6YeS5nIVXpTW/A5 ocd17BJC/XByygjKtUSpTmnTJxoTvIYZJ9FG/cRFBpPwevKvh+kbE6dH5u5Fadu14cEi5XMlq2i9i /1PjOMgA==; Received: from [179.97.37.151] (helo=quaco.ghostprotocols.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyzV9-00DaoD-0h; Thu, 01 Jul 2021 16:25:19 +0000 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-Disposition: inline In-Reply-To: <20210701093537.90759-3-leo.yan@linaro.org> X-Url: http://acmel.wordpress.com 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel