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 C4055EE4993 for ; Wed, 23 Aug 2023 09:22:23 +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=SNqr9wIfM/6j5BOA5hrWQ8R8jysELRqHQDutpuKxBSA=; b=S3/6GxVDPvEXUq M42sj2XBs1JoJgUvCLPbax/wc/bwSd81Uv4pkBe8q99vWN3LRNLauRVZRQO/yQzXT05j0HshIa+P7 M+EPbdmlUBrTh+NGXoukLvqcMt2HibhtjNN2ZcMR4M7HL8ycv6hxqfIKdMxKN2xrPrWoMG/HD0737 pR/RJEFbx/hmYdTAtyp1U3g5VYlV6bO0JMmd3gAlhdnLe2R+lk2wbrNISlkzr19cExPuipiSQMrON rF328PPe5JCTHUfijLKYDPplGLGD3nt8VCPMaD/2r+p3VyVYyvmMUt5QIdAFCaDcKW8V2r80SToXV NsEi13mIeW9nv0f+lfUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYk3q-0003F1-0u; Wed, 23 Aug 2023 09:21:58 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYk3n-0003E1-0q for linux-arm-kernel@lists.infradead.org; Wed, 23 Aug 2023 09:21:56 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6428C61EFC; Wed, 23 Aug 2023 09:21:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 975B9C433C8; Wed, 23 Aug 2023 09:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692782513; bh=GUJ9LT53od9VGXSMNu8wMPk9QIcxIcQ/QlIzbgxYftA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mpjJD6eXphpiL6+X+PzIXdKXqyGcSISVk2SQFrdtggdJFtloI33XaLB2Z9LhB4udV qsJaZj7WpsWFKZOgdj/FdV8tr9NVfJnnm7ktEHeXKuFWZ6dqKTb2Ei+tN6UVDwk5cP W0+a7Q9N7jRqInauXNINbCxcKK4yhy3+THssJexCea5ll/0TwX8RYpbiCUQ5lXKZfg BWOqx0AVSB+/oDaO4+aY0nwejeYk1YnB5a3vf7FFHOlHEJRQRDCDRk8La/aHNr1D48 vAOjo1k5l7xt4eXcpfrXSAMbpDMvTYOjSKlkQxcdf2MepQZrtIMcgvwPaVORcSD30C qfSsvNL3l+PVg== 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.95) (envelope-from ) id 1qYk3d-007Hp8-UZ; Wed, 23 Aug 2023 10:21:46 +0100 Date: Wed, 23 Aug 2023 10:21:45 +0100 Message-ID: <86h6oqf712.wl-maz@kernel.org> From: Marc Zyngier To: Alexander Stein Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Huang Shijie , Leo Yan , Mark Rutland , Will Deacon Subject: Re: [PATCH v2] KVM: arm64: pmu: Resync EL0 state on counter rotation In-Reply-To: <14141350.uLZWGnKmhe@steina-w> References: <20230820090108.177817-1-maz@kernel.org> <14141350.uLZWGnKmhe@steina-w> 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/28.2 (aarch64-unknown-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: alexander.stein@ew.tq-group.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, shijie@os.amperecomputing.com, leo.yan@linaro.org, mark.rutland@arm.com, will@kernel.org 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-20230823_022155_410024_10955B3D X-CRM114-Status: GOOD ( 26.96 ) 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 On Wed, 23 Aug 2023 08:15:38 +0100, Alexander Stein wrote: > > Hi, > > > diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c > > index 08b3a1bf0ef6..6a3d8176f54a 100644 > > --- a/drivers/perf/arm_pmuv3.c > > +++ b/drivers/perf/arm_pmuv3.c > > @@ -772,6 +772,8 @@ static void armv8pmu_start(struct arm_pmu *cpu_pmu) > > > > /* Enable all counters */ > > armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_E); > > + > > + kvm_vcpu_pmu_resync_el0(); > > This breaks if CONFIG_HW_PERF_EVENTS is enabled but CONFIG_KVM is not. As in > this case arch/arm64/kvm/pmu.c is never compiled, but the dummy inline in > include/kvm/arm_pmu.h for kvm_vcpu_pmu_resync_el0() only depends on > CONFIG_HW_PERF_EVENTS. > This results in this error: > > aarch64-v8a-linux-gnu-ld: Unexpected GOT/PLT entries detected! > aarch64-v8a-linux-gnu-ld: Unexpected run-time procedure linkages detected! > aarch64-v8a-linux-gnu-ld: drivers/perf/arm_pmuv3.o: in function > `armv8pmu_start': > drivers/perf/arm_pmuv3.c:753: undefined reference to `kvm_vcpu_pmu_resync_el0' Huh, that's unexpected. Let's fix it with an adequately sized hammer. Does the patch below work for you? Thanks, M. >From 2446f15d355ab7e766291eccf5b670a2060b4c3a Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Wed, 23 Aug 2023 10:14:48 +0100 Subject: [PATCH] KVM: arm64: pmu: Guard PMU emulation definitions with CONFIG_KVM Most of the internal definitions for PMU emulation are guarded with CONFIG_HW_PERF_EVENTS. However, this isn't enough, and leads to these definitions leaking if CONFIG_KVM isn't enabled. This leads to some compilation breakage in this exact configuration. Fix it by falling back to the dummy stubs if either perf or KVM isn't selected. Reported-by: Alexander Stein Signed-off-by: Marc Zyngier --- include/kvm/arm_pmu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kvm/arm_pmu.h b/include/kvm/arm_pmu.h index 3a8a70a60794..31029f4f7be8 100644 --- a/include/kvm/arm_pmu.h +++ b/include/kvm/arm_pmu.h @@ -12,7 +12,7 @@ #define ARMV8_PMU_CYCLE_IDX (ARMV8_PMU_MAX_COUNTERS - 1) -#ifdef CONFIG_HW_PERF_EVENTS +#if IS_ENABLED(CONFIG_HW_PERF_EVENTS) && IS_ENABLED(CONFIG_KVM) struct kvm_pmc { u8 idx; /* index into the pmu->pmc array */ -- 2.34.1 -- 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