From patchwork Tue Jun 6 07:16:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 690391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7721C77B73 for ; Tue, 6 Jun 2023 07:17:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235255AbjFFHRa (ORCPT ); Tue, 6 Jun 2023 03:17:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjFFHR0 (ORCPT ); Tue, 6 Jun 2023 03:17:26 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2073.outbound.protection.outlook.com [40.107.237.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C786E1AD; Tue, 6 Jun 2023 00:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jxb4OK+blPOmfCbfbFwS7RtwdO42XYZpU5ZSW/ULzSlDNLDhFNiKBGo4v09jVDQPB2CYJYYISek9YrkqX+IrwTrFvqdj2/AmJ+u6hKRLFOKoXYk5ZkxxNBzzzxyHl6Tp366Hqc1kHXri6Zh5TsZEGE+CPzXpyZ7IPCxaZUlNyl+s0QaIfhMIZkTku9TSqinCW0uAFPo9lbCI8jJC0J3J/etSaHDtYeBs7/5z0uxgsXfY8/wyxYL8/Yam1jrvXnT5fr6lgnkoxEUM2xHjK1Z1/vdSJsEhWOA7gPUsPwM8jzQsfnqA8LNdkIGLIOOLc2cUQlOgHBsE3vb9i0Ep9va+Gg== 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=iP9o5A+zo7bJweh4Rc7yXQPSG4GKmkDno5NX83EjreQ=; b=L8F4h4luMVb7aHHGY/TakNjh6bV1spHTg7Sh3v9JKC3637admAXedzvu5lSfhZQsZXezDHASjO6g+8zxIZo+E94C0rFzZYPSRZ1jP4ii25xaIFp+QMOGCP8CvHEJpJbI/CrggwZOxMxHbIICt8i1ze/rWozz4zmhieTEd1hVXZKjKH7Uo3h2cstif3hk/FmHY0m86OLNGdk0Z/zoNbpVtIj3I6SnjgjkBjDQBwnMLn1nZrpQVmwdXhy1gPhq+XPVxqk9VpeLa2SDeNi3v/b2pcyooYUeOo7t0Oy+Cu2SGNV2Yf2wcKhZVt6Joxzc7Trv0pQQ7X6erk6IiFZtGbYo1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=iP9o5A+zo7bJweh4Rc7yXQPSG4GKmkDno5NX83EjreQ=; b=gbKCs76rxbUz403CqK2c52BEcRCpPw3+jUixDiwSPG4FhHSPzD/T9iZLM5ANBfJdg1cWqZY5zmKdI1/EsTY+A/77v5segMma29qvOtr64q0HN3jhpe8Nx9NzbBfGy2vv7oiLuHMNjLzRBQ0EcAqbJZmQUsA22qXk4ZtBpUu7jlAsdUqAbnuscPVxMBLD4CeeYGSwoG2fVTr3XEOYS2IRPPWyDlAfiE2PoKoxWRLRCfRihU/+zW15YynvkInoMlyftFqUHBbo+BiejnLQLlD7FNZGJuWIjsyABknUgbphy9qz7wz05SfieU/NXrjYJR5v+spTCIXWWjERhBdDF2F5vA== Received: from DS7PR03CA0296.namprd03.prod.outlook.com (2603:10b6:5:3ad::31) by BY5PR12MB4997.namprd12.prod.outlook.com (2603:10b6:a03:1d6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 07:17:22 +0000 Received: from DM6NAM11FT086.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::60) by DS7PR03CA0296.outlook.office365.com (2603:10b6:5:3ad::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT086.mail.protection.outlook.com (10.13.173.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:22 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:08 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:08 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:08 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v3 01/11] selftests/mm: fix uffd-stress unused function warning Date: Tue, 6 Jun 2023 00:16:27 -0700 Message-ID: <20230606071637.267103-2-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT086:EE_|BY5PR12MB4997:EE_ X-MS-Office365-Filtering-Correlation-Id: a31904b5-6bb3-484f-a921-08db665e124f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r8WLAVKrtcMWNwSm3gAk54ZpLalVo5DloersbxMkOh24+6SyeyJHVF2piXYfMwp+NlHC0cjge1UlGT/zSedJu6i19FxYVvVbnSsW8rr6kcZxAiROKBBpxUGqo1JKODHHH8Zm9aH6hvmTHHS5JCwpTNnnwd/be5DvbzPGRp6z1Ujx8Q450wCOO4QdErNxf+t4SWZIfUk54/bzo8SsB1vtqlgTPg1MopW4ruI0vG5lJAdq7koxysc7KxaUrHi/d/6/IcWWuoYrIz1p2Kl9+qhHURZe60crOPmh45n7l4vPLtJlS0rodUz75WkWMW4eu91+9IsXOHrtTWNXBolpc9btOapuHsFP/iwRX5FTLhi2NxDuUwlMnqiYpN252cvAAIPdexl3ZFY1vHmWwWWqbWLKyU+lRbNYmfXdRj8LT7CPha2jw+2xq3UIWRcPqXiKqAZnn6kj37DcQP8lydmQ8Cu51eORwAutLjXmXu4mGRi7rBaCUxQcRMjY2JsoCeehX84gwW9ujGhKVYL1IrergrRPFlic7IeXQbFLDHobmkchIl4nadT2da3zjqCbR2M6CvtkZDd1oAtpE9/NfGcTHit7EGoX9dsM2ejTnqkYqHWfHr6EiNbS8WwSnJ6gJFnFbpzDMZ0zKqydqDjOyB4W/Kli5IxNz22LrSSICMUUx9atlprBHg740F+S9woiLrvWneDqd4EXSC43zhtXF5xq0k7Yl+iKnG8E7+KKEQALBWiKpLyfDy+Z1DlJyVf5y+FrWiR/ X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(346002)(396003)(376002)(136003)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(40480700001)(54906003)(70586007)(478600001)(82740400003)(356005)(6916009)(8676002)(8936002)(41300700001)(4326008)(316002)(70206006)(2616005)(186003)(426003)(336012)(36860700001)(83380400001)(47076005)(7696005)(40460700003)(6666004)(1076003)(26005)(7636003)(107886003)(86362001)(5660300002)(4744005)(2906002)(82310400005)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:22.1820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a31904b5-6bb3-484f-a921-08db665e124f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT086.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4997 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org uffd_minor_feature() was unused. Remove it in order to fix the associated clang build warning. Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/uffd-stress.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index f1ad9eef1c3a..995ff13e74c7 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -88,16 +88,6 @@ static void uffd_stats_reset(struct uffd_args *args, unsigned long n_cpus) } } -static inline uint64_t uffd_minor_feature(void) -{ - if (test_type == TEST_HUGETLB && map_shared) - return UFFD_FEATURE_MINOR_HUGETLBFS; - else if (test_type == TEST_SHMEM) - return UFFD_FEATURE_MINOR_SHMEM; - else - return 0; -} - static void *locking_thread(void *arg) { unsigned long cpu = (unsigned long) arg; From patchwork Tue Jun 6 07:16:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 690392 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DC7DC77B7A for ; Tue, 6 Jun 2023 07:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234644AbjFFHR2 (ORCPT ); Tue, 6 Jun 2023 03:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231139AbjFFHRZ (ORCPT ); Tue, 6 Jun 2023 03:17:25 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2063.outbound.protection.outlook.com [40.107.96.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0A01F7; Tue, 6 Jun 2023 00:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j61+e5z8XhSvb86Pb6/ZS/u+i72hc/l4keiNP1wo+j7D4ttiBIYibMYdfChf0KgYSGsIV6F+6ZcmQF6wldWpfwYfa1t7Cv7chvUxYN966yxm4PteKGR5uHGc3/oHhQcPO+WxNITnSOvc2mPXXZHL7U6JTnXjXIH4m0dd9pXR3zPKnbbz0YozVM4qzl/+k7xRLDtVmfq6zT7NyMeEZswWgnVLRQJqy8rSsl27FNLEwKCeILdtlrgalhkA5A5spUQaoyrYLC+gNhE5289ZlK0PqKaMc3Cn86lxrIB7KRU6v3Ip7emnyqXRDcDymnPnYgDftXJiHlHFXY7S5wBkt3rHOw== 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=Oomk2fy3Qd8IWmlp1U9Cr+uW/RGziNlTD8zYdFVYMMA=; b=aGqs2kVLge+C7sTZ6ErEWATw6v62ag7K644y/NnzGwj1tEI/TUWabJeZX4EfAkzQNuRXT2SBjJWXVDmzQ8F1RQDUmj1hrJxZ6siEGY53iEyBa5IT2zyBVaiDY36c1Ea4RQl+heoU+B5n5AI3XfuRmLwDuWyFBisuIhHTIwKaxAR0CaPY1oWU4LXylfnNfgIq5Rim7R7t781B18z5dyfPgkdqO+CFUu42oNamcimEnbrHwnSvMEped0+HetsowwzOD6V7bNADwjpfYMC0au18rvWfrTXSfLXUSpoP3CvZlr9q//sWcGUgAUl7UkvRwsGI01V3YFx7wRbmAw7A852iOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=Oomk2fy3Qd8IWmlp1U9Cr+uW/RGziNlTD8zYdFVYMMA=; b=Ze04XqAwyyefbOQdLS2a/cErELDu0dyXO/JDMG3PY5ONuz3OafovhpM1Vm1MHizELnzQs6lZEDvrRMUTwas281IZi3c+pzLI/s7EcVj4UO4imJR8ASc+TbiFjZcrgTj0s9v/9zKfdSsKMxydAHYdokyhDx5ax4MPnT7eW31G6OP8VBDDVO6dQgiXHTeMhJlhanQTJCLfuFGbrxrmB4xKE2sLPSnXYURWdAMxdpQue9GdFN/dcYNY0jx63JsRluHdWyhoiiCbYJLz9Ha/xj/A/VnFwXOCnUDcjwefYd34y41gGy6RaYzS7wWpbnp3+vv1ofYP9we/0g9F+qA6YAmdRw== Received: from BL1PR13CA0402.namprd13.prod.outlook.com (2603:10b6:208:2c2::17) by DM6PR12MB4877.namprd12.prod.outlook.com (2603:10b6:5:1bb::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 07:17:21 +0000 Received: from BL02EPF000145BB.namprd05.prod.outlook.com (2603:10b6:208:2c2:cafe::b6) by BL1PR13CA0402.outlook.office365.com (2603:10b6:208:2c2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 07:17:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF000145BB.mail.protection.outlook.com (10.167.241.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.13 via Frontend Transport; Tue, 6 Jun 2023 07:17:20 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:09 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:08 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:08 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v3 02/11] selftests/mm: fix unused variable warnings in hugetlb-madvise.c, migration.c Date: Tue, 6 Jun 2023 00:16:28 -0700 Message-ID: <20230606071637.267103-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000145BB:EE_|DM6PR12MB4877:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ddaaa03-832e-4960-58b1-08db665e1157 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xmsKfaV+Y9szZUbOLZz/nYJQ5ryVYu3989jC4EVu3MAXqDRqSRoZeotMfNffL2FceTjsGRiZj3rOt1cdxALUiE7XfVc3kIMalNK+z2anDlGJfG20eRAGJM50QMmoxNYomAhfLdiMqc9u5gnKwrNcqr/rFx1uMAyd1nY/yMKr8soUG2S6FZamAZhJNJLN4Vma91pbW89kwUvfItk52W0lVCMHcwmgGkoAneVqIi9a2IHEi8ezr6Vmsf+1Qg/hk+NUbaJ2R1Kx1NHbgutUfXdRP3TD2oPnaMpNY+NzHtykwfM2W5xjerS+e38ZkhNPzK+vc/abCVAZf3QLrvH1Yo57LBkuDGcQOawlrvkxaSn0qhJbXWz/CbPUTVvmuE2wU0P6B3mrNT2pdosQ71kb+I92H7ysmgx2/eUzjCywbKtXDLnD9dYPAhJl75xT5UfTEDW0CevAoXQv9C/jaBkKye3JaZFL88sqrahCZnCp6SXv5vLLmuOOkasW3XG5JQj7hjJv8Tqv11wwBVpIhFoFjkPiaT9qTOOy0l0V1oWuet8iUcXHIe7XjvigldV33GVDEGykwqNhRAgTIgLz2qI7zYTFzv4dunniqQs21zwLFbz9Nt6tBlGASkgy/vE+4MF18yUu1y+kcmOdSiOMHcmSmjupEIAnmNKjQL7404448TgKjZR6OwfLrEMrN+yVceP4i4t9US79AW0Hdl2Tw75sl6uT04uE5tXfMmHLGiK2mjlp9OhQNAR+bAZWX3osPTcjIORV X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(346002)(376002)(396003)(451199021)(40470700004)(46966006)(36840700001)(107886003)(1076003)(186003)(26005)(2616005)(426003)(336012)(83380400001)(47076005)(36756003)(6666004)(36860700001)(54906003)(82310400005)(7696005)(2906002)(8676002)(8936002)(82740400003)(40480700001)(478600001)(40460700003)(6916009)(5660300002)(86362001)(4326008)(7636003)(41300700001)(316002)(356005)(70586007)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:20.4921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ddaaa03-832e-4960-58b1-08db665e1157 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000145BB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4877 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Dummy variables are required in order to make these two (similar) routines work, so in both cases, declare the variables as volatile in order to avoid the clang compiler warning. Furthermore, in order to ensure that each test actually does what is intended, add an asm volatile invocation (thanks to David Hildenbrand for the suggestion), with a clarifying comment so that it survives future maintenance. Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/hugetlb-madvise.c | 8 ++++++-- tools/testing/selftests/mm/migration.c | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/hugetlb-madvise.c b/tools/testing/selftests/mm/hugetlb-madvise.c index 28426e30d9bc..d55322df4b73 100644 --- a/tools/testing/selftests/mm/hugetlb-madvise.c +++ b/tools/testing/selftests/mm/hugetlb-madvise.c @@ -65,11 +65,15 @@ void write_fault_pages(void *addr, unsigned long nr_pages) void read_fault_pages(void *addr, unsigned long nr_pages) { - unsigned long dummy = 0; + volatile unsigned long dummy = 0; unsigned long i; - for (i = 0; i < nr_pages; i++) + for (i = 0; i < nr_pages; i++) { dummy += *((unsigned long *)(addr + (i * huge_page_size))); + + /* Prevent the compiler from optimizing out the entire loop: */ + asm volatile("" : "+r" (dummy)); + } } int main(int argc, char **argv) diff --git a/tools/testing/selftests/mm/migration.c b/tools/testing/selftests/mm/migration.c index 1cec8425e3ca..379581567f27 100644 --- a/tools/testing/selftests/mm/migration.c +++ b/tools/testing/selftests/mm/migration.c @@ -95,12 +95,15 @@ int migrate(uint64_t *ptr, int n1, int n2) void *access_mem(void *ptr) { - uint64_t y = 0; + volatile uint64_t y = 0; volatile uint64_t *x = ptr; while (1) { pthread_testcancel(); y += *x; + + /* Prevent the compiler from optimizing out the writes to y: */ + asm volatile("" : "+r" (y)); } return NULL; From patchwork Tue Jun 6 07:16:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 689998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07C92C7EE32 for ; Tue, 6 Jun 2023 07:17:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232402AbjFFHRa (ORCPT ); Tue, 6 Jun 2023 03:17:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234251AbjFFHR0 (ORCPT ); Tue, 6 Jun 2023 03:17:26 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2047.outbound.protection.outlook.com [40.107.92.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03117E40; Tue, 6 Jun 2023 00:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GEXPRkzoIgjMzndqE1RUdfl2XnWEZqAjORlniVPU869eqFXj4kUzllquY/EfQ1OVtUWIW5buxT1BV0m0ViirL2Wn6m6XAY6cUTWseq7DEr8KOBxnAjuM+v0Gda20M9FH5tszuzu1FmNr7UJXpfhR7G2icJH43wx+zKWGS058e4ssUwd9HOnq+5JKYtQpNxEQYYeknTV1xqphABBQiKQ50NS06ojEh0bCCre28Aich1dj6vYE14U+s/Ei3faUoJctQrw0mcHnDpHL59boRJorAzG2cq2Ehq9r6NYh/JR5ui6RSCIbcrF6+8GlxmvBCujPmLcFJxiwrZXlYqEZ8nNFyw== 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=R/GcSFki6gkb8xdTqFtxT9LuvcMcqdER4egYKBl3qMs=; b=O54/TtuCLmvck9N6s1wKQT8k+Yl2Vh9ZCgR4kGa1tQDhzUHomLiNzUo/B0VJ13gyU3z6kGPabYr5shG4zgZIZMksyXhnp1H4zMUXd2djHX9o8EPLGO1SyulmijMxcnSNsfx/ci8N+a+P3dBhgJ1fGBtgC/SjAtukLSK7rdYgz+Dz6zaIHt4eot0UIJzc5k+3n1nP0G/7svW9aVie7WpX48FbisevmRVPtQfNh6cFFEdDg4QignmV22w4JED6/VLXfvu3Ou6pEfP5AegL9aCLynai3+7rG7ivqqbh8gadxLbPqavwdp2pAPNlgJRB+C/MxpsfeC3vyPFVWJAh8HC2DA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=R/GcSFki6gkb8xdTqFtxT9LuvcMcqdER4egYKBl3qMs=; b=Hi+nV0obGlmHQFbDWCV9hcFJ/8lvPTd8gxq4mxIKJHEyWeVOKDiSQY82AQgqJqm7RQ6dKvjy0ZOJ7N9Y/YQzfZICz/1Ymd2boHtaUaeU3zSCicKZDU28TDPR0Cnxl4/bDpSEd+DV3c7Vx36ABBkHtF/LpLg4IVTTGL0EjR1Av+G9GSTF4QRe6XaHHhV0bxTXfsuHxST0JOG7Gdz6LlYFv3Vy6QLSppS0ZerxVDiA1OCUvFFf1Ng0PWT8O0yCtv8lcwcKeYiilINkVPid8/2+/07/PeCOYOmZQ5cCVLvrj11zmRtTF94YR8WoplWe31Le2zGvB1Km+sQeubm/Nej+cg== Received: from DS7PR03CA0275.namprd03.prod.outlook.com (2603:10b6:5:3ad::10) by IA1PR12MB7567.namprd12.prod.outlook.com (2603:10b6:208:42d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 07:17:23 +0000 Received: from DM6NAM11FT086.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::ca) by DS7PR03CA0275.outlook.office365.com (2603:10b6:5:3ad::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT086.mail.protection.outlook.com (10.13.173.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:22 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:09 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:09 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:09 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v3 03/11] selftests/mm: fix "warning: expression which evaluates to zero..." in mlock2-tests.c Date: Tue, 6 Jun 2023 00:16:29 -0700 Message-ID: <20230606071637.267103-4-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT086:EE_|IA1PR12MB7567:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e8f41c8-e515-4892-ca0d-08db665e12b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wyMDwNmntgWoMJ5IwDjBrm5greNtHe+auxXOO3XhLmG7XX/UDDofLluMBXhWUCF/cmSc30oAG4Vr42qwJZO+sbnKXYAklTDXPMKUn3rx2X9kZfZ18hkoGysQIdoMNjQTz4/Xt2jLEz1H83AyWfJyWDB4VlqTBBElZZbLQjqMQE1r2tAgjRepHATcK1x0hzF/7V+ifze4RSHNad7r7JIBqBullWBzZ+o5Gn37WAfC8ZRuPtNegIH2oQGvd7+IYUgGC5V5j0qy+CfSkNvDog3cAkc6OAGB555zwZqRxH1MukhmWwQfItbsHduXND7zmU4xeeY7gbjfyE8g6yZCg/yyhWXkAWbJfN67oNvvNi5fU1uu3UPNyjP3M1n83VKaqqOH19mXY6uM9K83C7dE0u0lKcHsqUcMmo9/WmfgNZ+rF5OpkEO1xfgkYz3eHzb1GRN8NzHO73Lh+/kUCcMvPNHB21tF7TZwaiR6fvuhMTMTu7n/HObHhS2Uk+O1Sa6wtwNk64H752H1kM06kmRmgsFqFx6/sVZSBbTzBwgHjmzxzDIGbVhM8mkS+dAlVU1COpdydGca7uFO/qbhOkjmZvyGjskENdtGX6djwxjD8/bYpGH6QZ5OQuW7o6Y8i/lx9F/AGLpDpJSLfpm2lgN+gkAGEwJoDZKfNEZHwIg20kcN3uQUj2kg++1Yk9Nf2W0MkpwQaGxOsX2lndX+5fcP4A2VyPNaAYMzEhRIml/pWsdSsUeoMfsrSR1XDIgs5vCSbDsF X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199021)(40470700004)(36840700001)(46966006)(26005)(1076003)(40460700003)(107886003)(40480700001)(36860700001)(36756003)(47076005)(83380400001)(426003)(336012)(86362001)(82310400005)(356005)(2616005)(7636003)(186003)(82740400003)(8936002)(41300700001)(54906003)(2906002)(478600001)(70586007)(70206006)(8676002)(6916009)(4744005)(4326008)(316002)(5660300002)(7696005)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:22.8226 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e8f41c8-e515-4892-ca0d-08db665e12b3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT086.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7567 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The stop variable is a char*, and the code was assigning a char value to it. This was generating a warning when compiling with clang. However, as both David and Peter pointed out, stop is not even used after the problematic assignment to a char type. So just delete that line entirely. Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu Signed-off-by: John Hubbard Tested-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/mlock2-tests.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/mm/mlock2-tests.c b/tools/testing/selftests/mm/mlock2-tests.c index 11b2301f3aa3..80cddc0de206 100644 --- a/tools/testing/selftests/mm/mlock2-tests.c +++ b/tools/testing/selftests/mm/mlock2-tests.c @@ -50,7 +50,6 @@ static int get_vm_area(unsigned long addr, struct vm_boundaries *area) printf("cannot parse /proc/self/maps\n"); goto out; } - stop = '\0'; sscanf(line, "%lx", &start); sscanf(end_addr, "%lx", &end); From patchwork Tue Jun 6 07:16:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 689999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1D35C77B73 for ; Tue, 6 Jun 2023 07:17:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233867AbjFFHR1 (ORCPT ); Tue, 6 Jun 2023 03:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232402AbjFFHRZ (ORCPT ); Tue, 6 Jun 2023 03:17:25 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2076.outbound.protection.outlook.com [40.107.92.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C59B109; Tue, 6 Jun 2023 00:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SKCZpwPZn23qi/s//HrklUidi1cZTg+OFkOTTb6LLuNjErtxW09Q8rwbsLq6opHL7SDr266v+BpzJeTRp5iX4/lo6441Nc38GPSRS0FKYWIR0B6JXSnxhcL6FtfSepErTzWbOkf3RfawIllKqXRTNJULh23HJqR6pAMkrkHVONJrkJ8Ome9RHu1VG6NOggFgUTVHuGQpwOWhNSAvgnVw5fHQaRgDJRZgEDuJhIjlGip+NuERnINk+siIDs7VT/Pt0v3sjBKAMDGj/NRzmBr1T6gPhu5QI9M1DU15RUCyIcgRshZM9n18lubdZvL1HJdIIZv5xK6DzcdwPqfv6pp/Pg== 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=cvdHBj5yApv+3mwcH6LWSMXJlHljQnJdtS4CV2ZOt8I=; b=cZjPNHv3lFsL80EkUAoVmgtV9Y1ajms0ffTe/M7tRc3CqusyPIAWgfMR/YN9nYu5eFqXZzuPk5zEyHpT5gX5AuxgZpI05Wp/Qf/RDa2GVXm5TUmKMdpplKVynpWKgp4zEx6Thub6Yc6EqFwXUCG1t/o0HARpupRpTIpBjDJUoQB3B/73F+v0qlhHxl/S4mVhlfsvAiMObufKlIYh6NSbGTJ/n1EYZFkhk4lFwbZEOx+lN5HrVtYmCogoSPU4TfYst0+FPOQXtpzHsJV/84jF7zli/DTS3IKZE9ofmm1A+EpPcm1NocLc0GxxD6a5yMRFhNYqmlsIAvL7LR7UwY8bTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=cvdHBj5yApv+3mwcH6LWSMXJlHljQnJdtS4CV2ZOt8I=; b=hnOtLnQIeaBIonQjlIzuBxnpVe/Mj5harWLyrSeykRmLLQcA+b8fyuvpBU30IW7k7b4huCaOFjndaDY0+HUEpt3rHVBNSN4ikjAIz14AfQEXZCKL4xVzuHb5BtyGTHLZTRTDKs3ymrMEWApL8LrpJ0UKsyIyAxdoPE5DlgNcAsHDiGOoQe1yC/AYcvBAA6ayZBU+15Wdt/Zu0l8TeGfCvmxNx5C8eufdeNdXpZe5sgWy1gGhly6I8PrMDuNE0yOEtNdxTnTx+7fykL/hr0+hBGO6weSX0VipNfOSqlv2ng2HcvpdNmaSw1+Y2MSJMS1bfQLXUGEn6B8s+fSzms2MaA== Received: from BL1PR13CA0400.namprd13.prod.outlook.com (2603:10b6:208:2c2::15) by DM6PR12MB4340.namprd12.prod.outlook.com (2603:10b6:5:2a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 07:17:21 +0000 Received: from BL02EPF000145BB.namprd05.prod.outlook.com (2603:10b6:208:2c2:cafe::fd) by BL1PR13CA0400.outlook.office365.com (2603:10b6:208:2c2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 07:17:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF000145BB.mail.protection.outlook.com (10.167.241.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.13 via Frontend Transport; Tue, 6 Jun 2023 07:17:21 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:10 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:09 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:09 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v3 04/11] selftests/mm: fix invocation of tests that are run via shell scripts Date: Tue, 6 Jun 2023 00:16:30 -0700 Message-ID: <20230606071637.267103-5-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000145BB:EE_|DM6PR12MB4340:EE_ X-MS-Office365-Filtering-Correlation-Id: 555001b6-8227-4b16-534e-08db665e11d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tOxXSSCYbKiZAW8KhYwA//tOeeLektX4TyG4wkJRRv63fRRRNez/Kr0IWnUKT7BNwCP+PZ+bRfJyJ5wdEmQLS4YnhG6zJuhLLlK0rLdGZx5IAuI2jxuuO7g78qmPc5ZwaX4b3xxVHzeiarI77YScpsfP5ytdg8h7GfK01k9IbYS1d2SnRk3bAPhaowpHCa/Mj7tpC7YSN2g8eIFVb4E8srzEMd0wTSGXqLMpylHuoPVjXa/9Hcra8P90Pz9yziWdmkF5AQ/vUHmUNUtYsWP/qTpfoQRhP/CpsHOcYFog8X8APG7Lo9tBhkx2ER475JvcAywq7PTY399PIHMiEBRHrMV1ORij7KKYKfdi7CKF+Oc5n6PAGN37Vc7PSsmhtEcd+kfMwO67XrpTS2l00SR/H8T9wWx8dhpSRIcA/3z6B3pQc6X6QxPpoXoOXDyFLJvaW/5dh6inaK6ploMWuG6DAY7uQglcT+3XmoLGfBj4a2n1RBD726FfyJRguRYNlCUk0BVm5q8gvu5VHBbLc5z1sJYUJNa87mxkMF8YtEETATIKgbqsb/iEaRF39unYwe8RWiSN6BNDZsIPcb4zdeT8j27tIODkT3ahWoA3Z6KcUbIfcmBRfZv47T7eBpLdxECg7wcaKi03nhDi8NlzBUcbjh/QM+/AYMDxSIFAYLtQ9AMo/v9OwHpiw7bftd/wA8zC382vn5bIyYtTYnVXMQ8QVMM1JGMeub/ogvtC2213ICFIOdtQAmaiLVrw5y63gaNl X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(346002)(136003)(39860400002)(451199021)(46966006)(40470700004)(36840700001)(26005)(82740400003)(70206006)(70586007)(356005)(7636003)(6916009)(4326008)(7696005)(336012)(47076005)(36860700001)(83380400001)(82310400005)(478600001)(426003)(2616005)(6666004)(36756003)(2906002)(40460700003)(1076003)(41300700001)(40480700001)(8676002)(316002)(54906003)(8936002)(86362001)(5660300002)(186003)(107886003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:21.3046 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 555001b6-8227-4b16-534e-08db665e11d3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000145BB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4340 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org We cannot depend upon git to reliably retain the executable bit on shell scripts, or so I was told several years ago while working on this same run_vmtests.sh script. And sure enough, things such as test_hmm.sh are lately failing to run, due to lacking execute permissions. Fix this by explicitly adding "bash" to each of the shell script invocations. Leave fixing the overall approach to another day. Acked-by: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/run_vmtests.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 4893eb60d96d..8f81432e4bac 100644 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -242,18 +242,18 @@ if [ $VADDR64 -ne 0 ]; then if [ "$ARCH" == "$ARCH_ARM64" ]; then echo 6 > /proc/sys/vm/nr_hugepages fi - CATEGORY="hugevm" run_test ./va_high_addr_switch.sh + CATEGORY="hugevm" run_test bash ./va_high_addr_switch.sh if [ "$ARCH" == "$ARCH_ARM64" ]; then echo $prev_nr_hugepages > /proc/sys/vm/nr_hugepages fi fi # VADDR64 # vmalloc stability smoke test -CATEGORY="vmalloc" run_test ./test_vmalloc.sh smoke +CATEGORY="vmalloc" run_test bash ./test_vmalloc.sh smoke CATEGORY="mremap" run_test ./mremap_dontunmap -CATEGORY="hmm" run_test ./test_hmm.sh smoke +CATEGORY="hmm" run_test bash ./test_hmm.sh smoke # MADV_POPULATE_READ and MADV_POPULATE_WRITE tests CATEGORY="madv_populate" run_test ./madv_populate From patchwork Tue Jun 6 07:16:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 690389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 543E6C77B73 for ; Tue, 6 Jun 2023 07:17:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235606AbjFFHRc (ORCPT ); Tue, 6 Jun 2023 03:17:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234565AbjFFHR1 (ORCPT ); Tue, 6 Jun 2023 03:17:27 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0B8FF3; Tue, 6 Jun 2023 00:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fTzKPtksKGppwYgNWWe1FnduuQ0yXglnqHnyT3qE4dn1WY+ZTubxBcP3CHQnITDpbME5WH30ulZgFLSfuGQIdgr/WVWxCWvZRtroqnOQiQCS/Y91s0wnPIZ+a38LMXgsOvSvmvYL+4bv4PBgfTBSg66PCYIeAKNM5Yu7CWeZeOqET13quCMSpq82RhZJyekY+zdMvFT8aXd1GiSi0TH0bTKbJ+rTD+iZZekvhdo2Ot0DVQCYrvMiU4LfLD3uT26VAA3NCwFEQfhzd+fwVyQ7S8szw+x1mEeb6BwLhzRzToQDZYL2mgtx9ftUx5hGm7ZCf8tue79EQ5ixl/mVXdQO/Q== 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=IWs0ZFZtf9AA0eJlvMtGJJaItuLyGSP7UduhhCtkPQI=; b=d4pQJfcB9EZrz/3udttBRs0BF/oiiT324V01U14USktRmcCSk38wYbTzMmyeGU1ilO0mX7s7J53F/7/IJxZMYr3/eenowtCBSgMBRHlU7LIEzXFR9KWTeaGmgYf6CGF33g6oZGgQ+R/FiHJv9tR8RFKF+3jEX+y0+4k3bUI2F0Df8zzmW9qlMWc15NqNmMPSIINQjoFlKpoeZGvJHqQwfIMnlyeTBbYG1HlBFG305vUZvFpGA5EOpLLcjaD3WJSFzKxk60kjRgHZtQ4SvlYf8hJ508uU8nQXz25YyXji71n3wnerNeEbYrNceuJdGeyoJvXax2b6V/d9UIZVW2g86w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=IWs0ZFZtf9AA0eJlvMtGJJaItuLyGSP7UduhhCtkPQI=; b=FrW8qq3iIniRhOKjcrMk+tI9RGdFsQuV9jHdARaFNWwo9wZ/EJ7BvyuyWCKCwYL4hff2JLyo9B2RZ7h+Txiflt3FA/W3Ru6yg+RtXPSFc2LOHZy4eJWdUv6jxiuCjdMJaJ5NZ4ScNUuTMV+iFhlBDx9F4kHLzbkKNC4UO3yfBfqleI2chzAyBbdk/jvNebgEl7czaEX5utv8UVj/hN3SLBza2PtUPbzWoygCaZWRMfuxvswaipFvsPP9DGq7Uu+59r5iadLnlgNTYr8eX3PkzP2q20yCz/kpQuwy3Zk6sZL2I4VXpzqC/llXRGbSEu4M1alYLt43K+5c/XWMDT4RYg== Received: from DM6PR06CA0020.namprd06.prod.outlook.com (2603:10b6:5:120::33) by SA3PR12MB9160.namprd12.prod.outlook.com (2603:10b6:806:399::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 07:17:23 +0000 Received: from DM6NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::b) by DM6PR06CA0020.outlook.office365.com (2603:10b6:5:120::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT047.mail.protection.outlook.com (10.13.172.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:23 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:10 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:10 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:09 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v3 05/11] selftests/mm: .gitignore: add mkdirty, va_high_addr_switch Date: Tue, 6 Jun 2023 00:16:31 -0700 Message-ID: <20230606071637.267103-6-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT047:EE_|SA3PR12MB9160:EE_ X-MS-Office365-Filtering-Correlation-Id: abbf8a5a-5236-4074-5695-08db665e12e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7I+GSKEN71Z+WjprJLpX5AT6QOgRc9tEb+m3Jh2/YvridkV0KJH+oN3dxX8mWSEdL+XiCD81a6YTBk8jsLaASgOfJRh0YphOxGrfvrX4tcnEc0pQpK2CiozxaPB0eE+onZ9oVKcYpaaTto7pvTX/u7dh/CI57D7OPagcuQOsk+fJ+lsRqAMtYrXmvDU2WtWkn5M7IiPz17UySWU2wKKiiWl7WPXGPd2eDuSF7dgh+LsNJSpfhfeE+EVt9mu0E8Nw1H6qfj3XZp1ZakUKvNhodCgVXRc+G4cunVnfZSuSkK9hZOoGLg3FgYIdKrWdyE1jRphSvZ472okpOVUeIPH1ARfIxheOprWXI8SgunEQu+xXInuiZS3laKPNxUTEb3GL2TU7CSu0K4gGQFkzv9wzU5dGXNqKftpoakp5RCEft9MYvUsTlwn9L6N6mDahljObAnzfvtLKsVPMgH/raj0Et1zGoSA6OnnSXn3snbNd5iENJj7mCS/mSzzUArYndNq8HN4Bip95U/c6MHFvmDuHm0T4UKhsyWIJOQ1BFpl4seN2Ey5fkmFEuo8qoK/K+FigGOerucipMS6dtF99VnFiNvrNxpRb5hot+ZdfaxoVrmThBGJh+G7eTCQm+Dcknk/wO59YLBjxf6eAVI7A8RE11C2XSo1Flt3O5+Va9ukRg1WziyirZoctvXefFwvICMfmRRyQLy+tNj8S1wrlCf4SgURycBKhCnOHqA96cSc3Vq33xAt4H0C3x06G9nqd7514 X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(346002)(376002)(396003)(451199021)(40470700004)(46966006)(36840700001)(107886003)(1076003)(186003)(26005)(2616005)(426003)(336012)(47076005)(36756003)(6666004)(36860700001)(54906003)(82310400005)(7696005)(4744005)(2906002)(8676002)(8936002)(82740400003)(40480700001)(478600001)(40460700003)(6916009)(5660300002)(86362001)(4326008)(7636003)(41300700001)(316002)(70586007)(356005)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:23.1695 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: abbf8a5a-5236-4074-5695-08db665e12e6 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9160 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org These new build products were left out of .gitignore, so add them now. Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/mm/.gitignore b/tools/testing/selftests/mm/.gitignore index 8917455f4f51..ab215303d8e9 100644 --- a/tools/testing/selftests/mm/.gitignore +++ b/tools/testing/selftests/mm/.gitignore @@ -39,3 +39,5 @@ local_config.h local_config.mk ksm_functional_tests mdwe_test +mkdirty +va_high_addr_switch \ No newline at end of file From patchwork Tue Jun 6 07:16:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 690390 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDD1AC77B7A for ; Tue, 6 Jun 2023 07:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235573AbjFFHRc (ORCPT ); Tue, 6 Jun 2023 03:17:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234581AbjFFHR1 (ORCPT ); Tue, 6 Jun 2023 03:17:27 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20616.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe59::616]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ECEE109; Tue, 6 Jun 2023 00:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JLzHpO/KXQOAkH4m0DUEyVWY884g1hehCucOwsW4gQLKd1TrKX1TzwQMkIU5Rcwbk3fmjVo1n8PWsbg5mT8vyxSJ0HjFDxfhs2iG7LOS0/ukDlZfP1soyOeVk9vJ43if+KBo7zWxuej/V/lUMjKNvlfCLhzJKdbPhUKP8CJzobN6uUvsZpYV6bjtLZbZz5Aull/hedpLQNGoWwPGCb5kPNFjoatbk8FGylHw/mNVss9jsj51qdDF7ubqtWlVnvpb3zlG8llD7gpRJOwEYtqlriR/f4xPFcD8mrJSUJ/Gwtsefb2Sp0dzZEmkNAx8wZYHNdHitvRK6koj98b3he4Ilg== 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=MOpTW35hPW9iKOEt96WhLvNwMqiGhAYImrqLsr3Vsz0=; b=GIFcumYKROG5l85+lZaLd1PeTULqcs5ZstCyHrNlw/13MOCxEwH3kxKMuJvNYspuNEwuWIpfIo7fAu7G+zPJCVw1iIzCRSHKsfchtYzs6EpJ+S7uaK6JjYAqBeECN5d7REcLniJosvBFVb4lvkVWPS/CYnV4i/70nPo7G6NPGdzBfw+F4mST3HSBtDaDBsvMzwqTyeVBY77Fy57Ty7rdkN3NUqS4T4vJOQ6Q/Az7me4MzS9puxHHio7+KoyK6KTQGCPx6ultGWGIgVS4MbvGoczX9X87uOGgoM8fQ65VpO4p444yWm7l2EjdgGbvHSKnrI7vBRU8nO30XpkSdV7Lyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=MOpTW35hPW9iKOEt96WhLvNwMqiGhAYImrqLsr3Vsz0=; b=Cs3xjVBjMmPXKiGLvPsh82s1bxhDN7I+k1gUClbRmrPKFtiLSTgv+/Hn+vEF+hgOKubmKrJp8ss5sR/B73C8X1qXOrLpnv3FM+U2LfXiLbWsscKRjBm20WpEMG/Ag/JoHVgel3HfBAqRsxZ9k3y1CXKz1H9HwO8z1L9WhO+rCFz4pRR4OUfr0QPuMpk5swbYH/BAri98zXConkg8Be8dSYAfzwr2bTeMopJ8aFJIk+ex9fqFe3bqFhDa9tptkviz7pmkKIiMVyztGJsnGNbdyDxfki8e+CRuHfMTT0PZ6VDJcTiEkqRRqGzoPvU1KOQZ9JSij75OepNMLlIt1zqgdw== Received: from BN9PR03CA0685.namprd03.prod.outlook.com (2603:10b6:408:10e::30) by SA1PR12MB5614.namprd12.prod.outlook.com (2603:10b6:806:228::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 07:17:23 +0000 Received: from BL02EPF000145B9.namprd05.prod.outlook.com (2603:10b6:408:10e:cafe::a8) by BN9PR03CA0685.outlook.office365.com (2603:10b6:408:10e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF000145B9.mail.protection.outlook.com (10.167.241.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.13 via Frontend Transport; Tue, 6 Jun 2023 07:17:22 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:10 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:10 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:10 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v3 06/11] selftests/mm: fix two -Wformat-security warnings in uffd builds Date: Tue, 6 Jun 2023 00:16:32 -0700 Message-ID: <20230606071637.267103-7-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000145B9:EE_|SA1PR12MB5614:EE_ X-MS-Office365-Filtering-Correlation-Id: 08de86af-7f0e-47fa-dd20-08db665e12c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QvkjZ2c9IwzdJR78K2sjoTyO6arPk17BGxnWAkDm4+oEKD9TigllXXB/EIULxdNFm4RncZV5vH2TPVRlDzLGfAOb1dmzBMhVt3j2f2qzKY6PVnBW8tHqN93DyBcqaQVLz7wNRfHD7tJ0HU2Cts1exe6+DO8dPhj614BUTS+e49ERhXpvMgNxWFb5YFKrPHE/ZaqSUtTcCVw2UuteGYofliUAPD6ko+orjjiXzenHmEG0IP+u6aWA2OvbarLCFglFQ5nhi71Oe3IAXG7maRKDik/84K+PcHiPuq2U4/h4sX48oTWZJ7RWLunwbtyByxlLy6qimvyGSnUWa4UxzZ0ERHsSYcrg4ymuQ5gLbb8tQP98vygTpMGNuCyT4OfkOogW1e/z498wKGac1tEdf3hiPQMeBJ2i4F/4AVJok9j/u2h7MKZ8fHYZirkrmgq2UJYs3WeVmQKN7m4Hx8IBntoGXU/P+2v82YfdYb3tb1lx9WoK5DeoeO90k5XVz3Ba2538uWG39Twm3drLdJO1YEYa1mcVhOsdGmaHDN6IuGHXtzCUrVdecULDXdl9QYNCF3V4+J0FDOP5T4DZcN6+1MwDNncXfONyIvIQDqt1BB81omK4HC7VPh9Ca3qSfqxJjY/Nu/nbYZ9SpwjAN4JRPyWY0glVNxV2oWuj+HnprkOLri8tN8kKOxZjt9iUz4akXbsB+xBPpINXhIqBp4iCtdf1bf76aqmiupk7z2MC6EdDUZX0y6nVPc3DkTXYr87WgKcP X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(346002)(376002)(136003)(396003)(451199021)(36840700001)(46966006)(40470700004)(40460700003)(426003)(336012)(2906002)(47076005)(83380400001)(2616005)(36756003)(82310400005)(86362001)(356005)(82740400003)(7636003)(36860700001)(40480700001)(7696005)(41300700001)(316002)(6666004)(5660300002)(107886003)(8936002)(8676002)(54906003)(478600001)(70206006)(4326008)(70586007)(26005)(1076003)(15650500001)(6916009)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:22.9007 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08de86af-7f0e-47fa-dd20-08db665e12c6 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000145B9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5614 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The uffd tests generate two compile time warnings from clang's -Wformat-security setting. These trigger at the call sites for uffd_test_start() and uffd_test_skip(). 1) Fix the uffd_test_start() issue by removing the intermediate test_name variable (thanks to David Hildenbrand for showing how to do this). 2) Fix the uffd_test_skip() issue by observing that there is no need for a macro and a variable args approach, because all callers of uffd_test_skip() pass in a simple char* string, without any format specifiers. So just change uffd_test_skip() into a regular C function. Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/uffd-unit-tests.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c index 269c86768a02..04d91f144d1c 100644 --- a/tools/testing/selftests/mm/uffd-unit-tests.c +++ b/tools/testing/selftests/mm/uffd-unit-tests.c @@ -109,12 +109,11 @@ static void uffd_test_pass(void) ksft_inc_fail_cnt(); \ } while (0) -#define uffd_test_skip(...) do { \ - printf("skipped [reason: "); \ - printf(__VA_ARGS__); \ - printf("]\n"); \ - ksft_inc_xskip_cnt(); \ - } while (0) +static void uffd_test_skip(const char *message) +{ + printf("skipped [reason: %s]\n", message); + ksft_inc_xskip_cnt(); +} /* * Returns 1 if specific userfaultfd supported, 0 otherwise. Note, we'll @@ -1149,7 +1148,6 @@ int main(int argc, char *argv[]) uffd_test_case_t *test; mem_type_t *mem_type; uffd_test_args_t args; - char test_name[128]; const char *errmsg; int has_uffd, opt; int i, j; @@ -1192,10 +1190,8 @@ int main(int argc, char *argv[]) mem_type = &mem_types[j]; if (!(test->mem_targets & mem_type->mem_flag)) continue; - snprintf(test_name, sizeof(test_name), - "%s on %s", test->name, mem_type->name); - uffd_test_start(test_name); + uffd_test_start("%s on %s", test->name, mem_type->name); if (!uffd_feature_supported(test)) { uffd_test_skip("feature missing"); continue; From patchwork Tue Jun 6 07:16:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 690387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55B9CC77B7A for ; Tue, 6 Jun 2023 07:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236033AbjFFHRi (ORCPT ); Tue, 6 Jun 2023 03:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235189AbjFFHRa (ORCPT ); Tue, 6 Jun 2023 03:17:30 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2054.outbound.protection.outlook.com [40.107.93.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3002A1AD; Tue, 6 Jun 2023 00:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EtD5DMcRtax3IhhQMIiE+vjeICL1EGPrTF6//Ttjq+NjVcqCvGP5DvjDXlk1pgUlgmpzhEYGqTTcjdlco2fQaE++QPgSuHAMlM91cKauLkEbvc1hhnXyzGk7wGUap6MxfAZduCopL2OGc4hY2Yj867oXaLFuRRGkk2lXJtZ03VtiXorUAVzwfkMWHTOcGCqmVwWrw/tHHXb16w0x8GPnGVTwjYBR5Xqqn3VWcE6B8049AVf8DqtaI8POBvk5H7JV5Wx7WTRAOk5TMU70PCm+OP4NUZ8R2RX6ApUXpWlhcC065c5hjbBJLhcmu3IjvvlxsBgib6jQgoWpp4IvWZpVug== 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=NAgHsicGbXE7/y+61Ec/TG4fp5QK6NCUPay76C4Qy/s=; b=OoAqg5tguFZ1vwtXW8FuZaE2JlIvRPT1vpl0EzfNtqkyx3yyxoEvBZZB/RYYtLzaUuA914TSGVc1k/A191Xa5qPVX0Zn3Q/PfG6oRCcvgX2cG+hKaGxARt3w5oCQWaYFqVbNCZ38yVTk35/u5umynqTbFFXUzYl63ej2kxEPcz1YaYUps5isAVI4Uqa1f1l8y83mN0/0/6uUu3w9a82CwfALELyiK5CmbHMQqID0Xo82/YmOYwZI8ITyl1VX8iR34W/txL2qoDwVzr5paYqWsokvYvHjslKXvhi3IfFFaBoB6tDTSx7TnUX7nH6YWX7eXt9anoEmIdU5wFmBzrMi/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=NAgHsicGbXE7/y+61Ec/TG4fp5QK6NCUPay76C4Qy/s=; b=EeVZOxCmS8sCB9O2Pdq8KGt2pnC9CWFWrapoL4tF3K44KB4t1FvaCS+9H/id1MA9hkbYUX3sajszSdoRRqYmnQmJN24V9zI3PZKrS3oUuPZ9oO+mlsvyEeO9ExSKajaNHMaAtjKihFQbOJ7gl55HrfPLzRe+Fu+0zWSl2iCXHN10pX0oQt+bsYHsRmStF/mkCgdmVjxrzANQuh+9aKcbLJte1wfzxHCbgNy8UqVFoBwNzXxLztEigeCKAw5hlVkegso2z8EfmY4CPg2aoVnT6lzfxijMZuzb81/dhqa7YT5oCvL5ogBXZwvyQrWMJKFy/YysSzLd++0HQVjggtc0pA== Received: from DM6PR06CA0022.namprd06.prod.outlook.com (2603:10b6:5:120::35) by SJ2PR12MB8884.namprd12.prod.outlook.com (2603:10b6:a03:547::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 07:17:24 +0000 Received: from DM6NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::11) by DM6PR06CA0022.outlook.office365.com (2603:10b6:5:120::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT047.mail.protection.outlook.com (10.13.172.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:23 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:11 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:10 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:10 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v3 07/11] selftests/mm: fix a "possibly uninitialized" warning in pkey-x86.h Date: Tue, 6 Jun 2023 00:16:33 -0700 Message-ID: <20230606071637.267103-8-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT047:EE_|SJ2PR12MB8884:EE_ X-MS-Office365-Filtering-Correlation-Id: 87ba35a6-be00-4893-8c59-08db665e133e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qct1Q3zBkNF5cbSrqByrHcstcilf9UxsoJTgPw+u31leZzzB3/6kvsfFfRK9Rx5KOh63TvqNOcKvdQGCptalV8oDsUaURjr17phQcW4DzAP+k0oG6vKlVC+ekVobFgeik0YLDY0v/LUIDdjbumEgVLEK/PF40ss/sKmSo6QnrRWiEakQ0L5PF8iFiljulJnxWPa19jS9wB2PPUljWDT7wIpoGCu3g1vi8EMJg3N9EAD0WmnEb0hbuhV6MjPAG08GAmPKRLK/D4uNsqMuuSCEWJ1pcaDS3nVvi4VJ3n1L3Xre+iyOcdUkyweryQSSvG9+eJwcoudhbFolb7G6ACOoTvzQ1d9FDeZXGF/5hwXtt0OttvStUrUr9BdsubWNVdWRF+NlLZFqHaBy/4ExSLAeCfT7FLw98IVdRnOzbIJxaVPAbZJT8qRC2ZiHLSCUpC48/ENcxNBKyu+gI0mK1BLlXBomfSmy/K+6+QDS/Mj/bpOmhOYxg9LbLPIq2CepMRdbISBPn35yhQUkxOQvZpNJ4gHRDdgrAOVEnJZQ4/Ppn31gdXoa7+4YujMQiUIjqHLzqHNvbDNS4V6cG03udjjvQV/feMV6kEbuNjfOKRylBn84tOF/Jk2OAoATjNwYcoYU392ovx31jkpi22k+qp/5cGH5iuyqUtfAGXjm4DFBzqMJvKFcz2/gWv2pCNMFNQJGcwjGS3yvN3zUFxqk02w70XwjsYUHXDe+lVGHdkRYfnJpX+VsZLNKI7pAdlVt7Om7 X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199021)(40470700004)(46966006)(36840700001)(82310400005)(47076005)(83380400001)(336012)(426003)(54906003)(478600001)(40480700001)(82740400003)(8676002)(8936002)(316002)(70206006)(70586007)(4326008)(356005)(7636003)(5660300002)(6916009)(40460700003)(41300700001)(86362001)(36756003)(6666004)(4744005)(2906002)(7696005)(36860700001)(107886003)(186003)(1076003)(26005)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:23.7319 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87ba35a6-be00-4893-8c59-08db665e133e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8884 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This fixes a real bug, too, because xstate_size() was assuming that the stack variable xstate_size was initialized to zero. That's not guaranteed nor even especially likely. Reviewed-by: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/pkey-x86.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/pkey-x86.h b/tools/testing/selftests/mm/pkey-x86.h index 72c14cd3ddc7..e32ae8a1cd99 100644 --- a/tools/testing/selftests/mm/pkey-x86.h +++ b/tools/testing/selftests/mm/pkey-x86.h @@ -132,7 +132,7 @@ int pkey_reg_xstate_offset(void) unsigned int ecx; unsigned int edx; int xstate_offset; - int xstate_size; + int xstate_size = 0; unsigned long XSTATE_CPUID = 0xd; int leaf; From patchwork Tue Jun 6 07:16:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 689995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC28CC77B7A for ; Tue, 6 Jun 2023 07:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235895AbjFFHRf (ORCPT ); Tue, 6 Jun 2023 03:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234796AbjFFHR3 (ORCPT ); Tue, 6 Jun 2023 03:17:29 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E50F118; Tue, 6 Jun 2023 00:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j2+CmJOknzOVObATngbCndj5iKnYErmTawNWfqhtSn6UXR0xtVj6v6/27vDdUVRAyerww5C5IIBBgCA5QsgY6lNcMdIRATW1vthSDHrRgY4zDN7Fa9tXXXcxmfvRAOk4LlP144MTFP9bHookg017VUw5tndB9+en0f0l10E+0OgCDrOPhGrJkOM4GUiJSX7h03Gw8YJZHCAKjHQqDoxKg2ygp8yKt+t5BKQYKnPNuQKxkRhgLhK758FjSevlKc1J69ZeB4VWzlEdYkuFrAjrcOxJ8kbWw4v5G/7UFnh1ZthqfODYmqZRtAvYvoyckh5TZLbS4QoLhAhNZV4UR8xeEg== 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=r7qWJ0iKcBH5AScsmOvvAEPpASsgJNPE7K/FjHHYXLU=; b=iC0EQvt+uC/D4dgHBveGWXP3WZMd6ueA2+hWS+Gguiv7sqSIHoFES0GqHPniw1yq4wzSTTxMgn5ry+yLenFNOm11ADBEZWiCVVDcmcJ9mZ1CrEeyZti4w3hKDjPpMdN23A+5fD/zcsqndoIC/bGDLftyT4QdZ63T4BHzZIi1xpJ0vkh3JXzZrRRBqUP068qU+cuDv/9cUXXqcQpvzbLX2pF1MFnK84j26Dc+pgRaXucz8xqN2LMblX78ncO5rn8oCENHVVwI4jxWA5ROMXRLopweWc/TADdW83Hzg1VDEFRNAbDg6/3MHwQGUWWFBrxsOy/sBkynZ9Dzw5BNK9xibg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=r7qWJ0iKcBH5AScsmOvvAEPpASsgJNPE7K/FjHHYXLU=; b=jI5PQzww6bCAvu45bK6aiQuKfHqGm/DsQJ0YelBM0ekYCsleZAlUG0cnHtUdYAwa2YqkiWeO6QgvOtwKSWLmKRFTgQyLKMWi7ZoNGSM9kh8ludXQ3nZy7me5Il4H8GWaqpV2riffj8oVro5KITO6d7XftR6v+bcMSkRZRjeWCLlo2NuTDzxk4gV1J+o16FZkrQ9kDDRRMc2fbJ727O4275bpQu8Ys66mNtl+NoY5o8F7AqLs+/hmgQH8yquBGaXmcgaQ54Z6k06zv3QEUEaxCGEdFUVsmze0+znvny4IQgE/L4Xkt3hJfoqrzu584dC9nG9TXGps+iD/XchDeDY0eg== Received: from DS7PR03CA0156.namprd03.prod.outlook.com (2603:10b6:5:3b2::11) by CY5PR12MB9054.namprd12.prod.outlook.com (2603:10b6:930:36::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 07:17:24 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b2:cafe::51) by DS7PR03CA0156.outlook.office365.com (2603:10b6:5:3b2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:24 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:11 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:11 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:11 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard , "Muhammad Usama Anjum" Subject: [PATCH v3 08/11] selftests/mm: fix build failures due to missing MADV_COLLAPSE Date: Tue, 6 Jun 2023 00:16:34 -0700 Message-ID: <20230606071637.267103-9-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT015:EE_|CY5PR12MB9054:EE_ X-MS-Office365-Filtering-Correlation-Id: c254bc15-b3ae-4900-90c5-08db665e1392 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YJA1BoOtz50E7jA7krOEBGGJ8vpO0oO9I069MuRt8i/FQL9yUg04697EN3M8YVLpRCAOU3R/Z6JJ4+4FsVvLWT1m7yTEtry1V5JHVY0ogIp8m00Qo5qxNy1FWGGZe7AAhcoVdOnCRToY/C6oeADVJ3E4iTolbZ3mg69UczU2QZDU6QYMXMnOfvmFmDQlIG/JBpuVdannau89tYcxVz/Q/J77+HMhHPSImi/WggiHdXZytLEFLis35vM/7+8Ztc2pOJiCb8+QylP2z2xPJqiUg/VLR8HIj+ChhaJFrQCDnBt1xTMOQ/S5DGQRckXCFBVMSTho5XjizWqYxG8I0zOgvHuwOYkUKrTl8R2nQRV06Xw2wm868bNdKdArg9agz/VYirUsBcFDVfQXZ/GhKoE188wd8eRtgSJnQ5N5gj5jtz/8Kl59xcNcfBDDlJrJgN755yFK4ooMaB1EALny4KbU+yzqY/8oZsTLJErFBFSl13NWJLj7lekzh0B0JZkHVlOY+SL4WZpgKoOSeflzSWMqK6D5hGsOhQ/qQddzr6O99ctquFcJmcAdzcYqnzHyiSXiNr0zg7DYPmqVUROOkkv+7slEFOI0UJYBNCqSvOzg6xG2b949H/NfzyjhUbfxAOFBFHnZXLryJZKZl5V8X7TbWzq+ln55+5YCisaHjc4FOP6dkq+PU5XLfJ3jBI98yzYA0w8XjS4+yaFy3iyx6Ag7vWw6PMy1sRdI5pQD69keI1RFY1CnQ8pSGZo+DE6/UOiq X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199021)(40470700004)(36840700001)(46966006)(83380400001)(40460700003)(47076005)(426003)(336012)(2906002)(2616005)(36756003)(86362001)(82310400005)(356005)(7636003)(82740400003)(36860700001)(40480700001)(316002)(41300700001)(6666004)(5660300002)(8676002)(8936002)(7696005)(478600001)(54906003)(6916009)(70586007)(70206006)(4326008)(26005)(1076003)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:24.3138 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c254bc15-b3ae-4900-90c5-08db665e1392 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB9054 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org MADV_PAGEOUT, MADV_POPULATE_READ, MADV_COLLAPSE are conditionally defined as necessary. However, that was being done in .c files, and a new build failure came up that would have been automatically avoided had these been in a common header file. So consolidate and move them all to vm_util.h, which fixes the build failure. An alternative approach from Muhammad Usama Anjum was: rely on "make headers" being required, and include asm-generic/mman-common.h. This works in the sense that it builds, but it still generates warnings about duplicate MADV_* symbols, and the goal here is to get a fully clean (no warnings) build here. Reviewed-by: David Hildenbrand Cc: Peter Xu Cc: Muhammad Usama Anjum Signed-off-by: John Hubbard --- tools/testing/selftests/mm/cow.c | 7 ------- tools/testing/selftests/mm/khugepaged.c | 10 ---------- tools/testing/selftests/mm/vm_util.h | 10 ++++++++++ 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index dc9d6fe86028..8882b05ec9c8 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -30,13 +30,6 @@ #include "../kselftest.h" #include "vm_util.h" -#ifndef MADV_PAGEOUT -#define MADV_PAGEOUT 21 -#endif -#ifndef MADV_COLLAPSE -#define MADV_COLLAPSE 25 -#endif - static size_t pagesize; static int pagemap_fd; static size_t thpsize; diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c index 97adc0f34f9c..e88ee039d0eb 100644 --- a/tools/testing/selftests/mm/khugepaged.c +++ b/tools/testing/selftests/mm/khugepaged.c @@ -22,16 +22,6 @@ #include "vm_util.h" -#ifndef MADV_PAGEOUT -#define MADV_PAGEOUT 21 -#endif -#ifndef MADV_POPULATE_READ -#define MADV_POPULATE_READ 22 -#endif -#ifndef MADV_COLLAPSE -#define MADV_COLLAPSE 25 -#endif - #define BASE_ADDR ((void *)(1UL << 30)) static unsigned long hpage_pmd_size; static unsigned long page_size; diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index b950bd16083a..07f39ed2efba 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -63,3 +63,13 @@ int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, #define PAGEMAP_PRESENT(ent) (((ent) & (1ull << 63)) != 0) #define PAGEMAP_PFN(ent) ((ent) & ((1ull << 55) - 1)) + +#ifndef MADV_PAGEOUT +#define MADV_PAGEOUT 21 +#endif +#ifndef MADV_POPULATE_READ +#define MADV_POPULATE_READ 22 +#endif +#ifndef MADV_COLLAPSE +#define MADV_COLLAPSE 25 +#endif From patchwork Tue Jun 6 07:16:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 690388 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34CA0C7EE32 for ; Tue, 6 Jun 2023 07:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235904AbjFFHRg (ORCPT ); Tue, 6 Jun 2023 03:17:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234051AbjFFHRa (ORCPT ); Tue, 6 Jun 2023 03:17:30 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2069.outbound.protection.outlook.com [40.107.92.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81CF8F3; Tue, 6 Jun 2023 00:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R+kkFvaQQfAfFnjmU9QBjUlKnxH4PmVLtwABKvTJWWVjqSqfrpD01q6ejcQUo6UXWnvbX5WiRGvBDOJw2E0h9qOhZ/9LtIDFj68sIpDBbp4k0xQeU25Yizf9qZ7BJm7XeI/ljfWoJazx2K45wN9nfK6jmvdNK25GOmhtYxofRNrFj7Tns3Dweoln3uGO1RU2yOCrmDgWjzjjvixwdJ8cNl1db38gaHIg5WcEOcH8l3yaQ+XNV0Hj4iXULHNCfyFQ6AijmLiFOMn2XVrJEueO21JXSJ3J8pPMfhjFv6ZyTax7d0eZH3K6ZqeA+pzx51rB+B/ReV/YpfS3qBhwHrOD+w== 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=xYlalBEAxIzJMtKb5NGYNsMnsUemOvRTiXi3Wz6Od68=; b=PY2YKo+KGI7sDMXo/CM+jUAYd3FhVB9zzsO1+I55er6DlwNWqXF4+9iuVJ7fZzEDNs/LSlhZGE3eKpUliDufIn3p377KQmWwnqa+Z6BiVbTJ3uN+QnQO0uEbsNTAoDGftOFC2xy05ynky14b2b3Vvq+qHSo4n8S88UcRb9LBu3LoAw+J3LOLR+Whc/JR0uNilkn7y75zuj1yR2hs/WVWWD3bIWLf/ITdH9Ht0bncYUHbPtSBK26B7Qa1OuZZDzDqfI+tJmaQzBOzVCMFB5VBqbTAPG6vCBpW2VnR2dsiUBvmkObs9VUM4+ps5GQBzLyxtGatbHezBfOI4bcxuVC6Uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=xYlalBEAxIzJMtKb5NGYNsMnsUemOvRTiXi3Wz6Od68=; b=gxmuprP+hNR854TUEcopS/Zs6vkoR5wPAfC7GFrw2t4YQbcVgjvufEZxabPgZr3aokifyAVKTMS+V2ZtwkuQBibgm2KueXfTsVmdSN5k4ixBJnB2dggQPFtp34Xv/QlOKR11HmCHs+0nohNWCUUphFuUDaHrHzTJT8eUPOzmrzycOyCQPiPpN4ZIYlLbaeXjkzui/saK4mzxtJJ8ZWMUMU0Nfg07eYGhCSKzpjTxCEMFZjAOZQOos85javSt81oWvaqZkKcZJxG9P4+4bBbZrsDyKC/4EU8yw9Bvoo5PIhTPX3xT5cPidPYVtZ77nnGG15kysVdSVzOj3hR7GxSTKw== Received: from BL1PR13CA0392.namprd13.prod.outlook.com (2603:10b6:208:2c2::7) by SA1PR12MB6896.namprd12.prod.outlook.com (2603:10b6:806:24f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.31; Tue, 6 Jun 2023 07:17:25 +0000 Received: from BL02EPF000145BB.namprd05.prod.outlook.com (2603:10b6:208:2c2:cafe::32) by BL1PR13CA0392.outlook.office365.com (2603:10b6:208:2c2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 07:17:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF000145BB.mail.protection.outlook.com (10.167.241.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.13 via Frontend Transport; Tue, 6 Jun 2023 07:17:24 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:12 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:11 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:11 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v3 09/11] selftests/mm: move certain uffd*() routines from vm_util.c to uffd-common.c Date: Tue, 6 Jun 2023 00:16:35 -0700 Message-ID: <20230606071637.267103-10-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000145BB:EE_|SA1PR12MB6896:EE_ X-MS-Office365-Filtering-Correlation-Id: d6cc912f-6d42-4481-133b-08db665e13fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jn3hwNpDKfecigcUffYa/EsiW/gU4RqXOC7H1z3rOLhM0KNDzQuKB7R0aghLmIQDQU0P6X86dE3NxqvkADIBvItGfzkjNZhfFufs57B3QgjjJKlOoNUyA/PtWxlCcFH+wIicwJoLRUbEUX+x1ZU87FclWl4G2WsZ1+wX1sMMuRQzwwS7AgxozAlsk0k9saCnP6JH52LfdMEh+W06UaI4nsVYuDMkDSHXJBf7ropF7Qd/ED3oqnvFHHQJdhz4x/kB2SNXnrlismsnKV9jXY3FM+faczNBK/EYPEeUlfGayXvzpawNfaJ6eMcTzQKFdvOSehh8kBUlEFTrgliJhcxP6lyRccg2UG5LvgRF25S6JeK8JuK5AG5vSTb64pZ8PNWNMHAuzsbIE3I1lYHJbMJVpqIhKwSGEdrqhAX8lPI4CBecV5AirUdch9HPL73m107LnNqeQ3wruKhEy8irZTn58vU+PhkDqOXOE+3+otp23cKClGgXuobXBwKt7bFVDuF5VKsE5xa3UDXfVb0zBCqUt6+vSRFsLZk9jwRMgHUsEsEGriqiZ8WjGKVFWNn+44Iwf/lU2qmCbtHf7bX+uYG1l5EtlfzU+6uXcpmu4vI87shO1oU/rSEVfn06lUG0JAhLYd8dnXHF7/AeP7LC0P5OQwMLqY5PZ5kypEjrk24Bk3DlY+PlzBwWZ+/3ShbFhGmFRIeIXkzn61jcAAd18oXkgur71hATsN/dyhfbpsqwfMvkfKszgL1WQmA5Yny8Xy4G X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(136003)(39860400002)(346002)(451199021)(40470700004)(46966006)(36840700001)(86362001)(6916009)(2906002)(5660300002)(41300700001)(4326008)(70206006)(70586007)(82740400003)(54906003)(356005)(8936002)(8676002)(82310400005)(7636003)(316002)(478600001)(36860700001)(6666004)(40460700003)(7696005)(186003)(1076003)(336012)(83380400001)(36756003)(426003)(107886003)(40480700001)(47076005)(2616005)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:24.9140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6cc912f-6d42-4481-133b-08db665e13fa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000145BB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6896 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org There are only three uffd*() routines that are used outside of the uffd selftests. Leave these in vm_util.c, where they are available to any mm selftest program: uffd_register() uffd_unregister() uffd_register_with_ioctls(). A few other uffd*() routines, however, are only used by the uffd-focused tests found in uffd-stress.c and uffd-unit-tests.c. Move those routines into uffd-common.c. Cc: Peter Xu Acked-by: David Hildenbrand Signed-off-by: John Hubbard --- tools/testing/selftests/mm/uffd-common.c | 59 ++++++++++++++++++++++++ tools/testing/selftests/mm/uffd-common.h | 5 ++ tools/testing/selftests/mm/vm_util.c | 59 ------------------------ tools/testing/selftests/mm/vm_util.h | 4 -- 4 files changed, 64 insertions(+), 63 deletions(-) diff --git a/tools/testing/selftests/mm/uffd-common.c b/tools/testing/selftests/mm/uffd-common.c index 61c6250adf93..ba20d7504022 100644 --- a/tools/testing/selftests/mm/uffd-common.c +++ b/tools/testing/selftests/mm/uffd-common.c @@ -616,3 +616,62 @@ int copy_page(int ufd, unsigned long offset, bool wp) { return __copy_page(ufd, offset, false, wp); } + +int uffd_open_dev(unsigned int flags) +{ + int fd, uffd; + + fd = open("/dev/userfaultfd", O_RDWR | O_CLOEXEC); + if (fd < 0) + return fd; + uffd = ioctl(fd, USERFAULTFD_IOC_NEW, flags); + close(fd); + + return uffd; +} + +int uffd_open_sys(unsigned int flags) +{ +#ifdef __NR_userfaultfd + return syscall(__NR_userfaultfd, flags); +#else + return -1; +#endif +} + +int uffd_open(unsigned int flags) +{ + int uffd = uffd_open_sys(flags); + + if (uffd < 0) + uffd = uffd_open_dev(flags); + + return uffd; +} + +int uffd_get_features(uint64_t *features) +{ + struct uffdio_api uffdio_api = { .api = UFFD_API, .features = 0 }; + /* + * This should by default work in most kernels; the feature list + * will be the same no matter what we pass in here. + */ + int fd = uffd_open(UFFD_USER_MODE_ONLY); + + if (fd < 0) + /* Maybe the kernel is older than user-only mode? */ + fd = uffd_open(0); + + if (fd < 0) + return fd; + + if (ioctl(fd, UFFDIO_API, &uffdio_api)) { + close(fd); + return -errno; + } + + *features = uffdio_api.features; + close(fd); + + return 0; +} diff --git a/tools/testing/selftests/mm/uffd-common.h b/tools/testing/selftests/mm/uffd-common.h index 6068f2346b86..197f5262fe0d 100644 --- a/tools/testing/selftests/mm/uffd-common.h +++ b/tools/testing/selftests/mm/uffd-common.h @@ -110,6 +110,11 @@ int __copy_page(int ufd, unsigned long offset, bool retry, bool wp); int copy_page(int ufd, unsigned long offset, bool wp); void *uffd_poll_thread(void *arg); +int uffd_open_dev(unsigned int flags); +int uffd_open_sys(unsigned int flags); +int uffd_open(unsigned int flags); +int uffd_get_features(uint64_t *features); + #define TEST_ANON 1 #define TEST_HUGETLB 2 #define TEST_SHMEM 3 diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c index 9b06a5034808..681277615839 100644 --- a/tools/testing/selftests/mm/vm_util.c +++ b/tools/testing/selftests/mm/vm_util.c @@ -242,62 +242,3 @@ int uffd_unregister(int uffd, void *addr, uint64_t len) return ret; } - -int uffd_open_dev(unsigned int flags) -{ - int fd, uffd; - - fd = open("/dev/userfaultfd", O_RDWR | O_CLOEXEC); - if (fd < 0) - return fd; - uffd = ioctl(fd, USERFAULTFD_IOC_NEW, flags); - close(fd); - - return uffd; -} - -int uffd_open_sys(unsigned int flags) -{ -#ifdef __NR_userfaultfd - return syscall(__NR_userfaultfd, flags); -#else - return -1; -#endif -} - -int uffd_open(unsigned int flags) -{ - int uffd = uffd_open_sys(flags); - - if (uffd < 0) - uffd = uffd_open_dev(flags); - - return uffd; -} - -int uffd_get_features(uint64_t *features) -{ - struct uffdio_api uffdio_api = { .api = UFFD_API, .features = 0 }; - /* - * This should by default work in most kernels; the feature list - * will be the same no matter what we pass in here. - */ - int fd = uffd_open(UFFD_USER_MODE_ONLY); - - if (fd < 0) - /* Maybe the kernel is older than user-only mode? */ - fd = uffd_open(0); - - if (fd < 0) - return fd; - - if (ioctl(fd, UFFDIO_API, &uffdio_api)) { - close(fd); - return -errno; - } - - *features = uffdio_api.features; - close(fd); - - return 0; -} diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 07f39ed2efba..c2d4ff798b91 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -48,10 +48,6 @@ unsigned long default_huge_page_size(void); int uffd_register(int uffd, void *addr, uint64_t len, bool miss, bool wp, bool minor); int uffd_unregister(int uffd, void *addr, uint64_t len); -int uffd_open_dev(unsigned int flags); -int uffd_open_sys(unsigned int flags); -int uffd_open(unsigned int flags); -int uffd_get_features(uint64_t *features); int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, bool miss, bool wp, bool minor, uint64_t *ioctls); From patchwork Tue Jun 6 07:16:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 689996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E465C7EE2F for ; Tue, 6 Jun 2023 07:17:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235829AbjFFHRe (ORCPT ); Tue, 6 Jun 2023 03:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234649AbjFFHR2 (ORCPT ); Tue, 6 Jun 2023 03:17:28 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2067.outbound.protection.outlook.com [40.107.94.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 113AEEC; Tue, 6 Jun 2023 00:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D962y20PT32aMdprELt2ow7HJAgfMXzWFbDpA8O7M3E/7oByDbBdOBB3nQ6e+htwdtmgnIF3mLwShXf9oI7S4V0euNge85NPKwDBpK/6d9PiPRRAuVIfg//ItkgbLnSIwnI2bfnY951485Izuh1iYI4zjLKr+b9d/4+Lc3DNcepK2MDHwhzNieDvDeArXg3M0TfJchCZQfCMSQKM2Stz2JVx9a83K0Yfi+2HORTo2C1waNs6ohPraaR/GCg7trT6I3EpTXwwuBIfxhsEps90RQPV7Psf0j0WpgSv0GgRbKSlZz3DF6uSDA8BdUYWj8m7+3Q11zQGdYJj4xcWPOmGkw== 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=s37KNW0wVfL7/v6s3m7Yfh9HIX4qq3S5lut13aXDTUs=; b=Xm8MvdsZYy2QsVdpo8q0e1f5VrNywBufgI4WG2GA9LSx2ZbcjU32LXk4q01RNe/4g7J0Nx5YFfaPUAjcoydpNU2SVsFYNveiGglXN88rAMMVw/KExKap9sEN6cskA4mSuD5NjGhT6cg24ks+yi2H88rIZRuiWkBYch7bqR/UqyL30X+2tCwMNkDlIGgfuEfX5PVXLybw0vmuI9C4Ou4gheBkM2fJyQ4hXJuQR4JSVlXb8zYBpo6Sxi80si0FYs463VYQ63DVZ0L5ALsvw7SbtxLuJZrjEnzxa3s8g0uGWzIvcqeutHyPJxVN9Qcfx/X/tJod3zsj92kYC42h8Cd+eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=s37KNW0wVfL7/v6s3m7Yfh9HIX4qq3S5lut13aXDTUs=; b=YdsB19oeka8jAA189tXmvZoljsDDhB5pM3RmfZl7KDbwm02ySwlatVqT/h2VSTOudMsYQXjOCXRMHxjoqSgc+eBI+POb7DhWg8GWbY/P1xMviWAhqoCeQywd3lSgH75m00Wf46kM75VE/1J6Ja1fu1I8kc4qOXY3CCdrwDn4xog+qYgGPorEzWDul6qunWRp6FCO5cYp7sZcMWN9ln+d1Aatw1C1XqzYRyX5Au7qAyhkYeYi7/LjMI12DKdybCmA8qo0Vcu0O7J5nyQuBS6Ujbqg0CaHuTuUOQuWriWWAJCxzECjcTHYla+V+AafSnSaldSEjhhaZlLxweymfcrqmg== Received: from DS7PR03CA0164.namprd03.prod.outlook.com (2603:10b6:5:3b2::19) by DS7PR12MB6311.namprd12.prod.outlook.com (2603:10b6:8:94::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 07:17:25 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b2:cafe::db) by DS7PR03CA0164.outlook.office365.com (2603:10b6:5:3b2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:24 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:12 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:12 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:12 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard , "Muhammad Usama Anjum" , Jonathan Corbet , Subject: [PATCH v3 10/11] Documentation: kselftest: "make headers" is a prerequisite Date: Tue, 6 Jun 2023 00:16:36 -0700 Message-ID: <20230606071637.267103-11-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT015:EE_|DS7PR12MB6311:EE_ X-MS-Office365-Filtering-Correlation-Id: eb452bca-fef0-490e-ed66-08db665e13f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RPSHPyE5Is7JD0oVWeORYtMfsvUKWXu6xjBuKruTsMoRUFfjrf3qwjNJsaxyLj5Y1fgmaKSS3hUidz9BqLvXC5FYRKwk9DXWkaAWpyvUG82cjcByvGeEPosUqxnh5e4jaZw/BOgbdJKIuH4cnyk7sqyhPgVUsUaSyCnwJpqyL1JtSfK957yXOAIWIQ/quN5z/53GwU4TL3WqtWOpFXoAifFg1Mdgu6Ztya6SRa12AXFxljQQvYWrqmRS0sfWxg0SZH4pfuY2aMutwNa593wATZdnJS4C/RmNPFCgUV39BP477gDruf1NtrZEvuw/BLiIc2CgMnEbQLDNDYpqJ47+QS/Qf9Q+u0czVvV0IFAibJwcBkIrU336R/h6M56+47B5Lx5WybIGQqzTredzEZgHlDNfVQHlB2N9CHPP6r65UOdi3rA1EcsnDRXp0A0GiHYxBeMuQlWAH6fw8yZ4BIAQbWhEkSxh854SuJSaTo1jp7Qj6X8GdD03DNaJQF0WyF/uiQeDjrZxp51sR1TTHlW00wSlmQb46c5gz6r+VM1CId50arUdzKtmm2PfIINHEowtZVA1rTS9+eT8jAEPZqN1zL9EadBOrJeHKkH0zzXiAcS0JWPCpsvqGjUmDHu4o98FAUc8ce5Du/OkprdCqzRnLKR2mdn4JORrYlJIktq6A6SyGuqmbOCld5c6uIJ0NvWxRKkq/Z6gD+MzokyYWAF9GUmW/FIcM4BKr9qQMK2nB4pGhyJycL4LOKG3emiIxvFbT9OV2/SKEZ+xPtL0EDW7iHdORTkVWjtnCsM1qtD3KXk= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(396003)(39860400002)(376002)(451199021)(40470700004)(36840700001)(46966006)(54906003)(40460700003)(40480700001)(478600001)(6916009)(8936002)(8676002)(7416002)(2906002)(36756003)(86362001)(5660300002)(82310400005)(4326008)(316002)(70206006)(70586007)(7636003)(356005)(82740400003)(1076003)(2616005)(41300700001)(26005)(47076005)(36860700001)(83380400001)(186003)(966005)(7696005)(6666004)(336012)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:24.9232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb452bca-fef0-490e-ed66-08db665e13f1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6311 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org As per a discussion with Muhammad Usama Anjum [1], the following is how one is supposed to build selftests: make headers && make -C tools/testing/selftests/mm However, that's not yet documented anywhere. So add it to Documentation/dev-tools/kselftest.rst . [1] https://lore.kernel.org/all/bf910fa5-0c96-3707-cce4-5bcc656b6274@collabora.com/ Cc: Peter Xu Cc: Muhammad Usama Anjum Cc: Jonathan Corbet Cc: linux-doc@vger.kernel.org Reviewed-by: David Hildenbrand Signed-off-by: John Hubbard --- Documentation/dev-tools/kselftest.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst index 12b575b76b20..6e35d042199c 100644 --- a/Documentation/dev-tools/kselftest.rst +++ b/Documentation/dev-tools/kselftest.rst @@ -36,6 +36,7 @@ Running the selftests (hotplug tests are run in limited mode) To build the tests:: + $ make headers $ make -C tools/testing/selftests To run the tests:: From patchwork Tue Jun 6 07:16:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 689994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46ECDC7EE2A for ; Tue, 6 Jun 2023 07:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235929AbjFFHRh (ORCPT ); Tue, 6 Jun 2023 03:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235069AbjFFHRa (ORCPT ); Tue, 6 Jun 2023 03:17:30 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C448FF7; Tue, 6 Jun 2023 00:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YJooluIYCXO7Bo4oxRmnm+GE/+bdE/UI1gt/CmdnnvMrBX0JsqYKBWYF60hKDg9SUBYK1RDw3lfUzoxa6DT6Nxx4B4WMBV7+9Yv5pGCRbNts4Komh8dkw5gl2veFrVBneR1HYX3Y6dwGDOdK85VdIxWW0YbdO68+lmHjZ1uatf/6YTW5WludfTyA/N3FYuKjhtPFHXwG8raXVVraynSGOkRlHDUUsEeRSYgCJDDe1eKptB8jWYEix64DLfBsRBQLZYathBmFr0nWDtrARJO9ldOSGUN7LXbu30E5lCtztrdKR42rWpgrEzCldIBGMbNtIl4WSk6LbRwjRDx2nesqbg== 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=4Fine+ULcirLmEqNWkiHf+fbRUQNrgpAQqF8Q8I9Jv8=; b=EEnTF4VoOkwRqJnksL6DXhjUeRtUi46wf/CqhXZ57IwCWPqgoqKovyJzzKgmXazjL/YUbp6J5qp56AAulDq7dN9G5lwP66asBPjdFsYzvImNbA8cHqSv0aOEdlW+zJgaNtC76vAiKGFLi7izQ8UMHdzu6GkyonSZ+ytbE15ULPTEREFbDbG3pIzvTxRnSTtxGuiOODqk36HnZBAPXzzYtIb4IShg74hCzMvRo5QlObK8MuyeqkMP9GzBH3BQfpo+UHz8GbuMXAoUGOiYDsYTDRl+xYbu2FLUcp5ZcPYUkZiC+a1gobpeL8yoZd8T+DlJBHuPvt0k2rl7Rb7DqfFHTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=4Fine+ULcirLmEqNWkiHf+fbRUQNrgpAQqF8Q8I9Jv8=; b=btuvmAMYyzE27ABu7VBwlvAcjEci5vRX18QHREurNcFKmdPNUJtoqvLPH7Qr0qriZG8Bd0KJRYZd5wsIC5oUNI+ahY9cgMOvxHaQK0RgkczQFMgMJuqZF0AjFU2M/9fvRYG2YfJci/3oiE5TwVy72u9VKEbFYkiwfRlK6IMBsfgsEhcgbg61sTSpECqlwvzd/raMzw0GenEVcO8pyCGX6exsbzuvSZTcrwAps3Frxy58hYJZG2R4TZQ7sUCSUJW1rZ7vcFfak4fAawhAq34SndraL1KBO03Lh7sOTEFpOu/LxGogBpHakT96hSxYE+RIbswVG1c7/wPA7HKW/cOM0g== Received: from DS7PR03CA0284.namprd03.prod.outlook.com (2603:10b6:5:3ad::19) by PH7PR12MB5830.namprd12.prod.outlook.com (2603:10b6:510:1d5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 07:17:26 +0000 Received: from DM6NAM11FT086.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::da) by DS7PR03CA0284.outlook.office365.com (2603:10b6:5:3ad::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT086.mail.protection.outlook.com (10.13.173.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 07:17:26 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 6 Jun 2023 00:17:13 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 6 Jun 2023 00:17:12 -0700 Received: from sandstorm.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 6 Jun 2023 00:17:12 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard , "Muhammad Usama Anjum" , Jonathan Corbet , Subject: [PATCH v3 11/11] selftests: error out if kernel header files are not yet built Date: Tue, 6 Jun 2023 00:16:37 -0700 Message-ID: <20230606071637.267103-12-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606071637.267103-1-jhubbard@nvidia.com> References: <20230606071637.267103-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT086:EE_|PH7PR12MB5830:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ee2a593-f893-404f-6ef1-08db665e14a8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D6JyrV7UKBSncKCDQBDtupx10E0cen55WxHrGHi1nSH0HXH1Sg17VGW7XRQvJhO49sgPrX5cgXy3yK/rtw90NG9gScesFqMLSV1t4Cjl/SfLJhFRtrs1AJjuDXtqQXLNXEEBWwbus2XCzOSpVQ62eFjccCm8mJl4VG8ddsPoebDb3kWvrFtC7e6540rEvNshxVUBkGXC4KiombXlO2QkvftKNtuFsxzcqNKSbsU6Q8Y+xIHEzBCKDFCD9WL0kUvFjX8x7QK85ZpyCAOl6gvmIoYcWhgCwO9bzoEbvPjGHW8PjPsgffdEKguA0iX1A7cW61ANo0vWhguxJ5ibwGilo1oM6OE82Kjmh/buiiizjjj6idBDD+Nt7bpJ3DuCIRci14K+WQ5krZEm3votMvzu0eKGCQ/G2jPeaqX+goSWz7UV6TpCTwbFDLONi+rIt93g2brxk2KyrYfQrYsx6WM7jqvEb9DdYSLzZVMVcSEive/SQxdGHIGgl4RYgFGyrOlWhrBcOzVKaRQVWo7SlFB0DowwPyk/23tygD/S1rq7/cVLPIlmTaLwxmAIveQXPj8yCSyvUSh6kB386wP03hQGT9Zd2/wcD8ls6bSgRotOPYzv3gov/NjtdbvSYaMedLkkIdCBGDHOtD5n2HCsA6ckYbhaUJkmBegdu+D3L+O/DWPQjwv2CQ2nO7ou0htHizgMPnCP5eLJzGDKk6umHgthTJ/8jgvz7SLXi2u4GQ0nBNmWu3WCYVqh72G+HO/CSNgvcBmMlKBSPUyxZFUagD2aLg== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(376002)(396003)(39860400002)(136003)(346002)(451199021)(46966006)(36840700001)(40470700004)(47076005)(83380400001)(966005)(336012)(426003)(40480700001)(54906003)(82740400003)(4326008)(478600001)(8676002)(8936002)(70586007)(70206006)(356005)(7636003)(316002)(40460700003)(5660300002)(41300700001)(6916009)(86362001)(6666004)(36756003)(7696005)(2906002)(82310400005)(36860700001)(7416002)(186003)(26005)(1076003)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 07:17:26.1192 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ee2a593-f893-404f-6ef1-08db665e14a8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT086.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5830 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org As per a discussion with Muhammad Usama Anjum [1], the following is how one is supposed to build selftests: make headers && make -C tools/testing/selftests/mm Change the selftest build system's lib.mk to fail out with a helpful message if that prerequisite "make headers" has not been done yet. [1] https://lore.kernel.org/all/bf910fa5-0c96-3707-cce4-5bcc656b6274@collabora.com/ Cc: David Hildenbrand Cc: Peter Xu Cc: Muhammad Usama Anjum Cc: Jonathan Corbet Cc: linux-doc@vger.kernel.org Signed-off-by: John Hubbard Reviewed-by: Muhammad Usama Anjum Tested-by: Muhammad Usama Anjum --- tools/testing/selftests/lib.mk | 36 +++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 05400462c779..b8ea03b9a015 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -44,10 +44,22 @@ endif selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST)))) top_srcdir = $(selfdir)/../../.. -ifeq ($(KHDR_INCLUDES),) -KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include +ifneq ($(KBUILD_OUTPUT),) + # Make's built-in functions such as $(abspath ...), $(realpath ...) cannot + # expand a shell special character '~'. We use a somewhat tedious way here. + abs_objtree := $(shell cd $(top_srcdir) && mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd) + $(if $(abs_objtree),, \ + $(error failed to create output directory "$(KBUILD_OUTPUT)")) + # $(realpath ...) resolves symlinks + abs_objtree := $(realpath $(abs_objtree)) + KHDR_DIR := ${abs_objtree}/usr/include +else + abs_srctree := $(shell cd $(top_srcdir) && pwd) + KHDR_DIR := ${abs_srctree}/usr/include endif +KHDR_INCLUDES := -isystem $(KHDR_DIR) + # The following are built by lib.mk common compile rules. # TEST_CUSTOM_PROGS should be used by tests that require # custom build rule and prevent common build rule use. @@ -58,7 +70,25 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) -all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) +all: kernel_header_files $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) \ + $(TEST_GEN_FILES) + +kernel_header_files: + @ls $(KHDR_DIR)/linux/*.h >/dev/null 2>/dev/null; \ + if [ $$? -ne 0 ]; then \ + RED='\033[1;31m'; \ + NOCOLOR='\033[0m'; \ + echo; \ + echo -e "$${RED}error$${NOCOLOR}: missing kernel header files."; \ + echo "Please run this and try again:"; \ + echo; \ + echo " cd $(top_srcdir)"; \ + echo " make headers"; \ + echo; \ + exit 1; \ + fi + +.PHONY: kernel_header_files define RUN_TESTS BASE_DIR="$(selfdir)"; \