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 94ED7EE49B0 for ; Wed, 23 Aug 2023 11:16:26 +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: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RQzFbOpDLx2lGV5tEIQU0m6pVB5XgRwOk9AL9jexwxk=; b=JBAiIAaU8NWg2s NDOcFdysZcGfkPy7Lkfwv4qszLgxHbhsqCU9bCmv8Of3M1tXY/8t7UXf0cCC79olFzE2UeGIfIItS EcJP6fhQpRj4cgzbioaT5+JSJPPoxb3ho0P/asX71Ws7tjHWMN9zN/ppkpnrisLih/IbGE5fabAe8 OowfWFkCnFmA2PXgLaY58HazVsJITJw7zwb3LJVXc1UqeV4dmQADbxFW45qrYeQtnxBPZQ3bpuy3k wZozjpzi68T36c4SPG62VzhsesBvK1suO3iKigHtwQIga48vj6aqJgoh6K3WFkpouWsxUnVfJX6s2 7Q0G/9tQgc9Wx7yGrUAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYlq7-000Pd5-23; Wed, 23 Aug 2023 11:15:55 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYlq3-000Pbr-1T for linux-arm-kernel@lists.infradead.org; Wed, 23 Aug 2023 11:15:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1692789351; x=1724325351; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J1ClHpixZj7fuU2joNIT//doEwehogJ3lrBUfMEBCzk=; b=EApKtiB0fraKnZ+wtFHvxG71ZLokFQisi4zMmaQ9alZup8XBF/2Rmz22 CeEPo9E9auXYAYT9FuJ9Zta6647X9KOg2p13uHlI86DRQSun6RG0ioxfs TQZb9llcml3plRMOTheGUwXbEiMgYlXFv3RnWVt+03OVzZD5f0P24xrTZ 34W3j5CQEtjckXxs8JMgYvKdgZTgb1gDKT4Y1wGNLDNEiT7hfqRl4+9Ku i/juPmbB3X6DdG5CG0iNzmLzxar2RlQmVSEBrvYBp7KAjun3YJN4a+voP l1qZnaglAiwbnFXo9iuXiz6AaiKT/3vhQWFhS5d0eNeOlIt/HpVORoYme w==; X-IronPort-AV: E=Sophos;i="6.01,195,1684792800"; d="scan'208";a="32585053" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 23 Aug 2023 13:15:48 +0200 Received: from steina-w.localnet (steina-w.tq-net.de [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 3ABDB280075; Wed, 23 Aug 2023 13:15:48 +0200 (CEST) From: Alexander Stein To: Marc Zyngier 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 Date: Wed, 23 Aug 2023 13:15:47 +0200 Message-ID: <4055305.aeNJFYEL58@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <86h6oqf712.wl-maz@kernel.org> References: <20230820090108.177817-1-maz@kernel.org> <14141350.uLZWGnKmhe@steina-w> <86h6oqf712.wl-maz@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230823_041551_874005_28391B1B X-CRM114-Status: GOOD ( 27.77 ) 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Marc, Am Mittwoch, 23. August 2023, 11:21:45 CEST schrieb Marc Zyngier: > 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_pm= u) > > > = > > > /* 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 inli= ne > > 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 detect= ed! > > 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? Yes, the patch below does work for me. Thanks. Tested-by: Alexander Stein Best regards, Alexander > 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 */ -- = TQ-Systems GmbH | M=FChlstra=DFe 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht M=FCnchen, HRB 105018 Gesch=E4ftsf=FChrer: Detlef Schneider, R=FCdiger Stahl, Stefan Schneider http://www.tq-group.com/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel