Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1891099pxm; Fri, 4 Mar 2022 05:37:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRM5Lp/IcGMMx7b2Mh0lfazTqfyxCUp49VYG/bCaCOFzvBDaWuLOpCd/LzHNoBQJI9AyZT X-Received: by 2002:a63:4814:0:b0:36d:87fb:f1ed with SMTP id v20-20020a634814000000b0036d87fbf1edmr34436067pga.594.1646401023911; Fri, 04 Mar 2022 05:37:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646401023; cv=none; d=google.com; s=arc-20160816; b=Fw7l1eEC7mbif0cgATd//+zcr8GzTcekdIfd87jDSDUnG34ALT2KmNr7GCrqZTRFZA OGZYjTzDnf4sYln5AVgTittIecUc/Qm9kGYlE6ExGLYdPuEG10vAp248oSmYfhAAR6bB Gvk+H4L6eCCb8tF2MJxd1nJpCW0Me8jo7L2A8MEvw4nYZuJs85czGhdP4gAA8Owx0s/H qASHRIe7u5Sqmn65B++hu6w71IuistshgZHE3fkV7HpDconBH/QLPsUBLbkTTWAYB0TA XeZ0pHW6qihmPhzxxfJv6eCpK0EpRlPfFLrdkL70iWdv1UVpujJLSB4NBgiHc6wJVPg0 wQOw== 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:ironport-sdr; bh=y+wT34GxoGuasW/oiUpdhIlGpwKOyI8pcO0denSfaPk=; b=TKPX0Ws2DwgNxCI2KVxpAm2rVe0yHAV3N/9ShLT5Jy1lj6XOZhHG+d7C1PScQ4IyXa USh/TtQfs9e+pgRy68L+WhF96vubL0koPnUiCS3zhm75DgjqbcAyQ9WkIRSOADd3Tt8s BU/upvQorOM3eHdAYzONqPireh1FnUpHlqkgfJjOOaPY34PYYM6xEfG3pt124KSWtF/g nL8X/2N+wC5jjKR/fx1oqxr8qB0bWhNmrDdsL6D+QzH6TNwjuf+6s5OrhsUYda3dlcbn D+BPzxKXP/c0GRwtAiRlbyZLJg7PYFa4p0UuJiVvh3NeMX/zk2RyBzhjoTC+Kyu++b/U LFgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 2-20020a630802000000b0037716e2e56bsi4671990pgi.550.2022.03.04.05.36.45; Fri, 04 Mar 2022 05:37:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237524AbiCDKmZ (ORCPT + 99 others); Fri, 4 Mar 2022 05:42:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237463AbiCDKmX (ORCPT ); Fri, 4 Mar 2022 05:42:23 -0500 Received: from esa8.hc1455-7.c3s2.iphmx.com (esa8.hc1455-7.c3s2.iphmx.com [139.138.61.253]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80AD41AAFDE; Fri, 4 Mar 2022 02:41:35 -0800 (PST) IronPort-SDR: sNKOLv2BAlkibgeIIZSso01JBiPWq9hMk8+Zc8u/1hGej2VX84Y9wPdMXj4DlBuTxw9FddHGj4 7wZVCHpuhHyU8I/7hZ7ftE7uCBDq+zTCLfPbHhOVDv3CpBpGa6lRnNcufWF/hR69Hw34uUI3me HlhvSg/+UpwJ/nmdsSvtiPuC8ypOOBZo05b7WZc0t55wbG7Ge6TexFys1gQMwSIpG8lTI22dlh xDAwy1EHCmzG1RT36+LqyuVNaJSq0MQrWROZUjayCd7Barlbo66iwbbFZ58jlQoTVJpAXvRs2v ZBQ3MpLGlQpl8J9IL0USEkNv X-IronPort-AV: E=McAfee;i="6200,9189,10275"; a="53044773" X-IronPort-AV: E=Sophos;i="5.90,154,1643641200"; d="scan'208";a="53044773" Received: from unknown (HELO yto-r2.gw.nic.fujitsu.com) ([218.44.52.218]) by esa8.hc1455-7.c3s2.iphmx.com with ESMTP; 04 Mar 2022 19:40:29 +0900 Received: from yto-m4.gw.nic.fujitsu.com (yto-nat-yto-m4.gw.nic.fujitsu.com [192.168.83.67]) by yto-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id 92D2CC68A8; Fri, 4 Mar 2022 19:40:28 +0900 (JST) Received: from yto-om2.fujitsu.com (yto-om2.o.css.fujitsu.com [10.128.89.163]) by yto-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id 38230E679E; Fri, 4 Mar 2022 19:40:27 +0900 (JST) Received: from cn-r05-10.example.com (n3235113.np.ts.nmh.cs.fujitsu.co.jp [10.123.235.113]) by yto-om2.fujitsu.com (Postfix) with ESMTP id 0C38C403884E6; Fri, 4 Mar 2022 19:40:27 +0900 (JST) From: Shaopeng Tan To: Fenghua Yu , Reinette Chatre , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tan.shaopeng@jp.fujitsu.com Subject: [PATCH v3] selftests/resctrl: Print a message if the result of MBM&CMT tests is failed on Intel cpu Date: Fri, 4 Mar 2022 19:39:57 +0900 Message-Id: <20220304103957.487660-1-tan.shaopeng@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 According to "Intel Resource Director Technology (Intel RDT) on 2nd Generation Intel Xeon Scalable Processors Reference Manual", When the Intel Sub-NUMA Clustering(SNC) feature is enabled, Intel CMT and MBM counters may not be accurate. However, there does not seem to be an architectural way to detect if SNC is enabled. If the result of MBM&CMT test fails on Intel CPU, print a message to let users know a possible cause of failure. Signed-off-by: Shaopeng Tan --- Hello, In PATCH V2, I tried to detect whether SNC is enabled by NUMA info and cpuinfo(socket_num), but it is not reliable and no future-proof. I just print a message to let users know a possible cause of "not ok", When CMT or MBM test runs on Intel CPU, and the result is "not ok". This patch is based on v5.16. tools/testing/selftests/resctrl/resctrl_tests.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index 973f09a66e1e..ec2bdce7b85f 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -14,8 +14,9 @@ #define BENCHMARK_ARG_SIZE 64 bool is_amd; +bool is_intel; -void detect_amd(void) +void detect_vendor(void) { FILE *inf = fopen("/proc/cpuinfo", "r"); char *res; @@ -29,6 +30,7 @@ void detect_amd(void) char *s = strchr(res, ':'); is_amd = s && !strcmp(s, ": AuthenticAMD\n"); + is_intel = s && !strcmp(s, ": GenuineIntel\n"); free(res); } fclose(inf); @@ -70,6 +72,8 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span, sprintf(benchmark_cmd[5], "%s", MBA_STR); res = mbm_bw_change(span, cpu_no, bw_report, benchmark_cmd); ksft_test_result(!res, "MBM: bw change\n"); + if (is_intel && res) + ksft_print_msg("Intel CMT and MBM counters may be inaccurate when Sub-NUMA Clustering (SNC) is enabled. Ensure SNC is disabled in the BIOS if this system supports SNC.\n"); mbm_test_cleanup(); } @@ -106,6 +110,8 @@ static void run_cmt_test(bool has_ben, char **benchmark_cmd, int cpu_no) sprintf(benchmark_cmd[5], "%s", CMT_STR); res = cmt_resctrl_val(cpu_no, 5, benchmark_cmd); ksft_test_result(!res, "CMT: test\n"); + if (is_intel && res) + ksft_print_msg("Intel CMT and MBM counters may be inaccurate when Sub-NUMA Clustering (SNC) is enabled. Ensure SNC is disabled in the BIOS if this system supports SNC.\n"); cmt_test_cleanup(); } @@ -207,8 +213,8 @@ int main(int argc, char **argv) if (geteuid() != 0) return ksft_exit_fail_msg("Not running as root, abort testing.\n"); - /* Detect AMD vendor */ - detect_amd(); + /* Detect AMD/INTEL vendor */ + detect_vendor(); if (has_ben) { /* Extract benchmark command from command line. */ -- 2.27.0