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=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 92227C4360C for ; Tue, 8 Oct 2019 19:22:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6078C2070B for ; Tue, 8 Oct 2019 19:22:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="T+/ldlU+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6078C2070B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xykf3kZIU3PXt1reouPh4zStbWqWn4bx5hMLRPmtEnI=; b=T+/ldlU+Ut1TBN DCPxjhku61j7FYPmUBVWvEAMYhenaqJ+MALFc0YYvoQwwu8RoHk+B0SGhVHyhMXmXmwLekb4d/OtJ XYmf7nC30wllqivSkX195nT4AQL5e6hSQ+cASCbh9G8eJgCk6YDZ52/KuhgCIramy/5cnazVAXOmj AAVO7hl/fmAiG4uAKxip772OKO0m4c3Po+fkd0SaVFzaIozeY5rDBVUX22ZotRfnFOfUS7Wg2PSWs ra/MyAMVPyigx+nEasNDPnACZRiBzqIrDm1NJ8UTClcvK0bAyvlR6suSClf17dPUcmnZsUrHv5tpR Vx9H4hfLjtw16C6cQQjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iHv4F-0007qO-9B; Tue, 08 Oct 2019 19:22:43 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iHv4C-0007pT-2R for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2019 19:22:41 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A380F15BE; Tue, 8 Oct 2019 12:22:36 -0700 (PDT) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 272D53F6C4; Tue, 8 Oct 2019 12:22:36 -0700 (PDT) Date: Tue, 8 Oct 2019 20:22:34 +0100 From: Andrew Murray To: Marc Zyngier Subject: Re: [PATCH v2 3/5] KVM: arm64: pmu: Set the CHAINED attribute before creating the in-kernel event Message-ID: <20191008192233.GI42880@e119886-lin.cambridge.arm.com> References: <20191008160128.8872-1-maz@kernel.org> <20191008160128.8872-4-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191008160128.8872-4-maz@kernel.org> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191008_122240_162233_420FCFBC X-CRM114-Status: GOOD ( 19.28 ) 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: Mark Rutland , kvm@vger.kernel.org, Suzuki K Poulose , James Morse , Julien Thierry , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 08, 2019 at 05:01:26PM +0100, Marc Zyngier wrote: > The current convention for KVM to request a chained event from the > host PMU is to set bit[0] in attr.config1 (PERF_ATTR_CFG1_KVM_PMU_CHAINED). > > But as it turns out, this bit gets set *after* we create the kernel > event that backs our virtual counter, meaning that we never get > a 64bit counter. > > Moving the setting to an earlier point solves the problem. > > Fixes: 80f393a23be6 ("KVM: arm/arm64: Support chained PMU counters") > Signed-off-by: Marc Zyngier Reviewed-by: Andrew Murray > --- > virt/kvm/arm/pmu.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/virt/kvm/arm/pmu.c b/virt/kvm/arm/pmu.c > index c30c3a74fc7f..f291d4ac3519 100644 > --- a/virt/kvm/arm/pmu.c > +++ b/virt/kvm/arm/pmu.c > @@ -569,12 +569,12 @@ static void kvm_pmu_create_perf_event(struct kvm_vcpu *vcpu, u64 select_idx) > * high counter. > */ > attr.sample_period = (-counter) & GENMASK(63, 0); > + if (kvm_pmu_counter_is_enabled(vcpu, pmc->idx + 1)) > + attr.config1 |= PERF_ATTR_CFG1_KVM_PMU_CHAINED; > + > event = perf_event_create_kernel_counter(&attr, -1, current, > kvm_pmu_perf_overflow, > pmc + 1); > - > - if (kvm_pmu_counter_is_enabled(vcpu, pmc->idx + 1)) > - attr.config1 |= PERF_ATTR_CFG1_KVM_PMU_CHAINED; > } else { > /* The initial sample period (overflow count) of an event. */ > if (kvm_pmu_idx_is_64bit(vcpu, pmc->idx)) > -- > 2.20.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel