Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp352821pxy; Thu, 22 Apr 2021 03:45:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGZGa1FmBLvIHcCNSKXaBdvLMYqEk9N0Mm1M9CXXb8jigo6iLZu1HGy9nkRe/hTxO/ro+M X-Received: by 2002:a17:902:6b8c:b029:ea:f54f:c330 with SMTP id p12-20020a1709026b8cb02900eaf54fc330mr2822963plk.10.1619088339477; Thu, 22 Apr 2021 03:45:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619088339; cv=none; d=google.com; s=arc-20160816; b=xtlUb6lmLLFKuZG77VS3JwrEoCltryec6XQO9ddL8nulksdwgBAmemyZgwt/Rmwj9e hu82Ybti5x3oy7KVBOgj85trkCNbGEHS+quNBZYI91O/pWourmF/vEykwCpPczuj2/52 Zy81iifMa+3KuN6edq/31c1siVxUGbkzOT6ubYOymVAa1HO0R8ObaYAp+ASZtSxWxGnh 5UXUKHJ+3PRb+hGFRumsqPW+NswcG5i8zGJ8Abt8vxHDCjRZxVg4I4P7P27OvWK+tw5E LD9HOYjLmhwPgHNiQ/rRgEZV0ZFf7AIlYzoEFdggtT26xPfT922Dt+FgKHLmk32x2KID tJ/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=kAVYTuVBfzifmwST9YWNnSTg29AJQCyrMTscTui+AXs=; b=KzL/vrXKoGRo7sPTJb61Q0kFaaZq2OMeeg8cH5oXWr0pO4w9PS1XEYNTq9PxvcUrDB mzEBHDxEKqA6v5moSrDICZ5PAopgkp0+qTT/1nPHbItRGg5VyKgJDxFXwjpa2F+x88iM T8Xtj9ASLlHevyRYdg/TKaFUzh8Cxjwf8UIZLVOR2uG9LqoZdK34tux8tPLjuq+k7Wcf BK8rS5boBYDNLcd4hpu5M8DYfKqEZpkhbWVbgFgfseCLgSlAwGNaz3VAWQSh4Nkz1W7c zvAAxGJgXQ34pJmmQDZabhdeHhQ5JuJ/BHDgBYqnvmAlOo5T86u2+wnvFhFp3QufsEVQ wolg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pv3lOJjO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t5si2575691pgk.379.2021.04.22.03.45.26; Thu, 22 Apr 2021 03:45:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pv3lOJjO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235941AbhDVKoS (ORCPT + 99 others); Thu, 22 Apr 2021 06:44:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:53798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230270AbhDVKoJ (ORCPT ); Thu, 22 Apr 2021 06:44:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EC3FB613C3; Thu, 22 Apr 2021 10:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619088214; bh=R8WtOHNj+/vk47cusAz7Di0unsa6rOD5nce0ZJvBbNA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Pv3lOJjOC3h2kDfka9ri27gZcUMB8VEyrTNgwHgulcfk5rxqf4vWQAs+9f4/gOkt4 q1K3IywZtSZmfuAuIV1QlMAUjPELcnGmE+E6Q026430OI045oc9fdo7XHAtntCWx98 HrWrGalnCPFn5nmiuwtowUrC/HJgymZi/N/SPpHeF+WemaKXveP8zNQFVsLG2r+1U5 HbcS8855VzvPFetj1B3nDnzltb2SYqfePUXA1jdPD22flPn/kWQngnV9RR9Z/YwqoY 26f/HjDjK0J7nMqMw15ZClfInqScIhZ30PQLcQAPeEphwJqk8EnwbzQZC3oFbWjVKj m58DmUXn1KEpQ== Date: Thu, 22 Apr 2021 11:43:27 +0100 From: Will Deacon To: Marc Zyngier Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, Mark Rutland , Rich Felker , Yoshinori Sato , Peter Zijlstra , Arnaldo Carvalho de Melo , Christian Borntraeger , Heiko Carstens , nathan@kernel.org, Viresh Kumar , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH 1/5] KVM: arm64: Divorce the perf code from oprofile helpers Message-ID: <20210422104327.GC1442@willie-the-truck> References: <20210414134409.1266357-1-maz@kernel.org> <20210414134409.1266357-2-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210414134409.1266357-2-maz@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 14, 2021 at 02:44:05PM +0100, Marc Zyngier wrote: > KVM/arm64 is the sole user of perf_num_counters(), and really > could do without it. Stop using the obsolete API by relying on > the existing probing code. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/perf.c | 7 +------ > arch/arm64/kvm/pmu-emul.c | 2 +- > include/kvm/arm_pmu.h | 4 ++++ > 3 files changed, 6 insertions(+), 7 deletions(-) > > diff --git a/arch/arm64/kvm/perf.c b/arch/arm64/kvm/perf.c > index 739164324afe..b8b398670ef2 100644 > --- a/arch/arm64/kvm/perf.c > +++ b/arch/arm64/kvm/perf.c > @@ -50,12 +50,7 @@ static struct perf_guest_info_callbacks kvm_guest_cbs = { > > int kvm_perf_init(void) > { > - /* > - * Check if HW_PERF_EVENTS are supported by checking the number of > - * hardware performance counters. This could ensure the presence of > - * a physical PMU and CONFIG_PERF_EVENT is selected. > - */ > - if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0) > + if (kvm_pmu_probe_pmuver() != 0xf) Took me a while to figure out that this returns 0xf if the hardware has a PMUVer of 0x0, so it's all good: Acked-by: Will Deacon Will