From patchwork Tue Mar 15 16:44:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reinette Chatre X-Patchwork-Id: 12781656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90821C43219 for ; Tue, 15 Mar 2022 16:44:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 30F3D8D0007; Tue, 15 Mar 2022 12:44:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EBD88D0001; Tue, 15 Mar 2022 12:44:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D4D48D0006; Tue, 15 Mar 2022 12:44:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id E948E8D0001 for ; Tue, 15 Mar 2022 12:44:52 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8B37E180927D0 for ; Tue, 15 Mar 2022 16:44:52 +0000 (UTC) X-FDA: 79247194824.28.4FC6E93 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf18.hostedemail.com (Postfix) with ESMTP id AFFEE1C0004 for ; Tue, 15 Mar 2022 16:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647362691; x=1678898691; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8KaVKH4qUgKYR/3ymaU2krf35oF098yonqwR5NUOhxE=; b=flmAqKdiYIiuPDT1E8u3pSlCeYPBgH/MMDxItbDOFMu7xGDH8hUswNx7 1oHShSBl9f7cItzJGipOY/TZeDPXbxUyPeGorB9S9PSTv6vrZ+8DV8Dod GI79iSwrRUY8Q5NYjCcxXt8DHid+2YRY+mCAwXLLJaV2r+YsTW1aXAnp7 443r6o+AkJTY2tWUA615Mz3s79ZvX29CJ3DyeGGFCZjv/eiHfcurm909F pmnhf6OhGbXoKoNbnFbsEcf119EvrihaCeIHpj54ZY9+k23jizhE1ciUB NHVaJ2Knx/ShvYS7SUMAEa3Emd3HMX5/OsCD04JPsg753nwvE3xTie2Xp Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10286"; a="256081583" X-IronPort-AV: E=Sophos;i="5.90,184,1643702400"; d="scan'208";a="256081583" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2022 09:44:47 -0700 X-IronPort-AV: E=Sophos;i="5.90,184,1643702400"; d="scan'208";a="714236346" Received: from rchatre-ws.ostc.intel.com ([10.54.69.144]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2022 09:44:47 -0700 From: Reinette Chatre To: shuah@kernel.org, linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com, sandipan@linux.ibm.com, fweimer@redhat.com, desnesn@linux.vnet.ibm.com, mingo@kernel.org, bauerman@linux.ibm.com, mpe@ellerman.id.au, msuchanek@suse.de, linux-mm@kvack.org, chang.seok.bae@intel.com, bp@suse.de, tglx@linutronix.de, hpa@zytor.com, x86@kernel.org, luto@kernel.org Subject: [PATCH V2 0/4] selftests: Remove duplicate CPUID wrappers Date: Tue, 15 Mar 2022 09:44:24 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: AFFEE1C0004 X-Stat-Signature: dssbrb6dwe5qkpb973y4u5yrqmtrstny Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=flmAqKdi; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf18.hostedemail.com: domain of reinette.chatre@intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=reinette.chatre@intel.com X-Rspam-User: X-HE-Tag: 1647362691-568378 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Changes since V1: - V1: https://lore.kernel.org/lkml/cover.1644000145.git.reinette.chatre@intel.com/ - Change solution to not use __cpuid_count() from compiler's cpuid.h but instead use a local define of __cpuid_count() provided in kselftest.h to ensure tests continue working in all supported environments. (Shuah) - Rewrite cover letter and changelogs to reflect new solution. A few tests that require running CPUID do so with a private implementation of a wrapper for CPUID. This duplication of the CPUID wrapper should be avoided. Both gcc and clang/LLVM provide wrappers for CPUID but the wrappers are not available in the minimal required version of gcc, v3.2, that the selftests need to be used in. __cpuid_count() was added to gcc in v4.4, which is ok for kernels after v4.19 when the gcc minimal required version was changed to v4.6. Add a local define of __cpuid_count() to kselftest.h to ensure that selftests can still work in environments with older stable kernels (v4.9 and v4.14 that have the minimal required version of gcc of v3.2). Update tests with private CPUID wrappers to use the new macro. Cc: Dave Hansen Cc: Sandipan Das Cc: Florian Weimer Cc: "Desnes A. Nunes do Rosario" Cc: Ingo Molnar Cc: Thiago Jung Bauermann Cc: Michael Ellerman Cc: Michal Suchanek Cc: linux-mm@kvack.org Cc: Chang S. Bae Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Andy Lutomirski Reinette Chatre (4): selftests: Provide local define of __cpuid_count() selftests/vm/pkeys: Use provided __cpuid_count() macro selftests/x86/amx: Use provided __cpuid_count() macro selftests/x86/corrupt_xstate_header: Use provided __cpuid_count() macro tools/testing/selftests/kselftest.h | 15 ++++++++++++ tools/testing/selftests/vm/pkey-x86.h | 21 ++-------------- tools/testing/selftests/x86/amx.c | 24 ++++++------------- .../selftests/x86/corrupt_xstate_header.c | 16 ++----------- 4 files changed, 26 insertions(+), 50 deletions(-) base-commit: 09688c0166e76ce2fb85e86b9d99be8b0084cdf9