From patchwork Mon May 27 21:00:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13675761 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) (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 17E0D5490F; Mon, 27 May 2024 21:01:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843673; cv=fail; b=LIM9UwfNL2GzGAevjxXQI1gCk+afVHf5T5vspr/KtIHyquwoHGPGhh5ghP84nFILi61YphjKRGO0k949ggAnPMvHsdpTRJix1bajHtqIq+sySYnfnBvcpu0ClAvPKuuy6It0Fr3vAHlXjoCP89oqdX1TbB0GtEDCQlix8/p4mgY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843673; c=relaxed/simple; bh=gihCW5m04bS2+gEDSeKFO1ATJfmQbUY5i7jlNe6gTDE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=p4V381dNOFCEwQZ/iFbh9xN+P3wtwuSuV/7HDTJPtlyKihDq8owzj2TTZApOiVrGf/dm8+IjYJJrPeVHdmhfJYCTrRjk1KeerFQ85xw3sZDL86150XnnPm2dLC54+yPxJ0JGX3DA5vWBf1z6aVTQ65RktWM2pLWIIPawQCBqbN0= 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=FqGps3La; arc=fail smtp.client-ip=40.107.223.83 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="FqGps3La" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WbJu0G+7IhyZ1zk7p4IMo7mmDJ6H7h6Jc4WH9YALlXHATu4Hp46O0bMeBbN7Gtfepr7SMsL0lGCT5LyOnLFXq7DLofoTxaLRphOdfsyAKcqycOZW1SJCazYEWEMT9GkPUO8BaTKeGefKfaZWFglMWEK0jC8KMdRFh2GTpNKBjkzmlP5IoWbEjlAdld8TgauUQ3Cu6K+WgQTRhAzCkPj/bCH0NLrmcWNQio+/8tlt/uiqBQTZTRnyFzAR2/RNcaTjlm19YHR4ro+c1B9/iOfF60cYcJLSywrBDc7s+ZJ1YSXLzxy/lCE71wNv1YzJzwJpK4y9guvX99xJbMchOWIQaA== 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=Lqlw1it8KDqJAzssbYcBZFDteKEWA6B8BUPTxuwUxAk=; b=jMAjWFtdNCr9hoOFXPcRantx5gd439nrGh5VdWBWsVJDWJbMQG52Oqc4vfTJTLbSeFqlUvUc5g5pUUFEswaZc+WJM3I/6wCn9S+ShT5fw9What3QhB3G1shRmCFWkQnT41Yki0guNcDGvAzrzuh1QSkYJF2Kf/YhWNQ7EqXTkaUvpl72caFIZTPV8x8ytOZTwqougq/lsNktDE0bGyC0nxp7Rb5CZ8XiW40MRnde33ALCeNBl/WZg6CT02Ds6/Z0jtp3laROcABuivhPpuohR64FjYCpkG1onOTAkxMd+ffyQINOoGZnSPzMY8ccxCqEKTAVHGQzuBHTiD8SndLbyw== 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=Lqlw1it8KDqJAzssbYcBZFDteKEWA6B8BUPTxuwUxAk=; b=FqGps3LarIow1ITOspvCK0C8I80CF4MfNIS/MkzXzGpQLyJpQ1o3HtOo0cPOL7FS5EndJo0M3uoB0j+o8JXiXvpW2Sjilu9hDXdOAFwaAEwxCDhnkh7MukEx+WuVpOj3S/ipX290mg4NbIt5qfANsRv/XKk1NSqhFxMb0nvdNazlS0qPJI5Ll5TB4wwgfi4W6n9Ot/iF46x3VjHciHqmv6ej9SBwtLUBeE/PVkKK7bIoHIJwNjf1PdpU+PTiaXBItFVbmsHbpKvKENZ+k/WWBd4NBtRfUpMG2RqHAB/IRulV5m1vEowXPM5w7mA8OrGrZYlGKS0OU+6ar4N3aYbwrA== 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 BL3PR12MB6620.namprd12.prod.outlook.com (2603:10b6:208:38f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.29; Mon, 27 May 2024 21:01:06 +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.7611.030; Mon, 27 May 2024 21:01:06 +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 v2 1/6] selftests/x86: build test_FISTTP.c with clang Date: Mon, 27 May 2024 14:00:37 -0700 Message-ID: <20240527210042.220315-2-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240527210042.220315-1-jhubbard@nvidia.com> References: <20240527210042.220315-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR13CA0124.namprd13.prod.outlook.com (2603:10b6:a03:2c6::9) 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_|BL3PR12MB6620:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e7fa411-3e91-4f08-bd7a-08dc7e90201c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|366007|376005; X-Microsoft-Antispam-Message-Info: ypyK0Lv3hL9zSgKzTZ722r1F3FG6Ap0YAl5/98KRlACK1T0hJ3ZnxlkCibE1ydLMZxcs0qUJAuCXUZqku0UkWp5aJJBGk/Ci9akCQJJMpk7LZN5SS9FvG+Hsz9W1O866e48R+JXi95Khhg89eDBUEodCdtWndoWe+FVTW62IfVFuGyypdpkZwPg1By2YMsfbXZe4sRZ593Q3YE8TrIpA7ZgiwRG4YNzNYtWy4s77l9gary+7wdQvuRdXbANn9PTkEwR/nHRC3cHw5YGL5aTg9FurxwBLd9FbhELPVoV+Xt7Ezn+eQ1KDTgco6OQLk7a4uAtNH3eiI9Lckw4dsw2n+KzBZzIZg0jANH6wN5pwZ/qfi8gPhmXPV5jrG+yxjoFGMCnkNigT0r6fTXtaq506BdxBzgjP1t96maXdZrpb4WyEFfUPKUOolMvTs667re9QgVHs3dg2rACq8TtFYWWIp/tC7G6/fOJR/0R9xgTDIFoCV/hs7z/nFMF1mi6NXRzoqfrHR4U0bSPt1in3oMvyG0TgAQZtWq2YLCY/cotI68WBTedrqE8DO537KLZo/lCxEav8C32lzxMqpXLXRhd94daAbIHNJ6EeGuEcg4bu6uSPmO33q9DMNMePuLZPttVusdLJtwsgmmARAsTH/F3x1OKQoPvlteQ1SROmzNYZIJlPYhJZiEbUSwdSZquzPV8bFod+J0GJH5/yOd51NQ21jNc3LGwRjpEp5GuHaaMWHDW8I7OL6qZnBaBlXtaFBi3CV06JadtAClChwDSRF79ebkkwdD3RaiZ8d6iFsV419cIW/zbIY8CVbHbJIltJVIPfFour1YFwf0debVWh9hfHqjlNW43Aq1g9boNRaw0T1UoOK2bamPrIWubS8eIARL3cdcKa17mhYBOMKklQ888iKWgySfoA8Y/4FDbAy8WNc5kX+Vzs1ffMmKTb5DvT/pqgwWp0wDO6UMluL92rLpc9+/sRHTfmTqDfdngmKeRGnCNBROVSFJfakc+ScvI7m3kN1Rwtsoa0tsi0uzIG8K7lc9vuqOAEd+91ROWdQ8klVDDdNxosCGVeE2GeIa/H8hHuRONcy2kYsxNM1FtBXgigZkfaEuti7O1JUjcqYUxps+TTCM6zPiA/L/EHsPn4rUxTSd3WpQ9mKXZTCBRjo0LK+b/ukH86duLnm106quahDBwuuqWi+nHMeubtyk5WdXUMHUn3AhMnkQPPohThQ4DcGTOXxCthBSFBok/3De81paJudbYcwL1aM94HGSIPOAxLgkcnzHqFH0f7mPubAJAkYg== 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)(1800799015)(7416005)(366007)(376005);DIR:OUT;SFP:1101; X-MS-Ex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TZBntglO7UgCZjFZEKBGNwPa+zda0/9MTUUo4hG24LJraX+SVJr3umKuo5cf5CBdj4ayg3Z+2bItzITm44712S5bC0J76QWmbFgmWLXiV3VMihCaOZa7zGacCbfytcAdNcjGryblVPDT67DREQBFFz99hUmo43Gdr7mG0ETVPpad8tFRme1zVEb+YNbqm5Y4w2cU84P5m0ruEue01vH8wh5eSq/4JjxHrrX+wl3zXLTUa4DrRczLK/W9FFd417i9rUmLVvPu3T0vv/hRaS82bsplkuv6yLY7psNl5RcalYO9p/Ws+ADYi+0O76Q6oo+Y7OJtGVdbfgCq15/NWrjmkpLn+Q74fzG6+CR+jE+UG3VgL6vDoyS1+WA8cKschGAXVuhLcZb1PcGRrk0deNXz6TcrZ5mb2SV+yXpevaNQznfMfX8MeWt+RkOE4y0AnDcDKXhH7joKqpDrxo81qzTP0y5U2Z0+aoBb43jJcWaXejoDeLe8HfXSM8g3VGEeV7tPbItimgt0mhjgbI81nr53jNQ9ysSlkiAj4C/PXQjDLG6xFcn5YzKwTc3NgvHtsdlKzgbbuLTabg89UpPqcjLFeM6wvw8qDdtg== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e7fa411-3e91-4f08-bd7a-08dc7e90201c X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2024 21:01:05.9769 (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: OOGDj7E80quMekFM1echALrtZxbDfzx4DJGFux3mypnOgQKxP5UGbJhg/75RTiuYb/0LAkjv2sIK5AoADpoXwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6620 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 Mon May 27 21:00:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13675762 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) (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 5B38016132F; Mon, 27 May 2024 21:01:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843674; cv=fail; b=sQS+6/kxNhMi75+Swgt2rt+ze3Woi3y0NaxjtNdJJP+47kTYDrLxVRxmNytLwO1fuaJ5ZuBOoJr/owI1Djr7Sxx9DvamkgMcc5L4vK7LMQZt++AuEInLZ0BBE/9YIdnnj8SVU9eFX/D7BVl+VNLoryle5fbjFIo0powGzZZ+vCg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843674; c=relaxed/simple; bh=z5voJfi7a3PhbCCNXPEPmo1CBZBDZe8GBFDWfB85VVM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=VWEeKYowd1TKL4CgB4khZWctS6Z0fG+YtN3aE501vPSyJajpNPnSFMwQnqFPghI9tbsOHVTcA1AdRFP/gyztUFy/urG+fD5qZ2anTYfpxpuu4lflbepH3pKfwLKcn2pn1HpM52Rweck9374lX+OSOFfMrQzPK08xsmLO7MbmaGs= 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=fMUG4x+P; arc=fail smtp.client-ip=40.107.223.83 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="fMUG4x+P" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TkRWCGXZKIE3xFJvYD4i+0LvCSUlnDm+NHCpl2w4+2csVBdLJD9aJsP9F2BW4fOO4ic7VMya9+jt4K4hMDl855rAV8akfOnsUxggRxDsckd6bLOcqC7Du9xNNIv1KgL8q3cpvvkexhhE/kNoIFHzeQJ4OLsPVhZirCrCjCxWDWr5unfqJ1frypQX30obl9w6PqPQlvJ1SGvN8LHLvHN2eTbnmoNw/qdBBa3EGLUBHQ3PEr3O3E0PCF+1E6JOtVD7iIHdegYDiv5SimafYYmK/rYX8GBKbjdaVDtLPA3jhkICvRAg1peE5aK0ARUU80sVAXCm6mX1h0QFSdINg5TS0A== 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=rB0oAED9EaadsAW2/z4emTVYa+TrZ0to8ZFumYgF+ws=; b=K1V0PtCUB7XRpQbs0+v8LxR1ysMJmR54e9TcB/xKEjmuitqrYAOzriweK/ZLEPqZTH8ue0v55ZeiYUSbURGill8Q/xLxk7otOcrRGRAw3SDQpMaRiH1HtXpxkVzCvorv9OaGqUyKWlVEDDckSLhonE59+XjldxePqDB98wN0ONbwQejATe/wo3P6//Wek9ZqA+CTXAubfNm2tMqM9MTrWXrOuBu8VPcMRuvPNVVl0NwSy76fh0F+nb/xeVVg2abS6tHjpPXAGGHrI9S6sJkoQPL0yp8CzV4+ZG9KQ3lYV31HF2zr/WpwrtD1bTpeaDx6zTQD1a9M5YYLRp1rrWnLqA== 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=rB0oAED9EaadsAW2/z4emTVYa+TrZ0to8ZFumYgF+ws=; b=fMUG4x+PxEMNYl0fEuC85cUYNPI/ktKGTMac/IwirdWYJMV6PyvYl5hKtJratUzYCCq2ewrDRneCOQZGaOzpnKdGHFoY08zpHenKksn/5biqucd8qnFPFNz40lVr9xbGBuJHL3mf+sgwFhpQYYO/3+6ShIL1et4aiiWq0tbynARvnZpswPsFumN9pt6VmYGfLpGPw+nDpwVaqbooy35VIWl2ePgDSM/8y303/8NMBDtdJ3/NtqfbJnXgDXHuPbRbTR1qF6QJ3mGKXX05sNFRKjzY81VBCKlAMN/SOFCHZZ3uVhRITnsMp6wevJVPFgxP4XqgPHw9FqAxyXwgYrOrWw== 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 BL3PR12MB6620.namprd12.prod.outlook.com (2603:10b6:208:38f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.29; Mon, 27 May 2024 21:01:07 +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.7611.030; Mon, 27 May 2024 21:01:07 +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 v2 2/6] selftests/x86: build fsgsbase_restore.c with clang Date: Mon, 27 May 2024 14:00:38 -0700 Message-ID: <20240527210042.220315-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240527210042.220315-1-jhubbard@nvidia.com> References: <20240527210042.220315-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR03CA0380.namprd03.prod.outlook.com (2603:10b6:a03:3a1::25) 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_|BL3PR12MB6620:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e3fa4da-1e66-4a99-6887-08dc7e9020d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|366007|376005; X-Microsoft-Antispam-Message-Info: 5kPsmIBtaMaFaCTnspPDWrIm5TVfln31ZTo3Ug0PaLtcl3H/P+y9/tBHBbpF4/F77f4QG3WY/fDGl2/aMTVAnWcEoFqMlPEhI2HCEh05Ey6aN7Cmf7A6frhnPYukM7nDFnWW9oozujIzXFNm7ENhiTLo7URlvkunNPc5XFnWO8y/OtpOO6V8rAFj4sEfNHqY/ZDdvXfkyTJ6xa2rr2oZdhHyJlmdhsgJcE/DXxfs1cweIk2RdXgtCrRl8m5fMSqeK3LbmmjgT3ZjqjTjbPJyBkr/VRa5Px0GFlQu5+iWH+7OJ+EM05DAoyjiO7CvuYYrzgikL8qINwrkUeoRxS9/LrexiDe68KL+qx5lNJGEYwIkAJHBewnQu1ZxEerSMAVq/kryfpgfUj0ikbnMwFw5apUKlgnSuKh6Ho4EL3A9vJNt1UL5qCW3xyO2gf6+hgGobBlhAr1ss/rUpWrXDSEwHMLnFFZAg9BlqdgyMLJwlbD0CtetKpglbOftQK0jOh3AMuhBqPtY9N+Gs9jjUwsS0f7YLdwLdR0Htma3KMgXk4djiTlnDocCCi7zuHH6/scSq9rQz+vblGzluiadlNt60XTS90wQWjhp0SeZca6cy4j7nG2VJ4UB5m8ELagIAZG5A32+HxxM53fOXqSMhpXvhesekAYE2CJbUhHUHxXWrEREgMgCfZ94V0ijwJ9WY08gCbRTRYrTmnHGRAgb38St5vZR8d/X9O8+HRynBRtmxoarhIRyuvcCTU2Rh0KhYWzQAbsk4J7l6ejzJm1H74lHCEi2b7+IGHq/VAQg1J82gX3H6YBvaYzHNMEWZuwFaILINEijHicM6fnVu7Wd3U6YOl/ywtSO28XZ7TGmQBI/kC+I3HEVBdCSEz5621Me+dZO5GwiUiKoCKs/ShzTIOeMi8iVMWxHCKVNjylUnVxgZYZlE7pP7UoNFGbLTDoNZjM0r+1Eyzn9xaECQJAEo6QjHtXwTvL9p6GcyivrcKw5wNwa4AVw+n/099BRso6mG+Kov6uLuyWx8jJX7KUvfDWVgTVKaTAtQuLs80iduohI1VU3TOYHJdV9+h9xqSwwpYT+SzoPPvMIdQ44AQWM57+WmqBNi8qQrqPYOuPvA0uG6Kz7jVd5IL+zsvp495M9evPXQHuPiULlXdXGI8A58yB+x6QSx/ANQtqks+8bYP9tXIqUC2TNkovkFqX2WQhX/+4JHjc+VpJy4rPweMZEdXtWNgul7NVmqNwThDP+sIXOuqOwiKTb/1l5/qARqKv4S7mn5iiMwYp+EEsf9icJdxb7Og== 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)(1800799015)(7416005)(366007)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Anti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S88fepL1Ygl8yOsq96R4Y9FxFgeytd/1AF+COznUDET7Gp4FtibZ6KIUj7tB1TmVfTkiQ3NJnyhzX6kN45jRKZbsJZ4VMrI9Kd0lREycIwCmlQErIN9cTq5N7fSFO6crWE8Sn4TZkWqyiLYIhYsZHd4ArmSjJ/dp+E1BXAwIzWuSV+P3D83tJNj9I4377c8z3zBgITPKUu0CMZaKG2ru0NeeNWwWZR1/3T0KCIqYiHW5OSlvhpJ5eGC/HX1etdhRu2tJn1yb93iivX9F0OJ1GvwiU6RORgbLOsihoTbV3wUD8MuOE2oReoYMmfwtyfnHqy2W9E4PSeODMFAzJ5zVICLaRmmbOf32yVCwnRtc7T+mg4vB4tlHNX5yPZEXTcaxHX0v54NtqhLa6Ju+bwb+RLIaAAqoUaqNpOVq58FU9Z05Oz55XxXNUXqfqfL7uZ8C0PkHK8TyyQ3d97WZMGO5QDPktPRgAUqb6Old1oxC9xGikqzNql4yHUu9e5AbR0Up0AZNHof7wjWgQEkQfpHyODMDDwlHtnA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e3fa4da-1e66-4a99-6887-08dc7e9020d1 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2024 21:01:07.1438 (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: L2dptyZTpLprx3zP2QZuGufdjipxImzDv6yYLj53VieYoNXsfEweouiTRgH9eI4hE6q/MJZ068ukvMWWVciz+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6620 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 Mon May 27 21:00:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13675763 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) (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 27D421667C8; Mon, 27 May 2024 21:01:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843676; cv=fail; b=aCTu24cO+ROifRLpuS4gtNHiV4mr1jf1EEocNfUdzi79ZnecRRJ/sRtvfS3l9flLn7/LAmqnm5tXM0MeNJJvScdK0Gg3N1uPOZh3Ahr3Dh+N3VKNL6lLqZKyWHjOXOKZMyRpnAF77z6RxO6Jh9wlvjG1DfanIVS0j78de0mZteU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843676; c=relaxed/simple; bh=GuG5f0TQP6pUz66LVgwMcXUrRGN5M/R3zNBOo1yLChE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=oBz2dQfnvOKfcALeJaVrV4mkhQS5rT3vDPEYUoivgrfCVtxnTakncXzqM8VdNVSbmZIEuZ4bImL88f1P4h9KmHshQx3iADlwMmYu+9aev3snTnyGxVMHni9y8exDtrtvZSClWnLbOLmtgDp5+X1l13KVMUBAc+l2PneAIsSMUWE= 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=VQckyj5Q; arc=fail smtp.client-ip=40.107.223.83 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="VQckyj5Q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nht7zSJdXH2LA4B75SfwZffNzyoGdn2CAAA6Wn1AuNffSZhH07sbnxkn9uWXNyncBgG7d2RpG8iFqmVsZjy9c7a7qB/l1/tDdp2SaUCuBTPNONqhq4DFXKjdWbcV9oazASw2HrUqVI+mgdkBxE/phwQsFB+vOolHTVHPgh0f+yzpN1ioJ4M6qGqXLbyHqDIfA9oTY31gxDgAGR/RW54i/XDdj1FAmJbFlXKo7YA6FynhrrlxpiWbdfJFiSwIoM+eYV0qxr0y+dqWza5oOsqC8vQh3aZkJCHZnudvBPtiRkH2qk5QFtQMYG70m/DlUFdBTVrXUInxh6hhHsr/PUgc+A== 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=1KsXrc64B/n7qJbqVHIkeMhVnrby9P0KpJTm+Hbyyb4=; b=Nl8gtS2rVh9LzU5K0vBu9SIBJK9pTZljR/UnrVI2tXbO2D36yK2BfaEy9p3973/kZxyXjZ1+/Ht2VqznZgFOhIfE5mf5JVtzKu2MtFBuiWAD0n137OvDDwAVukPedL9Sui4tVzY2sNKDcop9oUNGB1d9zt+Hm/VVxSRME94WkEjUu/mw5Zf3nOem2xDQAwQfbwLi88i4/KkmEkSjukd3N4/FluNIsL+U2O2qHRvWpG8NeBFAwnGPETjbZj07b7WlENuOSONON7Bn2NWK9ZhKR5D0Bfjg7u/qgA6/eOG+bkDrg7wLTM5T3nklM2bnQr/+qWBdzukU4qpZ++8TqTgWvA== 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=1KsXrc64B/n7qJbqVHIkeMhVnrby9P0KpJTm+Hbyyb4=; b=VQckyj5QBJOJa4oE5ipahNRJWgwsd8OLwG+2e8YszLaD5++et5ZYfK9v9WTVvNTo85uuJwEJcpiu1Qvc3hqrJBjVdfhYWuJjwsVs3pBQ2hU41yNW7BlUPuVtylZz9KqjSXKBEm/DXY/+iUqvF8SL2Mbq3HN0M8Tl4vUS7Cv2KsqJc+KvUL3v8q1laoRpFM3+KvEWhpE2epGcTAr0VKCSxMFTUETmR2k2tdRYrGX9kUyiv8ag4EonXS89IPGv2SALVCvPRNuTAojc20zdvZWS2PjrQPrPK0l60KxjA5mix1FsezDlxQC++ctJ4EIK3uR19SSz4svI/tPEUsIJphRbqg== 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 BL3PR12MB6620.namprd12.prod.outlook.com (2603:10b6:208:38f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.29; Mon, 27 May 2024 21:01:08 +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.7611.030; Mon, 27 May 2024 21:01:08 +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 v2 3/6] selftests/x86: build sysret_rip.c with clang Date: Mon, 27 May 2024 14:00:39 -0700 Message-ID: <20240527210042.220315-4-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240527210042.220315-1-jhubbard@nvidia.com> References: <20240527210042.220315-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR03CA0387.namprd03.prod.outlook.com (2603:10b6:a03:3a1::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_|BL3PR12MB6620:EE_ X-MS-Office365-Filtering-Correlation-Id: 12cfd5f2-2d39-4350-2f95-08dc7e90214d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|366007|376005; X-Microsoft-Antispam-Message-Info: v2UF9j6T0ZLjNz9n8vnH7n14dNCL1VUvEfbSd1edqpwAGER4UvvwII1gGovuWEgyM0ZWNVA7Ni2nKlCxxtHHUN3xm21qRxld2U9jv+pXwR7M+t7M3WoKnZ+HSIs+aO3waMf4wOHUIbzXMPuBmD9qLUXr/Nx+OZr5gmh+WpWyUwSOSFrHPYmsQ41bb6ROB/jYcuRNTXRAQpszYMnKcSqd3s1B3JyiHWHclZYgbi8B5kCtqrEMMI0J1ALhMZ/UPJZbU0QRQM1fNssaDWlH3ZiFQAbMowuBNidu7d5DEwzjyl6JxShzm08oOxGdxSvo1tAQtVK6HczSMHRZZKHRFC5Oebpw6LFO49jn6AGR04mz6yWv60Rxa9xNIUN1qtpZBFjl9gi6AWqq34o/3vkD9GaEtxytLw4ihSfsvDlAsF1x/L4yz2zUJk68z87m2EWX9uNkj+9Tr8TwIbcxTtl5xF41BlQZJCphpBzojrgFKyuNixw/7QklFBwYzgFDzi5ynYrTp6PZWT6vcn4tncBb2Yaxuq7DNDgVBOpsvCB6pFqqta+W9WX0MCUTH6/DrDDlf2YPdQJuIXswup+nDEu33jxCH5sCLq9oabh2+qLU2a9Xp0U2l4JI7fZNaTrtTHRcyhRFfT4lku1sxNiL2cGsp83Gxc6wnbZ1LYVvHgc9iTEzsH2dBosaHTBj/Zy0yC2URLKjMu7J1hJpavIds0ZbIHhd4xM2NqVE9pdR+OWfe5VPkcx0VdgoHXr7XdDpa9kfCH0eIyAAJTYMmom8eWbT2CxMZeB2lSh0q8QcHwAFu69UFekIj6i0vt6XZ75iNgJ/fbRTYbn5HiQlUGR8P0adpCNXigNcjRcWhw497Y26aXndyJBLHyjT6OBZYlgKset9fnd3Xhe4SN2apodBgfaPoBQZdN7Y74oOFuIW/oMvkJcVDZpt4zdCiwVHlK0EvnZhNgOsObyrMMzgAbnalZg9p997+XmXu2lZzH3wmAFzHfx1UQcyYkFFY/e65L4p8c7utVT8yJbyXtfnhODVjdqLAzcKH6qyXwgjdjHP8WU9lDkbZuzRijHGT+zxfGvaVMBU9XWi7aCaLbBKC6BX+vOifgtiPoO/2Pyw04DyDilMEIzuruz4sdAu9Y2bjlbGILuD2KvvGuBlgwe6M6MfGrjzfSAiSRLWIIMARxbPIYav+bJXor2n+BnmNAhwSToVKbSQh7okB+gaVcIqHRyaiCDOG5aHQAEpEc1MOYHThwULuTBHRvdjoEnMRt7MoHeVm6tOgtjC2/0e7mqWO4GXL9btlFo3Eg== 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)(1800799015)(7416005)(366007)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MhlawuCHpdgGZa4dIVxiD0+jEeALhkN58GWLEHJdor+yF5q6QZRnn86H3iNJfvbwbnfTJe5+aFnaCXMVIBE6THfpKyWCFApnuZqhS8zOyNbd69kYrA0UigJGALpw1kLvgVkABoeRoenYsYNdniSiX8gzBflwADUuU6S0APx+DX8DHYSUU+ZQsEs0G0a0V3ej/0i4bnZrYVxSDsqL47x9UixQA4hEdDKpOHqqoLS9xN8AxbzCcgnY6nnZcXBj90xcGVxE2wSYwKWT7TEICCU10zjEUz6F9xPxUSbqQ9n08dbAeVsoJ8xatrhUB56z9mkrZIw9wHStxrmm52hp68tTsFS+0FBzk/2MuPCtgiSV1NUEZwqN0/Rcn2jRQepZb+dUUYVuT2jSc10wQ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eV3MU19Rsz4pkPIda3Y+Qdi/GUNb2fbR/+iXNgdTCmrknjYt5EhewGmL4A/2WwqlpSIDeW0Z2ymaQ2RzxXAjjiMH+xBiqzE1nsyX3+v8Ps8mIkv3o+Ya94JMlidkGw3ejZbftJGaC4Si7tg== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12cfd5f2-2d39-4350-2f95-08dc7e90214d X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2024 21:01:07.9591 (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: BT8LCEfG8ys21qA53zUQHDVEZyImzmWZ1EYKD6WS3OBFEOudAxs2N7rCfTldFfkLrUHbIma0DfKJbULQ9orGTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6620 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 Mon May 27 21:00:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13675776 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) (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 F33ED1667FF; Mon, 27 May 2024 21:01:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843678; cv=fail; b=BhJmFluRt70B/tsSSBOehxM/P+g98AkDlmM4TMaHm0LFhq4D1BHm/QljddnOsyIqhMYYGpXMeagRI7dxY4EC5Rx1+90OV3CpxFgRitIfgb/0kkLdagasvuUwX0uXSYY2S6P83eJUrMk3VEHLYu8osVTAJnbaYqVY40VcHY7yeS0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843678; c=relaxed/simple; bh=9vXO2O8P65102jHpZCmvZbsXezd5ETiqc9DbI3IYg7g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=WMu26shqEvAMAnlxkYpxvzJW/PGx7Q6CQ5CZEwPW273OniNUTOSL4FAgBQoSBQ23KEhzaf3OTCfhmFT+MbrLZtFA63H6D7vcDhtMOwoDoigCEivA3CkIAzhonGVoZXv/pxVb7h81N4pAGFNYuEn9CebFF5GxKoQ3LWzvJLMcKAo= 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=YSEAxdJg; arc=fail smtp.client-ip=40.107.223.83 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="YSEAxdJg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LIDevDuOA5mVzsrA1HwPAo1VCS1cHTEzlmWWLYSrJdXDegnjKjvxwD93gVjKVMy72nJJ3MVj4WDjEeLmPGH14qJ1Ov8mQM5LfQBO7JvRP/ZqIh4nfX8IyLNnTUw1/6iRAGzGQp+CvOsMGTQtt3X2Fc1IQV4ergjxAJjLafPQNflFNYPgu/gaia74cmzD39XZZfqP/oLWs0iB3KXDB0HLZoX6fka+d+xG1rZ+sVnHlF+UlgrNyBr9eav4nCLYoraOQC+U6zEAFBzaTf4tHyj4p67Ane3MtdxAut7wdRx4UQYvUdkT8TT3ZT/rQbfhhxoFa1QVe9hlae/3+5/mLcx1Cw== 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=OXxd3UDPrLIFQ0NXN7YcDKcV4htYWKypH3EpeO9mfUo=; b=GobRWtFqWeF9xLtZCcrp3uuTZTC0GKtgybTFxxWG3FC8mcScKgwQtmKnb0YW6guQOHcZpXApWOMNNt9CjtAL7UuegR6pbXU5NTo5RiUBZIs5wCPg7yLLW6wosTTzgl0prMoWmIxx0y7TWZtRSPDAssrbtqbqY674BK2GGAiKh1so1YASVME8/5K20vSEcZJZPA9FQnbLBA+3iqDVEj9el1iNxxY/ssnNPUt4AzyBQiDQAGsn9cekZBr9Z0/lcV2ArRgJAa2dVFFsOH/20LVcod51O69senrLoJwPHxUkphx1QwTFqLAj7idERGrKKlBFMcJZfqXIvdYi3NJgkUMmVw== 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=OXxd3UDPrLIFQ0NXN7YcDKcV4htYWKypH3EpeO9mfUo=; b=YSEAxdJgvigIY42RzTKZO06oNsBnfpCSpchMAuj8gkmHMDpSj1EmNzmSit4G98DXvZwLJFyxHIbXHKhTRD3YXnggzWdrSPq2fgNySkKMFHG5iY6XvJXRWmgEYbn9MsoEAPip7265MFPUvTOqmdXXHFQ/78dZjBd8zcywW0c+++E+2uIhOVsFgzeouDG3akx1jXDaZEEqN+WXS47/MORKMaMBUVzWKUnYI9VImKxWX6olra31XxeT6dI09sSYPCLtqZlFGOZj1v8WdwS/7FrBDkSXsjgg2BUCnQBczKOhazYwuTRp+Z6ugvB/Ve4VBIJjUOkrxOeIVfLBoYwjHOwctg== 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 BL3PR12MB6620.namprd12.prod.outlook.com (2603:10b6:208:38f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.29; Mon, 27 May 2024 21:01:08 +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.7611.030; Mon, 27 May 2024 21:01:08 +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 v2 4/6] selftests/x86: avoid -no-pie warnings from clang during compilation Date: Mon, 27 May 2024 14:00:40 -0700 Message-ID: <20240527210042.220315-5-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240527210042.220315-1-jhubbard@nvidia.com> References: <20240527210042.220315-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: BYAPR04CA0025.namprd04.prod.outlook.com (2603:10b6:a03:40::38) 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_|BL3PR12MB6620:EE_ X-MS-Office365-Filtering-Correlation-Id: c1af2471-084f-4c0b-e9ba-08dc7e9021b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|366007|376005; X-Microsoft-Antispam-Message-Info: FDGz9Y83OqvgDW+he47fX/GhgZ4UbiOdWVnWApPI0EC+rivj43JyhH9Jy0y2grr7HLOEdlZlG2GLY6BU/G8Zi8pV6GiL4cyaZG9ElT9wGA3kRr6gvoFvANn+SRat2HTcZAMCrp2sc9k46sn27dLlsbAVSAcLQsvBHYRQGbQqGZVJ3bVrYCdsS9cR8F7W0dDLelsm/F+jCOi7e19YZU/YtbykKLWHPNAWgIrCUq2I18snP0gm6xPd47uktjVoTs+mKKmpCzmQUg54IeMOMOJ3ZHF7sx0Dv4nWGnSC4rIXXiFNEuyOPVQfPHoMfMR7YvxaM2DxOUje3Ejv3dX2WqZmOnH65rZfqgiqSK6/qfCCHIhaliGczyQMVOWvkLkFlo5o1tJxgfQu2n0eJ4r/aHP/j1rACKGJTUkvJLxfIHyeZsEGh86rWuyl5hSJSt7+ir+9JGCI8PYY5C275nRTdQGRUv0Rns3tu8Wv0LNQOX0Ej8gv6izrS3q1D+xDhf1mMoeYl9baOB26k7VHy5TbQbTmvLaEwqI/r3CVnNs9js1GlzArrwGJt5GLe8MtWobqGsRRfMq5eMVFTG+1clWixiUu5j5itH32C63GrvmrgN9MEL872X6Jo/MbaQkKiHxaxJ+LssZCFu5opBZsATumZ+9imJhPXb55FkaJgWfjzWMeUgeMHtAKeK8B5QvRQhSzWbLQOMFNq4PkkP9zxzTBebUbpfgi8rcHz7hWy9KhrhAZKHdoxWIylmVmjoF6eJum58WBC8EuOY9GFRebeBcyRLVNj/XkF+utnFL0JeWetgsH2XEskyaWWK4nuVVVV0BFQOgdzWtqUH6JRPyH7+mzxLKVMbJbWr9caqA4baC285wtYDgDWbBXUErSDW3OqYcIqfzSq5th+HrkeO26oO1Iks1mf6xTEV2zGVNZkDw6vK9uZLh4bCaXl5TnRNg8xu2eYNY1mwumIT/jlyU1Z0W21zPuaTKM/Ma3M/MizdCzierFdQxmcGDOrJkBfsIVBGcMRLmrDI68fLIfGpwf4VLGZsvLgwMSxhZ3GRAVES0LHNcf7Xi2qU6mxR5upeXe2iulIz7ORprNFDZ5wcSmf3C8Jrpcaqg45E0ZfEhKHOuU32Nuc8CRW0+qZIXLbREniWBCiaY8dvIS5kyZzS9lo4qYXpLtuRKVdL120r6UDExBxDF62hoCBjsctoYx+cBiCEeDcnocxqs/Xl+6iFHz4lZXbQ/qSTCeErLbvE9jx+TIt5WsqUSOi2cCuEvn3bHm5NWlTXOKiFLK8rXM0aGeSMUWJuwXtA== 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)(1800799015)(7416005)(366007)(376005);DIR:OUT;SFP:1101; X-MS-Exch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XvKijOXKRPFg8ZIHloQNTjAmmX2m4D345dQ8hBW0PzL7qYOQ45ZiAUDzmyJAVd3RrrppWLLKMvrzzS9hL/4u7V5M0lD202/rvrLLAmJSfwDU2ArDF1q66HPnQLxfgfMCMOU5c3Me/rFa1YAo0GA0R5lh5Doe99xGw4UUGHKq8GXMWLaYN4qeodUkpMqIQPAbAycHMetuQZTEip72ing2i/tMCS9LwrmR7SeAZ8LvoNsSq4ei3kk4H1euxFZ8LQ6LlMSVRjz7UZXLFnzUqwMxS/obzRttH9IDqvCnV0sgbtuXcXaRby8ownInKUDGMYHOWzreR0Ljkga8tk9RHAzqSANKuMwxejssrCcWGRicogUWaEyFDRgv5bxkxcqOcx3woqQSJhdXr1GH+BIBVViP5h50Ha4jrc+lF+zIi5VBHeUThQBiBdAyWAQ4lNb8yZtYtXwgM2apgfbX75AAa+FmIoyWb022pKAEI8Qe1R/SBikHmwWHT/IW457bsKHC9+ReUGR2APWYT7qP922L5dmwWAxWKsWHOboeLIJDhdF987+3d5yUR6q71vvbdkTcFiHQAsooDVHUGitFnbPEb/GsIUy8PWVEg== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1af2471-084f-4c0b-e9ba-08dc7e9021b0 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2024 21:01:08.5947 (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: w2kJJH2Fdy5qpp/VxuN1F+nr0scY/b9DFqV0fqQwzaXvxptI9T7vvdbx5+VULi2Z+E3x07apNbmPNEPxpwyyEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6620 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 Mon May 27 21:00:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13675777 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) (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 ABDB8167D92; Mon, 27 May 2024 21:01:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843680; cv=fail; b=q0t8sHKbLXxfxWcCHpnuCrn4no/a3cYKQmGSwDysjAKqnaXq4jKEdbov29np13F35Pc3fXgdbdYMSty23618ZULSw2m0RFwkM3nbtCM1o1OIHp/TmnFY32Grg2Mi7hhCsQZQa0zG7PwCeRuRF55kCP+QHUYFfbBdvDsEC+kHHqE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843680; c=relaxed/simple; bh=c6b8+bXannTU8QjH8p4Nb9a42/H/kQXRHJejx2iWK10=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=sQnRgC2n3Ka6qGrd989iJwD4SZm6nIineYJUy7OovFLx7JxECU6SyfHn0p38udwEJxnl53Az4o3uXMkHf6WzwN5TyccBjkZLCGA3o6l5F9y0p6+YxSrnx8gmJbQrbNklWpcIMBbsEd/Z/BONkfZMOwIICZDd1iSzItoYDfWfXd8= 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=pGNnjoQF; arc=fail smtp.client-ip=40.107.223.83 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="pGNnjoQF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bnMn3h2v6X6bfAweRXWR4/HxaMh7EVR5lzhJbO8qnZQJPE3AikHNTzwgSsdRjmDxqSYL2VVLH/oSmNutU8upNMZ7jrMkdbK8n3HiI0rBq0g+vc/KvTr9sF74ogpZpFWfiUb8NIZ2L2N7nn2YuuLYSc3VObTGUxEah92CE1o8XRlXU7VXCeyEPmTmHhNdjy3RP2LUwLNYbgdUji/kvThBJW4CZ8o2XRvyfMuhZFnmLW/Rk3FPdu7bUEZ6mAkiDXrDOQthSVSlBMxIfoIf3w9679S2lS8EYRmi36rVU1pCo9P4P5i0YIrnVQZYUcCkH1F7sVemQGszr04fjBXxU2jKfg== 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=x9AzN/Pj+pcez2zGR6CXChIoS6ZCr8a5Q6nbSa88LBc=; b=bgNJwLWw0pGlWxfk9C0HMAx5/XatIZbU7Ovl3ivTD5zEfgMnHrhbbDL0taWoCBPyn8AHgR9m0iQWMtYMx6j05xuuARUwpm5ruuzN21QDEfRPBWOOdJAKsg3AC3PReQsSydG0qvqMwKM+rIuLNMDh9BSrreM/94QC46KgHWbkxtZimynvLjd4NGB0vG9xCto6mNm5MQu21MkaGCDGx6htbu5tpfdO/e2BLTSS/CasAKZ7OJhuaA/SNdi2ZimW2a6ZVbLE2e6kkJCp1gSl+SAklcoBKszSlhh2/vq1TvASkBFSe9jLAYh3tD6EXpJcLZS33+ttD/dgAZ/xCm8oYyvrTQ== 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=x9AzN/Pj+pcez2zGR6CXChIoS6ZCr8a5Q6nbSa88LBc=; b=pGNnjoQFpkWkNhIzPQqc3Cm5R9VNFWv54ruTEeAGndVGiAUwPKkFX/N/Lqqdu2U+SKsAcMPm3KdZwzx06gu7deNCQbHYpG3aO7+fC8NseFk7EpQgIXwosmBhBP/IW8w9DPsyo/0h0SOBydCMJ+R6cXdhtWIlXtiGiEC6jUdx/zyQ3kVXQpsfg9yFUxu0l84ke+xF7nk3/TqZsi3o2hFsXwmOhuL9PDjfRwhFx3hQKXo+4HKG+UC6D7JJcc7y7ac1SXKu8r+jekLvAaBSkDVyXAuO+im6H1odQnRykMgnUGuO6sxhO8yljL5IM3i5CkZiZ9ECSXGZd58DUQtAlkSQMg== 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 BL3PR12MB6620.namprd12.prod.outlook.com (2603:10b6:208:38f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.29; Mon, 27 May 2024 21:01:09 +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.7611.030; Mon, 27 May 2024 21:01:09 +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 v2 5/6] selftests/x86: remove (or use) unused variables and functions Date: Mon, 27 May 2024 14:00:41 -0700 Message-ID: <20240527210042.220315-6-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240527210042.220315-1-jhubbard@nvidia.com> References: <20240527210042.220315-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR05CA0097.namprd05.prod.outlook.com (2603:10b6:a03:334::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_|BL3PR12MB6620:EE_ X-MS-Office365-Filtering-Correlation-Id: f90d0499-bb9c-4c1c-ce19-08dc7e9021f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|366007|376005; X-Microsoft-Antispam-Message-Info: ZN80u9rkoAkd2aV5nSZ3cSWjdaJeu1muDAz/EpgoFmsD8vzeF02gRhDWAWYMhMeevoFGKGa9BfkJYQdpq5iCkxXaPQM1ERW2gKNXLPS9/593F+XCardVA5OD/Vy4W50qtcqnzb57W4Toz/3G/eB/hG4UfZQZTGXiSVbcTbvdDCLRZeJZcOUPvsVBxZ+Co06aEqeAZ9ptzKC1w7yqnD5OHoE1eJGvRI6t52SW1kczPOMlzLddP0UQARU4BX23pLPfv0nDy5y/Lm99banLGQPZ3SbgSvx3WraIzFSmoBvPKSAoZgZFwwmodFGuMYd/x07k9cN4vug/jCYw0RipyfVb8q4cxjOokKpVFSOWh0C49Sf6gLOGMlJGzfuIFZAaT322KuSWX8iHKB7KXrJfAyiStU3gmET4zftYhsYQ9tZdlvqmkmuJS/i3924eB3lm9VKgzojjo/5wIOBZVxjc6DeByZh3aEFEyL3MW4/xqAGjXc78FNl8kCGVqohcnDr03HjhGWXDInBBcKy81iL5+HiaURCuJK+y0VTg4Hi4P+Xzj3+WJt1xswOeSyJCYvFtQ3WTwHleOAI6KuDxYYTefEcymy4g0Kowp9NM/JykaSKtlO9SfgYmTswHdEIkTdprweIE50nEltXIJJke8Nbt4hS7f/uQM2WlQAP4OrBKB1p5rvg2IA0sxckIqoRslHkXRZrXrB/jlE+vuVkVBQyo6dnjyNawRSzJYjb/W26SAFHw7HewcjyE+i+DAOMZZav69yU7X+tPluJ032Jb7BiXziYi/GFOP7iPBrydZo8F7bZvB5N2V9umU7RpUCrmfVkdKGJLx5V+04jGuMfiCfjWtnGiJZKs6arLHLsLyHhiDoEqTsDh2LEby/nBS2vCDOO2JF89PR95T3VF9G+MvKNCg2AFYbRj2mvbrp783LN9OsgjediRarencquyJINbMbdCaUQjT2aQQrgyf6sOd9rJG9TbFV7s/4Uy5G7STScXt+OVBNQKx/A0DJrB6Zu+RktjO6/EPFrnnf0txcsjl2eZ4r+IkAqrYVCTiaNDMjOKYi8gfZVrvwLdBGUqFm6Zy+oM6K/yCSlpCjU+mHWsV4ut/W+Qx3LZoND8gOBJs5nIqPnRE+ZwSuTA0b4hJ9258mSm8LNTU289y+JVMWNGRj5cJRhwYgDeL63Yn3o1o1nfwXWsNt+RtXK/2ykfumIwx5z4kze1eSMOhZ3WeuUt5RMNW64ctLm71fyBqVtFnQBICcRFwMcXI+q6pxG3v8Z7I2xKKw1MSAyGBpke9A7CwQYkdpzZDQ== 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)(1800799015)(7416005)(366007)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +PImgknLw1d6ek5R+z8djY+rgtw8fPmMdBs1IzCbHdJNfjwexY3/hymvFbLd7tDET3ruQtnocC5JWourFJGeES+yRYGiyiUHHRe1jnFA18WnnK+40R2i1wb9P3mPup4E68RZOv2XjRikpG35M4/OU37cKTfKMN79Y8leu+fWUWsj4dD4AUgDAjBdLAbST8SNnzdIZ5NrFiw9UXwbsbRFkTMMJ+S/obPFPMoQ8qYNzkN79NotbreIn8J+xURy59stQM+l4RtXCP6+ttArplXbs/5G52fNTeoa0f/cQhDsfAa/vpE3aYTNG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RyIqsF739tA7nmewSA/WYEYxSq5+hGNM+YXVzAZZEfYYV8fP79S7dOOGH1CPA3p6rzGrvcvGGGwKgnElfldBKkP7e2upRei9KVtj3kdzQ2cvY9vNaOl9smJAFbBZpPwW9MaPA7JCyZvf3udTTBLemBkxk6DUk/u9BdrtcoykyQTzdYEDwP6Vu8Ci4oyPdJ4lmi55kObAGbtCRm55ZE0eQExt3sZiTYyjCY61PB69M2xhHdw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f90d0499-bb9c-4c1c-ce19-08dc7e9021f8 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2024 21:01:09.1122 (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: HvXZvQD46vWzUq2o72XG+1V9z1XKZQQJvbRUOI2E90cfBR/9d4FcKIuQJNBub8pYITL46qVQo0srRlv6oyedlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6620 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 95aad6d8849b..1fdf35a4d7f6 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; @@ -164,12 +154,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 d4c8e8d79d38..1c9895cfc660 100644 --- a/tools/testing/selftests/x86/test_vsyscall.c +++ b/tools/testing/selftests/x86/test_vsyscall.c @@ -97,11 +97,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 Mon May 27 21:00:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13675778 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2083.outbound.protection.outlook.com [40.107.223.83]) (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 9255A167DBD; Mon, 27 May 2024 21:01:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843683; cv=fail; b=O6HiqjDhEKrvUvdFUH06KETJFqmFKgB6PUgGqFmtOkT+lZgJnTJ3DUwBLSF1nQaIumZ2J8KwMO63QuS2GVNU8B59mVDivhTYiamNz+CwlteHGthpWkQ2JpB7dxG9LrEZZQXPcNIjaJOU+YNCxuVC4g7wL/yBPD+VoL6sJ37N8/Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716843683; c=relaxed/simple; bh=LcWrjcndeq3iuhARrc/mp+c08zzUu1zFoYgBoT4w7lM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=gER/SMUOL4/r+AaaGFHI0i0sSx7voyJQ1NUcyLEJyu+5mOF+UIomDTbHKtUrZNDxp3Z223YJS9ISNwBXkvszIeyes8azcURkFZpyuH1bjgBgZNOqwYzH2VJ7M3K+AlCxdd2onQfrxqUFFFb1YSYZR4qPH7jbADBA4+GEWK2DDiM= 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=UMPQLR5S; arc=fail smtp.client-ip=40.107.223.83 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="UMPQLR5S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iARgizJiXldJujcoALC2w8ZSZKMqY07CrubQsq2udLmQgD0JfO7VDvwvY4o/xSENncrCR5agJB3M9BkDr6KxB+Sp4C/M5hCw+WfUPNO2pPd4Dz8c3zSJwMQB8QgOvBuGg1dxIUAqu8tqigEp8yp7zgk8nCHmhuoSDw8FqFeS+I6VYOM7pbkc9Dp5I+6PrES2HbI/P9tva6wwtJJ3wfU3QNwgsBEEZemhSTCfaml9v5pWeso6TZOQKpBDgKkgQu5MdHMJzz1m6lW/S4el901Q7/LTGxRLHnO0OUAV5PC8CXTi1SeGj9lHUwh4ibmde+M8XmyBe6aYepbrwW9J9DZJYw== 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=M9NVry3VUsyNcWz2ZdDnrII1PJ3GUu9peaR80x/6epU=; b=bMiBEuRuyVbwm2hK9qC+wwqmPc3I+iMKyP3A1CdDjIAZwS3I8uXqsVYhU+wTmddTpKNmnO9Tim0b1SaBpwRgVXhVOZuaNquQTY8tGnFCnaIlGLLVoQPBcwAS8u8qOXwygkBrF52QTFfrZXAYCT9Ei2nNsSXjn/r85nMBUPmDZAMYHFsPLX22HeJfJTdJvt5Fon1o1MrUuD+hLQXMmzTX9IL6ZaiSjiGjBhqNCY5+li2lfBuL+DBdeg2+m4FC8LhW2xEnZhbzQYXHnXekg9r/fKk4EkwEcZMAeffoh5uYsTtJzj//ERhHL4gYZaTKQaxsZJetGECDmU0r6vjTNFCtLg== 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=M9NVry3VUsyNcWz2ZdDnrII1PJ3GUu9peaR80x/6epU=; b=UMPQLR5ShcQajHXtuq3aCsVO8YLw4L0vyAUTyXyztai8AHf6msLIEP9cjL9JUnQmAq3tAhoqxSj5YHlkzSYZmnnk8RlEaZn/i1jkdrLjGzfKA0liQ+Ov30ksRl7iTk1Q8tM//ItqB19tExQcHSZMpi3EV77wlIwx8RwVMGJzakOVYYsE/S9J+KMg5FfcD3Fi9bsdviJNmlaggrL8BmTJGsG0X/fA9jTkBVxoELFrP+tKsORLrDcTwIkC1pKCsCySezdo1DudDyOr8KaQKT0xZbngglwRF3SYAeBOiofdxZ8a2FqoUAskfz3y3i2FOoqjnx4i3mTek1tK2yHcvZjX2Q== 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 BL3PR12MB6620.namprd12.prod.outlook.com (2603:10b6:208:38f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.29; Mon, 27 May 2024 21:01:10 +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.7611.030; Mon, 27 May 2024 21:01:10 +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 v2 6/6] selftests/x86: fix printk warnings reported by clang Date: Mon, 27 May 2024 14:00:42 -0700 Message-ID: <20240527210042.220315-7-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240527210042.220315-1-jhubbard@nvidia.com> References: <20240527210042.220315-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR05CA0098.namprd05.prod.outlook.com (2603:10b6:a03:334::13) 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_|BL3PR12MB6620:EE_ X-MS-Office365-Filtering-Correlation-Id: 317c3d96-de36-4bd1-04f9-08dc7e902297 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|366007|376005; X-Microsoft-Antispam-Message-Info: pKNZmUVdnTqk4fMNqmRm7+3AiKPgV6++ndounRP6/q5AsoCJDJMfTJ5jrkuonzJajnXY6vQqV7Wse1oiAGABN9OShxqfW8JVYLr0+rvfZysu4K+2xUTmjnei+OwiPvoOD7vOAFfKWA8P7ZOfBJHiRJAwZTs30YsNd9Zi4ZamuyecVuCROQc1MKS9bWu1D80uL6WmmWSxBImxFCNsXmwFXGvVX/vdA+RtPDNmP/rkLvnpaOgjAezztBX0d2qd8ZPi2IpKOKyCAkfNSflyswwPtpe4uVJCbu17pSuKZv3nO8upRPtcclgxJMIThcHGgZyL6eAMreFkmpWq7shcqqy2r1jJokoifZgcvTR7g6e1FJWL2a21G4ay6b5Ix/yhOlR403B8AuGyhNzJU+uIjJrO+px8zh9Frvz5DjTZAbcOteYzZxeGbxHEI2irW5UTR/HnhupL9CefBHBqyWNfHPuYHWCVr4Q1kFP2bcSBdnNtxmncDE/BmCiqduGf6XZG7iLeprX4vUgaMPEaJ7nAizMAlUWVABTeKlWUMLeTjxeIw+Qibf4pVo7jOeIMuyf1u/9y6Z6JHYtsdTlf1JYHJ+ibwyGEgwN4xqe1k8tEUAdBv4KSHNOpiSrvMxUTN8LDdk0bZssJ+DrjG7sDSKBaqIBG5/7++LjTAhFvrOocbcL/GvDc03FlPRDMt49+iYLhQTUvWEMlXlYL7By5RwaCAXEgk+weBdWE5SQUweTBlEyHG5twNvl8mbqdeW1JgE6178W5yGrrEXK9iMvyjz9SmmZjHcDhrXkq9X5rHTIWw0KvcRUwyLZQiohrkEEl3lS7FoLukWG3H0nTHFQm4uJIxgEEQiEUfMuJc4wLPuIxh5BQxv/3nUFaV9xKDJmxWvojr3UN7ADnw75VFN+tt4sdUHmpLyIwjfHrtZTwQWp4bt5jXrt/scpRF2AIdFJ6mxnsbSAWEWdy8U5ua5Tf3+gplLyaqqGGBDwxc+RkC0ZW10PqFfwmwn2b3ffNy/79pe/PgTkcil++3mlfE/oJ67sCmQ29Xl2J8gMr3ToXDV6KcKU6jR1uSkrVdjZGkujY9Z7ezFyjGXqJtNhA/ZpZhBrhaGNlIEIUFiKR6oI+vlcXeOTwWoUb0+1+Uu2CFq8X2wD049PI/hYGfoKBwo+3eTD8iK2s1qw7S3lp6qsbSk5vpMOO80G8Ttbkrklq1JmwOkCAvC66m88Vmj/0T1zBDSgDgWCwJ7H4qOu2mI63RqNgEcR+MgsVsuu1igLiqAn4tsjmhtvwZUjfRtJj9nzUI2Tlj5Ul3A== 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)(1800799015)(7416005)(366007)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UkSCmkCwyAjUTQAjwJYk/MhTVGHixHKOkHNWPeTJN9hQig9hUifeGE8UvxgXBiirJXQhQvUNRf8AX9moyooim/zul9asi+uk1XRGhQa0l+t/pDh+wxmNndOk44j3LGxvIkhc6q75gt8aAXoCyclGknPquQmch2qr3SoscoGQ5Sn88oiJL/1S8y4J7FRK8MFsS65FkOOfOJ2qtLAn2lMNbpXaZ3s+ruUh3f+xo9yHwCK1WSd10SnZ54M7+u6KZlf4b3k9W6vsO/ngaw7iNPmI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MarDZ18crwjk7o4R+e8lkxnf16OIeZckxHxo5A1F8d4X7cdxTLjvGnPYHNr+odsUdkLvAcnKEbtf7Dvvb7S0aUybsm/Gw4kFDXV3nnce5PdK5XXKhBFc8+MfNV9rBI03QpSMfKofNLddZY+oUAg7Teijf+ngzdS6ep3uW4wAG/FeUVdK3KpcsEjuC66nGCJJrgGP2uD/3kXBfP9uO4uVqXqMFLm3Hoq74Ga/t8SX8MHB9vLiegdY7Bu50nD8gB3Imm5FYEn3HFx+qqCxtw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 317c3d96-de36-4bd1-04f9-08dc7e902297 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2024 21:01:10.1162 (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: Z0mihRnrBwG1l8Aj2ZwbkCBbalQ5i0sKH1NGfwdNM7KrJHM2ao9DTjRfxAC6A91N5cAo639ARmA9RXPpw7FGGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6620 These warnings are all of the form, "the format specified a short (signed or unsigned) int, but the value is a full length int". 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 1c9895cfc660..6de11b4df458 100644 --- a/tools/testing/selftests/x86/test_vsyscall.c +++ b/tools/testing/selftests/x86/test_vsyscall.c @@ -247,7 +247,7 @@ static void test_getcpu(int cpu) if (ret_sys == 0) { if (cpu_sys != cpu) - ksft_print_msg("syscall reported CPU %hu but should be %d\n", + ksft_print_msg("syscall reported CPU %u but should be %d\n", cpu_sys, cpu); have_node = true; @@ -265,10 +265,10 @@ static void test_getcpu(int cpu) if (cpu_vdso != cpu || node_vdso != node) { if (cpu_vdso != cpu) - ksft_print_msg("vDSO reported CPU %hu but should be %d\n", + ksft_print_msg("vDSO reported CPU %u but should be %d\n", cpu_vdso, cpu); if (node_vdso != node) - ksft_print_msg("vDSO reported node %hu but should be %hu\n", + ksft_print_msg("vDSO reported node %u but should be %u\n", node_vdso, node); ksft_test_result_fail("Wrong values\n"); } else { @@ -290,10 +290,10 @@ static void test_getcpu(int cpu) if (cpu_vsys != cpu || node_vsys != node) { if (cpu_vsys != cpu) - ksft_print_msg("vsyscall reported CPU %hu but should be %d\n", + ksft_print_msg("vsyscall reported CPU %u but should be %d\n", cpu_vsys, cpu); if (node_vsys != node) - ksft_print_msg("vsyscall reported node %hu but should be %hu\n", + ksft_print_msg("vsyscall reported node %u but should be %u\n", node_vsys, node); ksft_test_result_fail("Wrong values\n"); } else {