From patchwork Thu Mar 30 23:35:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chang S. Bae" X-Patchwork-Id: 77478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp209702vqo; Thu, 30 Mar 2023 16:50:44 -0700 (PDT) X-Google-Smtp-Source: AKy350YbzTTyVEKHhch5Oo9Pb79bHV3/aRQsA0xrMoFRSrHD+Ss1cxJTLo8C5pe+7HYUc6/BL5AQ X-Received: by 2002:a17:907:6da1:b0:947:ad38:6184 with SMTP id sb33-20020a1709076da100b00947ad386184mr171651ejc.31.1680220244104; Thu, 30 Mar 2023 16:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680220244; cv=none; d=google.com; s=arc-20160816; b=ZRM/X7t8qnCrXPiijohlQhAvU28SlGNfoFXpCgcXEoennbBaPu5h8nZY0SgkCTACUZ Po5PJBGyCMk03fkoHOuYEoV3MYL26d2BcL0rsU16xtHjJA7WZ+hHtPI18dtMwOpNnl7P 6hRSaZyDWkG/joGBO/O8jAyZPFZFUmkrmov80mTuwVpKSI7K+7Cce21fOOyNjPhJZoL3 LBxUSetiTPSibf6OdGRYhNiV/Yji312MxfjBctB+okDyqUVh+ENCXQD0fLbxAZ+g5cst xfYQRk30Lyg53iCFzmOKunOdmbMiGrRp9DSaD2k0xFjAik5pUytbpVGb+zBpghfkQOn8 b/6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=zHQtC2glZiKH19uqmEsZKRRe+yrxo9+87sHo0bHm9ig=; b=MpkG46PNofGxN9FkjsxOY4jwHXYWIK4cVjX9DbPK9ArQ/pcIih0b5TQo4ej5Iy/W+s JXGiNYwuB7G7RMa8xgoQHEZzpxo9/EE6tIgC7rbdzM0xpTd2e5IOLXjf1i8maZpS5zd0 Wn1iRWt27IYT+/eDxLzrupORK+w7d+g3R70RvWxfIkcXfOOs5+dxgtItp9Sf2V+QBVQ5 QN++Qt/YrBp7JaowEBsD4DAP5EAPIa0hJDVCU6m2CnTrTZ+fwG8QLGubM6w5HFub1As7 1E+R+dCn4sxHEKOXWgUu8UwUVzTSI/4LJlsCwjdwT615aQCSg1AtuosgqZicsu1Yv+Xi 14Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YWeOrMdj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jt15-20020a170906dfcf00b0092ca204119esi646471ejc.570.2023.03.30.16.50.20; Thu, 30 Mar 2023 16:50:44 -0700 (PDT) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=YWeOrMdj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231776AbjC3Xs3 (ORCPT + 99 others); Thu, 30 Mar 2023 19:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbjC3Xrx (ORCPT ); Thu, 30 Mar 2023 19:47:53 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 720AA12BF4; Thu, 30 Mar 2023 16:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680220042; x=1711756042; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=PXl1dGOSTl3mjfBv99XnPT3QfP3sbVC8+kNUvV4iUz4=; b=YWeOrMdjuvUsAeQlKBK4PxqDsMoposkoi4rhIYI6AGr8Y/nlLEC6ftou jOXfKdaeAx06cC+G6jgtYttjtL0TAMahGdlOlEjUwUv+QyuvvDZngA72a icL1B7i9TNlxRtvMzAGDzLMBeHCZBrF7IePxV90TvyKwZiDn520Q/qCjs HItQuVtUkZsuksOYshCWmheS8DpVI0Mu8gZaDxjs28KekkpmVZnFzF+wK AoLTdkr5XbdWnlOhR8CMR3JA1o8R/Ri2eRMFhxnScLLHBckhTBU9T5QDv o4yFcgbjTESKccKJLUKYvcGgFYS7c3RTK8yLztR1cldQ+KdPyfKsgDFG6 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="427587825" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="427587825" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 16:47:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="930926049" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="930926049" Received: from chang-linux-3.sc.intel.com ([172.25.66.173]) by fmsmga006.fm.intel.com with ESMTP; 30 Mar 2023 16:47:16 -0700 From: "Chang S. Bae" To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: shuah@kernel.org, tglx@linutronix.de, dave.hansen@linux.intel.com, bp@alien8.de, chang.seok.bae@intel.com Subject: [PATCH v3 1/3] selftests/x86/sigaltstack: Adjust the test to the kernel's altstack check Date: Thu, 30 Mar 2023 16:35:18 -0700 Message-Id: <20230330233520.21937-2-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230330233520.21937-1-chang.seok.bae@intel.com> References: <20220711170330.27138-1-chang.seok.bae@intel.com> <20230330233520.21937-1-chang.seok.bae@intel.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761838622838010157?= X-GMAIL-MSGID: =?utf-8?q?1761838622838010157?= The test assumes an insufficient altstack is allowed. Then it raises a signal to test the delivery failure due to an altstack overflow. The kernel now provides the STRICT_SIGALTSTACK_SIZE option to tweak sigaltstack()'s sanity check to prevent an insufficient altstack. ENOMEM is returned on the check failure. Adjust the code to skip the test when this option is on. Signed-off-by: Chang S. Bae Reviewed-by: Shuah Khan Cc: Shuah Khan Cc: Thomas Gleixner Cc: Borislav Petkov Cc: Dave Hansen Cc: linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- Changes from v2: * Fix the subsystem name in the subject. Changes from v1: * Call out the config name (Shuah Khan). * Massage the print message (Shuah Khan). --- tools/testing/selftests/x86/sigaltstack.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/x86/sigaltstack.c b/tools/testing/selftests/x86/sigaltstack.c index f689af75e979..22a88b764a8e 100644 --- a/tools/testing/selftests/x86/sigaltstack.c +++ b/tools/testing/selftests/x86/sigaltstack.c @@ -88,8 +88,18 @@ static void sigalrm(int sig, siginfo_t *info, void *ctx_void) static void test_sigaltstack(void *altstack, unsigned long size) { - if (setup_altstack(altstack, size)) + if (setup_altstack(altstack, size)) { + /* + * The kernel may return ENOMEM when the altstack size + * is insufficient. Skip the test in this case. + */ + if (errno == ENOMEM && size < at_minstack_size) { + printf("[SKIP]\tThe running kernel disallows an insufficient size.\n"); + return; + } + err(1, "sigaltstack()"); + } sigalrm_expected = (size > at_minstack_size) ? true : false; From patchwork Thu Mar 30 23:35:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chang S. Bae" X-Patchwork-Id: 77479 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp221510vqo; Thu, 30 Mar 2023 17:15:23 -0700 (PDT) X-Google-Smtp-Source: AKy350bD5v/JD981ZHGgMh6ng+d0d0U7LIN7dAGRSwxq6hfHVFxvC1l17X4fel5oHKru3i8Inufi X-Received: by 2002:a17:907:724c:b0:932:5b67:6dee with SMTP id ds12-20020a170907724c00b009325b676deemr8559163ejc.27.1680221722922; Thu, 30 Mar 2023 17:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680221722; cv=none; d=google.com; s=arc-20160816; b=iCSOwt41lFVLqWGUWAILoXFo/c2FuCUr9LD4gE+9ciRJDX5io60+BIWVKcvDdzmYK1 SsneygeHeXcYw/mYHrZ+r5ttk+BCWUFXhNDT7kVFQqyTlM1rhiczs2q6Vnmsp39gdpvc M4E2uzk+tzYuaz2ZTIEUfW/wE8gSbrZet9FAFJsUtbQhkSZPZiRbIekQRjSGVPi2bAWj 42i5QWZQWbtyTYpBXImRi/sL3SFm16hPlnfIzmZRq7NTKIR2bMb6NXLzO1/q4Xs90HP6 STY89oIWocf2hNg7DJot1W7FDZS1sNek6Hs+xD3W0pJcFAPTvtXuTaZ+Z0+JuwQ6Bpu9 Is4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=OwrugvCgwHkdppSWhdVvmMzXmCZliWDawiH/mZrhfo4=; b=tdekwyGaPt7qrCOUtWNdSf7bqgIqdOZ1o9GbQbQ0AkrYWTWLDAiZkaldVfCwyRXz61 LUqP2+0TEgn9mxOnKQvxz18+c/rJiCSu/yoEdoSiHeLTWO0BWKB/s4oqqwYhETFAEcHB nUTahy+1W/PcXg4/IkidmqxtlMPyzYU8fF+omvqma6LKASrPNRVo/yxFwJsSqbZWRWqF hoNkjDWvYZL9xU5QICF9BGB2rsa8lk4yYlxAVM83pytpgEOTwnwFuJR1yDuR29rYWabv tTi5WlKzonWEKLmtxlkkkuRJWO/yBtHcB9FvQd/Wr408TkCHaMncsDgTAO2Q+3B9hjQw 0pAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NvNnoRt3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qx26-20020a170906fcda00b0093c09a76ac9si760553ejb.481.2023.03.30.17.14.58; Thu, 30 Mar 2023 17:15:22 -0700 (PDT) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=NvNnoRt3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231835AbjC3Xs1 (ORCPT + 99 others); Thu, 30 Mar 2023 19:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231705AbjC3Xrx (ORCPT ); Thu, 30 Mar 2023 19:47:53 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066091287F; Thu, 30 Mar 2023 16:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680220039; x=1711756039; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ICpoF7mu9Aw52F1J5i0VBfsK43335W9h7I5PoX16fbU=; b=NvNnoRt3EtZAjx/7i0Gc0+r3jiYoDXI7TvrS4gg2Mof8PewT28pQirJt f3meeVSLfz6DUxYJSComdkcSk243uwu1/wWhF+pA2EJhI2i1Wqp92Snk0 RXi5r4PFZTmu4NweNN37HO+JWPT0GhfnpxheSnmRaTEhm0IMTg8se6XQx 30lLtvWKtVnkNdUva6huzZtgAVb57QpexMRbebH4LVozsJDrzQM1pPISe ge2TpY62fnAFnDhxb7BhbF6SVCQEZkweBoyH9moD8C5DY46zXZIguMyAB Kd/42wUcW7akw0OM9oj3NZOGLt/zgGWcdrjjCFMuipb1KMtTF1Y1Kmcd8 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="427587829" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="427587829" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 16:47:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="930926052" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="930926052" Received: from chang-linux-3.sc.intel.com ([172.25.66.173]) by fmsmga006.fm.intel.com with ESMTP; 30 Mar 2023 16:47:16 -0700 From: "Chang S. Bae" To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: shuah@kernel.org, tglx@linutronix.de, dave.hansen@linux.intel.com, bp@alien8.de, chang.seok.bae@intel.com Subject: [PATCH v3 2/3] selftests/x86/amx: Fix the test to avoid failure when AMX is unavailable Date: Thu, 30 Mar 2023 16:35:19 -0700 Message-Id: <20230330233520.21937-3-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230330233520.21937-1-chang.seok.bae@intel.com> References: <20220711170330.27138-1-chang.seok.bae@intel.com> <20230330233520.21937-1-chang.seok.bae@intel.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761840173358660405?= X-GMAIL-MSGID: =?utf-8?q?1761840173358660405?= When a CPU does not have AMX, the test fails. But this is wrong as it should be runnable regardless. Skip the test instead. Also, simplify the feature check using arch_prctl() instead of CPUID. The syscall is more trustworthy as the kernel controls the feature permission. Reported-by: Thomas Gleixner Fixes: 6a3e0651b4a ("selftests/x86/amx: Add test cases for AMX state management") Signed-off-by: Chang S. Bae Cc: Shuah Khan Cc: Thomas Gleixner Cc: Dave Hansen Cc: linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- Changes from v2: None Changes from v1: * Simplify the feature check code (Shuah Khan). --- tools/testing/selftests/x86/amx.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/tools/testing/selftests/x86/amx.c b/tools/testing/selftests/x86/amx.c index d884fd69dd51..f0b1efe89ef7 100644 --- a/tools/testing/selftests/x86/amx.c +++ b/tools/testing/selftests/x86/amx.c @@ -101,24 +101,6 @@ static void clearhandler(int sig) #define XFEATURE_MASK_XTILEDATA (1 << XFEATURE_XTILEDATA) #define XFEATURE_MASK_XTILE (XFEATURE_MASK_XTILECFG | XFEATURE_MASK_XTILEDATA) -#define CPUID_LEAF1_ECX_XSAVE_MASK (1 << 26) -#define CPUID_LEAF1_ECX_OSXSAVE_MASK (1 << 27) -static inline void check_cpuid_xsave(void) -{ - uint32_t eax, ebx, ecx, edx; - - /* - * CPUID.1:ECX.XSAVE[bit 26] enumerates general - * support for the XSAVE feature set, including - * XGETBV. - */ - __cpuid_count(1, 0, eax, ebx, ecx, edx); - if (!(ecx & CPUID_LEAF1_ECX_XSAVE_MASK)) - fatal_error("cpuid: no CPU xsave support"); - if (!(ecx & CPUID_LEAF1_ECX_OSXSAVE_MASK)) - fatal_error("cpuid: no OS xsave support"); -} - static uint32_t xbuf_size; static struct { @@ -350,6 +332,7 @@ enum expected_result { FAIL_EXPECTED, SUCCESS_EXPECTED }; /* arch_prctl() and sigaltstack() test */ +#define ARCH_GET_XCOMP_SUPP 0x1021 #define ARCH_GET_XCOMP_PERM 0x1022 #define ARCH_REQ_XCOMP_PERM 0x1023 @@ -928,10 +911,16 @@ static void test_ptrace(void) int main(void) { - /* Check hardware availability at first */ - check_cpuid_xsave(); - check_cpuid_xtiledata(); + unsigned long features; + long rc; + rc = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_SUPP, &features); + if (rc || (features & XFEATURE_MASK_XTILE) != XFEATURE_MASK_XTILE) { + printf("[SKIP]\tno AMX support.\n"); + exit(KSFT_FAIL); + } + + check_cpuid_xtiledata(); init_stashed_xsave(); sethandler(SIGILL, handle_noperm, 0); From patchwork Thu Mar 30 23:35:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chang S. Bae" X-Patchwork-Id: 77485 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp226705vqo; Thu, 30 Mar 2023 17:28:14 -0700 (PDT) X-Google-Smtp-Source: AKy350azPbu7IovMUHHrqwd1TFbWylcOPG6WIR9gGkP4E4idwKijEcfI0TLlmZcBsCMmSYyJiPSo X-Received: by 2002:a17:907:d09:b0:930:e634:3d52 with SMTP id gn9-20020a1709070d0900b00930e6343d52mr32393387ejc.24.1680222494302; Thu, 30 Mar 2023 17:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680222494; cv=none; d=google.com; s=arc-20160816; b=j4EXdezc84cFpKDZCIdXrlQMaKx+gWEUPg/14Wui5c8UlE+vBWDGbZxf8IMwJjCuH/ TUby2+P3NtVYU4z88FNBwEf325wCDGNgpP2BhjYb6jG3/vaglZqSwnV1X/h+pK9QU3jj xVVgyaGxnv6hYfQjMXFGzp4lb1qK1z2t5xfe/joksXQ2BGcK2suiCgZ5BeDpZsfzip3Y 27TyZgy2fNMC4zczIcy/8lx4gM04LmIyvVXpixSlDDH3PkbxVwwFuUNMCUurCkMsW1gr vJKjT6jm8kb4FE1HwMv1scFOpKRcpKOOpdtLoddZq9Jn3wiU1ItLKI/ysKgcqg8YQ4Ac Bc8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=BgRNM9Cqstqiy3lAGuE/GARyE94Uatr3eLcyx52UXxQ=; b=W4PhegAI0pYFdGouK9OWlkDycFm2Thwiy6wwEnlQIcd8ba135qR7zoRw6OLZ8gXB9l RiM2R9iUCfC1ch0HfpGr6tbB5ynwc/SRNMo5wn3+xdiUe6fFHgL9qYb81AOQgd2dOiUn s0+Nuge6ER0YAzWSiX1DxnNdzQHj+lCfmLrQm/aGzGHHmNiG6gF7BS0ijEbCl23yh7ot VO5Yn/QtAtcsxf731DJWQEIFiGCf57A5tAP4q76uxfF7jbmgFp68YWtGQVg9+D6OT5Pr APOYi1GKPOWOYhP3LrMKTJaqUEJB06Vt0JIjgOKwYnIj995OiwJh55FU46JpAFyhKF1U Bhfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MfEAjojD; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020aa7c651000000b004acc613462fsi767546edr.525.2023.03.30.17.27.50; Thu, 30 Mar 2023 17:28:14 -0700 (PDT) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=MfEAjojD; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231842AbjC3Xsd (ORCPT + 99 others); Thu, 30 Mar 2023 19:48:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231770AbjC3Xrx (ORCPT ); Thu, 30 Mar 2023 19:47:53 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DE5710AAB; Thu, 30 Mar 2023 16:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680220042; x=1711756042; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=BDOVJxkv4ZCtP+exumrul4a9lyDZPaoK8i+VzmJqHJE=; b=MfEAjojD+Gk3mEDX8uSsu1pjgKRg28dU9ELllbN6P4FqIyaPRiWBDXrB BAgU0/RffY6Ils1UiexOs7Zbu+GOeeGf48Mj/kMCbFlJSynjTIkxV/wcL YqswD5g399LT//D6OJp9JrNA0FnTeuOSrO4ba3Lr9sZT/7sXgQt/Pe9Tt H0dc7RLwVRi1BZ5QdkhZn17xZoT6iYIOapfiKiMujBSCAaBdNFb+9pYuo 2KoB6t51LFcciVU+5loAskbXoUcjQ0IKhN6flt4s/WD3x0Q4xdA6TM4Ah Snnb++932y6W/ahT6x9W+bTlb7xMEK5mjHE/W5q9YTJUbSMgXh+vWGjn+ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="427587834" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="427587834" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 16:47:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="930926055" X-IronPort-AV: E=Sophos;i="5.98,306,1673942400"; d="scan'208";a="930926055" Received: from chang-linux-3.sc.intel.com ([172.25.66.173]) by fmsmga006.fm.intel.com with ESMTP; 30 Mar 2023 16:47:16 -0700 From: "Chang S. Bae" To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: shuah@kernel.org, tglx@linutronix.de, dave.hansen@linux.intel.com, bp@alien8.de, chang.seok.bae@intel.com Subject: [PATCH v3 3/3] selftests/x86/amx: Remove unneeded code Date: Thu, 30 Mar 2023 16:35:20 -0700 Message-Id: <20230330233520.21937-4-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230330233520.21937-1-chang.seok.bae@intel.com> References: <20220711170330.27138-1-chang.seok.bae@intel.com> <20230330233520.21937-1-chang.seok.bae@intel.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761840982616139627?= X-GMAIL-MSGID: =?utf-8?q?1761840982616139627?= Remove some unused helper code. Also, get rid of the redundant permission request. Signed-off-by: Chang S. Bae Cc: Shuah Khan Cc: Thomas Gleixner Cc: Dave Hansen Cc: linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- Changes from v2: * Add as a new patch --- tools/testing/selftests/x86/amx.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tools/testing/selftests/x86/amx.c b/tools/testing/selftests/x86/amx.c index f0b1efe89ef7..854f7d61be89 100644 --- a/tools/testing/selftests/x86/amx.c +++ b/tools/testing/selftests/x86/amx.c @@ -39,16 +39,6 @@ struct xsave_buffer { }; }; -static inline uint64_t xgetbv(uint32_t index) -{ - uint32_t eax, edx; - - asm volatile("xgetbv;" - : "=a" (eax), "=d" (edx) - : "c" (index)); - return eax + ((uint64_t)edx << 32); -} - static inline void xsave(struct xsave_buffer *xbuf, uint64_t rfbm) { uint32_t rfbm_lo = rfbm; @@ -110,8 +100,6 @@ static struct { #define CPUID_LEAF_XSTATE 0xd #define CPUID_SUBLEAF_XSTATE_USER 0x0 -#define TILE_CPUID 0x1d -#define TILE_PALETTE_ID 0x1 static void check_cpuid_xtiledata(void) { @@ -161,12 +149,6 @@ static inline void clear_xstate_header(struct xsave_buffer *buffer) memset(&buffer->header, 0, sizeof(buffer->header)); } -static inline uint64_t get_xstatebv(struct xsave_buffer *buffer) -{ - /* XSTATE_BV is at the beginning of the header: */ - return *(uint64_t *)&buffer->header; -} - static inline void set_xstatebv(struct xsave_buffer *buffer, uint64_t bv) { /* XSTATE_BV is at the beginning of the header: */ @@ -769,8 +751,6 @@ static void test_context_switch(void) /* Affinitize to one CPU to force context switches */ affinitize_cpu0(); - req_xtiledata_perm(); - printf("[RUN]\tCheck tiledata context switches, %d iterations, %d threads.\n", ctxtswtest_config.iterations, ctxtswtest_config.num_threads);