From patchwork Thu Jul 4 07:24:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13723347 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2086.outbound.protection.outlook.com [40.107.93.86]) (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 DCC5A1A2FBB; Thu, 4 Jul 2024 07:25:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720077934; cv=fail; b=qJNuAz+5V05ADhjDV6ZtWvX6nxidKIGFKBE6qxsu3QWupmWX1vYRjyuDUtAfW64xxpqVa9nAozkObzsOoXdDthJ3X1bCEp4EQetRzVRMZTPfrSfiLdgCInodCDSQV3wXx0M/wYcR7RCVut4dgksmoByiECJHPDA6Pb6PLCPRLOY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720077934; c=relaxed/simple; bh=PJkb7pOjet9akjxtdL3weN9511lk7kYO5jQcO/1Il9w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=XIT/rxidVAMlSWsLGgyuE9HztAuq/WuzLuHMEqK+mbhq831R4sIYj351auHS4clwg/vSMlwVgkENQd/8aXCz9V4hpL3CkHwE/s5LX/gyplcx9JISTXIit2WQj9P8tnJfvTWH+IHIOZljyh2meNVmUZ1NUa0yZ5T51OS5r9Lr30Y= 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=aapGBSrL; arc=fail smtp.client-ip=40.107.93.86 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="aapGBSrL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JFdbHvDZvgc8MsLa5WE2t144fqwtYq91xIiYMsRl6Hk8voyB7x3+6KfRSjvfjgqfZpVyCLP8IMDhwOS1Sjw1TVgx9giHVT3/w8i48crLIgtnm5pmNqt7DGwQ2MafkTHfdTXlD4MhV/w9EI0O5fFbXzw4a0CUfhbS71O4+dbJAAAWd3Y0ahayOTsTgwGC8TwCaJ4oLcoZC+oc4QAJQkLux6iR/iboVBj1bw48vg+pQHvEvONs0tMuOMuYhp20v30fa4hbIVou289+COiMZnqmzeGa63GC5FMzQbZOvS20cIpq69edazVZYK2Y9qT/YaFTCR2fXopNvx/gidNgVTSygQ== 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=8AEZVE3Uiw5qEDEQbGcpW//gGLlgERAuhbrwbTfJ1E0=; b=fT8zReR31fyercTkuPgdMVRA0ktAkcX3jcZQgJ3uvsa9KPovKtkVfmZ4lnMe7Q/rx5MPhIMm2HltW9FYdAt76+8a9MJpnGxDxjhpVhb8m/Hk9zCCy01wwJYCqhEXmobZuYqBFQwb4ul/JE0jmkyPxjgoyQ9sQ2Qksje3lZh7/ERSnnBJdghW6Go3reh3sYlVx6PEKksmNfxXMBSYc3Pw1ozA2uP2Gnk/EmY4xVBv1JkoMTErKuoR23u4VXRrN9qRXbRZZV3235j1E/TGo7Q3PH5lpYAugWtN5/JEmOK4HZobBJaOF049jXScEbFAGgwORh5x6piTP39+5f7BhczVZw== 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=8AEZVE3Uiw5qEDEQbGcpW//gGLlgERAuhbrwbTfJ1E0=; b=aapGBSrL6BdcgfmMMzvaX8uZY9+IQabbHfYk84cXiIPf/9AYxUGZAVJoI+zPQmPWAqVTp/46zvcES67z0ugfrZwHdGWVjS0UvgekimbQNaLrTLu+8zeOzMp5ffcv2o/KiYXH+OV91L3sec+OSY+q+Cztk0MAf3jB3VTmFVOAnRDVQj1JN2NpxoWkG+sOaMrZtGYlMKKWhgXgZHvqNeFJwQOXwZpBexMLeq1oFztDuTZrvxbBkXhC1VN+ES2ixHMYUNOY2+r/wJFB9hVl/Pm5wGFeEqfVl3MbVQEPP/Y8n39GTIryl2oCRr++DQPqJL0/v6/ElmStXexitI7X7iIMSA== 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 PH7PR12MB6610.namprd12.prod.outlook.com (2603:10b6:510:212::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.33; Thu, 4 Jul 2024 07:25:24 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%6]) with mapi id 15.20.7741.017; Thu, 4 Jul 2024 07:25:24 +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 , Muhammad Usama Anjum , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, x86@kernel.org, John Hubbard Subject: [PATCH v4 6/7] selftests/x86: remove (or use) unused variables and functions Date: Thu, 4 Jul 2024 00:24:30 -0700 Message-ID: <20240704072431.111640-7-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240704072431.111640-1-jhubbard@nvidia.com> References: <20240704072431.111640-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR03CA0139.namprd03.prod.outlook.com (2603:10b6:a03:33c::24) 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_|PH7PR12MB6610:EE_ X-MS-Office365-Filtering-Correlation-Id: 033eebbf-4b25-432e-e040-08dc9bfa784b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: eI/GL3y7CkqtIxWYe6yo66H9OtQWlSYn+r4IPEpn8p5ir+BmNKqV4IiJmHLoUcupnqm4rIE7CVK69ofyN+mtcKxlNsvuIl/9XPvWyp0QsO9DOartiDiO2yeqCefEPLbyOxOb/BznwBaW+pgabpRuLCzcVL9h9Nez8U83/nMr2cDD5U607S3OYIVTkx+eAcAZR3vARx9esMTqRTXWSuYZkqpUqplC6Qq+0dPlKaDOLKfRisHegdKHi9aoT6hZSOQCZhmPBXNphZeOz5GD0l7Gg7xAiUzrmRxic/gBtoGnEMNQrYSriste+srD5yYswVRQ2MwCmwYenWtycVn7td9cfndORJ/hCH5eLQH5RZ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SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2dmKaVBcIJHoUtD4zod9EClKAhT/QbNbJVZr2p0TIOxEfHHODmDatl6sT4p2prEjvk1kWJsQAxEDfHHvl5zhHThC9y7inD39e5Ku8hyPP6OAoal/OrKrSErxXxq+C5KpKvhdvFlcjoU2Xr9Gs5VAZSEzfymGqmMkUfQSU2zqI/JJl48S+CjwL3c6R4jx7opS9F1dL6e9IrBzQ0zBHtJ/wuWCKX3L1Tgw6kxA1MyenpP8o0iENw7HZ5JdKPSqRpgibjbOtx4adQgHGcyB8dMo0IiPQyJgIkf+LArn3Ku/qBQ4MSxrzCFwtAXBF98/yigVztXFv+lUr1dbhj5F1ofmvyfbsiXWZ623mlPe/xpVLK9x04qs4MIpb+iWHTVoUw360zOEiPTkPL7NWry/4xRPD/YK3cuY1U63k0UnxnJYLG8ArqQU6IvO3Chd6v+GvYmI+NZdgebk+b4bL5ls6hU2DR7iGNAxNcQJVRuYqNKzFH8H5VaS9E4pdfKuAASG28TqFk+rWLTQ3txaxqJNpugrowm+44nYifsXEGTCTHu+R8AkuNKAPalOsi3Yhh13CxkPNFIdTTHDqQcjJ4rX9n0YP9slrj0DGRiTwelgMzIglZMjOng/LEvtGcGQ3PxY8gfnisMhgDDgzYwt8KxTLP3BzJ/j2FuE6+8JpyioLfRZtB0iUekx3irjbesIw+mXJOdWmjOavFl2O2Ac6OPQQ9KoEsTKWqmn4Tz7k3ygXV475D0pLDhb1zKfxMKVY8RvS7+hl5nJ8Tf0L8QjSTI6lsYiqnqMYd+Z6JCngrVwI1SufFs6/Ix2YnPmU6dVTxUwSN/aZd/Mdr9bP8SJzWhCzU89MyV2oo07d6gmiklRsnaSPWXO4j2JVAy728DL4KOILW5qfeckcxKCZS6vfu9BpFu8cBiJLhD27n422dsIUuTLDAwhJ9YD1Tvb0RQ2TxsRMVkMsACgfoj6vFCm3CPlcNlnt1vLFjaQjVK4LPf/zUGr2TVcyZtd2QYtbX455xL1N+yDYHiinchSFT9Yr3BzPVk4uLAtflcyQrot6NIkmlLUhZPDeW+bpA7sekXVEFyhsxhaTioW939ZmesxKzkHvs4V3/v7z92KUhmRKLfun3IEFUl6NSXi2+9N60e3Nvfs41Kg2rlxd2f/92yVG/tKD3xKeMyIu3iM46r2RR2g0qLGcN2D+szElGJgQ5rNY4xevF5+PYzlPYvSzZDSctD7j6MxOUn1yCAdl/TFjgCARnxGSh3cdEPwxQsMOHhzm0ln92Uut/vNsXIwXw3XpqQsfC5spEdBnsFHr7EG8yD1mx6BOIFR/siplKokL3NhhsWjoFbrNu8X3WGKTu0yP8GQeMBYLvtNnS8+K7HOROqK7SJ0cRrqAvV1appGy3ocrTQ8VDeY2KgLwNznErlouIcJZ3/rSPuZ1Z79LhKOyLsmCpBEXmYiW4rnOm0KHLbheNKuiiv3pU8HI51kBZgC0hF0MQYQq/N1I9UOILog1FDLKMpXGlkORLwK/krUjhhCXH4S4eo0Iaiq/6ZIeE0xKko9Y+W0X7ogh6HH0EVRV/0L2SgNKw7FLZ5kPjUSZESezGyDDKWBYArKHzfh9qKGu+9fk71hwQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 033eebbf-4b25-432e-e040-08dc9bfa784b X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2024 07:25:24.2872 (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: 8A1f4ex4hpOJu1tTz5rGfGyDImTvUVLpG4T99bH8nT5xYepw6Oj5IO9iPloR0o7CDOXN0av1UJZMV0RHDVxiOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6610 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. Acked-by: Muhammad Usama Anjum 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; }