Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp114892rdb; Tue, 31 Oct 2023 02:22:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGL6XAExxz0osyXhIf+SmQM3tVLY0KzWdkdzgz5EoLRZm4KU7a0jqCRzGEvsyorZg8z2Ub X-Received: by 2002:a05:6a00:14d2:b0:6bd:254a:8876 with SMTP id w18-20020a056a0014d200b006bd254a8876mr11402423pfu.23.1698744132424; Tue, 31 Oct 2023 02:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698744132; cv=none; d=google.com; s=arc-20160816; b=qn7e3rec7PkO4ScdWh/prqu+nGrfGlFc6YVwpCCEliWW+AhumHiHHWnYcQFfh636zv SU7pUhnToOMZK3EHo5+leIOssfgiWE0uQacdQrfV+rsm5+QXhaLVG50Rn/TQQXvs+R1B i0PjJAUd6f89DJgY804FPCh4FT6Yn7+1JhHoYXZ0oMh5Re/naqc8JREHPuDzj04Y0Tdn bqxt5kpQtewA7D+meIvQaRxcRpSnRKwAevQW0joWS8bOa2jYQXoXnX+NdAi7mX75c1HK SUSYCfTvODQ3lp/vWRxxwfuuUOR4fXLTgxOyIGmuEoDSqu5VvxKz9a/Iiu03GPRSDcfE KtJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yTeWBDitRUsmDXRS0MWrrJbkHkw69BXtGLkjovhS8/0=; fh=E3ilibYCxplRFz20OpOkjMj1lMKBPGRzcx1abGX98y8=; b=XZVLac5lhFTX59WbzWfpgD1D4WVqMYvW1+eOyXesLxwa22qf2TLfRYG+H8ePHR+UKi 2XBJVcGnQzbwYwLXKW3+lT5FtUJI87ChzbqWOfJxIQ8yC1tf4sTFYCsgJPm7Ri64Qpj9 gsoEMJZ0B+H1pj2c3kjrp7eKNGRnzofxhGyQCZvPPsKIgdf8UwNp5yGvS+ox7FC1Nsu0 BDQSjFxWhW48irLiQQP+aPWBXix08hK8TV4Fh7EuosLN01Y+dw0vgA8+K8NAfXnTMk4l Ch7ueCIEuBgVCtnVboxG/9UaZWhGpcuYp6QfHYk8kWiA/YSl7Y4eDRvpEWOcCWGDi+iL tVpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Uqjq+UmR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id s184-20020a6377c1000000b00573f94e8b83si757731pgc.265.2023.10.31.02.22.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 02:22:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Uqjq+UmR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 7CAEF80BB1EA; Tue, 31 Oct 2023 02:22:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343841AbjJaJVv (ORCPT + 99 others); Tue, 31 Oct 2023 05:21:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343834AbjJaJVu (ORCPT ); Tue, 31 Oct 2023 05:21:50 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D752B3; Tue, 31 Oct 2023 02:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698744108; x=1730280108; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=yjOXbjPiGipjy8R9wCtdAqsCejHtbndkyznTFcK3Fpc=; b=Uqjq+UmR2IvTvPCDG7eO9mT2BFhfE3yq80xVVJT+JMrtLjkAlxRuDQd0 +raHSMUmHLSUqh18OZPG7Y1K9QU4HF5vraK85DcR0/RdEnFyore2vm8rK /PTyZyxhs6kXCopsk4rNVKO+Q49YOuHWJKXvSdwvkAYhMvufZQCkzTtOq A7oaePsptLh547N3LUTOwYpp++UnBQGM+xR8CLXR88QfYz3CEhnUTW2Zg SuuoXfMWUdqX3yUiFy5NcrzXO4O9142/ZNQJ9YAmZ8XVjZ0MPgfV7AXkM Z5DGH4G4qNT0xi8J3BO5QBixVOCpFkzlb0CfIxfDXKrbe7ma2iZl4NYck Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10879"; a="385435948" X-IronPort-AV: E=Sophos;i="6.03,265,1694761200"; d="scan'208";a="385435948" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2023 02:21:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10879"; a="877445514" X-IronPort-AV: E=Sophos;i="6.03,265,1694761200"; d="scan'208";a="877445514" Received: from dmi-pnp-i7.sh.intel.com ([10.239.159.155]) by fmsmga002.fm.intel.com with ESMTP; 31 Oct 2023 02:21:44 -0700 From: Dapeng Mi To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhenyu Wang , Zhang Xiong , Jim Mattson , Mingwei Zhang , Like Xu , Dapeng Mi , Dapeng Mi Subject: [kvm-unit-tests Patch v2 0/5] Fix PMU test failures on Sapphire Rapids Date: Tue, 31 Oct 2023 17:29:16 +0800 Message-Id: <20231031092921.2885109-1-dapeng1.mi@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Tue, 31 Oct 2023 02:22:09 -0700 (PDT) When running pmu test on Intel Sapphire Rapids, we found several failures are encountered, such as "llc misses" failure, "all counters" failure and "fixed counter 3" failure. Intel Sapphire Rapids introduces new fixed counter 3, total PMU counters including GP and fixed counters increase to 12 and also optimizes cache subsystem. All these changes make the original assumptions in pmu test be unavailable any more on Sapphire Rapids. Patches 2-4 fixes these failures, especially patch 2 improves current loop() function and ensure the LLC/branch misses are always be triggered and don't depend on the possibility like before, patch 1 removes the duplicate code and patch 5 adds asserts to ensure pre-defined fixed events are matched with HW fixed counters. Plese note 1) this patchset depends on the Kernel patches "Enable topdown slots event in vPMU" 2) this patchset is only tested on Intel Sapphire rapids platform, the tests on other platforms are welcomed. Dapeng Mi (4): x86: pmu: Improve loop() to force to generate llc/branch misses x86: pmu: Enlarge cnt array length to 64 in check_counters_many() x86: pmu: Support validation for Intel PMU fixed counter 3 x86: pmu: Add asserts to warn inconsistent fixed events and counters Xiong Zhang (1): x86: pmu: Remove duplicate code in pmu_init() lib/x86/pmu.c | 5 ----- x86/pmu.c | 54 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 26 deletions(-) base-commit: bfe5d7d0e14c8199d134df84d6ae8487a9772c48 -- 2.34.1