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=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham 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 99059C04AB3 for ; Wed, 29 May 2019 08:26:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C40E20665 for ; Wed, 29 May 2019 08:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726330AbfE2I0m (ORCPT ); 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 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=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham 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 BA82BC07542 for ; Wed, 29 May 2019 08:26:47 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 456FF21670 for ; Wed, 29 May 2019 08:26:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 456FF21670 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B0CB64A4EE; Wed, 29 May 2019 04:26:46 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oElTJGwo2LDg; Wed, 29 May 2019 04:26:45 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 6B5E14A4AA; Wed, 29 May 2019 04:26:45 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 112C54A479 for ; Wed, 29 May 2019 04:26:44 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x49p8zcUit+k for ; Wed, 29 May 2019 04:26:42 -0400 (EDT) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 8E0FF4A332 for ; Wed, 29 May 2019 04:26:42 -0400 (EDT) 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 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-Language: en-US Cc: kvm@vger.kernel.org, Marc Zyngier , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu 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 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED autolearn=ham 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 CC1A5C04AB3 for ; Wed, 29 May 2019 08:26: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 A1FD020665 for ; Wed, 29 May 2019 08:26:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="L8LtbcxO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1FD020665 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hYWVspjIQIln4aUd+KLtI6MLiYebmylE7KCsGshPVfQ=; b=L8LtbcxOPHHjKp j1khT61g7k6AuYQy/o2+VcxoS9dMNESJ9nFmGg4IUK8U1E6uaFyo1ZLzVa8745w/DTm+hL+lFAaUx A4X0YfVNIGdLVbmVc3GyK/yUZ5DK1GsMOYs0KY7yDLCfNOlnUOH8mdVcnK139TaYi1fdH/rclDbuS FCHNolVTvRtJc8BUegY22xFCJipYnRZzeR67Irf1ZMG0VM1wMyKpHjtLdtv7OoCnVe/oP5Kq82rsk WhDCUKr0yJXXRS6ikhxTw1gdfQjnD44XEwVBvLF08GVbIwhfXnKdiRthxE075kiCXsT/PUKt//S92 mhX3FeWEjMM31c3HP+tw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVtv6-00037V-Of; Wed, 29 May 2019 08:26:48 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVtv3-000378-9H for linux-arm-kernel@lists.infradead.org; Wed, 29 May 2019 08:26:46 +0000 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 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-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190529_012645_334112_2DEB03F9 X-CRM114-Status: GOOD ( 20.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Suzuki K Pouloze , Marc Zyngier , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Christoffer Dall , James Morse Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel