From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792759418; b=np86mtdA5H1nOrDI6Hpw3b4gdHdMni9p33qE7I7QujSAQhgPzwZcmLfNo2mUOGbXRPBA OOqz4pNDL/ZA3l72u2HE/hAiV2NdcpETotdge7uCEWCqmJ9UP2pTXr//pvINuVOPD88Va 0DDoglTHZ/7mBNZ2BcIJpI7RqQz9z7WIduywx8li7GfSnsWMLmwCezqyXEvBeLFrT7wLZ foUUzDymGYE2VoIC1tnp8tkVX0zYV8etnUZczbNEpaWq/4Q+VHYTju2s1O5BUmOc79e/2 hA6ZFEx3VRam56buT48tN8CxVMSpgC9nkwLse/34TO8zWM51igj9Ob9lRlRLlfi/p2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792759418; h=Received:DKIM-Signature:Received:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:User-Agent:MIME-Version:Content-Type: X-SA-Exim-Connect-IP:X-SA-Exim-Rcpt-To:X-SA-Exim-Mail-From: X-SA-Exim-Scanned; bh=IiTpUVrPsntr4c3s5eLquFzntS/9A4Vem272aEb4epg=; b=tEb+OIrEOQHpNn/+w3I1F4V+zwz+rc048RpHcjfxUNmXEHHnNwQUb97mKLbw3s/S0pIR BlY0xuCDPxsDCzIC4ZBXsyesFz6aAkRXpwNpjLL5LDiY1HzSJXr/lfVzSMQTOtwyKYO7A xiM1O/Z4nOw9D/Voq8XP5nLQquy6GFFlvSZFyggMK7BisEkLNeXu5YC7oU696AJfzA9Jc u53ghazST/tJk0csdMRItBO3rnMd++QBTjqd2vh3ApxPvkgrRdX5Mqt3hfSyJjhz6e+TA viuzAf0bJwf/rHwYDuso8SjZ6fex2hYJ+AY+ZIImweOCxOrqaXsb98S0ctrPXDdft3Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IIY7U003; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 956E0606A31A for ; Fri, 23 Oct 2026 12:43:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IIY7U003 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C1A41F01825; Fri, 23 Oct 2026 12:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792759418; bh=IiTpUVrPsntr4c3s5eLquFzntS/9A4Vem272aEb4epg=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=IIY7U0035cGKpwVJ+pBrPs2u6Tw6wEVwqyum5wukse9tTNz3LN4YkwZS+5Ggc7v+q rMeae4XbHcm4NT6xeu4pli4//Qcs4LisdYWIxlS/Lp0SGEf0CJczXvWV9Hz8eYn9u5 op8n1WwXJay1BWQ3h3WmUjaGjpgd8/9sR4wNtEnFrrcD9HdF5BJ32uH17mp4bXFLWT kcOCNdEY9wYWIfF5j7pwv8Ug5mG4+sq3+YFTPMCMc2PJKqriWVUNzLT+5qPYkhrq5P wYzgcVCS+Gb7jJwTmxNDLVnbyS+4tYvWlWuSJ83QiP0BxEFIEoavXeJwdwgMScZaiE G4u7yEfP4z4pQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xKEcR-00000006SWT-47JU; Fri, 23 Oct 2026 12:43:36 +0000 Date: Fri, 23 Oct 2026 13:43:35 +0100 Message-ID: <86bj8kzix4.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Vincent Donnefort , oupton@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, kernel-team@android.com Subject: Re: [PATCH v1] KVM: arm64: Use the host kvm_host_data for nr_event_counters In-Reply-To: References: <20261023092007.3918848-1-vdonnefort@google.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/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: fuad.tabba@linux.dev, vdonnefort@google.com, oupton@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 23 Oct 2026 13:29:04 +0100, Fuad Tabba wrote: > > Hi Vincent, > > On Fri, 23 Oct 2026 10:20:07 +0100, Vincent Donnefort > wrote: > [...] > > So kvm_init_host_debug_data() initialises nr_event_counters in the > > hypervisor's kvm_host_data, while kvm_arm_setup_mdcr_el2() reads the > > host copy which is 0. With a HPMN of 0, this stops programmable event > > counters from counting a non-protected guest. > > I tested this in pKVM with a non-protected guest counting with > perf_event_open(). On its own the patch doesn't change what the guest > sees: every counter, the cycle counter included, still reads 0. That's > a separate bug: flush_hyp_vcpu() never copies vcpu->arch.pmu.events to > the hyp vCPU, so the guest's events are never enabled on entry. I'll > send a fix for that shortly. Please synchronise with Vincent and sent this as a series fixing PMU handling on pKVM, not as discrete patches. The approach taken for this patch is wrong anyway, so you have plenty of opportunity to work together. Thanks, M. -- Without deviation from the norm, progress is not possible.