Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1850638imm; Thu, 2 Aug 2018 02:00:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdOaX9ma6ONTppNJ5pd3Tezb1LkGO09bHjjmSAa+41guKRNNauf/fvWptNm4TBpQEfIpPe0 X-Received: by 2002:a65:5784:: with SMTP id b4-v6mr1892564pgr.315.1533200437223; Thu, 02 Aug 2018 02:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533200437; cv=none; d=google.com; s=arc-20160816; b=hmH42XG8kPUQCz9w3CzQH0imPPfudTr6hbLzqGrolA3dEu5VVYURroEgfa8Q9FpPFd FkUGYdi1u+u3VRiyuUqYwc3bpsqc48hrT3aXFtQBXeQpVVhw+RT3jdyNDpYXR4IPsRbV WF+PFJUyCGBMKO7ZrDGJ/No2g65nCGB7FRQ4pAoBk4R7QNC9KA2xjLXKtTdWSQBNqBbb Ms1EPbw9aa1mlwRLLaZVKFB9mTYb8CH2tyMwyFxEO4f/OeZp6XJIWJWNGXT7bhVHnIaq 04BFMZfiY4Zw5iXpSn2G60RJH7BB9e3xY/hyoQVYuGWx52C5bq7/3I9q8Hcs3+2n8XT/ CS2w== 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:arc-authentication-results; bh=a7SI0OBAkWecIDcH6uxDPUhkAy1mzUsSgxOmH+H+CfI=; b=AxTx8uWtbQwDZ3QJ71zVV+TCzULOGKbasjvl9EFy7N1V65tBK3w90lxxUenidAUij+ aWaF3ix1e+pLvohbtcCWMVkCaNZOmOdvr+WI+PvNvdSjbiQ8AzyOTZsHIZggXWZWyKVt 93LL23E0mZoKvmrt3XKHDRy0IB5irfcXjN8ycMUpPLGXODDgYdKrlkx0mEoyQHbg7gVf bVD62X4jpbWjf+a6mie2NTJbcaEIrOprrvnhn94Evv3eA8cJiBrpLsiRxIUdo712TZVf Y09gjlN2v8MDbTUZKPOv5+nMrttUIKvKvL4f+F5m6UzpElNacp0jOnXPePlHvEp7jemT f3RA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w22-v6si1029349plk.512.2018.08.02.02.00.22; Thu, 02 Aug 2018 02:00:37 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731966AbeHBKr7 (ORCPT + 99 others); Thu, 2 Aug 2018 06:47:59 -0400 Received: from foss.arm.com ([217.140.101.70]:54420 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbeHBKr7 (ORCPT ); Thu, 2 Aug 2018 06:47:59 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 96E0880D; Thu, 2 Aug 2018 01:57:47 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 887683F5D0; Thu, 2 Aug 2018 01:57:46 -0700 (PDT) Date: Thu, 2 Aug 2018 09:57:44 +0100 From: Mark Rutland To: Boris Ostrovsky Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Ingo Molnar , Jin Yao Subject: Re: [RFC PATCH] perf/core: don't sample kernel regs upon skid Message-ID: <20180802085743.tznoldd7oy32uwvs@lakrids.cambridge.arm.com> References: <20180702151250.14536-1-mark.rutland@arm.com> <20180702154655.GR2494@hirez.programming.kicks-ass.net> <20180702160249.qck45h76galxrckn@lakrids.cambridge.arm.com> <20180711055927.wcfcfkninfjwox3n@salmiak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711055927.wcfcfkninfjwox3n@salmiak> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 11, 2018 at 06:59:28AM +0100, Mark Rutland wrote: > On Mon, Jul 09, 2018 at 06:42:29PM -0400, Boris Ostrovsky wrote: > > On 07/02/2018 12:02 PM, Mark Rutland wrote: > > > On Mon, Jul 02, 2018 at 05:46:55PM +0200, Peter Zijlstra wrote: > > >> On Mon, Jul 02, 2018 at 04:12:50PM +0100, Mark Rutland wrote: > > >>> +static struct pt_regs *perf_get_sample_regs(struct perf_event *event, > > >>> + struct pt_regs *regs) > > >>> +{ > > >>> + /* > > >>> + * Due to interrupt latency (AKA "skid"), we may enter the kernel > > >>> + * before taking an overflow, even if the PMU is only counting user > > >>> + * events. > > >>> + * > > >>> + * If we're not counting kernel events, always use the user regs when > > >>> + * sampling. > > >>> + * > > >>> + * TODO: what do we do about sampling a guest's registers? The IP is > > >>> + * special-cased, but for the rest of the regs they'll get the > > >>> + * user/kernel regs depending on whether exclude_kernel is set, which > > >>> + * is nonsensical. > > >>> + * > > >>> + * We can't get at the full set of regs in all cases (e.g. Xen's PV PMU > > >>> + * can't provide the GPRs), so should we just zero the GPRs when in a > > >>> + * guest? Or skip outputting the regs in perf_output_sample? > > >> Seems daft Xen cannot provide registers; why is that? Boris? > > > The xen_pmu_regs structure simply doesn't have them, so I assume there's > > > no API to get them. > > > > > > Given we don't currently sample the guest regs, I'd be tempted to just > > > zero them for now, or skip the sample at output time (if that doesn't > > > break some other case). > I think this is going to become a series rather than a single patch, but I can > have a go. I need to get my head around how the various cases interact with > each other. As a heads-up, due to sabbatical leave I'm probably not going to have the chance to dig into this until September. If someone else is able to take a look at this, that would be great. Otherwise, I'm happy to take a look once I get back. Thanks, Mark.