From patchwork Fri May 3 03:02:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 794529 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2089.outbound.protection.outlook.com [40.107.236.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E7411BF2B; Fri, 3 May 2024 03:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705347; cv=fail; b=b7uAMBr/ESA6CcYFOeMrrjz1IwLwzJKJiSEWMWPiTMI+cLJpb1Mgs0wZLdCSum/cpQXF7kNS142Qa9vFiDO4jcrHM6pK8ptrvTUXcHgeWhEToL73RdgxdxAd7jG6MuLyoTMxaTSOHnxfEdhSOJ9ySSvXabrtnKug/241SXQeMMQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705347; c=relaxed/simple; bh=FrW0QCYswwBHG33dYl6LglaBS7QJD8E+wWjt3tX3yfU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=SRxyFjnKcmGycrGQR6KTiHukXw2MYLk4U5T8aKG7qMVU4JceU4ilVHbJRLM0uqoE1+G88NJRirpxtLVw1QWYx8cuR2QTalAlgaZRmSZwS4aNfngL+sM7PBWcSc2a/4sizLV6iXF+qop8XLNkH7/e8LA2nOijXnHD0zwG36E5b60= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=TSIeVu5P; arc=fail smtp.client-ip=40.107.236.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="TSIeVu5P" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TYix1v1Az8JMp8Hfs2vt5IhlV1xjhl+J8fEdOs6dNVlNdvJTJhbko3bu5kN3T3PolGXmPl7fZDW5newGEb4JA56jCjW4AyPIXWKw3+16lrIqQQ6GsxM3mJQWnAaD0qqIQ7DpnL1DDRvFjn1dMa/UZ/1EUGpqaOQxRuTz7vuQEOGMHu13mnj/INvTw2SNOmQHmGRcC0n+lU9IYJ4K3zXNq/uQsEMzLRAIMJZTa7IbpnIL/8iEcwGhpIIQKPwwzfFV9XHfwGKB7zhIHqkfFg2hLmF2tIElaS/DX+0fvdqKS1Q4DwxThSaxB3+iDcKrdR1xWNetDS5clkjCkytJpoLMBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WrtAYNTBOn7GExk9ndx+JU/5Z0QkjDJ5YY6nCJy4GCc=; b=UgMFBNlN/ntoCvwesNENW6ajgNX+JDqWu0xqQgohdSfeaDT2JUtbfiwl9/2HmrjfxDdGFY9yXIzZ3I6UU2yXXepF6iYJ72eDbif/DKJ5Eeke5X8wU/MoAB9BtCmqJV4rUTOYh4+r4WE23hRMDqYX3imQMLeIK3dbibCDHL8914CcRI6+LuoFu1dIlHGuq3VcHexkcu1eEx95MrW6kp5HsKQJRhtEdpRU9rE4eKLy2rUtqvVjbPM+6M90iRUIkopfJdAEd6v3xREaDSIgVZvZ2rmu5acDfJVRyFQAWzyVSrlcJS6aX5m8/iFTLCfM7v0f5SgG8eUk6pg2djSWXsb6ZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WrtAYNTBOn7GExk9ndx+JU/5Z0QkjDJ5YY6nCJy4GCc=; b=TSIeVu5Piwd7Li53F5bd2c2xOHBMhmMge5UodbAXWUJLHcGpeoJKUSufJbQsWi0FkutgvlwCYbjfaBSSiUYGQwulZ0Np9CcBNeEso6q7Eaqva/oL4SUoSwB9hyt+WYttPasm2J7jOZyk1rKbjkylg1DjmTW8HRUNMmMZb6e2d79CobiCx/rBN8p1e2AlyUSqVxVSQkIvLUbMIMJZJe8nikku31AcbNRY+5WYZQskCYf0bKU7HfZqeHxfAOuMWG9688GhVQToLqx+4hDoEaMKK3BkHX0yopZgS99B+0XNBR6T3kAgTZqPCQknOfevsFsQ2wxzVw+FQGlQ4fwqCt5Gpg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by LV8PR12MB9109.namprd12.prod.outlook.com (2603:10b6:408:18a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Fri, 3 May 2024 03:02:17 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7519.035; Fri, 3 May 2024 03:02:17 +0000 From: John Hubbard To: Shuah Khan Cc: angquan yu , "Kirill A . Shutemov" , Ingo Molnar , Binbin Wu , Alexey Dobriyan , Rick Edgecombe , Sohil Mehta , Yu-cheng Yu , Dave Hansen , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, x86@kernel.org, John Hubbard Subject: [PATCH 1/7] selftests/x86: fix Makefile dependencies to work with clang Date: Thu, 2 May 2024 20:02:08 -0700 Message-ID: <20240503030214.86681-2-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240503030214.86681-1-jhubbard@nvidia.com> References: <20240503030214.86681-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BYAPR02CA0049.namprd02.prod.outlook.com (2603:10b6:a03:54::26) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|LV8PR12MB9109:EE_ X-MS-Office365-Filtering-Correlation-Id: b875bae5-0091-4647-ddb3-08dc6b1d70e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: 3Y+tFxGBg5pYBdxLpEoSRJt7e/rAlIn6uWz1gD4WX2AKaF6f6Q4Su4guN61LCAJau0CugussffzQxxSNwKA878EuTwdS160fP6iiVqX+en07lCY8jaZDJVKK/UBhBaIwAvhr1fXE/nAYdDo4YXo+M9u+Zf8r9zcN6zKQ/6hr1UQ7vR4aIpotOYmUBk1Ws/j8DWAKIFuymOp9Hkyp4O0VBtK/uLtIekOHAQyROgBQSDWgfHPlg1GmmvWql2BHhmFwe02KXWSQvpCRmcSOWSptoVPZu1q9L6WaFB1P/4FJ2m5iPMLePz1X7SyCcAKZN1R+FvuAq9uclHuhKoSIDaWHNYN8/iBYrWNJ5jQd0up0wE2YH5BDzSwisrxzaK7LOPXytWJ6nu/6gLMTtRoHDrlG0EBhVto318ZToKWeSSqlux7kJnu7IeDtREVX8aOaNnPohxBAmPe94tB7e3L7JaqFP3CJedkdzz2ymMsd8jynWF+SOwlZT+SSMOyw9jZnk774gh0BwpBN7ds/n8q3wnq4MLOY/iPNF1oTIATP6kgFio3l8bPhQiszKiNh+DORB+x7fpIxG71X77263dren/lAWScZcfmB8WyGCbLV/xE4Lho/EWoW2G4CCxzzTDGzPWjVULLZzU3Bqm9F2+JFb8YXihEET3aOY7X+S47ezZRXYSboQsmxej2DHZ/Nedc9b4Yzs+XgahWH8imK8ee1/rBf1TeJplQIkoNi/UEvimQyv/D8hiPkBniWBgKD8w1Zt2Ucz7crKnnPxzIRstrnaaWi2aPB1FG1+njU4RHajqstV01Z4cFkCCsd00SxteTFOFBays9ZSxzJ9P73N+ZigKOzMXsCZxdSZ+6/09D5+hWqx7N7XsSXXNC8VIqA53lm5nK4xlqbUwU18WV9R3lusGxauAs5HEFk7iSKJCKYvnMoX+Jv1VEZjdLJ7supad9Pmy1XHg707carQeC7k8IbLLY2rOiOrs+WpciTNW1fbCUwHINU+4vQi5SLS6LCZkGaO77dfBFw1/HK9+mgTPa4wMo3Hb346FV7Zn4qyRJOuNVsy6AZRmDwdaaxxZLSg0e8L0QaVEyXUtC/JREZmi3hdhDVwONldRXb8D3mIAGSBgb7al96WOgQr+0nEPwqyXByagR9zmboNIKAMyt2nedUPOV5aj68Bx6znNoIowIy18BOWSmPsm3eWRv6FTlT4OVQK1HQJIqvENjzvhApMa/C1fehoxpUrJqa/KPNPBCfqMW3glxf9KHs9lzZ1hUF4aupewCYgwOxw2vF7hFgH1Mt00YpCQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4130.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(7416005)(376005)(366007)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OHGWj3JhyYo98TjwGEI1hDsNq3DizjnZAPNTXuRkAovtk57RDHsUpirIA8QS62BCNiodP0dCrPYqlzc71CG5S9KG69T1sS3wGq+ruef5zNLjbd4G5SJgDh4YrzVSb22P/l43v/yaxb5/pII/6v98mabOBC6oi9P4eivCozm06vPWNS1IsNYXbvhCsW8UZHWKCpmoUXi9uLuRAFPfSqemidrvTFXdACL4gyTDGwIYstoedL780tZOgWWjigqeJsUl6ljrpBman8KYX0rND4BZs6Bd/ufY6S7gXJF0UIXxyXxxFckL3qKSpNeA2g9zmcAIFoorqtyVcw8LyV8hMmNTb34OcufSWYgu0pO3CYmD3O9QA1zrqAzHUgF4Wx43hlWwt5mqOI3una75LbJ1ZatrVcUigsvPMCXWsVGcMCZhEfb6zhzR1lliaKWZ/QsqbmvxYlhlquM+oEAwc4vK+a+ocdGIDA84JCLOaKHE2GB8vSe1B65aIm81nWWuSniZ5M1y1ccHq9mOcGlUMwX39XCrjhpTJelQfoc+M6ajTY70GFRaPIdHp9ILLDOP5V7m+ef2yHUIyaqhaKYti4O0Z3TeDDob8B97Tkstm3NiJoVCy3EOy/IsmsUl1604bhAANJNU3AWi0rlVTWpiTHh1xTFbdjnzBJsZjIhZxp8L0cti9So4UOyjD05+F69x+87XJYQqU9igoWK+n2hBht210X8pETPNTuZsADRk6lMeB8avZNOI7djrXovH48PHvT8Ikb3cEpa7I6ntv67rlY7zgVATxSNaAGxlHuuKl0cyApHamCQEkzafe8Hx9o7GRtC94o8mw/DEui7PNASnZXskhG29/p1c1FWoUw0ICG1Rclgue9SHQupOROLqNRG/ZMc2DafRiucA7eGqSc3Dp6Mc5FU2hcGtEizKU98A3D9+hlAoxHaIH42CNYZ4AsR6UJFMhC8Y3lOcW8wb7YGXrc3QGo9fAVe1xi6bkaZjKun44Yu/y1lRyelDUn34UZ6ebH5dhM7SAca7BFHlvJeuInceRPTfPjuVBkOFdAhdACvkI/fMErDFkkS8eDcMb7SFsfuWEiwzFr2OYtsVGCRSwoUA28m2tBZss0D0wSZVd4CoJ/xMB3zfc25pGCtfxJUDnvOmmLSSj1u+76XXQLEshGCoVt9MMr18FADaSWm43nUiZMw+LWBVlgTHp7kV69cP7/lUhbfF9rbK/al8BSRBHjuL8dX2Z2bul9VTYTPKXdYiKmztNb3WspUO/ArdDTVUn+Iz2/qI/v6Hpy/8LPrhEs80JT++v9v/yIp7Us51VEBksfNjuGkGGAfJy9XGByz7Z7XXhDZbmUuPqv/A7+n1DAktuXrkbtr1NSIIjSetdRS+BwpPYc3HXgM8wXtEJpUJvKgfU1x9QQzu1dG6t0pTVfHduoEAncaTu6m9UT02OaxVdLM7zP3+KDuDaVy6Qxn1vJXkZWePJ2qUG/GFrtIFIqbHwCCSs9RAepQJx8TIGd6MfDtcPsvlbWu01jp7LDJ6tjOEu6gxyJdFBklsRpRju9ireBNMEd2U1T62C2NlgkFZdM27cIPlPqQGPyv6CEqZaV1p/f5w X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b875bae5-0091-4647-ddb3-08dc6b1d70e8 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 03:02:17.3202 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3lZ3YbCUJlR/KcKySDHMbOWraMGRAfQjbdfJQYdrgt7jvcta4Y/YC5jw39jvN5fRewnQXDAzkwJaqIqwPEir5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9109 First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...the following build failure occurs in selftests/x86: clang: error: cannot specify -o when generating multiple output files This happens because, although gcc doesn't complain if you invoke it like this: gcc file1.c header2.h ...clang won't accept that form--it rejects the .h file(s). Also, the above approach is inaccurate anyway, because file.c includes header2.h in this case, and the inclusion of header2.h on the invocation is an artifact of the Makefile's desire to maintain dependencies. In Makefiles of this type, a better way to do it is to use Makefile dependencies to trigger the appropriate incremental rebuilds, and separately use file lists (see EXTRA_FILES in this commit) to track what to pass to the compile. This commit splits those concepts up, by setting up both EXTRA_FILES and the Makefile dependencies with a single call to the new Makefile function extra-files. That fixes the build failure, while still providing the correct dependencies in all cases. [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/ Signed-off-by: John Hubbard --- tools/testing/selftests/x86/Makefile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index 0b872c0a42d2..c1269466e0f8 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -73,10 +73,10 @@ all_64: $(BINARIES_64) EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64) $(BINARIES_32): $(OUTPUT)/%_32: %.c helpers.h - $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm + $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $< $(EXTRA_FILES) -lrt -ldl -lm $(BINARIES_64): $(OUTPUT)/%_64: %.c helpers.h - $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl + $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $< $(EXTRA_FILES) -lrt -ldl # x86_64 users should be encouraged to install 32-bit libraries ifeq ($(CAN_BUILD_I386)$(CAN_BUILD_X86_64),01) @@ -100,10 +100,19 @@ warn_32bit_failure: exit 0; endif -# Some tests have additional dependencies. -$(OUTPUT)/sysret_ss_attrs_64: thunks.S -$(OUTPUT)/ptrace_syscall_32: raw_syscall_helper_32.S -$(OUTPUT)/test_syscall_vdso_32: thunks_32.S +# Add an additional file to the source file list for a given target, and also +# add a Makefile dependency on that same file. However, do these separately, so +# that the compiler invocation ("$(CC) file1.c file2.S") is not combined with +# the dependencies ("header3.h"), because clang, unlike gcc, will not accept +# header files as an input to the compiler invocation. +define extra-files +$(OUTPUT)/$(1): EXTRA_FILES := $(2) +$(OUTPUT)/$(1): $(2) +endef + +$(eval $(call extra-files,sysret_ss_attrs_64,thunks.S)) +$(eval $(call extra-files,ptrace_syscall_32,raw_syscall_helper_32.S)) +$(eval $(call extra-files,test_syscall_vdso_32,thunks_32.S)) # check_initial_reg_state is special: it needs a custom entry, and it # needs to be static so that its interpreter doesn't destroy its initial From patchwork Fri May 3 03:02:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 794726 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2089.outbound.protection.outlook.com [40.107.236.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DF141C6BE; Fri, 3 May 2024 03:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705351; cv=fail; b=gKqbpnbtf1Ztig4CAmFFyQ+6PG6JgJChuT+XQI0RxXd5W7hCtSF+2mJY4L5n+0/jx1pFWdzeD1CgJMcWyWWPonSeHixcR3k50AyeR+L36P6H7AXYwfzHI7D5uazSKSl1BhLaIf9gt3VnD3BmUMtxf40bwG8R7phrWI1GVErZQ/4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705351; c=relaxed/simple; bh=cwA0gFYXz3BUdHrQnZZ9wj7J9+njZ+oBhrdJxstY7IQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=uV1IZsMmAohrVyOw1r8F+VLBhLJxZiPn3lo0DL/kwO9PaM8c/irOCgEdhMYvauxqnBtjjN+jm5Sxs4y5yDQ9dD7g8H66p4FI9Ysd0GHiVycOcidCZH7FEDji9pCITochKQGH98uc3ZdL9bd+ZpHsXgwDvj5eGqYm04FtY9P8g/8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=mGlSPAfl; arc=fail smtp.client-ip=40.107.236.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="mGlSPAfl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UztQze5idXQZNwKN0rDOCO4oQu54uAbNbvfl/mxD3HCWQu0BH0rixsOuxcm8HNMV2U9TCSwfMFVhEEzDnojzJzxXyL9OOQGTXOXIcNQfhPIbACH0Oh3HWRD+gA6egtcnCDUA/hz90NKQvjEiSsEwV8B+3Z+mmAV2Zq42BTi9kqwK4gi3wX/oi3W00zkKoavg4xbqmkA7EQwf2bybquoaebtqOP/3VaXXr5SEyxRdvKOCKcBdxvxnsw4jIH83aUSWC2Y7inhHPZpBSrXSVdqiedyjMyzFYXDyeGvDOUU4OwmOSA+6y1wJowjkuaJVOJho1SGqcQ5MKPFRj7IgEQOowg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dnmBrYk3OK4mw6MTPykzlq8+LK/K2jDYYaxhtdmsk5Y=; b=imCWiRlprgkrKQUCHm+Q6qrnJ+26Io5n4bpuACFPdrpVsNQ41ummOuoZ4P1htgBuU0ITXDvDnee2dUcLwdTnUzLwEsTXq15jHr7zLLdZCnb1aheaM+BJL8Ey9oG/92eisDFCPOeL9EZV2OsEJ8TMzLTfKMYckA+ecKtLEv+DpceWPGzXs/8t/wn+AEjaDyHaSkj4UDCqniGijEV4UaoTpC2rUZudWkdFCMRSTbbWP0xwSCjXfqJCkITj0CYoGBUT9bkNtsDOJOKRknGWK7PW4t9Tidd7g7NyeUJPyrfxIvYV/SGZ2xc/Xyy+041rRzFnYbDzssI34ACIXsSaqxmffw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dnmBrYk3OK4mw6MTPykzlq8+LK/K2jDYYaxhtdmsk5Y=; b=mGlSPAflDGZZogMp2To1RLYTULpJn0LlIKz4zRgbbZtzJSncXbSon+cKRcAuZJzOnnWtT4AbOxSubzDgDySAd9k+kcRmqb5sie/hDwurU1aqx4i4Vcn326AaCip/IV9uZUGOzbxwrifWVgEGTctTHfFOMBMb+xltP00vkacRLUDUTM2ygp2Zfkdaq7RsIjXS0RgZCFIBfgt0JmXkzSJ8e6lsKxKONkqUu0IUp1zsvrS0aAWik8fnLDRRqvhoNqbll/C54sK1ocZollqvOkpyYQLC7XyQ3cOOy9aodTYV9+nRceXU1IbhuMpC8dxXCMZo07IsyN1eGrV8z5x4+uL4vQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by LV8PR12MB9109.namprd12.prod.outlook.com (2603:10b6:408:18a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Fri, 3 May 2024 03:02:18 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7519.035; Fri, 3 May 2024 03:02:18 +0000 From: John Hubbard To: Shuah Khan Cc: angquan yu , "Kirill A . Shutemov" , Ingo Molnar , Binbin Wu , Alexey Dobriyan , Rick Edgecombe , Sohil Mehta , Yu-cheng Yu , Dave Hansen , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, x86@kernel.org, John Hubbard Subject: [PATCH 2/7] selftests/x86: build test_FISTTP.c with clang Date: Thu, 2 May 2024 20:02:09 -0700 Message-ID: <20240503030214.86681-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240503030214.86681-1-jhubbard@nvidia.com> References: <20240503030214.86681-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BYAPR02CA0055.namprd02.prod.outlook.com (2603:10b6:a03:54::32) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|LV8PR12MB9109:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ffb178f-dc8c-4d00-6581-08dc6b1d7135 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: QXHJpi+zqT0wjPI4K9x9DiRVakUE2osFjlTHQVY4cLA6Q5rVuDWsPekwL5MmGF2BqcoDdxt4CtaVmPjwxkymJNLCQSnUfVQTLEu19tQ2MRbSUS2QnJ8RGmAReEgGm74ql8nLKSX01WyTccc2aLwS0IP5UTHjdsHf+XW7H/3MdWCCp0uuo9y+QobDMdHo9xneAwTQT8gNL6rCH+NLPspa5kaw+fn6JOZu2QNbBGExhhYqK/4YUvCay69C4THczMSwvRJhz9GXuPbiGA6dhX6QhedncUTUnTz3xL29k7VrdRBxzg4s4Ah/DNDCHwpWLBjZrm9RM7T8rduHAc6G2nT9vQktbg3+XotfqX7dFkjGkpaVFo/vLYXKUlQiYxDGtueYW7POm6qtVkVdC8HMNQOve6XuFalv/JS2MWjPN/4fJOO1JCCnJ08r3BKPr35Y9FZMgQf5mPvg8/voghYDO4dLVlHzu6zXUIzIVpM7sTxaKS43kErhS3bLnOK7iFe0QOw4lfEdV5ij1U6nV9aVbEf2av0Cq3fhJ3Pmb5LSTNctvf/R4CKBJK0ne/5COzRMhuqRbiAEwt5eixxu9OCJ33j8+mHJE4Ud+u3hlglxdXsYwYMS92Gc78+01W8dP8KJRGiHaHULcmySXkXOVQlEtSjzAneQ1dPu8du8ifiG6d5IgsXxKW4l9tmkr+SQvQwXSmrhR+0AETmm5prLvLDpS9VO+Lb9oF4qlbd2NrM1cjo2dhzZyUmKQ+2a87g7Ntf8u2ziiM60Eu4zlKlt0gkts4Q85/3VFdg+GP/nssLJC0HVTkgtRBpJ00/g+jZTI71j/a/8j5TcYeQon/5xlzvmI5/JB6mwAyBLYlSVi3GL3mba2UVkN8u9mlB7gQFEPLEjK/mqtkE7j7HHSvPBPc3tSpp4z/4gIcw8JtBFnB/vIAC73i/kV3LD9K8ASONwFKX91EvHn4JP9KwI2qREbL3H1aLBCzAfaLOa1qBeXJdILM/FLhRW+/kFqTS4H2qFqMXgWogOcPeV+wJtEPNMP1E2B63rEfoGrsv72GLTQwmXf3J4dqki1mR1uMvyCBby3F/4oaI2B+nnNQGZ5vpuQpN52tQey3u/HYW0rVU84XE8tF3R5P7oW4Jfsz7wSeeIk9x3jxA0f38IYAncGirj2BL0kaGeNyl32ob/cQdsx3VU3NR89AaaAMOuwQvYdN3UGv98bmn6n7xjX/rUGdjt7Od42Qpb2O7nrGlFSiPfakNch1PPkQCxNXz9PqQsr7Z4qfE8+xAGiulPS+nVEsUG9Sfq67szFQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4130.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(7416005)(376005)(366007)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nbRUHUyr6wp3CaHySv6LE/vVAvfRnbNE58cHHyrC0VGdemCI+hHlaBRY+3KCZB2PRXtrTkbGR4rNr+6arPYvksovWxpwU6fWR18qA7qPXUSQlZ89IQk8OK3dw8Y/v27Fu/BfUUpNZ1g/BTJgRzELAdQp7hmDM3Y/BG7NVpA0RbiuAKyqFi96444k7u4tlmonzlni+sR9lYuvS51bpyIb5+dKbeYrDzzN06jk6crhSJTTlmAbG9FegmbUs2kNzjayAPwSOuTW+gixUZxBwMm5AXBMUJw9CMKFC5JSIKd6KXW7xHFfUBRvfuyzzxt8Bf+ljJHdhUq9carvMWVYNEl5aWwMQaSENpdLuNZCP3Q3Hk8NG+v5C86TXuIUXhYf0btMJZHdIo+mwaOYJBSlNIFW+tPrwCsTyxtQMM0xTKfYI90gr842y0gNLvvkU02JADMRntIj8oeKN1DpDVF0vj5MrU+3q6YzILkDHMUdOa8Zm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/qI1xLIIe9RL X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ffb178f-dc8c-4d00-6581-08dc6b1d7135 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 03:02:17.8201 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ceBZyHNiQpsaQP7HKypQtrSxBWXbd6YjukOewGvX8UbxO5mc7MXIndsk9QbTq8T2e/bn3Z49NjxglPvIFmhdcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9109 First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...the build fails because clang inline asm requires size suffixes for instructions, including the fisttp instruction. In this case, the 16-bit suffix 's' is missing. Fix by adding an 's' (short) suffix in each place that it is missing. [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/ Signed-off-by: John Hubbard --- tools/testing/selftests/x86/test_FISTTP.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/x86/test_FISTTP.c b/tools/testing/selftests/x86/test_FISTTP.c index 09789c0ce3e9..b9ae9d8cebcb 100644 --- a/tools/testing/selftests/x86/test_FISTTP.c +++ b/tools/testing/selftests/x86/test_FISTTP.c @@ -25,7 +25,7 @@ int test(void) feclearexcept(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW); asm volatile ("\n" " fld1""\n" - " fisttp res16""\n" + " fisttps res16""\n" " fld1""\n" " fisttpl res32""\n" " fld1""\n" @@ -45,7 +45,7 @@ int test(void) feclearexcept(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW); asm volatile ("\n" " fldpi""\n" - " fisttp res16""\n" + " fisttps res16""\n" " fldpi""\n" " fisttpl res32""\n" " fldpi""\n" @@ -66,7 +66,7 @@ int test(void) asm volatile ("\n" " fldpi""\n" " fchs""\n" - " fisttp res16""\n" + " fisttps res16""\n" " fldpi""\n" " fchs""\n" " fisttpl res32""\n" @@ -88,7 +88,7 @@ int test(void) feclearexcept(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW); asm volatile ("\n" " fldln2""\n" - " fisttp res16""\n" + " fisttps res16""\n" " fldln2""\n" " fisttpl res32""\n" " fldln2""\n" From patchwork Fri May 3 03:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 794725 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2058.outbound.protection.outlook.com [40.107.236.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42779282EE; Fri, 3 May 2024 03:02:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705353; cv=fail; b=kH3o+k/PmN/tgmXSWaO2iS1aHe41FDYacsjyjjMprbxqHQNpsm5Q8pf7NvCKVmJAscHrnurvrS2iI+/v2CbIRiYL1EErhYp9Dj638U9txHiW0ODFWZTUIZPwlTWScN9xrJDJU9h2J7zgwr28N88NXhtwAase2o4SkoHcHj8MUIE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705353; c=relaxed/simple; bh=rLFfhCwPVhxx2LuBytfPCW793/w/Mv/erRVKAQJQpPQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=NUesfKIxSi48lY5YKqwSSwCv0vDvwHwBfPD+u/7axnKY9z/tDsZiNvckF0xibdbRcMAwNd0IrFydYxklv3UtYsfs1cvmdm4ypt0JqoHMhE7JcIbaYHvgFroutV+q/mjnyP5/w737e4/cMbbG+1uwP2sk0ewwxhiafBWAeothQIs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=IHqPfYTI; arc=fail smtp.client-ip=40.107.236.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="IHqPfYTI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lidb3oY0xIV4IE/FpQ+sQqMuBHeaD39sc6X8TRH2LkJrVPE6Sr6JAxsrrUH4y3ctQTBiIiHnUWn4xRYKRJ2HoyNPaDCTbUWENR5cny/JcAt5Y5AhJLev88p1bP8vgT6oot2R80F+q7qFEFOgTcTryTT9SkNW9A6+ldSce8Tx82dKjlNOFat3Aovi0xNDE/GqADc3nA7trSb/Z3g6n8MR5nq+AbXAydHlNxzzyDyXfTXkB9A4+lc9ISBs+T/aO/6aYi0SqN9SoY0yRd6UZybrtBTHjj3/1v+sC6nl7A0fqR7QmBA65tlq4ZdN30GChtSTPxOR6Xk1UqAeKHVlfDJi/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VpznGdURjPIsk2AHw2htrP17OZUQysIZLjGVN0Dv3vY=; b=cLlr4DFkmXquuFzdxsSmaLNYhFn3N4YaDtutdTu/W/3ewPgga677dSKEXEzqXZOdKTWHGsTLX95a2IFx1yEFQxr0AZ4fPlb28Y5LKThZAe6aUZJj5ktRGEz2Cd/cM0VMoUSV8Y5S6lwQ/EQwI5HipA0AE24QiKG9p9vQ9I+8YDfwPoomqdMfLMTerjkmvkvGAUIO0Dfv81hTdDu09j/IyvOzEr8yQO/OIkYZ39143ubJ8EXmt00k5boj8E54G12lagYpMo1pdRQ44NwytTEm/brYDL5tW6qEMr+eGqpBQrj9ruwHkYvM1LlPX2Vu89BxhkNVSgxFBTCzDMJtmDmJ4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VpznGdURjPIsk2AHw2htrP17OZUQysIZLjGVN0Dv3vY=; b=IHqPfYTIV9kuD+5xFCh/TnDwd/2tw/e6tTDYdbDF8Y4CNlsMsyUPepG2Rx8RNNTgycghGC+FNFbWtp1w9gXteHUIyS3hSUIf6My76hrn6oN4nlrbRHKMxVc+eG9m8rYNqs5BLox+1Nf4u1pliWrXNmGolH/arEsjvhzDAlbSwDehPUpPfUdmDQIfsLDQ918wyOA8aQjtyzb5moDi98/vsclbr8LUlRQ9l5PydCdbcQcWHZzJ3oBV7DmHN0xzlwLplVnTHthPHjM6t+X9qTmznrrgQ5j5IM3q1ffxPwOmvNQmEH+FNmAiGoZOMa4jSov9r9NyrjeseiC61Ohdfq+p3w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by LV8PR12MB9109.namprd12.prod.outlook.com (2603:10b6:408:18a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Fri, 3 May 2024 03:02:18 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7519.035; Fri, 3 May 2024 03:02:18 +0000 From: John Hubbard To: Shuah Khan Cc: angquan yu , "Kirill A . Shutemov" , Ingo Molnar , Binbin Wu , Alexey Dobriyan , Rick Edgecombe , Sohil Mehta , Yu-cheng Yu , Dave Hansen , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, x86@kernel.org, John Hubbard Subject: [PATCH 3/7] selftests/x86: build fsgsbase_restore.c with clang Date: Thu, 2 May 2024 20:02:10 -0700 Message-ID: <20240503030214.86681-4-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240503030214.86681-1-jhubbard@nvidia.com> References: <20240503030214.86681-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BYAPR02CA0065.namprd02.prod.outlook.com (2603:10b6:a03:54::42) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|LV8PR12MB9109:EE_ X-MS-Office365-Filtering-Correlation-Id: 345f2796-ac92-4d7b-fd37-08dc6b1d71af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-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xbTcSw0Y3xGU4SwRWpFFM53DGOQZkH49bclBYyw13hIllId6so7ILrLrWloDFH0nkHwTiCpHDTLBjOYS21OwlywNVBrQfDhe11n+ZkBukF2lfLN/uV2dWs6WN4RvqfXzmdgs6d/pVpVw7w6M2L3nHOQIB6rZLL7zY7POq+em4z0NXL5KbFD+oIb6MtkxrNpXpbRq9mqkN4GSSBG5XFeZ6UOZozOoh00fr6MxvZPR6E5d3iNG0eq9wtlxRxNP3AuVrbjJSu3PGW5vqa4r5gl2G1q+8gJ6NBhQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4130.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(7416005)(376005)(366007)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UO0EcOmfJ/7TiDtfF51I4FQMzDLEVRyrq+gge+24urQhaNo1P4P4qzoMGXaQ3x6b52zHbLvew6UbDfMpmaWcTdqOqAAgiElRpQUwYdnwZpmjjK6gul/3ke+yZmgsXw3UFTg6oFNeM8cAhmzlx+fP8OVvgXh9w1PHkPujEvecS94T0BjwIA5dd4o3nFi2EjqpHzKXrsaCZbdJNk9t23vGtecsZqYgXwsODE0/59vS4d7RogpbaKW8BnhfeMOOtxxzHMOfgvqMo9ELinckk3raZKBbFJd4twWei0j3xBa+enQ7ytncA9dIUm1Zt0AT3hyZnDV5Jv/AG9Gi1MnJnqPDRP5RyZaraldiMr1IWaRL7vBy3gT+O+D2UH+FV5pvvfpaz/uDIIC5fOVujwrPj43VpC8sJu17BZqLsGAOAHGgwlgBO0F8B5SDSTJrREVj+RWtoUeh7i27Gyeod9jj5MEV13US8Ea5/KTJ0iEHYak97RdXXvK4ruGLv5B6CEAKT8EIwU9tdjRMf7bqJQp4GyRqMmo8PYvBJ1ZAH2IzIR2ntM/VCW/Eux7p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change-CrossTenant-Network-Message-Id: 345f2796-ac92-4d7b-fd37-08dc6b1d71af X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 03:02:18.6362 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YniczqJo/bjeESEoPJYXkG6QhQ1aNY2PWrOeuvBROU5QVlczBNnsKlzQAjdcf9Zf0jYThfFO2th8FqvbpzA4DA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9109 First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests Fix this by moving the inline asm to "pure" assembly, in two new files: clang_helpers_32.S, clang_helpers_64.S. As a bonus, the pure asm avoids the need for ifdefs, and is now very simple and easy on the eyes. [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/ Signed-off-by: John Hubbard --- tools/testing/selftests/x86/Makefile | 2 ++ tools/testing/selftests/x86/clang_helpers_32.S | 11 +++++++++++ tools/testing/selftests/x86/clang_helpers_64.S | 12 ++++++++++++ tools/testing/selftests/x86/fsgsbase_restore.c | 11 +++++------ 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 tools/testing/selftests/x86/clang_helpers_32.S create mode 100644 tools/testing/selftests/x86/clang_helpers_64.S diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index c1269466e0f8..99bc2ef84f5a 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -113,6 +113,8 @@ endef $(eval $(call extra-files,sysret_ss_attrs_64,thunks.S)) $(eval $(call extra-files,ptrace_syscall_32,raw_syscall_helper_32.S)) $(eval $(call extra-files,test_syscall_vdso_32,thunks_32.S)) +$(eval $(call extra-files,fsgsbase_restore_64,clang_helpers_64.S)) +$(eval $(call extra-files,fsgsbase_restore_32,clang_helpers_32.S)) # check_initial_reg_state is special: it needs a custom entry, and it # needs to be static so that its interpreter doesn't destroy its initial diff --git a/tools/testing/selftests/x86/clang_helpers_32.S b/tools/testing/selftests/x86/clang_helpers_32.S new file mode 100644 index 000000000000..dc16271bac70 --- /dev/null +++ b/tools/testing/selftests/x86/clang_helpers_32.S @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * 32-bit assembly helpers for asm operations that lack support in both gcc and + * clang. For example, clang asm does not support segment prefixes. + */ +.global dereference_seg_base +dereference_seg_base: + mov %fs:(0), %eax + ret + +.section .note.GNU-stack,"",%progbits diff --git a/tools/testing/selftests/x86/clang_helpers_64.S b/tools/testing/selftests/x86/clang_helpers_64.S new file mode 100644 index 000000000000..0d81c71cad97 --- /dev/null +++ b/tools/testing/selftests/x86/clang_helpers_64.S @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * 64-bit assembly helpers for asm operations that lack support in both gcc and + * clang. For example, clang asm does not support segment prefixes. + */ +.global dereference_seg_base + +dereference_seg_base: + mov %gs:(0), %rax + ret + +.section .note.GNU-stack,"",%progbits diff --git a/tools/testing/selftests/x86/fsgsbase_restore.c b/tools/testing/selftests/x86/fsgsbase_restore.c index 6fffadc51579..224058c1e4b2 100644 --- a/tools/testing/selftests/x86/fsgsbase_restore.c +++ b/tools/testing/selftests/x86/fsgsbase_restore.c @@ -39,12 +39,11 @@ # define SEG "%fs" #endif -static unsigned int dereference_seg_base(void) -{ - int ret; - asm volatile ("mov %" SEG ":(0), %0" : "=rm" (ret)); - return ret; -} +/* + * Defined in clang_helpers_[32|64].S, because unlike gcc, clang inline asm does + * not support segmentation prefixes. + */ +unsigned int dereference_seg_base(void); static void init_seg(void) { From patchwork Fri May 3 03:02:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 794528 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2089.outbound.protection.outlook.com [40.107.236.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68A4323748; Fri, 3 May 2024 03:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705353; cv=fail; b=Wykl9+fr8f8n4OiykrK9SjGCVaidsz55BoyRMzuRaGojuiTE/rq61Ft5y567tp7kYsAJIg0WHnciCi13yWwFzfxNpsZOm0bhL3jRm8AIM2dfbC9yECJrcenhQZS/iHDrHCGFO0oL0/HVJh004sX4vFkzDnTwgWmvBuRt2AHnwA8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705353; c=relaxed/simple; bh=Gv5MNFQjHt7YKiTu3eHcG3fEBXerk+8LxISmOrEvjo4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=LcZZGxA4iCf7nK5Oqff/6JBUSocHr8+61/F2uVLN2sBbBHiv1JOs5ff+TohtMHqlQiJIdzK+7iU/LU6RpzOE+WWv260ZqOlG3bKnalzCwKzZVKZJq8k8nwzRJ9wexamZouXRqrMZl6E7qeF3Ng4oN1Ak7jVG6JdeIp7qjFYnpAI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Z3Xm39li; arc=fail smtp.client-ip=40.107.236.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Z3Xm39li" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oYPidyHBSXwZf3l5/r30oqZXX3+SyJTvB+6Ode1UM3WZ6MAZMZhluUvXYBHlAN+dKrXI1ce8oqDjUS5ZTNP/aRX7u8F3KbTvJvTYbXRR2ccRTt6jCOQrovbE+BnSGjyvNSl1Qr6q5d36ehmGQG4AN0jZtOa1kQ0mi91yGFEvebfReip1RFJanWfPsid6yEkXqRyo5+vt7wgkNCuSYpELEi5noYqLDiH0c+fDbyayfHKDqC3SZ8PyHZYI1ZymWY6cEPsWGYpwhjqkMFONFhDeC8DQJynM0VH8TURUBcEAHcLLDXT4KtYys055KCifj7fo4ALXZg78BD9ZkaUSQW6rBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/ZmUlXAUJgZP4ZJ7jjUF7x2AitQ28TLfjFTzo9TywuY=; b=Ss0LP3GMEDdEXlcfjq3IXaZ07Ev07fQc6fuv+y21lwua6Of3desaZ0k1m9mj2ncDMDbR1vC8ML1nsMtWhGVIomzcgp8eKmjI2tR9hVgLSExa6zUmvbqXUTk2YKiwDq3qDDNzLVGed5i6lezu4NOYkMSD1MOprQ3XmaD/YovctBS5tn6ooEFrVMe316hLMpAQTuJZiNcX1mO4gdLKzolCsM61i1nzqvqGbwQqmpuqmKTVyTsUs2blH3/S0jxiTavboNw+Fsry+n0oHLzz+F34OKyQv3gfEtzRpWkoPqtnSvds/sEExqhdcnZ12nuX1XjgakfZ8LUko4jAOpvSKTZ/aQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/ZmUlXAUJgZP4ZJ7jjUF7x2AitQ28TLfjFTzo9TywuY=; b=Z3Xm39liQosBb3jCk/1cZDZjqZIKFO4WNRHgiBQnIeYRyII11Tbqq4ndElecWYKYZDghKR+JHnWlS2FrUpFn99336sEb5ltIRNg71Nu7zmZ0f0CJtuNeS9zp6h/cTP1nQh21tN0SX6uWpaPeJ8CinCgqpvlcCImqTeBkZ1YpSJxGT/UWDP7wjqzgLESYJLn7o3qILsWhDqzLzILqKrHD5BHPqZ+sIdYtYCcytHbHWtXAxOIs/W4/Cm3uFRn8G8RwdbbBITte8kMpGX2CTfDqd+arHg6AKYKuaeOR4GGGwEwz+jB595NPI1M0b/QtGpwa7zwwfxS3CXnBmecpXpw6Rg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by LV8PR12MB9109.namprd12.prod.outlook.com (2603:10b6:408:18a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Fri, 3 May 2024 03:02:19 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7519.035; Fri, 3 May 2024 03:02:19 +0000 From: John Hubbard To: Shuah Khan Cc: angquan yu , "Kirill A . Shutemov" , Ingo Molnar , Binbin Wu , Alexey Dobriyan , Rick Edgecombe , Sohil Mehta , Yu-cheng Yu , Dave Hansen , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, x86@kernel.org, John Hubbard Subject: [PATCH 4/7] selftests/x86: build sysret_rip.c with clang Date: Thu, 2 May 2024 20:02:11 -0700 Message-ID: <20240503030214.86681-5-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240503030214.86681-1-jhubbard@nvidia.com> References: <20240503030214.86681-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR13CA0062.namprd13.prod.outlook.com (2603:10b6:a03:2c4::7) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|LV8PR12MB9109:EE_ X-MS-Office365-Filtering-Correlation-Id: de5a64be-f814-4b1a-c878-08dc6b1d7227 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: KzZXgRihM2j9kewsqFML4Jx8w8wyv7SmtiKqR2Bk+spD3Ee4faJ7Qfux1z0840qhYQ7UAmoNuLAgDaVuUlOaZqccrLFgR83rtibwG9Zg1IkQlNNqCQq9bJVhqCvagCHrw+/jpYZuJeIRazziWkudOn7wGBxD08wk3er13KKpaJdrnwIiLsGkO1gJGYE2JbDZ/m+ztHo5DHh1AR8cuEBDPuQ9evXQKmGHFkZn9te+e/tRl7+9kf1z3bZCJDksDb8KEYIjDSaoXIGGadQc+2QDqEbERk/8fpFmDnE7Jfhz1Dt7mKfNs76wbNcpDJSRFcsn8VIA4+s6cK4NSC5++jS9/8zMdZLHnDxFzqNI+RTISoUkIUEEhNxGOSoxy8n4lQz4mXaSDIiuHF/UtvxXTkm1HLqo58cKXUzeIgZSBZywjMVBIh1CIHTJwMMARdcfOhBhTv2AeYLVJnRps2C6vQ4wxd/1ERv7RC19yHnsuXm2nLTt541hLujhv9yESy63kUBMUGD9KE+i75Q1/zBN/AeNSS0b24DHGH5g5ObhuLJn/izpkU0tik99itCFTfXc0Z2BHiQzQFedOS5USAOC/sY84wpvHh8/P8y4DtKyvugwcMi+q44wtQCIfLAgYIXFM4G8imJ94fF9y8jkVinQ59VFmcaUU/NWkdS4P8AZwRBHsw7HTOzd+lsk6CIw2R1ONbUYUk2OKJn2J4sslFkE6sJmlnkj8wx1nJuXmKLfSsvUdmEhM49SXevTUtj+6U3e1YFymvWuFt2pAlShGJ6QhhAYYd20BWEL9pSpJkEh3zEgDUo9S8Sn5y5s6cZ6dsreK7cVxU8LGur0zPJ4oU6LHoZqYWVk6l+8bbuZGy/PRDQpYNjR322v+FAnN2/QaP72FkPraKcQCSE0KD76gvNGizPcU6EKu5wHeAsRxRz2pHgmW6Ghlbt8GUYO8ejiRVDj5SxdfiqXvb3Ij37IYIFuo7VzEu52aj9oc63jBdj4Hx1Qj3KBfMBZEw9WJSnOGaj4iW3zsV87COC6iF3xx/545JBwLxBUNILUL2Mdz/0t5TOMHjoFdf8erYTR6fm9PH7n2VKL+B9DtBQ9mF6vqRM4hJnVgIH8bFaImI4amZVaPjAxzNn1BjWxDG58tyAellpTArjf4F25vGAIvmQFVg5pq5LDvO40gp8+jkXmajaL7fhQuVhH7YxfE3mtRnpaSlgyW5UYk1ItskEu5VOogSqZnBjgQi15zHhwzmCxI44e6H68aMX87qxhBZXAIIHd5UyanWvCHDe4D8JQTC+02H+JSwOu1A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4130.namprd12.prod.outlook.com; PTR:; CAT:NONE; SF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qAWn7a8kRm1bR2qZWJVYRK1IHLvJy5FTVhkzJARFMK+a9b4h0cdFAlPqWvkSdnHVRJOxu4s0HhNXWfvv8WBpmL/JQ/7mQ/3+eUjbEd3DozK71HfBnCiHpXTsNz1dtt50TPpkcqSzJVoMYdYSqUJQFcgs/jbDAPh5fSxXwk8owf2BJDY4aGwAltN8OrZERRQUh96O9Z+1kf1ynA/sfFtbH43qXqtkCFED+nr8prvJzuC7vNmhTCUCuamvNlWw+jSaiJcSHUQ33QaA4KnK7uiqAv2XSoDX223kaxNYHaXLZHaX+Cn+ZbQw4RznIbxm67SPKmZ9vikz7t0CYbNMXCaSWU4/VXIiLBDOvFTpXZEkf9obScl5elG/LnjgPAKCSnYeBS5Y7NOJ+TPTQCVDLRVFR8aJGYHPVdbWlBCmx9tKd1zmWuWEbvNQ1MjItO/ssvSpJsQ+4B0bnD58xp+BU3NtQS0JNXFo2YXzxbcfXAJCj7Z83PBFomvWQUbHE4xOXa69xQ021xRLOMH0Jh2aeUuDxAsgNZUQMNoaj+XrV7ivQ9DKmyybr8x6N337QOrkoEvxYiXDJqOM1WskLySlaLcpeqNUq0zeqUEi1gnDEPI9GCzfThpZxlQQS2FitUxW98c X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: de5a64be-f814-4b1a-c878-08dc6b1d7227 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 03:02:19.4060 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oRoy7JuqtIWscrbXROeeHA7YTMRqif0QWQQXjAGlMstSvpFzc+Xs9v737Gph4o8KzESWJu0Cobo0MUQb2r8low== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9109 First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...the build fails because clang's inline asm doesn't support all of the features that are used in the asm() snippet in sysret_rip.c. Fix this by moving the asm code into the clang_helpers_64.S file, where it can be built with the assembler's full set of features. [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/ Signed-off-by: John Hubbard --- tools/testing/selftests/x86/Makefile | 1 + .../testing/selftests/x86/clang_helpers_64.S | 16 +++++++++++++++ tools/testing/selftests/x86/sysret_rip.c | 20 ++++++------------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index 99bc2ef84f5a..d0bb32bd5538 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -115,6 +115,7 @@ $(eval $(call extra-files,ptrace_syscall_32,raw_syscall_helper_32.S)) $(eval $(call extra-files,test_syscall_vdso_32,thunks_32.S)) $(eval $(call extra-files,fsgsbase_restore_64,clang_helpers_64.S)) $(eval $(call extra-files,fsgsbase_restore_32,clang_helpers_32.S)) +$(eval $(call extra-files,sysret_rip_64,clang_helpers_64.S)) # check_initial_reg_state is special: it needs a custom entry, and it # needs to be static so that its interpreter doesn't destroy its initial diff --git a/tools/testing/selftests/x86/clang_helpers_64.S b/tools/testing/selftests/x86/clang_helpers_64.S index 0d81c71cad97..185a69dbf39c 100644 --- a/tools/testing/selftests/x86/clang_helpers_64.S +++ b/tools/testing/selftests/x86/clang_helpers_64.S @@ -9,4 +9,20 @@ dereference_seg_base: mov %gs:(0), %rax ret +.global test_page +.global test_syscall_insn + +.pushsection ".text", "ax" +.balign 4096 +test_page: .globl test_page + .fill 4094,1,0xcc + +test_syscall_insn: + syscall + +.ifne . - test_page - 4096 + .error "test page is not one page long" +.endif +.popsection + .section .note.GNU-stack,"",%progbits diff --git a/tools/testing/selftests/x86/sysret_rip.c b/tools/testing/selftests/x86/sysret_rip.c index 84d74be1d902..b30de9aaa6d4 100644 --- a/tools/testing/selftests/x86/sysret_rip.c +++ b/tools/testing/selftests/x86/sysret_rip.c @@ -22,21 +22,13 @@ #include #include - -asm ( - ".pushsection \".text\", \"ax\"\n\t" - ".balign 4096\n\t" - "test_page: .globl test_page\n\t" - ".fill 4094,1,0xcc\n\t" - "test_syscall_insn:\n\t" - "syscall\n\t" - ".ifne . - test_page - 4096\n\t" - ".error \"test page is not one page long\"\n\t" - ".endif\n\t" - ".popsection" - ); - +/* + * These items are in clang_helpers_64.S, in order to avoid clang inline asm + * limitations: + */ +void test_syscall_ins(void); extern const char test_page[]; + static void const *current_test_page_addr = test_page; static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *), From patchwork Fri May 3 03:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 794527 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2089.outbound.protection.outlook.com [40.107.236.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D98118B1A; Fri, 3 May 2024 03:02:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705354; cv=fail; b=cXErEhcBqcXLKvPqOK3bRaetAFgcw9K3q9W+olEmxiSN5vAXcQ81QdBF4GOwyTJ71VK5+iSkdHD1dzVoHxIVlj3k4r8mi+C6z4aSburZKO76hl923ENC0wvMlfPreMsDm0nFj81OuHkFMrEw7Mzo5NLM3fbPNRv4UXX1R7WNkLs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705354; c=relaxed/simple; bh=A8b+aEnZnKsHaceJ92fSVC8AA3iiS+E8E92LAo0tiK4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=jZavVWRG6DgPevCtgt//xaxMB7Ke+cXb3EwA0BEHLY2KevFMAmAyq9rOiFpoTpFAeu99L6KvMmMlfR9qCDepqroQ7l33/sSe+3EZaz0Sf+EqKbKEQljSuyMdcsRA6FNHczkjIIojw3BUphsBS/BgaeE8ylNN4M29EpUeUJ8lheQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=ZitUjLd9; arc=fail smtp.client-ip=40.107.236.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="ZitUjLd9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S1EcJcw1/6tGVOeXY2mBxXE1sQjgVcpFt5QIGGEPMegHTCl8pAf68YeaSMtg5+cYVXYFI/E+lWsQxHjHkYuJlZqXxqpWy37NU68s0k2qWZzCMpdbt7d3kC2vwbcwSA6SI3v7d6+TFKW//vAxC5pcI5XN+q2ZMmWpmviXdOxKl8PrNWh7rCuVAz1OT5Hn1YhYeCo+YGZXMg9JYO3PZ2sYthvUGfLyYvG27ws5VrPzGk1uzqprTs/vn7ZnNuUEuoSEL0LWx44CvlvF0l+6Dh//fN3Q7rW/j77Kgx/RuZFY0UUCL9v+XJ1fKYK3g/sF/ombjqACgLrlbLqmQnxQ8qWhNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jcVxyQncfHX1ly+thnXuHYz+bhZTN2O+XYhizqACyJI=; b=ZSnXdkKGL3aySbwJuI1g2s5eJdWjodTGT4w1IUEOr74VDhFKH3n6WmJt2aZvC+o/BOxTELWDsYBlZTRIHml5si1jISIdjkGyMWCZo9KSC2gZSiEsLNAAZtw9ULNq0OL6GBROuJaTr1lYJxKgV3DMIsB0JYWk5DcXX7yw2CXC8AtMdcSNGu0+wgLEbvhmg2yelDc1Eqqqf2MMDmd2X86KbSvYDQGqAOgFEjbu9ZjXzMD2odmjtMUzCFoHKNIInoTJGvppA1/lydg7ski2KxscNayK4pqkFPL0ejYXsS+lOAoSFJu/XuJLmaXWRdGs6TadJERCNLn6HTPUXjzQ/h2E3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jcVxyQncfHX1ly+thnXuHYz+bhZTN2O+XYhizqACyJI=; b=ZitUjLd9QStkrrDJn8Z0uzKcfrnOvSePAsJa8tUJFvjIwd67fNUHi64ioZHWrzioVUZAQialcv+k8Cc0fFtE6kGNJcCzmFesTdof/to/ZckglET2sMPil6TCp4ceSfAEr2EP1pwhgIGgaBUyt4TLxYFLnsl4drmRPATv9BHjgwGHHTNHe7+kV5SQGRFf+bMYRDSNw9Z4Upkj7Gx94f+LwVb6oj0yp/2WvIs6hiVNHNJCiFSTdDK4FP1OqaoqN8+9GJ+5ot2S/yuhtRVWcDN66+aiSNHDnVojqqarNbbDBKUu5RtBNDmItN41qijlxG1zwG/2xw4C+4GdYLikWlf+1A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by LV8PR12MB9109.namprd12.prod.outlook.com (2603:10b6:408:18a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Fri, 3 May 2024 03:02:20 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7519.035; Fri, 3 May 2024 03:02:20 +0000 From: John Hubbard To: Shuah Khan Cc: angquan yu , "Kirill A . Shutemov" , Ingo Molnar , Binbin Wu , Alexey Dobriyan , Rick Edgecombe , Sohil Mehta , Yu-cheng Yu , Dave Hansen , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, x86@kernel.org, John Hubbard Subject: [PATCH 5/7] selftests/x86: avoid -no-pie warnings from clang during compilation Date: Thu, 2 May 2024 20:02:12 -0700 Message-ID: <20240503030214.86681-6-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240503030214.86681-1-jhubbard@nvidia.com> References: <20240503030214.86681-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BY3PR10CA0027.namprd10.prod.outlook.com (2603:10b6:a03:255::32) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|LV8PR12MB9109:EE_ X-MS-Office365-Filtering-Correlation-Id: 54edd36c-7d95-4a20-6292-08dc6b1d7291 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: oU53Df12L+VGd4N5t3vrE3IH4yVJzbK/COQiLvZnXC1i5hrVs/02okECwbnRb6IhbHuDppAlGqGA1KpV+zekQneyLQRmaorEMAbpG1b78md5z50VsFCxiJJTXZ7GllVXphwYqiHIZjtIQKMuesBZ67CfEI+YWRCFrV++c+4a4gICiTHTd92OJkAp19ZF7zGlLNtjXijTu3tPiklkDSk2CyJKPg9SdThDRlZaf+rnrJWkiXblJFtYZCdh7ghbZKwzmPVqjRgUQAELoslGrqWw5LpW6OGzFZAYDcwNqN7Df+pUA+mmLzqyefNrHLidXehIwERqDeNoNAFCOYJGUpu2lDQenWpyxE3QcaOb+zfn1m0WR9S472TWGSv0qE57WodvgVGLQ64I6bwSv5W2TxIDxkavSIHUKO1551I99TJ0YB0p9p/Ttqe8HqZ8Xfkdepx26yUjSUMe25DyGDBYo6LPsNxje2iPacq0gn3ngWn7pJP2N+xFIGds4DT9qjn8Ny7OW9Ja33gRc2173IQUdkQUvmYqbrWtVuiEKpcgSEGkbbXqqLuv+Oi2HmpfyqLRFLNh0gkG9IKk9xA84Kg220dPJ8CZD90Kv1DnaAd/Gn2CXXmNBq33dxy5QqzsY5u6+ko27pfoaceHoBpDmLqrlQIJmeZ6xxvkSA6JkZ8i2ZyS5jK9epoaI3I+3E3o5B9aXyQMUjvwT6K2E6OfUIxD4kublXXj2g7ZrhsiRugIhkB0GAAakYsrUQbQsY/xf2OkSJPWzBgMmD70iIUUXsxW9aUGGK9ITd2/Do0klBQa47PVS2OsmAuZn1DVVYFVfONZtWI+Op1dj6WWGm5kcnbVFGWjWVfk9XJrZ8nQYA6nZ65S9y4Q1uW+vusCjF5o5gzO7IZFKQej0LvRy0dgMVyvDnpF7Io6zuabujYIzIT16uNqqwQxIyhXPxyHHZNf6OMNrlrucwhhdGM4zjc5vP5rfV+82hmuA17VLJFUwIDz/aQYW3KtK2vF1qTp+BHdg1EuBQojP5aQ3xd9M/zQlvw5TZObEiXKZPNN5XsJHFJ446uSy1B9/M5eu7hE8XLllmpKU7IktJCiN78d/6xNuRut9hPeeG4E5rtgwWhzGRQDezU3irRlrgJZU8OTvmU+g6pjaZUpj5ULQYq12yhmagY8a676D6KVeaaoC4d4skVGjcaZ56fcm+uLPib8Uo28NdrDQA1kAW/Rk/2ySj0pFQHZDnFPwTxAEOEdpRMhc/FqC5kBUnTJLi1b7KlZA1qJbHtum/9rBnwG/ehR3bmJAHiGpdy8HA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4130.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(7416005)(376005)(366007)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6sI7Lp+SSps54Lm6oC3eBxf4iB8FYXgZA5bGG3Nz9BJq1syo1nFT1rsjvXho/Ga8Z4qsdcHYQpW/1JnEOnLp6eZF/Rz60UTP+heagd0Rzi2QngCoCgtYUUL45Cv+XP/1DcXtx9aAe7kfpbQeKIHyjJ48aWDcUMtMlfuww/G40KBvT0TM9om8i2Sd89M0ZGyHYoxibE+UVX2MqgSdYthyZVeQxSpcrR2IlZMwy/ONX5QDXX+UcXxAmmsLbfDy3dxzXl4wQRZLmjmcf0YpL8SX+T61kdZm0FE74/jZONMfPRFe6IhpJu4kkZyB1jSYMhqZ+iH/bb8k8pFOrKRIP7jIJlIStTWn17UwWDkNL4l57q/DNCzQ3tOfsMC7/QqfMYf6Rg4DNUfO4O6vuy67P5ep66WFtMN1xFUOVmmLOV4pwHoxavBA4qMWgHeP/t0JTgSG0eTe2FusoqsDFdDtlBFU/2522AQWKkg4ASWJoGbiuxk+iWvsPELRfXAfYlwRxFV/Pyc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riginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54edd36c-7d95-4a20-6292-08dc6b1d7291 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 03:02:20.1419 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nRPNV3CIrgTzexZy7mzerO7Xic41JALfevEoEcLsS1THoxocQLHgLy4uN51gDEJfVAkRcr0awIImR6HLFgmjfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9109 First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang warns that -no-pie is "unused during compilation". This occurs because clang only wants to see -no-pie during linking. Here, we don't have a separate linking stage, so a compiler warning is unavoidable without (wastefully) restructuring the Makefile. Avoid the warning by simply disabling that warning, for clang builds. [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/ Signed-off-by: John Hubbard --- tools/testing/selftests/x86/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index d0bb32bd5538..5c8757a25998 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -40,6 +40,13 @@ CFLAGS := -O2 -g -std=gnu99 -pthread -Wall $(KHDR_INCLUDES) # call32_from_64 in thunks.S uses absolute addresses. ifeq ($(CAN_BUILD_WITH_NOPIE),1) CFLAGS += -no-pie + +ifneq ($(LLVM),) +# clang only wants to see -no-pie during linking. Here, we don't have a separate +# linking stage, so a compiler warning is unavoidable without (wastefully) +# restructuring the Makefile. Avoid this by simply disabling that warning. +CFLAGS += -Wno-unused-command-line-argument +endif endif define gen-target-rule-32 From patchwork Fri May 3 03:02:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 794724 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2058.outbound.protection.outlook.com [40.107.236.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17ACD2E620; Fri, 3 May 2024 03:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705356; cv=fail; b=kJ/cywSEUHxgUonADyLN5JchSA2QU6gAD5++Gs/aKlzIZ3N3vEPvIbv2i66I4Ts/n41ebBN18YNpLa9YUwfp8BIhky/tu4Wpz5KfeBk1XzcORJnPghaMfxchS/rwSU5ZMQGyT4inUXPBpVDAt+lHJh63Hg+adqAO/gkQ1gJ2fgI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705356; c=relaxed/simple; bh=qixLcQ/9RwBg4QrHTHtOrHckZ7Ks1zlFyaakKsb9xV4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=kxWZdQFFEZKLcMOrbIe8hdov3ftZZKASjlpC9aYcRxvojtobxlWwbcPqbgfK7m1sjKXGeIaWnWEqJzBWs4ysl+LmKErVws/ClRfLemps0LGqfOKPyrfDTBoUENBZ5tvdZLQGns3rXj6p9LSrLfDfFj0kqym5oStRzMZBlaCdnSY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=ZYe0C4ik; arc=fail smtp.client-ip=40.107.236.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="ZYe0C4ik" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X6XPbUv+59m/bQyzKk9Hdu+QeqDQW1hFtzhrxnjf2sUbHcfFk2B7pm47wOggGx3hamYVQYyHV3OIFj6Hn+LtHEUjBRND7u4MYQcUDFvaGWgIEeMzkBaEOEmDW3qwROvoZs4qm8slec4c7ZqAtbLSdLp4yitfcV8M+5CkNVnTmitFtXokE8GcN9a27AglFsaKNgHwVCLdJZvM+F8el/My6tGu7mLW9MNgs/TLOchv1oA405VxZgm1Hgf741UFs5nv13G/EERC3AGBxKV0+IM6stiAZNlL2X9htrJTfUR5NCTgV2Pwlt1MAPnJ5kYFs33SWWqsSDJquEXxqyd50GDlBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YUgnb09vIQr3fcTeQGm5T6f7+6e3hOEfWyZnMw+AQ7g=; b=HbwjcpZw44BkE3Rpo3zlrz/azPiyZD5FmrSG7WJiGvRZaak58Qz8NYMEMtE1ihB79hZtZnv9QlwhwW5Ejzv9lNV4wb6vWyoVoKkuu8wODnYMre8sPgIi5W6JEto9Mj2zhpBzPqRXwcZYrGvMASqT9lhGzqTxWPc70Q3IZ0iyeU5n9i+jRranjPdxxCdeJ5xoAObPXRaYOgJcneGkxMpSXJCuB0aSR+9tZVzqOIxoiJ/y+BUyJ+2E/RPRJmao02zFu114ymK4w3INolahl1DtZwPxeMKzS3uJt5RDqrUUuRolupzWoUSRaHY08N7fcDanqG7pa853NvFq0MDyLzKCsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YUgnb09vIQr3fcTeQGm5T6f7+6e3hOEfWyZnMw+AQ7g=; b=ZYe0C4ikpGgPuCCK13p6kygRaKoF6E9xDX8dIlqOW3P7MOksXnuZ79/ofrv57JevD0f63JbBIlztk65xXtSk8QzkvrRyedqaFGAwrovV5ps6fEXgNfwi0bX+GH6g1LGHQKu/7bpBSxzaFKa6YO7KN1NjEujJZp59Wcm08SsTVFYeDfJpqojIg2n8APpiAQFYuQon+ky5eUFusQSbxqxEP4vCjCFZl0X6ZgUqsUZbHnariPFsC2+oPSOeLXcPOBKMBjiVcz/dKVB5thgzSXkNVRHTA9M6QvuUkxZ67uj5Z85Irx7gm+nMimf8RO/uuomp7o3W0gC0A5fDWLATJL10pg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by LV8PR12MB9109.namprd12.prod.outlook.com (2603:10b6:408:18a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Fri, 3 May 2024 03:02:23 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7519.035; Fri, 3 May 2024 03:02:20 +0000 From: John Hubbard To: Shuah Khan Cc: angquan yu , "Kirill A . Shutemov" , Ingo Molnar , Binbin Wu , Alexey Dobriyan , Rick Edgecombe , Sohil Mehta , Yu-cheng Yu , Dave Hansen , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, x86@kernel.org, John Hubbard Subject: [PATCH 6/7] selftests/x86: remove (or use) unused variables and functions Date: Thu, 2 May 2024 20:02:13 -0700 Message-ID: <20240503030214.86681-7-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240503030214.86681-1-jhubbard@nvidia.com> References: <20240503030214.86681-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR13CA0062.namprd13.prod.outlook.com (2603:10b6:a03:2c4::7) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|LV8PR12MB9109:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d287a72-affe-4a7b-c688-08dc6b1d72d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: lnatlGNJfk9w6koRYePH5NZGgB2ZdgfTkLnVb/Ti6Wb3UA371nkFECbeM5MUrv7iJKzdiLFkx1SBMZ+JytMlUYIndOBldW7+wetzirKsyj3MZ/GFu6GRES9rymvxQn7pY4zG7wOVc5FglGGWbmQDA4J9wldSI7HCBZziFXjnBINqMrdp/iCsTLjLVDQhyuytnECKSvJ0umHh9CWVBWpmm/QZ43XK1Ybw9+4/w7Ajity0Zyjrt1FERoeeDGmiZLMzDAcEVVZgIlcbqF+Vhx64NZ1X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PV:NLI; SFV:NSPM; H:BY5PR12MB4130.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(7416005)(376005)(366007)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LjFBaQ+hn95mU9QZ9PflgOqxsaeC0W2tTMfx2fmHhrob4pqto0Zn9Mu5udo+r31fF2UnTZsveaIzJvyq53nj2xSwuIyNcRnIsk6gAhcjuKXoRXajkd2qgJ3z5PXU/bD+Gw+fCFvppCdOx9Rlhdv9goiB6bV8RtDsT+e7oRUy8aFl6qDlByzN4ts7VMV7KQJhqRyICCPpKDU3Sh/m0JRfaDopdY7p4JAU8kGyKZQuhgcWNoK7QjUK+kczn1N4LvM1tWa1aKP71k6ghlOT+36GxRy+aIZJ30zB8m8KibEI3RO+L2Mx5w0zMGnhQp8b/aBuwEAEg6igWsbaZHBodyAveTTIMXyGl2oJg9+OBoxK1lKnseD90bFgxsamZ16AKWCP+ix6CsmTXwXlnSsfANUJW61bBzaENZLNcFyOQNc4dQNK3HCiBzQ6QDEJf0b/fQG515s7cdLY3nwJAq1Z/Ppwvbp+bYVl7uPw1tAufI/VfbpVnanHouUMN0Z0Dkqdzv/o5MUntWbgePDvFw2pwjdA8DeiEwXg9Luval6BwmzvQI4qBXSPHkc2fegOIqWcPQqfZGmpo5QY+fiJY1XRF2bQDNCfST4GN/NOG+EJYKA/Muf7Rw0YnZfJRyeUx05VndE6upIdf2e+Xdf4agJyBw6NGlqNB20imbceHfe1Dh8Yl9jHPr9bTZPyZhsEEsjLW9kfBUdCy6kSobXiX+vWsWWm5fOBcJl1J7/zzMkctF/ezC5b8HxHx+kQnIHoGk3w0oLp6+an/NVP+Z5xAopk2h7TySGnDpyuYZauDVw/nssBAHjZdspmQmiPaXiw7qIahhlWRkxJgHup4QhKGPOoYJZ7LT2K6nyX+m4uOiz5IZWTn9vGhByMhMT9212RgTlOSClflJqPMKAwrML0+2cjYGUntziFgp2hMGkewkl0J28M4VO0pcTOB422bmACdJ6hBx1bZGR/tabf92gsXxV2On7fHRHYokKur9s7v2xXuUpgWIzGzS23DqCbO5L5HfITjmaulvHxm/7X5keVeWHi+0TJhbR8b5huJoTvz6524nRgrxz7+33o+BU+m4b3XYmc+b8vGY0W3U+OtrAkyvcTOUTRnpkstYCVUMrFVGMyjMgZJO6U7q/rzXMT4NPm5FIqDkt5DwJhv5TAnxr8BxspBqF0z6j3hmCm086D/gS+QwWepfxWmf9t2lyt9AaJJhd/ypCuWZxNY/C0mrnBJzKMJfgu5ExsfJMwKAwEPP1xepX9GITgdSgUb8oWrG5R+MIm6I72J944FEjZoklQ46eGH6jjj4Ej4EU29SmIJtVA738ek+PMuIG9E7OMpF4p90+abADJ0wm37o174pXMdyRtxQH2EVERKoUH9t/OG7HdRy/h2dIk+QpPE9pB1MLomLn0A9of4DLZQQ5yG9z4LNjePAN3+j0HAMQQE9hdqyD/qPJXu6XnBHu77UVgoZ/kFdxOnfk0Ogy7r3NIOfUWyNl9zvDlCc/EiihR36adxkf1692JucivNhbT7mJ8C8mTxuj/7EEZbJS7KQiSwxaepbneh0f9m8eOMwWo07ybRHqiyz4Ge+AP1XYECu4+ZTFO1rdvk0Re X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d287a72-affe-4a7b-c688-08dc6b1d72d3 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 03:02:20.5341 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: i0GVUYpEQyxtl6MXXkBvCSMXyedkL5NiCttR+UlvO+1H9k+Q8hrHWmoF0j04FukFnNHVd6p3Fu7pYSDSz/kgHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9109 First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...quite a few functions are variables are generating "unused" warnings. Fix the warnings by deleting the unused items. One item, the "nerrs" variable in vsdo_restorer.c's main(), is unused but probably wants to be returned from main(), as a non-zero result. That result is also unused right now, so another option would be to delete it entirely, but this way, main() also gets fixed. It was missing a return value. [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/ Signed-off-by: John Hubbard --- tools/testing/selftests/x86/amx.c | 16 ---------------- tools/testing/selftests/x86/fsgsbase.c | 6 ------ tools/testing/selftests/x86/syscall_arg_fault.c | 1 - tools/testing/selftests/x86/test_vsyscall.c | 5 ----- tools/testing/selftests/x86/vdso_restorer.c | 2 ++ 5 files changed, 2 insertions(+), 28 deletions(-) diff --git a/tools/testing/selftests/x86/amx.c b/tools/testing/selftests/x86/amx.c index d884fd69dd51..a2fbb9b58ab5 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; @@ -179,12 +169,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: */ diff --git a/tools/testing/selftests/x86/fsgsbase.c b/tools/testing/selftests/x86/fsgsbase.c index 8c780cce941d..50cf32de6313 100644 --- a/tools/testing/selftests/x86/fsgsbase.c +++ b/tools/testing/selftests/x86/fsgsbase.c @@ -109,11 +109,6 @@ static inline void wrgsbase(unsigned long gsbase) asm volatile("wrgsbase %0" :: "r" (gsbase) : "memory"); } -static inline void wrfsbase(unsigned long fsbase) -{ - asm volatile("wrfsbase %0" :: "r" (fsbase) : "memory"); -} - enum which_base { FS, GS }; static unsigned long read_base(enum which_base which) @@ -212,7 +207,6 @@ static void mov_0_gs(unsigned long initial_base, bool schedule) } static volatile unsigned long remote_base; -static volatile bool remote_hard_zero; static volatile unsigned int ftx; /* diff --git a/tools/testing/selftests/x86/syscall_arg_fault.c b/tools/testing/selftests/x86/syscall_arg_fault.c index 461fa41a4d02..48ab065a76f9 100644 --- a/tools/testing/selftests/x86/syscall_arg_fault.c +++ b/tools/testing/selftests/x86/syscall_arg_fault.c @@ -29,7 +29,6 @@ static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *), err(1, "sigaction"); } -static volatile sig_atomic_t sig_traps; static sigjmp_buf jmpbuf; static volatile sig_atomic_t n_errs; diff --git a/tools/testing/selftests/x86/test_vsyscall.c b/tools/testing/selftests/x86/test_vsyscall.c index 47cab972807c..bef6abac331c 100644 --- a/tools/testing/selftests/x86/test_vsyscall.c +++ b/tools/testing/selftests/x86/test_vsyscall.c @@ -160,11 +160,6 @@ static inline long sys_gtod(struct timeval *tv, struct timezone *tz) return syscall(SYS_gettimeofday, tv, tz); } -static inline int sys_clock_gettime(clockid_t id, struct timespec *ts) -{ - return syscall(SYS_clock_gettime, id, ts); -} - static inline long sys_time(time_t *t) { return syscall(SYS_time, t); diff --git a/tools/testing/selftests/x86/vdso_restorer.c b/tools/testing/selftests/x86/vdso_restorer.c index fe99f2434155..ac8d8e1e9805 100644 --- a/tools/testing/selftests/x86/vdso_restorer.c +++ b/tools/testing/selftests/x86/vdso_restorer.c @@ -92,4 +92,6 @@ int main() printf("[FAIL]\t!SA_SIGINFO handler was not called\n"); nerrs++; } + + return nerrs; } From patchwork Fri May 3 03:02:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 794526 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2089.outbound.protection.outlook.com [40.107.236.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9E0538DE1; Fri, 3 May 2024 03:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705357; cv=fail; b=lF1dIVBWiSX2TR/xMLcdHicc1nk/4/AR8bChlXNwZcSKO9O6o+p9f1zrgAjbNoMgUKcVpjKvA8kDJMhhB6FanqNTUTRra2gjFsr4aSurhHUCNDW9F9ofWA78iFHhFaIoroRhVdSULdCiX2+WcPq0zF8qFUUrzIBR3JZeRye1wnQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714705357; c=relaxed/simple; bh=q/s+MCqqUwm9QYyXcfnP6HFL7eldF6hXYw3yadOljDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=YB29xuJIyUB3Gftjnx34QfxPBClAwkjUllrRnZ6O/WWN2PLQybhzw+kjw+GS2zZEKhUpjSyBANSu2hoeM/MkxNB+uReyK0M2oW0HTepMH/gsJ6L4n6hAe48YFLmMeoM9ds+J+60xhanP1GwEsG/GcZsMmDW88p33+/MrFwCSjxc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=VROUjg8z; arc=fail smtp.client-ip=40.107.236.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="VROUjg8z" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SF5nKRaO3bYY+Npvw9mp0TtDy/iNPW4XslqM8BoL3ucuwiHvnNEL2XMnFcC0rDfqCbAZWfUQpBPFIGnqtDvMa6FBmYg7uV8529cjvBYciz4P8uq1SDhD2lqfvW9D8uvb99FY7UkwY5qZXr8Ky5Suuhz0lVo0pB7+tUEeXNCVqRctPuMWpn+cPRy9HXeWCc3+mIaZmmcSv4rRxRzGtAt6ji1iclS6EoxxMQJaZGChL4MPazvz3d/Qo/nEzHh29ypQlsahL713WdGFcAqs3IQa7kMKeojO+8zs/D2R47mZiFzCA8pyS7z/QkomFaVt7fzuhDVOghv1eQSQfm1pR4Ykig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sRSf0YN+kJmQNBcetisQfacrBGQy+f7g8zeYtQJYIXo=; b=cNDd97JMDxE8lDw/qs5z/9T6LP1p0kjHWODLXtm7sDodF2puQqnE5L3A5gH3YzKuNV5W92Is/9xFjCVgW54mLsZxWgRVAqxVPsr/ZW8tj6qfUA3klPiZKwb5bLvOSqQsk1HArVEa961nW/z02sm5bBU/NcLhmLhlX89ORqzf+QQmongFaTPFKohb2fnsi/E3xM3Lg+fYnq4yxAGsGxHtLipzKipD1IyC42Sm6EDQMwvp5R1qVM7PljmuxKdAa53Z1kiXpO2cboxrKHkMmy74LexX8PrDPUgMULCOuiCLZ1NioFse7zBulwj2Qw3XDNauEVtgOijyFqDSfYtnf18eOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sRSf0YN+kJmQNBcetisQfacrBGQy+f7g8zeYtQJYIXo=; b=VROUjg8z6N2jy56FLiR4C6nsIbfuz1ZEn1JCWKAH7eziF2adA4RltzBqnc0uoeZMY4a3/FOnmR8m+AU7Gq6hYIVHb+4mg8+NTTrzxp05iOH+yUPT0G9EtDw17fn8bqax/UtRQmrYterXRqEFw0BrRHZCdtlCX6lUKjKhEnHTU6VsvJzuchVkvpYfgYBDvEevN1QIKMrFNk1pvpx1kA4CX5ynOsCzQXgiGJ2sd3ak4KQtqJf4uP2c/vakY7YZlN34XiCJuKz2m04oK+gpxaywN8j27GKjdSF9E34wJKcbHdnB+ohOq47BFhybGPvDPMeyIdmtRYhzw2UV2FMreGEE/g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by LV8PR12MB9109.namprd12.prod.outlook.com (2603:10b6:408:18a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Fri, 3 May 2024 03:02:25 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7519.035; Fri, 3 May 2024 03:02:25 +0000 From: John Hubbard To: Shuah Khan Cc: angquan yu , "Kirill A . Shutemov" , Ingo Molnar , Binbin Wu , Alexey Dobriyan , Rick Edgecombe , Sohil Mehta , Yu-cheng Yu , Dave Hansen , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, x86@kernel.org, John Hubbard Subject: [PATCH 7/7] selftests/x86: fix printk() format warnings Date: Thu, 2 May 2024 20:02:14 -0700 Message-ID: <20240503030214.86681-8-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240503030214.86681-1-jhubbard@nvidia.com> References: <20240503030214.86681-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BY3PR10CA0007.namprd10.prod.outlook.com (2603:10b6:a03:255::12) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|LV8PR12MB9109:EE_ X-MS-Office365-Filtering-Correlation-Id: 6eb231eb-789e-4e70-4b9b-08dc6b1d736c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: DgFiWw+ltA+agySUdx2rlsmnyjD/jUgZQsR7cqceYsLdLxoyumaxwrHRNYadZZsRZtn+7eOGsOqea0Snz53DC0ZK+HXmo9lu4H5WgmZLg8qBhltMF3dUTNQKXIFql+EXtTADLQhJ4w2s2dbP0u5U7s609YRHK7C2BRcJEPSdbJXPhhLoTh7UOrSlVvDn8HKrN45OEVHw+HirlTwSaoQWeGdjlws0vQT+bBHKHOh61rzZJPt8M6kDbEit1RpZSGVy+inVwJcFDjfbIKCJqmUaiEeSNQsdJ1H0OxceSNI9zm0D0ZvuWJ/+LV8E4rHmD4kwHyC9rBl4lIMxnqX4G/urgIPqXthkUkDNOjVf3U4DqsrN0pC6GiXqGVTQixjVL76800aS2jyv7Bq9k6fZgRfUK+/OVNUOKcJ6yUwxFRBQDk/vN4ngO7dW4v1x9VR1XqKIQeTQ07Q3Kz9z36NFRKpLpS49+tFLO7HyejJaQONHPI0WyQ2fpIjhu/ylrJMm0jHVJ3fKuWLfE7Roa4755o8LswW9uxOLZXLSax9kL/tyHRGjQ8dFFFqXaVGGYEKraBwK64SQORWzIBJa25Cg/FpN/riPm7nQDPKs8V51cR3+h64qIewsfvG02eNieCKCVCKK+u7TjHSPDWtk+UBoyMjeKi3AFeyoaxJwQQZdChjpQAiadbZhga9eiLX+eGBSlDEm+5qY2pmRW9xPdr/FsoxhScGKljP6wGaPmf5T9PqwLG81DzV78cguEnOn2bX4k7M0KZldEnmZfDAYodMw30w8ezQUtw1NkusEtuqAElNfa5qVBauflMq8yPG/sUKW8Ibt+n8F6uqdetmAZ6B+KJmLITx/gqYhtSFHqxH1PQYoEBkIxs2V0ucLWB/XArQb9XIZdAaddpy2tbhHyippYXt8W9m8vWeE1wIpChrOVpb+Ej2VQcir1Hl0/+XaS9/v1emC+v/h4jlThxc8dQPwKsJ9vu0uFY/Y2U6ElEdlL/o3fRmjzksZdnePRBHgBidofB8EncbaMX2Zs58WZ2lOZUifT+6cUvv+X1ZB68IfIdu/Abdl2ok3L4RxXHue9Deez+C84NWpvqQX5WF3lTUkZsnQlucGYJn/UjVRblw1POSpAiyOYXqovBBDZWObWcWHZRhVubtbeehaYh+LQ177OHzDZF0HKQdBaWKIi21rg1SISHogwu0zHlIjDVOqQcXScEq3Ku0e9OUzEdJNduA1bLp/77NmEUwmVqdkmCc1Q7+EsPjLKYnTBFpRWiyFvQtC4EYHNoDLwI1PfRb7C0nWUEPLYQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4130.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(7416005)(376005)(366007)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sfgQyftVYjX4rM8wchjQ7H/ceO57SYB1RYIl7HLHBn3O1N0JV9TwdEIO67gY1CLcVsPSiF9BHaMeBF0PSc/+TzrmDRDSywW7OhhoDnAJGXVuQfPMWelXcp/o5Jz8Mbd9z9EthunghZy5NleYn02Abn7j3sBnwulD52qv9/zZu9SXZKHQII3h1dRFY2E3+up5imN2+Roj4xEetVBbLfMNK59FpH7dVqxEhTuUheOBzQO0lHRac+SAOY4P/sgvEahqMfJJc5t8kLd1TNtXQv2nmu1FO9WuZbL+fh6uTLDuMUNZ8I66f6HjBQYDe4tuzILtjJ9/BVEtepIL4umH0PuPrGvdHdlNthWNWkSexyhm9awVfovFU8ONrxFDnDkdz7SDhmXYUYnItiGqhpzPqa8ySWW7Yl4AOdjcEUkSGgTZyie2u/54RoYn6CMChhGluEyuv9HuV09a04z5NPVu2r6NAotPmFJu59GwipwyKFgDPSC/sjAJelXNlA63wqwDV9DIZ6uNUhIq21cFc74h96tORw0UN3hW+I4A7lAWksiPyaKRytxIthNxQSh5i6suXUWYqoyYKb7mIH0d2oDlqNamuTNbRgGl2hilBTgpHLczin9tVu6zKxKTxWabmY82cyHh56/L2660muhAbONw4d+yyy2noT7hEzuij1Jo0zU2+7hm+zdtEDwpyEFelonSPEI95kYh59dDrFe2C1+AxwipmFvL5GUGfoLukiT9X8F3l8W9ntY6kdGDIdSO3fqWTW7Fo2lzCIWq5xdiQcWQjgYkn95kXoYzgg44ZlncmbAFkYw7Qi1ry52fRtwNgeQmw+fTrIeW8vMHqEmV0EB2YvUyqWneV0bI5ruMGOx3dIKj96yOI56lFp7mWnDDetXkae9xD/TApj3xEA3S0//Hqzf+uXOGrUJWZrGxbDMkebHnLfgZg44ipYxxiIRta5hjxYeKPUt9nn8lqUF6PuD2kBM8dge9cxp3Yd99+0lFZ2ZZEIg8bThX0kZ0vo35Md3PWY2DKW1g+IuZiP/0LzhNOeD+5FEQJy9ru8ei3B6ZbO8uiOkJtNoqVqjDponAfXQHE+fDpnYspZR6T80k1p11J45pXEA4OOzWxogT1LEpNCDU652jsL6TP9sUD1JnhyM0tdddDRAmDCzez8MU0IRRPil8scBf4lLtdSkEkdejyN/dLCOaS2+i8qAVKc8z+UtrSvfkETxwuy6bHzVDCgp6aHPO/AvdcOJ9Z/VYBNtRvj18i72k8wJudmVwYAf2jBAgaGnqGqDVUNj3R92Kpok0E/gX4xoexHYt7hOgx3SH6XsmDTOTLN6bFR1RJ5nFySIgXNts0XFqWb4zHJjHTa84ih4SE9GKmVlMj74RTE/m5EnDXE8ND1624lMREmF3XVaYEkiNCl5NQYlxDpQmyYJkBLKhjNBMCr7lTBozxGill77w8KIMIZkB5edXBrXtkTTmaPnHojzyuz2C2umDkx3B22ksIMwj20UnJm91BK/sMRp9hL264trcz2arADmPx4cOJcinrR7tB13J+AVeJRm3U1pz/im21o55h/HxmQy9Ily7NbL6LjLjGDXKsfA7q+Qx474L X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6eb231eb-789e-4e70-4b9b-08dc6b1d736c X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 03:02:21.5391 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cYB/eqgx1kdCi7hTY9QaRzB6sR/EpFq2F7of4HKWLE9ofgfGAlROmaMBMbi80fpiOgPq5ltfNQcYpBmOXwO5qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9109 First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang finds and warns about several cases of using the wrong integer size in various printk() format strings. Fix each by matching it with the size of the associated variable. [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/ Signed-off-by: John Hubbard --- tools/testing/selftests/x86/sigreturn.c | 2 +- tools/testing/selftests/x86/test_vsyscall.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/x86/sigreturn.c b/tools/testing/selftests/x86/sigreturn.c index 5d7961a5f7f6..0b75b29f794b 100644 --- a/tools/testing/selftests/x86/sigreturn.c +++ b/tools/testing/selftests/x86/sigreturn.c @@ -487,7 +487,7 @@ static void sigtrap(int sig, siginfo_t *info, void *ctx_void) greg_t asm_ss = ctx->uc_mcontext.gregs[REG_CX]; if (asm_ss != sig_ss && sig == SIGTRAP) { /* Sanity check failure. */ - printf("[FAIL]\tSIGTRAP: ss = %hx, frame ss = %hx, ax = %llx\n", + printf("[FAIL]\tSIGTRAP: ss = %hx, frame ss = %x, ax = %llx\n", ss, *ssptr(ctx), (unsigned long long)asm_ss); nerrs++; } diff --git a/tools/testing/selftests/x86/test_vsyscall.c b/tools/testing/selftests/x86/test_vsyscall.c index bef6abac331c..63aa3abcd741 100644 --- a/tools/testing/selftests/x86/test_vsyscall.c +++ b/tools/testing/selftests/x86/test_vsyscall.c @@ -328,7 +328,7 @@ static int test_getcpu(int cpu) if (ret_sys == 0) { if (cpu_sys != cpu) { - printf("[FAIL]\tsyscall reported CPU %hu but should be %d\n", cpu_sys, cpu); + printf("[FAIL]\tsyscall reported CPU %u but should be %d\n", cpu_sys, cpu); nerrs++; } @@ -347,14 +347,14 @@ static int test_getcpu(int cpu) } if (cpu_vdso != cpu) { - printf("[FAIL]\tvDSO reported CPU %hu but should be %d\n", cpu_vdso, cpu); + printf("[FAIL]\tvDSO reported CPU %u but should be %d\n", cpu_vdso, cpu); nerrs++; } else { printf("[OK]\tvDSO reported correct CPU\n"); } if (node_vdso != node) { - printf("[FAIL]\tvDSO reported node %hu but should be %hu\n", node_vdso, node); + printf("[FAIL]\tvDSO reported node %u but should be %u\n", node_vdso, node); nerrs++; } else { printf("[OK]\tvDSO reported correct node\n"); @@ -373,14 +373,14 @@ static int test_getcpu(int cpu) } if (cpu_vsys != cpu) { - printf("[FAIL]\tvsyscall reported CPU %hu but should be %d\n", cpu_vsys, cpu); + printf("[FAIL]\tvsyscall reported CPU %u but should be %d\n", cpu_vsys, cpu); nerrs++; } else { printf("[OK]\tvsyscall reported correct CPU\n"); } if (node_vsys != node) { - printf("[FAIL]\tvsyscall reported node %hu but should be %hu\n", node_vsys, node); + printf("[FAIL]\tvsyscall reported node %u but should be %u\n", node_vsys, node); nerrs++; } else { printf("[OK]\tvsyscall reported correct node\n");