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 4801CC433EF for ; Mon, 25 Apr 2022 17:19:05 +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:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0PdKhCd1qg/uRxEoLEl34r0n61jiRqvTxFnkQqOE2qc=; b=X3DpBXhIG1RO0t 9EOWwwyPpBQPSEjLNeTv2nRH0D6/JKKNKMwIg6cAbYNluy3wpzNoJM8UWE6SWi35+EghAMzaqPefr U2oCCzFZvIBnLj0tvaeXagUSzdtUaXk3oqwRTe2b9XFe1kZXi4nINpmZXUoRoykpg2x+LeAqCdCZj jq8AuQiMekGdxkq0vdhbtQpab4LVFl8b6Os4+kwIO0J2ZBt3FPqKEPESSu3M1KANS1T3pDUyKamIv F4RWhurWnbd49qysbXtzm59SVIyS9dTEmnG6LEdrhBjZrIvDB/L5cPHkTzZ7e+nfXi8n/tYB4p0ER av06GltqVnStiKUs6s+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nj2LI-00Ab36-G0; Mon, 25 Apr 2022 17:17:45 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nj2Hy-00AZ84-Jv for linux-arm-kernel@lists.infradead.org; Mon, 25 Apr 2022 17:14:25 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B74F661521; Mon, 25 Apr 2022 17:14:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22F3DC385A7; Mon, 25 Apr 2022 17:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650906856; bh=30Xz83WjEjlPuGd160S3OWJ2GpjN1lAzqyn8HINC7ls=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=spuipJBRHJwnDWhFTncEFli4zdLKIZZbYgxNMmI1s8C3wJh9cHq9Dpwmx/Dm0VimT XLWE5qIiybFAzOWn1AZ8esybrFrlnwYsuaGVLuz5pzj2aAc9ifnAE/jTGJXpJ8QIr7 nnS+CC/BhzPLTfpvK32WsVncQjf9XqzsOqq9oOqqd5uDy1NS8FNtEabu3uf9GSmuZ/ Z2bxovHHu3PlkzxN//yxqIX8+Vnn0yHXSN93ZtJl9n3qD8lrzjx8AGO87gzPulhNai pdEzhOmUYLPEy8xzz/Bqi3ku6qRxLtiCf31ibq6mGtD7RDapXiJBxZ5LBMkkDAhXvC 6WzL43KHXu8Cg== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nj2Ht-006qcE-Iv; Mon, 25 Apr 2022 18:14:13 +0100 Date: Mon, 25 Apr 2022 18:14:13 +0100 Message-ID: <875ymx9jbu.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei Cc: james.morse@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Oliver Upton Subject: Re: [PATCH] KVM/arm64: Don't emulate a PMU for 32-bit guests if feature not set In-Reply-To: <20220425145530.723858-1-alexandru.elisei@arm.com> References: <20220425145530.723858-1-alexandru.elisei@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, james.morse@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, oupton@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220425_101418_770299_D5CD7A8C X-CRM114-Status: GOOD ( 18.94 ) 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 [+ Oliver] Hi Alex, On Mon, 25 Apr 2022 15:55:30 +0100, Alexandru Elisei wrote: > > kvm->arch.arm_pmu is set when userspace attempts to set the first PMU > attribute. As certain attributes are mandatory, arm_pmu ends up always > being set to a valid arm_pmu, otherwise KVM will refuse to run the VCPU. > However, this only happens if the VCPU has the PMU feature. If the VCPU > doesn't have the feature bit set, kvm->arch.arm_pmu will be left > uninitialized and equal to NULL. Although I'm not opposed to this as an immediate workaround to avoid the ugly crash, I think sanitising the AArch32 regs is the way to go. Oliver had a stab at this a few weeks back[1], but this seem to have stalled. Could you have a look and see if anything was missing (the patches needed some rework, but I haven't checked whether DFR0 was correctly handled or not). Thanks, M. [1] https://lore.kernel.org/r/20220401010832.3425787-1-oupton@google.com -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel