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_PATCH, 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 09441C433E0 for ; Thu, 28 Jan 2021 16:56:10 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 214DC64E07 for ; Thu, 28 Jan 2021 16:56:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 214DC64E07 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 3AC074B1B2; Thu, 28 Jan 2021 11:56:08 -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 Qh2-VINyYLuw; Thu, 28 Jan 2021 11:56:07 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2BCBB4B184; Thu, 28 Jan 2021 11:56:07 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id DF0104B17E for ; Thu, 28 Jan 2021 11:56:05 -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 WPvail-+Iev5 for ; Thu, 28 Jan 2021 11:56:05 -0500 (EST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id EED5F4B0DE for ; Thu, 28 Jan 2021 11:56:04 -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 9501D64E07; Thu, 28 Jan 2021 16:56:03 +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 1l5AaP-00AedB-9V; Thu, 28 Jan 2021 16:56:01 +0000 MIME-Version: 1.0 Date: Thu, 28 Jan 2021 16:56:01 +0000 From: Marc Zyngier To: Andre Przywara Subject: Re: [PATCH 1/2] KVM: arm64: Turn kvm_arm_support_pmu_v3() into a static key In-Reply-To: <20210128151643.6e2c3668@slackpad.fritz.box> References: <20210126151521.2958688-1-maz@kernel.org> <20210126151521.2958688-2-maz@kernel.org> <20210128151643.6e2c3668@slackpad.fritz.box> User-Agent: Roundcube Webmail/1.4.10 Message-ID: <9bf9be4149cfd0671fe5178ce553159b@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: andre.przywara@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, 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 Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu 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-28 15:16, Andre Przywara wrote: > On Tue, 26 Jan 2021 15:15:20 +0000 > Marc Zyngier wrote: > > Hi Marc, > >> We currently find out about the presence of a HW PMU (or the handling >> of that PMU by perf, which amounts to the same thing) in a fairly >> roundabout way, by checking the number of counters available to perf. >> That's good enough for now, but we will soon need to find about about >> that on paths where perf is out of reach (in the world switch). >> >> Instead, let's turn kvm_arm_support_pmu_v3() into a static key. > > I am sure the pesky build bot has told you about it already, but this > fails when ARM_PMU is not defined, as perf_num_counters() is not > defined. It's bit nasty, since it's a generic function, so we > can't easily stub it in its original header. No sign from the bot yet, but that's indeed a problem. Well spotted. > Shall we find a place somewhere in arch/arm64 and provide a stub > implementation there, #ifndef CONFIG_ARM_PMU? Sounds ugly, though. > > Or something else entirely? How about: diff --git a/arch/arm64/kvm/perf.c b/arch/arm64/kvm/perf.c index 198fa4266b2d..739164324afe 100644 --- a/arch/arm64/kvm/perf.c +++ b/arch/arm64/kvm/perf.c @@ -55,7 +55,7 @@ int kvm_perf_init(void) * hardware performance counters. This could ensure the presence of * a physical PMU and CONFIG_PERF_EVENT is selected. */ - if (perf_num_counters() > 0) + if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0) static_branch_enable(&kvm_arm_pmu_available); return perf_register_guest_info_callbacks(&kvm_guest_cbs); It certainly compiles here. M. -- 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.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,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 2CAD9C433E0 for ; Thu, 28 Jan 2021 16:57:33 +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 BD28564E12 for ; Thu, 28 Jan 2021 16:57:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD28564E12 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=ybBSuFYqQ4TeY+o4CzGOsL1TtQTaJvCJzQnlqIKBzyE=; b=nh6+T3wF5gkuVpwC+huPrEMwG Y79k6lwXaOJewhNmC1ia986q3ztgQjkD1W/D3qRGgbgj0pkVAFQip2ufAcNwfyo3orLXTJqEOv2bY +V072hnLTTyLcXXaVV6cSwqKMc4ua6mrL9O8UlmuUyeSeIBS0qFWkXXKGM8EH/bDxq8bP/4ywpW1D cqzFWDF7UDKnoPD2I3rU2NKJndcfTtXaEhqtZ1MJ1BxkP2g2alqRQG6Mufrk/sKyVQ7qPRvcnUtPK SfSekAD/Mpuc7g3uJI83wzUepPgFkX4tsLi0f/0acLIZFmuC4gjZTJlIsXGNDkLZ03PkM2gxgazfK dF5JXzaeg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5AaX-0007Cn-3S; Thu, 28 Jan 2021 16:56:09 +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 1l5AaU-0007C8-B9 for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2021 16:56:07 +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 9501D64E07; Thu, 28 Jan 2021 16:56:03 +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 1l5AaP-00AedB-9V; Thu, 28 Jan 2021 16:56:01 +0000 MIME-Version: 1.0 Date: Thu, 28 Jan 2021 16:56:01 +0000 From: Marc Zyngier To: Andre Przywara Subject: Re: [PATCH 1/2] KVM: arm64: Turn kvm_arm_support_pmu_v3() into a static key In-Reply-To: <20210128151643.6e2c3668@slackpad.fritz.box> References: <20210126151521.2958688-1-maz@kernel.org> <20210126151521.2958688-2-maz@kernel.org> <20210128151643.6e2c3668@slackpad.fritz.box> User-Agent: Roundcube Webmail/1.4.10 Message-ID: <9bf9be4149cfd0671fe5178ce553159b@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: andre.przywara@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210128_115606_462844_A016091E X-CRM114-Status: GOOD ( 15.91 ) 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: Suzuki K Poulose , James Morse , linux-arm-kernel@lists.infradead.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, Julien Thierry 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-28 15:16, Andre Przywara wrote: > On Tue, 26 Jan 2021 15:15:20 +0000 > Marc Zyngier wrote: > > Hi Marc, > >> We currently find out about the presence of a HW PMU (or the handling >> of that PMU by perf, which amounts to the same thing) in a fairly >> roundabout way, by checking the number of counters available to perf. >> That's good enough for now, but we will soon need to find about about >> that on paths where perf is out of reach (in the world switch). >> >> Instead, let's turn kvm_arm_support_pmu_v3() into a static key. > > I am sure the pesky build bot has told you about it already, but this > fails when ARM_PMU is not defined, as perf_num_counters() is not > defined. It's bit nasty, since it's a generic function, so we > can't easily stub it in its original header. No sign from the bot yet, but that's indeed a problem. Well spotted. > Shall we find a place somewhere in arch/arm64 and provide a stub > implementation there, #ifndef CONFIG_ARM_PMU? Sounds ugly, though. > > Or something else entirely? How about: diff --git a/arch/arm64/kvm/perf.c b/arch/arm64/kvm/perf.c index 198fa4266b2d..739164324afe 100644 --- a/arch/arm64/kvm/perf.c +++ b/arch/arm64/kvm/perf.c @@ -55,7 +55,7 @@ int kvm_perf_init(void) * hardware performance counters. This could ensure the presence of * a physical PMU and CONFIG_PERF_EVENT is selected. */ - if (perf_num_counters() > 0) + if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0) static_branch_enable(&kvm_arm_pmu_available); return perf_register_guest_info_callbacks(&kvm_guest_cbs); It certainly compiles here. M. -- 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