Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4980696iob; Mon, 9 May 2022 06:14:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnUjnetRQRUNO8sPD5AM1FmuzAU1Hfke+rIMRlvvUTALmU4Enq9R3D+Pe03OahIWN2xVCw X-Received: by 2002:a17:903:40c2:b0:15c:fd2a:7198 with SMTP id t2-20020a17090340c200b0015cfd2a7198mr16134396pld.0.1652102064579; Mon, 09 May 2022 06:14:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652102064; cv=none; d=google.com; s=arc-20160816; b=SZaFVlWWSbB3qn3PkuaoPVBb8xqb5zxu4X+vgLfR9ztxrB/x3fVjU9lH+iJdt8HggK eacn4xT96AJzhmKrSrZOd1+GQmDlqY9qUerjsUQhhnkvEi17rsG3t6AEhKeE/xTT/Vrv 81dJ6gpasKyMtVlqkMla7pky7XoHXYiH4KMQ5+E84mnlCBROFBlTypXyFuONWr6vA6fa YgCQnnFWYndjEbCoRxkoS8igP88uvHPb5dDe2YgCmrUvS1pzMn+29SQ9Hec0AwlUOYX/ eo7spTOlMwD2QZcpfdGom7gQtVSR8Mp349eFMx4//vWqjkvspiDECc9JeV0f7YWuCxCO Uh4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=n4rkQQU7/xYEHvdjU2quuucIOfcZR2es0FVvNk6/LQQ=; b=IfIY8nSeS8WnzyGJ5rsPvBoGy+a9xpVoQB5nkeGsV6HnzBfs+qD6gUv9Gf3I0SvPMx DgAkak3MkKhVx/cvE7IkgeTectsyWXxMtTEIsm0FJAWZVsVCipad7vR+uS+9QqHDtQw5 anhDdHyEZxdJieFdcW4M7m8ENsaMl3sqaelCbhe4oFo2YXSZuWRoQRN1AGSi7BG6bZL0 Un4fQnf5HFU6ceiNdUIEET2y1MLaQJV6KijnZz24rtMweE04mEapZz+w8mwAigDqEj0y 0L7UG5csJcz+LNmRh8rVUdfZtd4Bc+2cBxYIQCyHTfrFqmQgD3ka6g7C7Ryxnzj5ZSvx V9Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OOJmAkFq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id iy13-20020a17090b16cd00b001cd658e7640si18649266pjb.43.2022.05.09.06.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 06:14:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OOJmAkFq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CF0411A8DE1; Mon, 9 May 2022 06:12:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235314AbiEINQJ (ORCPT + 99 others); Mon, 9 May 2022 09:16:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235365AbiEINQF (ORCPT ); Mon, 9 May 2022 09:16:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ED961A44B0; Mon, 9 May 2022 06:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=n4rkQQU7/xYEHvdjU2quuucIOfcZR2es0FVvNk6/LQQ=; b=OOJmAkFq4dgUgmGVUNZoFJOt66 P2PDpxgCs28mGkZL5Cf44dEveHH2JSG22rWXTSRd15v4LqC38RzrkfeCYUwTpMdznyj98cZsqw3Z4 BVtRnyHV7ZCGn+d356nvbKDs6h9xR7Sj6fUqH1gE75mCkxf5jj9IJmVL1cWb1QFr4QxFsRHEIVGQz iKCEP4jwiKqXTgDTso2hzhfCMcirTZ9vAgtdKtcc0+LHTKOKbc8eIKKW4a26f6F8s3irgbmv6TlWd jfVsJGJEGSn4IjaziZIQqQ0Ns1HydfzgaDJWT3ezJFX8huTyCr6WCGyI+PJ8RsEBF1UIALnII2W+P sN9cGxhA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1no3B2-003Swo-Fl; Mon, 09 May 2022 13:11:52 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0370B3001F3; Mon, 9 May 2022 15:11:50 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E28902026963D; Mon, 9 May 2022 15:11:49 +0200 (CEST) Date: Mon, 9 May 2022 15:11:49 +0200 From: Peter Zijlstra To: Sandipan Das Cc: Like Xu , bp@alien8.de, dave.hansen@linux.intel.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, namhyung@kernel.org, jolsa@kernel.org, tglx@linutronix.de, mingo@redhat.com, pbonzini@redhat.com, jmattson@google.com, eranian@google.com, puwen@hygon.cn, ananth.narayan@amd.com, ravi.bangoria@amd.com, santosh.shukla@amd.com, "linux-kernel@vger.kernel.org" , linux-perf-users@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v4 3/7] perf/x86/amd/core: Detect PerfMonV2 support Message-ID: References: <8d3e23760726cf6647a98999e1fcd12a37f36a42.1651058600.git.sandipan.das@amd.com> <78e001bd-42bd-5481-5a19-1a0bcca9a63c@gmail.com> <96e41431-eb80-f61d-9ab9-c76cd9b6086a@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <96e41431-eb80-f61d-9ab9-c76cd9b6086a@amd.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 09, 2022 at 06:38:19PM +0530, Sandipan Das wrote: > > On 5/9/2022 6:31 PM, Like Xu wrote: > > On 27/4/2022 7:31 pm, Sandipan Das wrote: > > > >> ????? x86_pmu.num_counters??? = AMD64_NUM_COUNTERS_CORE; > > > > Thus boot_cpu_has(X86_FEATURE_PERFCTR_CORE) is true. > > > >> + > >> +??? /* Check for Performance Monitoring v2 support */ > >> +??? if (boot_cpu_has(X86_FEATURE_PERFMON_V2)) { > >> +??????? /* Update PMU version for later usage */ > >> +??????? x86_pmu.version = 2; > > > > Is it safe to assume that once AMD CPU has the PERFMON_V2 (or further) bit, > > > > it must also have the PERFCTR_CORE bit set ? > > > > Yes, always. There won't be a case where PERFCTR_CORE is absent > but PERFMON_V2 is present. Let me introduce you to this dodgy virt stuff :-) Best put a sanity check on it.