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=-9.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,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 A393AC433E6 for ; Mon, 4 Jan 2021 18:26:50 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id D532121D94 for ; Mon, 4 Jan 2021 18:26:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D532121D94 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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 4D4BA4B19E; Mon, 4 Jan 2021 13:26:49 -0500 (EST) 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 MVJndefx3RLo; Mon, 4 Jan 2021 13:26:47 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BDDFD4B137; Mon, 4 Jan 2021 13:26:47 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9A8CF4B0F1 for ; Mon, 4 Jan 2021 13:26:46 -0500 (EST) 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 SkF2r0CmfyiU for ; Mon, 4 Jan 2021 13:26:45 -0500 (EST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 47B964B0F3 for ; Mon, 4 Jan 2021 13:26:45 -0500 (EST) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1EDFD2075E; Mon, 4 Jan 2021 18:26:44 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kwUZ0-005HbV-06; Mon, 04 Jan 2021 18:26:42 +0000 MIME-Version: 1.0 Date: Mon, 04 Jan 2021 18:26:41 +0000 From: Marc Zyngier To: Qian Cai Subject: Re: [PATCH] KVM: arm64: Don't access PMCR_EL0 when no PMU is available In-Reply-To: References: <20201210083059.1277162-1-maz@kernel.org> <703e1b5f2db1631e8f9c55619909fe66eb069f25.camel@redhat.com> <579c839a0016107af66e704f147f9814@kernel.org> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: qcai@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kernel-team@android.com, sfr@canb.auug.org.au, linux-next@vger.kernel.org, alexandru.elisei@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: Stephen Rothwell , Linux Next Mailing List , 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On 2021-01-04 18:20, Qian Cai wrote: > On Mon, 2021-01-04 at 16:27 +0000, Marc Zyngier wrote: >> On 2021-01-04 16:22, Qian Cai wrote: >> > On Mon, 2021-01-04 at 16:08 +0000, Marc Zyngier wrote: >> > > On 2021-01-04 15:47, Qian Cai wrote: >> > > > On Thu, 2020-12-10 at 08:30 +0000, Marc Zyngier wrote: >> > > > > We reset the guest's view of PMCR_EL0 unconditionally, based on >> > > > > the host's view of this register. It is however legal for an >> > > > > imnplementation not to provide any PMU, resulting in an UNDEF. >> > > > > >> > > > > The obvious fix is to skip the reset of this shadow register >> > > > > when no PMU is available, sidestepping the issue entirely. >> > > > > If no PMU is available, the guest is not able to request >> > > > > a virtual PMU anyway, so not doing nothing is the right thing >> > > > > to do! >> > > > > >> > > > > It is unlikely that this bug can hit any HW implementation >> > > > > though, as they all provide a PMU. It has been found using nested >> > > > > virt with the host KVM not implementing the PMU itself. >> > > > > >> > > > > Fixes: ab9468340d2bc ("arm64: KVM: Add access handler for PMCR >> > > > > register") >> > > > > Signed-off-by: Marc Zyngier >> > > > >> > > > Reverting this commit on the top of today's linux-next fixed a qemu-kvm >> > > > coredump >> > > > issue on TX2 while starting a guest. >> > > > >> > > > - host kernel .config: >> > > > https://cailca.coding.net/public/linux/mm/git/files/master/arm64.config >> > > > >> > > > # /usr/libexec/qemu-kvm -name ubuntu-20.04-server-cloudimg -cpu host >> > > > -smp 2 -m 2g >> > > > -drive >> > > > if=none,format=qcow2,file=./ubuntu-20.04-server-cloudimg.qcow2,id=hd >> > > > -device virtio-scsi -device scsi-hd,drive=hd -cdrom >> > > > ./ubuntu-20.04-server-cloudimg.iso >> > > > -bios /usr/share/AAVMF/AAVMF_CODE.fd -M gic-version=host -nographic >> > > > -nic user,model=virtio,hostfwd=tcp::2222-:22 >> > > > >> > > > qemu-kvm: /builddir/build/BUILD/qemu-4.2.0/target/arm/helper.c:1812: >> > > > pmevcntr_rawwrite: Assertion `counter < pmu_num_counters(env)' failed. >> > > >> > > You don't have KVM_ARM_PMU selected in your config, so QEMU cannot >> > > access the PMU registers, and no counters are exposed. >> > >> > Well, isn't it the rule that don't break the userspace? qemu works fine >> > with >> > KVM_ARM_PMU=n until this commit. >> >> No, it doesn't "work fine". It gets random data that potentially makes >> no sense, >> depending on the HW this runs on. >> >> Now, userspace tells you that your kernel is misconfigured. I see it >> as >> an improvement. > > Marc, do you suggest that CONFIG_KVM=y should select KVM_ARM_PMU=y > then? > Otherwise, this is rather difficult for users to figure out and a core > dump with > an implicit error message from qemu is not that helpful. What I'm suggesting is this [1], which is to get rid of KVM_ARM_PMU completely. At least, the kernel configuration will be consistent. Overall, I think there is an issue with KVM exposing more than it should to userspace when no PMU is defined, but I don't think that's the problem you are seeing. M. [1] https://lore.kernel.org/r/20210104172723.2014324-1-maz@kernel.org -- Jazz is not dead. It just smells funny... _______________________________________________ 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=-9.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 F1C72C433DB for ; Mon, 4 Jan 2021 18:27:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5E1621D94 for ; Mon, 4 Jan 2021 18:27:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726599AbhADS1Z (ORCPT ); Mon, 4 Jan 2021 13:27:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:44224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726396AbhADS1Z (ORCPT ); Mon, 4 Jan 2021 13:27:25 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1EDFD2075E; Mon, 4 Jan 2021 18:26:44 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kwUZ0-005HbV-06; Mon, 04 Jan 2021 18:26:42 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 04 Jan 2021 18:26:41 +0000 From: Marc Zyngier To: Qian Cai Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kernel-team@android.com, Stephen Rothwell , Linux Next Mailing List , Alexandru Elisei Subject: Re: [PATCH] KVM: arm64: Don't access PMCR_EL0 when no PMU is available In-Reply-To: References: <20201210083059.1277162-1-maz@kernel.org> <703e1b5f2db1631e8f9c55619909fe66eb069f25.camel@redhat.com> <579c839a0016107af66e704f147f9814@kernel.org> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: qcai@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kernel-team@android.com, sfr@canb.auug.org.au, linux-next@vger.kernel.org, alexandru.elisei@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-next@vger.kernel.org On 2021-01-04 18:20, Qian Cai wrote: > On Mon, 2021-01-04 at 16:27 +0000, Marc Zyngier wrote: >> On 2021-01-04 16:22, Qian Cai wrote: >> > On Mon, 2021-01-04 at 16:08 +0000, Marc Zyngier wrote: >> > > On 2021-01-04 15:47, Qian Cai wrote: >> > > > On Thu, 2020-12-10 at 08:30 +0000, Marc Zyngier wrote: >> > > > > We reset the guest's view of PMCR_EL0 unconditionally, based on >> > > > > the host's view of this register. It is however legal for an >> > > > > imnplementation not to provide any PMU, resulting in an UNDEF. >> > > > > >> > > > > The obvious fix is to skip the reset of this shadow register >> > > > > when no PMU is available, sidestepping the issue entirely. >> > > > > If no PMU is available, the guest is not able to request >> > > > > a virtual PMU anyway, so not doing nothing is the right thing >> > > > > to do! >> > > > > >> > > > > It is unlikely that this bug can hit any HW implementation >> > > > > though, as they all provide a PMU. It has been found using nested >> > > > > virt with the host KVM not implementing the PMU itself. >> > > > > >> > > > > Fixes: ab9468340d2bc ("arm64: KVM: Add access handler for PMCR >> > > > > register") >> > > > > Signed-off-by: Marc Zyngier >> > > > >> > > > Reverting this commit on the top of today's linux-next fixed a qemu-kvm >> > > > coredump >> > > > issue on TX2 while starting a guest. >> > > > >> > > > - host kernel .config: >> > > > https://cailca.coding.net/public/linux/mm/git/files/master/arm64.config >> > > > >> > > > # /usr/libexec/qemu-kvm -name ubuntu-20.04-server-cloudimg -cpu host >> > > > -smp 2 -m 2g >> > > > -drive >> > > > if=none,format=qcow2,file=./ubuntu-20.04-server-cloudimg.qcow2,id=hd >> > > > -device virtio-scsi -device scsi-hd,drive=hd -cdrom >> > > > ./ubuntu-20.04-server-cloudimg.iso >> > > > -bios /usr/share/AAVMF/AAVMF_CODE.fd -M gic-version=host -nographic >> > > > -nic user,model=virtio,hostfwd=tcp::2222-:22 >> > > > >> > > > qemu-kvm: /builddir/build/BUILD/qemu-4.2.0/target/arm/helper.c:1812: >> > > > pmevcntr_rawwrite: Assertion `counter < pmu_num_counters(env)' failed. >> > > >> > > You don't have KVM_ARM_PMU selected in your config, so QEMU cannot >> > > access the PMU registers, and no counters are exposed. >> > >> > Well, isn't it the rule that don't break the userspace? qemu works fine >> > with >> > KVM_ARM_PMU=n until this commit. >> >> No, it doesn't "work fine". It gets random data that potentially makes >> no sense, >> depending on the HW this runs on. >> >> Now, userspace tells you that your kernel is misconfigured. I see it >> as >> an improvement. > > Marc, do you suggest that CONFIG_KVM=y should select KVM_ARM_PMU=y > then? > Otherwise, this is rather difficult for users to figure out and a core > dump with > an implicit error message from qemu is not that helpful. What I'm suggesting is this [1], which is to get rid of KVM_ARM_PMU completely. At least, the kernel configuration will be consistent. Overall, I think there is an issue with KVM exposing more than it should to userspace when no PMU is defined, but I don't think that's the problem you are seeing. M. [1] https://lore.kernel.org/r/20210104172723.2014324-1-maz@kernel.org -- Jazz is not dead. It just smells funny... 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=-9.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 5A093C433E0 for ; Mon, 4 Jan 2021 18:28:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 19389221F8 for ; Mon, 4 Jan 2021 18:28:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19389221F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=w+GcCrvkRSsJjqiEZMi5gDc2+pX5Au7QwRJCIpuxkMg=; b=DESXc2Prc2KzX3AlQfFqXqvrd YPlgTdXGJYJGYMuLMu2ZeYNCHNOM4591iuQXCZjU3ljwQLWEYDklCUrit7+TrqHiaGVStqZnvsCSU MllJAn2RHVWfKFafl3Vi6ZR4DeSut7xdaEsbZpb3i3pZx3ARZJwHqqs+l6kBEXDfuvRQchjhlE7oJ MIIFDkttcxdxntgwvjv45fN8giiv0u726AqmJRt9L7opgCiMIG39KBAd3XQ4daoXOfH7TAjc6P/Dp WfkPydFR88MvbT0rOuA3w/ypQH1Ce3JxHL4wNBCt0dUHsDgdKW8EXxBK3+wXJdzAGNjf8KNEHvTaF jFowEee1Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwUZ6-00053V-IH; Mon, 04 Jan 2021 18:26:48 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwUZ3-00052u-TK for linux-arm-kernel@lists.infradead.org; Mon, 04 Jan 2021 18:26:46 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1EDFD2075E; Mon, 4 Jan 2021 18:26:44 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kwUZ0-005HbV-06; Mon, 04 Jan 2021 18:26:42 +0000 MIME-Version: 1.0 Date: Mon, 04 Jan 2021 18:26:41 +0000 From: Marc Zyngier To: Qian Cai Subject: Re: [PATCH] KVM: arm64: Don't access PMCR_EL0 when no PMU is available In-Reply-To: References: <20201210083059.1277162-1-maz@kernel.org> <703e1b5f2db1631e8f9c55619909fe66eb069f25.camel@redhat.com> <579c839a0016107af66e704f147f9814@kernel.org> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: qcai@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kernel-team@android.com, sfr@canb.auug.org.au, linux-next@vger.kernel.org, alexandru.elisei@arm.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-20210104_132646_118380_80B228CB X-CRM114-Status: GOOD ( 28.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephen Rothwell , Alexandru Elisei , Linux Next Mailing List , kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-01-04 18:20, Qian Cai wrote: > On Mon, 2021-01-04 at 16:27 +0000, Marc Zyngier wrote: >> On 2021-01-04 16:22, Qian Cai wrote: >> > On Mon, 2021-01-04 at 16:08 +0000, Marc Zyngier wrote: >> > > On 2021-01-04 15:47, Qian Cai wrote: >> > > > On Thu, 2020-12-10 at 08:30 +0000, Marc Zyngier wrote: >> > > > > We reset the guest's view of PMCR_EL0 unconditionally, based on >> > > > > the host's view of this register. It is however legal for an >> > > > > imnplementation not to provide any PMU, resulting in an UNDEF. >> > > > > >> > > > > The obvious fix is to skip the reset of this shadow register >> > > > > when no PMU is available, sidestepping the issue entirely. >> > > > > If no PMU is available, the guest is not able to request >> > > > > a virtual PMU anyway, so not doing nothing is the right thing >> > > > > to do! >> > > > > >> > > > > It is unlikely that this bug can hit any HW implementation >> > > > > though, as they all provide a PMU. It has been found using nested >> > > > > virt with the host KVM not implementing the PMU itself. >> > > > > >> > > > > Fixes: ab9468340d2bc ("arm64: KVM: Add access handler for PMCR >> > > > > register") >> > > > > Signed-off-by: Marc Zyngier >> > > > >> > > > Reverting this commit on the top of today's linux-next fixed a qemu-kvm >> > > > coredump >> > > > issue on TX2 while starting a guest. >> > > > >> > > > - host kernel .config: >> > > > https://cailca.coding.net/public/linux/mm/git/files/master/arm64.config >> > > > >> > > > # /usr/libexec/qemu-kvm -name ubuntu-20.04-server-cloudimg -cpu host >> > > > -smp 2 -m 2g >> > > > -drive >> > > > if=none,format=qcow2,file=./ubuntu-20.04-server-cloudimg.qcow2,id=hd >> > > > -device virtio-scsi -device scsi-hd,drive=hd -cdrom >> > > > ./ubuntu-20.04-server-cloudimg.iso >> > > > -bios /usr/share/AAVMF/AAVMF_CODE.fd -M gic-version=host -nographic >> > > > -nic user,model=virtio,hostfwd=tcp::2222-:22 >> > > > >> > > > qemu-kvm: /builddir/build/BUILD/qemu-4.2.0/target/arm/helper.c:1812: >> > > > pmevcntr_rawwrite: Assertion `counter < pmu_num_counters(env)' failed. >> > > >> > > You don't have KVM_ARM_PMU selected in your config, so QEMU cannot >> > > access the PMU registers, and no counters are exposed. >> > >> > Well, isn't it the rule that don't break the userspace? qemu works fine >> > with >> > KVM_ARM_PMU=n until this commit. >> >> No, it doesn't "work fine". It gets random data that potentially makes >> no sense, >> depending on the HW this runs on. >> >> Now, userspace tells you that your kernel is misconfigured. I see it >> as >> an improvement. > > Marc, do you suggest that CONFIG_KVM=y should select KVM_ARM_PMU=y > then? > Otherwise, this is rather difficult for users to figure out and a core > dump with > an implicit error message from qemu is not that helpful. What I'm suggesting is this [1], which is to get rid of KVM_ARM_PMU completely. At least, the kernel configuration will be consistent. Overall, I think there is an issue with KVM exposing more than it should to userspace when no PMU is defined, but I don't think that's the problem you are seeing. M. [1] https://lore.kernel.org/r/20210104172723.2014324-1-maz@kernel.org -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel