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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51751C433FE for ; Thu, 30 Sep 2021 12:26:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30E4B6136A for ; Thu, 30 Sep 2021 12:26:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350795AbhI3M2F (ORCPT ); Thu, 30 Sep 2021 08:28:05 -0400 Received: from foss.arm.com ([217.140.110.172]:53400 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350160AbhI3M2C (ORCPT ); Thu, 30 Sep 2021 08:28:02 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D05A3106F; Thu, 30 Sep 2021 05:26:19 -0700 (PDT) Received: from [10.57.21.68] (unknown [10.57.21.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 15E733F793; Thu, 30 Sep 2021 05:26:16 -0700 (PDT) Subject: Re: [PATCH 4/5] perf arm-spe: Implement find_snapshot callback To: Leo Yan Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, John Garry , Will Deacon , Mathieu Poirier , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Mike Leach , linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org References: <20210916154635.1525-1-german.gomez@arm.com> <20210916154635.1525-4-german.gomez@arm.com> <20210923135016.GG400258@leoy-ThinkPad-X240s> <20210923144048.GB603008@leoy-ThinkPad-X240s> From: German Gomez Message-ID: <1c6a3a73-27dc-6673-7fe7-34bc7fcb0a68@arm.com> Date: Thu, 30 Sep 2021 13:26:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210923144048.GB603008@leoy-ThinkPad-X240s> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Leo, On 23/09/2021 15:40, Leo Yan wrote: > On Thu, Sep 23, 2021 at 09:50:16PM +0800, Leo Yan wrote: > > [...] > >>> @@ -336,6 +480,7 @@ struct auxtrace_record *arm_spe_recording_init(int *err, >>> sper->itr.pmu = arm_spe_pmu; >>> sper->itr.snapshot_start = arm_spe_snapshot_start; >>> sper->itr.snapshot_finish = arm_spe_snapshot_finish; >>> + sper->itr.find_snapshot = arm_spe_find_snapshot; >> If I understand correctly, this patch copies the code from cs-etm for >> snapshot handling. About 2 months ago, we removed the Arm cs-etm's >> specific snapshot callback function and directly use perf's function >> __auxtrace_mmap__read() to handle 'head' and 'tail' pointers. Please >> see the commit for details: >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2f01c200d4405c4562e45e8bb4de44a5ce37b217 >> >> Before I review more details for snapshot enabling in patches 03 and >> 04, could you confirm if Arm SPE can use the same way with cs-etm for >> snapshot handling? From my understanding, this is a better way to >> handle AUX buffer's 'head' and 'tail'. > In other words, if we can only apply patch 03 and can pass the testing > in patch 05, then it would be a very neat implementation. > > I will try to verify these patches and will get back result. > > Thanks, > Leo The patch is indeed based on that commit. The reason behind it is that the values for *head are being wrapped in the driver side (see the macro PERF_IDX2OFF which is used at various points in /drivers/perf/arm_spe_pmu.c). If this callback is not to be added, I believe the driver needs to be updated first so that the head pointer monotonically increases like in cs-etm. Do you think this makes sense for SPE? (note that the patch will skip the wrap-around detection if this is the case, in order to handle both cases in the userspace perf tool). Thanks, German 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F7BDC433EF for ; Thu, 30 Sep 2021 12:28:51 +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 3BC6861353 for ; Thu, 30 Sep 2021 12:28:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3BC6861353 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qdM0e2T3x1IXSqFCeSsl6OeJYejOQTTFhNH1dM/8lsU=; b=eKCbdpbVFDYNAdQywV1loBEbNj Mah/T0CCHGIyf9+JQpGV0Ke2KbGCB2pqL6MbsZMA6p/Ij4nJacQ7xe/AOAM+k4+GB9xH5+4lw1OC0 BbmYoT+LAYg8gS139w8NyHv78uFORIMEanQaLU4IuW6C0qZOnAvhrf6wTZTOJ7Woh2OtQx57qEMtH y5Tw75m5mD2Iyi5Cr71tApw8M/7Udp4T0MCxb8xiWWSa1yX3Sh3pqEZBrcXz+F81PjsClmrOXgBP/ jE4kXKz5FJGX+tKQXBpsIYkg1sgcKCV0FufqnoW0wuSRwHaj7gDIPcFlA5BNBueEMUy5+MfNGGXe1 k+6OGt6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVv8r-00EBpf-KZ; Thu, 30 Sep 2021 12:26:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVv8n-00EBok-Dk for linux-arm-kernel@lists.infradead.org; Thu, 30 Sep 2021 12:26:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D05A3106F; Thu, 30 Sep 2021 05:26:19 -0700 (PDT) Received: from [10.57.21.68] (unknown [10.57.21.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 15E733F793; Thu, 30 Sep 2021 05:26:16 -0700 (PDT) Subject: Re: [PATCH 4/5] perf arm-spe: Implement find_snapshot callback To: Leo Yan Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, John Garry , Will Deacon , Mathieu Poirier , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Mike Leach , linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org References: <20210916154635.1525-1-german.gomez@arm.com> <20210916154635.1525-4-german.gomez@arm.com> <20210923135016.GG400258@leoy-ThinkPad-X240s> <20210923144048.GB603008@leoy-ThinkPad-X240s> From: German Gomez Message-ID: <1c6a3a73-27dc-6673-7fe7-34bc7fcb0a68@arm.com> Date: Thu, 30 Sep 2021 13:26:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210923144048.GB603008@leoy-ThinkPad-X240s> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210930_052621_547587_F316565D X-CRM114-Status: GOOD ( 22.63 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Leo, On 23/09/2021 15:40, Leo Yan wrote: > On Thu, Sep 23, 2021 at 09:50:16PM +0800, Leo Yan wrote: > > [...] > >>> @@ -336,6 +480,7 @@ struct auxtrace_record *arm_spe_recording_init(int *err, >>> sper->itr.pmu = arm_spe_pmu; >>> sper->itr.snapshot_start = arm_spe_snapshot_start; >>> sper->itr.snapshot_finish = arm_spe_snapshot_finish; >>> + sper->itr.find_snapshot = arm_spe_find_snapshot; >> If I understand correctly, this patch copies the code from cs-etm for >> snapshot handling. About 2 months ago, we removed the Arm cs-etm's >> specific snapshot callback function and directly use perf's function >> __auxtrace_mmap__read() to handle 'head' and 'tail' pointers. Please >> see the commit for details: >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2f01c200d4405c4562e45e8bb4de44a5ce37b217 >> >> Before I review more details for snapshot enabling in patches 03 and >> 04, could you confirm if Arm SPE can use the same way with cs-etm for >> snapshot handling? From my understanding, this is a better way to >> handle AUX buffer's 'head' and 'tail'. > In other words, if we can only apply patch 03 and can pass the testing > in patch 05, then it would be a very neat implementation. > > I will try to verify these patches and will get back result. > > Thanks, > Leo The patch is indeed based on that commit. The reason behind it is that the values for *head are being wrapped in the driver side (see the macro PERF_IDX2OFF which is used at various points in /drivers/perf/arm_spe_pmu.c). If this callback is not to be added, I believe the driver needs to be updated first so that the head pointer monotonically increases like in cs-etm. Do you think this makes sense for SPE? (note that the patch will skip the wrap-around detection if this is the case, in order to handle both cases in the userspace perf tool). Thanks, German _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel