Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6024087ybi; Wed, 29 May 2019 01:28:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwHB358hR4j7HWa1GfYhLvkZDmxvq6+FRdw2zPPWaXoq49ohIiB+j8JXFz1Dby9XOVSzA6W X-Received: by 2002:a63:4852:: with SMTP id x18mr124300610pgk.14.1559118480667; Wed, 29 May 2019 01:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559118480; cv=none; d=google.com; s=arc-20160816; b=V64zYMwqAtTTeS7QDKkI4/FiztrkeC/Sd1B0/hlOFxNk1kV3oXw06mE6sRxcmQ9YVB Ftpjs3DGgGgYFXENs0Pp6a8B5L0IOFN0EoNjwqMQAfVpngI5rKEw2yKs4TQI+XScf2SQ zrH6vjlDC+ODyxJo2l4RnOHvfBRVfVnXA1PZQDu3NRgiiG4onkTa+OTuQUdwJbz8m6EE GFQcjun2TYvKcPmi6JTSx5qzGWifuRZ36FhDkg9nPVe5Hi5ONvHtsrt9J8FO3cllvfLM 0xZvgeXimBfrWD44vZfNoZR9o9PYhedNrteBAjn9xZIYMxnWipFXmsL8eWIftR5xDOa9 GqIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=LIX5B7FGmjk+Ww+Yk8CXaAPHpS5RyJnhbtljGzn/X64=; b=gDzx/hDLGv9eHWZ2noVzUQ/tL1xxMwn+Yye8iLmEylokndSH0owFaW/5D6kup6Dfev 97AmC5lT2eQ1rEIojlqzuo68RAcIF2nG/VZeQqQgsn7Vze2IntRvAPS7S4j/hvU4Dnjs QqiGaAqVkVFQ46a0/5N9OT6T/iNXx9MhMoLzj5g8jyAXz78lnupiTmkVXjQzzkasFz/p srp30txblclbu3ML73FarV9daaZQU9Gr3JVVx1PYIBWDvOGUNUw3oegRUnXpcwCGOpDS QUhjf1/ZSd6PBsHfphxjxqimiLa17CxsQTOcQd82Ixk85BYg8bhPOgFavRJ1zRnYqvoC OcFw== 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 y5si23018609plk.366.2019.05.29.01.27.44; Wed, 29 May 2019 01:28:00 -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 S1726238AbfE2I0m (ORCPT + 99 others); Wed, 29 May 2019 04:26:42 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40662 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbfE2I0m (ORCPT ); Wed, 29 May 2019 04:26:42 -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 D98F580D; Wed, 29 May 2019 01:26:41 -0700 (PDT) Received: from [10.37.8.255] (unknown [10.37.8.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2030D3F5AF; Wed, 29 May 2019 01:26:37 -0700 (PDT) Subject: Re: [PATCH v2 09/15] arm64: KVM: add support to save/restore SPE profiling buffer controls To: Sudeep Holla , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Christoffer Dall , Marc Zyngier , James Morse , Suzuki K Pouloze , Catalin Marinas , Will Deacon References: <20190523103502.25925-1-sudeep.holla@arm.com> <20190523103502.25925-10-sudeep.holla@arm.com> From: Julien Thierry Message-ID: Date: Wed, 29 May 2019 09:26:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190523103502.25925-10-sudeep.holla@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sudeep, On 05/23/2019 11:34 AM, Sudeep Holla wrote: > Currently since we don't support profiling using SPE in the guests, > we just save the PMSCR_EL1, flush the profiling buffers and disable > sampling. However in order to support simultaneous sampling both in > the host and guests, we need to save and reatore the complete SPE > profiling buffer controls' context. > > Let's add the support for the same and keep it disabled for now. > We can enable it conditionally only if guests are allowed to use > SPE. > > Signed-off-by: Sudeep Holla > --- > arch/arm64/kvm/hyp/debug-sr.c | 44 ++++++++++++++++++++++++++++------- > 1 file changed, 35 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/debug-sr.c b/arch/arm64/kvm/hyp/debug-sr.c > index a2714a5eb3e9..a4e6eaf5934f 100644 > --- a/arch/arm64/kvm/hyp/debug-sr.c > +++ b/arch/arm64/kvm/hyp/debug-sr.c > @@ -66,7 +66,8 @@ > default: write_debug(ptr[0], reg, 0); \ > } > > -static void __hyp_text __debug_save_spe_nvhe(struct kvm_cpu_context *ctxt) > +static void __hyp_text > +__debug_save_spe_nvhe(struct kvm_cpu_context *ctxt, bool full_ctxt) Rather that add a boolean to just indicate "do more stuff" I'd suggest having two separate functions. Also this would be an opportunity to fix the naming of this function which doesn't just save sve context, it also flushes the context and disables it. So maybe have a: void __debug_spe_flush_ctx(struct kvm_cpu_context *ctx); Maybe adapt the name to make it understandable that it does save PMSCR. and void __debug_spe_save_ctx(struct kvm_cpu_context *ctx); Which would save the registers you save under the full_ctx condition. Cheers, Julien