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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC2BCC433F5 for ; Mon, 9 May 2022 22:36:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4410B4B08B; Mon, 9 May 2022 18:36:09 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com 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 Tn3DNX1gCL3c; Mon, 9 May 2022 18:36:08 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2A4064B0C0; Mon, 9 May 2022 18:36:08 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5CDA54B092 for ; Mon, 9 May 2022 18:36:06 -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 6Q3bC+Obgnxk for ; Mon, 9 May 2022 18:36:05 -0400 (EDT) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 4E3B049EF0 for ; Mon, 9 May 2022 18:36:05 -0400 (EDT) Received: by mail-io1-f45.google.com with SMTP id z18so16875983iob.5 for ; Mon, 09 May 2022 15:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OSnht+8VCAB6CRGae6+His6a8pPmQv2FFPIyTYc0Bpc=; b=pO3gpVng8y8atVOaJE0kjrwYtdT6e+MRQ4x1h47NCCzQvKnOUxu3/dgFV014FfNPjT GY4WhlrMBvSQ/Q5+EhWVnCjnTYjomy3sTe4nsGsSTtvhT5qgROC0SN0Zc/M5g7GtN+lE Ruq8fYoR7/k+P+vSGh9pYjzhFjuOh8/+ioB9Ui2NCxmJEOCYog3nvaUlxykBTI6qOrV5 32e26PmWjrVnm3dK2n6fWFOX/YmS0HJw91xrSPvU1SvbhE0uSgCTryB3ATilTo8NAAF5 eP1arEqfXNoMSOAxX31QbP9xE5yd1P5sI7xXdVxWyFc1X9zwJhWR5bb+6BJIv7peaPW3 B/Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OSnht+8VCAB6CRGae6+His6a8pPmQv2FFPIyTYc0Bpc=; b=YUZq427yoN2BUDnihDi/3Pwvun5lzKP0De6S/S3kFx2b/AFeoDxujk+6bMBtRKq77S Xob2uwADiTAY5hQWn6n7zzRke1jZjeRECWVLWSTDTgRUswgjXHPeMUuIV8/DEfuQEJgF 53N/Ph98Vf/+6RW7NsQpR24TzTcHE63GWkAz/AMPu+2E+/Wg4u5PpJ4rHX+2V/lh64tT pcqmulh9Ca5xgtSz0/Sw/Th5/ifcJSC80bQS7HcID1JnEVObsiIk+DskJ8wy7SIXbp61 BgTjxJZLuGTNabDbifuSX1gs8Vgb8lSOp2UFVpLDaxGTBwW9iAnUC0yYODvRrzMjWXJZ T4MA== X-Gm-Message-State: AOAM5313RSG7BGmbHpj5EBJUJL9Sn67MpFBJtP8G6x9rCMIF/5PAtGVf 3E3CFNpBbLqSXdFAdObBkeS1og== X-Google-Smtp-Source: ABdhPJycub8ue9uVjQrr3auGUDS3nibsPeiX1OCClK9zcna5Od9ajYwZLZtpHgtTe/lmKnlDJa3DbA== X-Received: by 2002:a05:6638:2104:b0:32c:26ac:4d8e with SMTP id n4-20020a056638210400b0032c26ac4d8emr3361940jaj.89.1652135764457; Mon, 09 May 2022 15:36:04 -0700 (PDT) Received: from google.com (194.225.68.34.bc.googleusercontent.com. [34.68.225.194]) by smtp.gmail.com with ESMTPSA id g4-20020a056e02130400b002cde6e352c8sm3448252ilr.18.2022.05.09.15.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 15:36:03 -0700 (PDT) Date: Mon, 9 May 2022 22:36:00 +0000 From: Oliver Upton To: Fuad Tabba Subject: Re: [PATCH v3 4/4] KVM: arm64: Reenable pmu in Protected Mode Message-ID: References: <20220509120330.3043773-1-tabba@google.com> <20220509120330.3043773-5-tabba@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220509120330.3043773-5-tabba@google.com> Cc: will@kernel.org, maz@kernel.org, catalin.marinas@arm.com, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.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 Fuad, On Mon, May 09, 2022 at 12:03:30PM +0000, Fuad Tabba wrote: > Now that the pmu code does not access hyp data, reenable it in > protected mode. > > Signed-off-by: Fuad Tabba > --- > arch/arm64/kvm/pmu-emul.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c > index 3dc990ac4f44..11c43bed5f97 100644 > --- a/arch/arm64/kvm/pmu-emul.c > +++ b/arch/arm64/kvm/pmu-emul.c > @@ -774,8 +774,7 @@ void kvm_host_pmu_init(struct arm_pmu *pmu) > { > struct arm_pmu_entry *entry; > > - if (pmu->pmuver == 0 || pmu->pmuver == ID_AA64DFR0_PMUVER_IMP_DEF || > - is_protected_kvm_enabled()) > + if (pmu->pmuver == 0 || pmu->pmuver == ID_AA64DFR0_PMUVER_IMP_DEF) IIUC, you intend to enable the PMU for non-pVM guests, right? Based on the pKVM feature registers + trap handlers I can see that pVM use of the PMU is in fact disabled. It'd be good to state in the commit message what is exactly intended for pVMs and non-pVMs. Since the PMU counters are disabled outright for pVMs, is there any value in context switching between host/guest in this case? -- Thanks, Oliver _______________________________________________ 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D8D2BC433F5 for ; Mon, 9 May 2022 22:37:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mkZilCY96rkavrwHoUv0Qbf9kdCY7sNDNtmeYhtT2hQ=; b=af+u6NbsBGNa8U wA9aiKcgZec+I5Y6OrObYuYHMPaBkLMVIQa9IBzBENPT9Py9GMsa1o5JZd2NphQ6CDkHGJZXq+7jq FTxnEKkaIjBWY4HQa4Tv4pigUg4GAx7cfYbmHPPDb5/fU4B82o+Y60lASAvlQiI1yLECJICWxN7aZ Xojz+AIaI4ngiIa5fza6yYopPE0wMJsiua1jciNqjLhe83/SJMJjvzQ2ixSpqy4rGuE1hDIOqB4u/ Vb0zWssra4XcuVV4qqAIwKfR71yKLEGWXq5tZxG07CJxJzGbxvaRqlBJRSPGHcLl+BGE3QCPXB0aB 2D5enu48MufenlDOBO1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1noBz7-00GabI-Or; Mon, 09 May 2022 22:36:09 +0000 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1noBz5-00GaaK-4L for linux-arm-kernel@lists.infradead.org; Mon, 09 May 2022 22:36:08 +0000 Received: by mail-io1-xd36.google.com with SMTP id e15so16877009iob.3 for ; Mon, 09 May 2022 15:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OSnht+8VCAB6CRGae6+His6a8pPmQv2FFPIyTYc0Bpc=; b=pO3gpVng8y8atVOaJE0kjrwYtdT6e+MRQ4x1h47NCCzQvKnOUxu3/dgFV014FfNPjT GY4WhlrMBvSQ/Q5+EhWVnCjnTYjomy3sTe4nsGsSTtvhT5qgROC0SN0Zc/M5g7GtN+lE Ruq8fYoR7/k+P+vSGh9pYjzhFjuOh8/+ioB9Ui2NCxmJEOCYog3nvaUlxykBTI6qOrV5 32e26PmWjrVnm3dK2n6fWFOX/YmS0HJw91xrSPvU1SvbhE0uSgCTryB3ATilTo8NAAF5 eP1arEqfXNoMSOAxX31QbP9xE5yd1P5sI7xXdVxWyFc1X9zwJhWR5bb+6BJIv7peaPW3 B/Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OSnht+8VCAB6CRGae6+His6a8pPmQv2FFPIyTYc0Bpc=; b=uGCaN0ZBMIYu0LCV5fraZEZgH1RranpI56NwGCRVE6iMTAmMe4Xcp81nNfkm0nlY0w /DHYALh/EbWwTBgZw432RtqUOUIhq7WVS2M+pKxylkgUJppUXTvM0wrIiUXb8kfQ1K/l BfXJLpPwBRMZ8xQutMhKFAoZPPm7HgyIULJMlbeVHKIZSC2VX266t4LKyxLwDDU7Klm0 BzdJtARFSNqb1EOvhf3/+bxx1yFmCjum9ZMbLdXBLNZHqbX8DKiNMvJIzX5w+F+Ejqrj /1+yGlHRbk2F2hp2bX0tPo764+q38WpTanUvbsLg2WAJGm/rypmwBadGnYcUN1XetKb9 Fyqw== X-Gm-Message-State: AOAM532Y/em27fPB6qknMfNHgo51Zp8Y1P5Z/M7DmbqeqDgQX9pevz6H FaDp55aOfl7a8wEk2JM6Nr6DrQ== X-Google-Smtp-Source: ABdhPJycub8ue9uVjQrr3auGUDS3nibsPeiX1OCClK9zcna5Od9ajYwZLZtpHgtTe/lmKnlDJa3DbA== X-Received: by 2002:a05:6638:2104:b0:32c:26ac:4d8e with SMTP id n4-20020a056638210400b0032c26ac4d8emr3361940jaj.89.1652135764457; Mon, 09 May 2022 15:36:04 -0700 (PDT) Received: from google.com (194.225.68.34.bc.googleusercontent.com. [34.68.225.194]) by smtp.gmail.com with ESMTPSA id g4-20020a056e02130400b002cde6e352c8sm3448252ilr.18.2022.05.09.15.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 15:36:03 -0700 (PDT) Date: Mon, 9 May 2022 22:36:00 +0000 From: Oliver Upton To: Fuad Tabba Cc: kvmarm@lists.cs.columbia.edu, kernel-team@android.com, maz@kernel.org, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 4/4] KVM: arm64: Reenable pmu in Protected Mode Message-ID: References: <20220509120330.3043773-1-tabba@google.com> <20220509120330.3043773-5-tabba@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220509120330.3043773-5-tabba@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220509_153607_212098_19898966 X-CRM114-Status: GOOD ( 19.60 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Fuad, On Mon, May 09, 2022 at 12:03:30PM +0000, Fuad Tabba wrote: > Now that the pmu code does not access hyp data, reenable it in > protected mode. > > Signed-off-by: Fuad Tabba > --- > arch/arm64/kvm/pmu-emul.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c > index 3dc990ac4f44..11c43bed5f97 100644 > --- a/arch/arm64/kvm/pmu-emul.c > +++ b/arch/arm64/kvm/pmu-emul.c > @@ -774,8 +774,7 @@ void kvm_host_pmu_init(struct arm_pmu *pmu) > { > struct arm_pmu_entry *entry; > > - if (pmu->pmuver == 0 || pmu->pmuver == ID_AA64DFR0_PMUVER_IMP_DEF || > - is_protected_kvm_enabled()) > + if (pmu->pmuver == 0 || pmu->pmuver == ID_AA64DFR0_PMUVER_IMP_DEF) IIUC, you intend to enable the PMU for non-pVM guests, right? Based on the pKVM feature registers + trap handlers I can see that pVM use of the PMU is in fact disabled. It'd be good to state in the commit message what is exactly intended for pVMs and non-pVMs. Since the PMU counters are disabled outright for pVMs, is there any value in context switching between host/guest in this case? -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel