Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp631194rdb; Tue, 31 Oct 2023 19:00:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfha//XfCVhLwDv8eE0siPW+wui+MjOnrfRXY4DUVlOGHMpKUeFKiZ/SwteG5+EZTXPI6Z X-Received: by 2002:a17:907:3685:b0:9c7:4e5d:12c5 with SMTP id bi5-20020a170907368500b009c74e5d12c5mr817388ejc.61.1698804002223; Tue, 31 Oct 2023 19:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698804002; cv=none; d=google.com; s=arc-20160816; b=uh+PoQoc1OqTWrEpU8pz9Z/5Vc5Ik2hOimu5jg1a3VkkVjCr+ymqPu3DTCXa6w1aLu Q3rl8hSYzOC64iZwsk/zGDOdTT59IwJnfPrDlgAdtyc/NdnRPZmwO8Omk4p6Een5tJ7p TNt9SZCOPmoFX7rEvESzI52PsEgffygAkemgWyiDVjcGDzy8NY8+VSaylBMUxcnnDTNq 8AQUUCTQNvqkaXFSBGBGTn35zIXuLLXxO3JA2lXPOpXZ9URx+/fmzj9+VEwfHOtUQlkV qxbaC4bfWU5DBvq6BjELL8OjL+ou4PzQtqkEb5CFqaddJS7b6G/NpLOg4+ND1gui6+bB rP/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=5XPhmIOAPPhkglwGw8ad168l2Xxj4WXpYC/mjWqYyTo=; fh=FCtVf3R87dDXaI9hP/V1C+ofqeLqcShoX1oAe2SCV5g=; b=DuTxBD1yYaOm49pC8Bqmt0Kulgg9no2Iqmju56XzJw/bVs8O+XpQEb6JLqnGYo8Hfe G52tYdS9FEv8OqxbeJntPUdNfE508HIOk+PjW2PU6Ly+d129J+TtwbQ++iiWkdtKWo+v yP2zrVtGZWKvG4KvKhLDPoYmgs1HV2Pr0iNbGIXeWvZprgzC34wvWpXn7mY9t5vDVx3N jEAzwE0lIGsUvIVPTiRxXXUeBUN4aPuFoF9t/9AJlwyJIO5oKBJ2Ypl7dn/kupvnxfoj 8v5kjxKwkThKLLdO3OpcIw7KtOBUyHtoLAJHC/PjGR1ZRf0ON98R2wT3ciZkdEBWGeWB g+lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KcU3Gxm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id hz3-20020a1709072ce300b009d5b84b0b76si1054983ejc.861.2023.10.31.19.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 19:00:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KcU3Gxm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id CBBC78026450; Tue, 31 Oct 2023 18:59:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377329AbjKAB7g (ORCPT + 99 others); Tue, 31 Oct 2023 21:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345095AbjKAB7f (ORCPT ); Tue, 31 Oct 2023 21:59:35 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 889F5ED; Tue, 31 Oct 2023 18:59:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698803970; x=1730339970; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=hy+BaQYzelq4bNrPLUQer7B8U5ZvM3TM81vJ3Dtbimc=; b=KcU3Gxm6ncLm7JMJayPc4JBgTZlJ+CC/DJdY0Xzt6T9QfAK4S1QoL1MY jSCB5NqYNgCu1vdZ6O0AHsRDNG0eibZw3B3j4fNvAuIOoAC6MJ93ArVKG bwNexLcmLRXVFAThLl30DBCDWf+w+Wp/RlDPeIRaODh6FEl06nrXB0EEz CwNKN8bqPDMES75Z2b2YrQeuOkR4shhPQp3TcIqFA1s0gO0y+YKJKPqbN FoBUlRygGmrEE1EjN6pCk6uC8OxgMUoJwUrwSC8/rJeQqx5rTSvgKTzP0 boqgoYqGxyKeckL2uCj6slln5G5m6FG18yMNvnB+l+Anmbdr95a6OUeoW A==; X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="367758528" X-IronPort-AV: E=Sophos;i="6.03,266,1694761200"; d="scan'208";a="367758528" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2023 18:59:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,266,1694761200"; d="scan'208";a="8508070" Received: from dapengmi-mobl1.ccr.corp.intel.com (HELO [10.93.12.33]) ([10.93.12.33]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2023 18:59:27 -0700 Message-ID: Date: Wed, 1 Nov 2023 09:59:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Patch 1/2] KVM: x86/pmu: Add Intel CPUID-hinted TopDown slots event Content-Language: en-US To: Jim Mattson Cc: Sean Christopherson , Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhenyu Wang , Zhang Xiong , Mingwei Zhang , Like Xu , Dapeng Mi , Like Xu References: <20231031090613.2872700-1-dapeng1.mi@linux.intel.com> <20231031090613.2872700-2-dapeng1.mi@linux.intel.com> From: "Mi, Dapeng" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 31 Oct 2023 18:59:54 -0700 (PDT) On 11/1/2023 2:22 AM, Jim Mattson wrote: > On Tue, Oct 31, 2023 at 1:58 AM Dapeng Mi wrote: >> This patch adds support for the architectural topdown slots event which >> is hinted by CPUID.0AH.EBX. > Can't a guest already program an event selector to count event select > 0xa4, unit mask 1, unless the event is prohibited by > KVM_SET_PMU_EVENT_FILTER? Actually defining this new slots arch event is to do the sanity check for supported arch-events which is enumerated by CPUID.0AH.EBX. Currently vPMU would check if the arch event from guest is supported by KVM. If not, it would be rejected just like intel_hw_event_available() shows. If we don't add the slots event in the intel_arch_events[] array, guest may program the slots event and pass the sanity check of KVM on a platform which actually doesn't support slots event and program the event on a real GP counter and got an invalid count. This is not correct. > > AFAICT, this change just enables event filtering based on > CPUID.0AH:EBX[bit 7] (though it's not clear to me why two independent > mechanisms are necessary for event filtering). IMO, these are two different things. this change is just to enable the supported arch events check for slot events, the event filtering is another thing.