Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4013186ybx; Mon, 4 Nov 2019 06:28:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxLmN7Ib/BHmgMOhPz+GCsKfS8k4vupRm5+LR4iWNVwnUDVdHaGmBXuGz/vUS9FVpVcy6ui X-Received: by 2002:a17:906:3045:: with SMTP id d5mr22953420ejd.162.1572877682837; Mon, 04 Nov 2019 06:28:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572877682; cv=none; d=google.com; s=arc-20160816; b=FJPZwd3+a2lmBb88HYw4dShr8UmedkvQSahMbcSG2DtA0gO9AsMsZBryawbEe47chd AuLVMdWFVEalAVXW8QgdsyTPetS+ovMWgiDL4hZZ8lhEqBEDRDBLb2xKd1pQ5x0ael9G w+IEe6/ookaPrDBiVgKdVxZsSON9OrTHUAf8ZE6xatpgfjin+PjFVtFLeg1AxlvgcLU2 85lxdh4D0U5S8C1EJKWrvng61fXRbZFzLVtg9Qfyp8E39xYVCERRd657BDk9zXLEcidn YbMf0gurHh6ERW4vnE5uOF4AGAVLws76BSu53j4/+FArx++/eWFJd/DloqYXXe5SgOUV 95Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7LBT7gDE3T9vewckmIuo6JUdOMA/ibQqmDcJKPvxrzk=; b=pkaYg78zNUBPnHJ1Y6kNBCL0V1jtYHGSihKmkTaDS1prcT0sRKkh7indGN3pwUvMN1 VqhVPiFuVv2rUbi0mkkbHBgFDecF+ggQEpN04EGjRPnP6XaG+9H/DSTG2LEyss1Zi9Ow jWb1ywnKWj6TaPr0fvAsvvRZb/wjkV5nnxBFY7xI0L3LUNgdeXQA51yW3evYL+x0X8EY B1exFVxbQY/P4gIu3b9xpuw7xcyoIBU928I9fGWRUbWChX6UpxGwPq02gUjuLVc4z5cq K5aykcwMVqoifmHWVX2erZqW9USZzkcPqISBNwlwGnGHqTkbSSzFGcgME/X98q9bc2yP fh1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EcwNhrNW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id p37si6780364eda.405.2019.11.04.06.27.39; Mon, 04 Nov 2019 06:28:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EcwNhrNW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728409AbfKDO1A (ORCPT + 99 others); Mon, 4 Nov 2019 09:27:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:43120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728174AbfKDO1A (ORCPT ); Mon, 4 Nov 2019 09:27:00 -0500 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 01E0A217F4; Mon, 4 Nov 2019 14:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572877619; bh=0IjKRPtlsAuGGSBfyycUTHeq+OKoAcUZR2xfdqbrOgs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EcwNhrNW699SAWToP/HTLcjb/0Z5KD9Ws4UgUPP7G8FaI4CkH1achz2b6G8yRHmPX KUp8mUaFn23KKjjV7S2q8vXsnnkEzHKzEAr4SIsa4FWir9RubmKdDuAKKQDOi7z3UW gtlvHv2zF/WuZLLl1N2CUhO2A3M06mGFLMG2ZfgA= Date: Mon, 4 Nov 2019 14:26:54 +0000 From: Will Deacon To: Shaokun Zhang Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jiri Olsa , Arnaldo Carvalho de Melo , Mark Rutland , liuqi115@hisilicon.com, huangdaode@hisilicon.com, john.garry@huawei.com, Jonathan Cameron Subject: Re: [RFC] About perf-mem command support on arm64 platform Message-ID: <20191104142654.GA24609@willie-the-truck> References: <74f8ddb5-13cc-5dce-82a6-ca8bd02f8175@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <74f8ddb5-13cc-5dce-82a6-ca8bd02f8175@hisilicon.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 04, 2019 at 05:18:00PM +0800, Shaokun Zhang wrote: > perf-mem is used to profile memory access which has been implemented on x86 > platform. It needs mem-stores events and mem-loads/load-latency. > For mem-stores events, it is MEM_INST_RETIRED_ALL_STORES whose raw number > is r82d0, and mem-loads/load-latency is from PEBS if I follow its code. > > Now, for some arm64 cores, like HiSilicon's tsv110 and ARM's Neoverse N1, > has supported the SPE(Statistical Profiling Extensions), so is it a > possibility that perf-mem is supported on arm64? > https://developer.arm.com/ip-products/processors/neoverse/neoverse-n1 I don't understand the relationship you're trying to draw between mem-stores and SPE. How does perf-mem work and what does it actually require from the CPU? One thing that may be worth noting is that SPE isn't generally able to capture information about all instructions being executed by the CPU: instead, it instructions (most likely micro-ops) are sampled based on some user-specified period. The CPU advertises a minimum recommended period which we expose under /sys and enforce when programming events. > For arm64 PMU, it has 'st_retired' event that the event number is 0x0007 > which is equal to mem-stores on x86, if we want support perf-mem, it seems > that 'st_retired' shall be replaced by 'mem-stores' > in arch/arm64/kernel/perf_event.c file. Of course, the cpu core should > support st_retired event. I'm not sure Will/Mark are happy on this.;-) > > For mem-loads/load-latency, we can derive them from SPE sampled data which > supports by load_filter and min_latency in SPE driver. and we may do some > work on tools/perf/builtin-mem.c. I don't see how you could reconcile the sampling nature of SPE with a CPU PMU counter, particularly as filtering in SPE happens /after/ sampling. > From the above conditions, it seems that we may have the opportunity to > support the perf-mem command on arm64. > I'm not very sure about it, so I send this RFC and any comments are welcome. I don't think there's enough information here to comment meaningfully more than SPE != PEBS. Will