From patchwork Tue Jun 20 01:17:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13285110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1CE8EB64DA for ; Tue, 20 Jun 2023 01:17:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A08688D0008; Mon, 19 Jun 2023 21:17:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96F0B8D0007; Mon, 19 Jun 2023 21:17:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AFDB8D0009; Mon, 19 Jun 2023 21:17:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 50CA78D0007 for ; Mon, 19 Jun 2023 21:17:36 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2CD8B1A04ED for ; Tue, 20 Jun 2023 01:17:36 +0000 (UTC) X-FDA: 80921363712.19.2D77A85 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2050.outbound.protection.outlook.com [40.107.220.50]) by imf12.hostedemail.com (Postfix) with ESMTP id 195C540005 for ; Tue, 20 Jun 2023 01:17:32 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=tn1RRm8D; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.220.50 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687223853; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iP9o5A+zo7bJweh4Rc7yXQPSG4GKmkDno5NX83EjreQ=; b=Jw12IF+Gw6Q0EZRgCxq6TJDTR3UFtDLIlT5anYkxLPA0lcuNN+nRzc3YEqmd9yFwKfLKIh aOki+4wGXfjbQ26ZEPulV/tj84W65BNZO7ePVGRdOtVBk/JrA5EZdqJ2DT0HlbIz1/lj5j /N+MN26q8seB2YuAXtjY6m2d71QVcvk= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=tn1RRm8D; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.220.50 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687223853; a=rsa-sha256; cv=pass; b=js5eKtzfricxB5GFwXsUnMieTkmE+hnWiuabpbpdDywVaGXb54ToBg8IQRBqqZ2hQJ8/pp fkvr8Ed09cBFmkE3RV8xHgBKsV7VMCpIbkuRWt2RMOvgThq7+nuC4FcyQ60CjHbgbn+ngv kqnYiJuAq8Ud3kCwM+yGlcEktYs5CfU= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ye3LYtuT1M1IXmZgTQNVOt8Lj3FQ1IyTTI5aOFVqT5yvpBzJ45alRZIzo+jVRNkq564/J/x86cvGd+d3RxzDD2LENCGaXkhI85Qm8+76Ri3vkvdRW9qsGUm6w+mr9sRC3F6vMGt7hpRTtcaJedoDALDuwprIO2ZOywc+y9zSRIlucCmvuWIm80eqOyaqBA59cn/6W7MNBywwAnV7/3ctqCYCEfaYU5P1zndgNpgna+AMsYBmelTsfpiyyjaRdI+0hdhKkgcZbgmxpwWNaFYgf9J5M5xif/c5czq0aukLfHhgOX8o/9XHi0c4MOk0wFNXDZ0SDrc4CyJTlfUNLq2roA== 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=kInNYkIH2IM8KceOBH5gXw0vTqkn57iyIvADmIGkFhmf3xNje0xpZVVKWspoMLrvGB2/AkhfhVXWld2xoXPU/qLB0o2gt++JtfCQyoc8ah8V2yiuVYKlR7gRnQM4pHQib5cotwy35ZTSmQ2oYDyTPPw0FCrwVm0/RVMDyn1Khl6e+19xpIwbhnDuSFXGr7zQtJs9pPdnasrooEPEHh+i2sMu5ulOoKyALAtx+RNjn5rl5FcPqFRMJVE2QTGRkJpX4lePwoxdD6dBRF6k4TB6MKvc6ouB8NltCyWKV01DqoDjJFUOH08PnMst5siNjtu5WTA4CSIX9VpKCihunRLkMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com 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=tn1RRm8DLqjXU9UiTJQcDt3h+2O93Ygo0GojKlWt5cLnqFiEclhj+N48pUNAvjd5FgwHS8bR4scn06vOgAN+sEma039o3MDCUp6yblJWyt+JjfKScoVrYp02w0/NekzyrkyQvxfICejzOSluV+UFXkNpRAITjTl+t0qmMJluWnhEVPBmo0Efq5FWNz9qOD5Q8qPZMLpUqAfgYe8GpVKDVicge+C955lYuIkLN3RcHcADdgTtuuyedeU/act2pLzy+OCbGIrtD2vQWum3Mga8MsCW43l7qYjGx7qgQOHJH6pTsjC2/X5J0SV98kxs2KMSQFva+XSIE8Pec4fDt0lkSA== Received: from SJ0PR13CA0076.namprd13.prod.outlook.com (2603:10b6:a03:2c4::21) by LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Tue, 20 Jun 2023 01:17:30 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2c4:cafe::c9) by SJ0PR13CA0076.outlook.office365.com (2603:10b6:a03:2c4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.20 via Frontend Transport; Tue, 20 Jun 2023 01:17:29 +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 DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:29 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Mon, 19 Jun 2023 18:17:21 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:21 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:21 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 01/11] selftests/mm: fix uffd-stress unused function warning Date: Mon, 19 Jun 2023 18:17:09 -0700 Message-ID: <20230620011719.155379-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT069:EE_|LV2PR12MB5990:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e5db98e-4a20-4a4b-e01d-08db712c1db1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cbrTX2hbqEXVUecY2Sx225TXnfoF7a/S+9KcMbgPWgUprG2wzUd94jaelHG3U+/4+MCifGTBbPaJl5/51WVXzNXphRCoE3BIZOENPWdaKnrT+tnLaIjDZejSAKmHmdMM1ldrGM9ujvjmnNLLny7USwLGrk4dMQTHh7GLxx3HHoUWxaJaiqdD2QpXVCxCzhECrelsjE7kHKhijzlvB5Jx83/jruUzeAghgPdW2TJaOeP6ZLpCvaU/Mw0ziLLTIlZlHIHehNZzu/WW4WQD2iPMZ/nnsgzLNJEIai1iYcMRvTK28Bt1nOAPbKRqXV4O2AQGbP2IhxthzLkJUlCeplYB3SuaufwP3xBJLRykNRu0R9WFiq+sXo45DOXH34UV3KGHKE899sYDuvivQMACwE0UVHghWOQl6MEgxE2YM/e5tH9Jd7N1txcMdqMLzNvIjrRk+NIXdWmEmyv4vAsIlzJClKWroSnH6m0l6IQhNK8q5nYcxVECL9BMPKl/EkygMHgXARDVdLikqHqlNMB1mkB5FnXCp0u4z5TO2I9tmjFD9M6HMwjRaddBB+he8Bm+jzhFSfNd3gx/puqwlx1hvsxgCHClS8O0RWAUkycvtgYMYzvnZJh8GBpfKxN+i+pgYAV/oC12956G6M4Im2kKqofpqSZogB1noX/ce+u8kHL9+NXksE0uaNXlMCkeqzQfbnxghVCeMCa31riDI0fTTM8oA2B/4cbsYp08GIqRtMvNNKIL5Jmf4T/k7nrtrCOOljrC 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)(396003)(346002)(376002)(451199021)(36840700001)(46966006)(40470700004)(4744005)(2906002)(36860700001)(40480700001)(8936002)(8676002)(5660300002)(316002)(6666004)(7696005)(41300700001)(36756003)(54906003)(110136005)(82310400005)(4326008)(70206006)(70586007)(40460700003)(478600001)(2616005)(83380400001)(82740400003)(356005)(7636003)(47076005)(336012)(186003)(426003)(1076003)(26005)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:29.2347 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e5db98e-4a20-4a4b-e01d-08db712c1db1 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: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5990 X-Rspamd-Queue-Id: 195C540005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: rzkc7wuiywqjf1ishtdr5qygcjk3whq8 X-HE-Tag: 1687223852-95241 X-HE-Meta: U2FsdGVkX19caKGJZH47WFcVGQAot95vrm75Sg2bQ4g5z+PDgTl5Ych1FAZaQx3XoncYYnPWwKvv/5EPO25mBlgWi1PzpgAxuMkYDBCdWpgRftnYoSUXqWUz5WH7Y3bzPJqBJesMOvDzOQSaC49QI+hVUkEqeZUoUh1sOSMxCdFQzB9J5XB5th3zEf7iefKgguIqhvd1D+8dJZgDirQeEGCXaDBGX5hElHe8G3RB8i+p0PrXoyH0eOvhW1XHn6p9c0tdiZBCyFjgoZUNEJ6J5K8++YAn5yYPBwCAky5R13jRgvfLHHLv25mgjxGFNW1V45oCcqrj8i3MCMECVMTfi5WM4b076y6vuWSR1NRVJDS66TsHrx/DTTX+D4EQmv9+HBqGskQzDc86bKNZImc8lftuMx3XLZENGg5V2Ag7GJbbZYGh9opCPLGKeedEtomBzXoqByf/Lqs0sQIpKt7eojEx5XGvx0QpapOKLwBZQ494YkAQbk7F/pbc5C2vnAgwH2eOJrDWtsH5wY071uCYzYURP0J2WyjidYTDkN4GhIOGetkw0reGctAPU0CS5x9vPmnLVdtZTnViRXtZnTc0jSlVZuj+cagIqE58Y/WLnDYeVqEAcVMvI7LEw9BBrbSrj7ZODCrk6tSRP7hyCASbDNYDoIxypSg3Go7rwqD5RtMqS81Ho/5b+omJcvXYtPGCeXMFve+ne5OUo6f3+x78yOCSAaB1hYrQ1qQ1/KWryXXUmcQchcVucEufww2OBKyBv4sAZ5rT4gQeypPZth0yk2HL6SKU6nyT7MuoLvjcyHGoqCbYynir6kC0rFfkEWHZcydpVbjamR4KULvu5gdb+oBSyMkGezoPaMI9WtysA4ADQbMSr2yclOpaDVPAGEBuVIgoZ6uh2g+lfjvWbh1/Z8uzGWCGUuzLO0rhODRG6ZOQWI6ymY985y4zeGKrsGaH7ttae64gKzSqCKORoLP xND83kiO VLRSAdLT7hP/zM8ylYUG6lWiQEVFgc3nEGVRw/ChinGOSXhA4b9Go3sx5Z22MZ5vluAmdjwG6ud5PSYg4jgbAveKsIC6P7YOtniMj/p2uY1QFNhuE3P/39PjW5j7KH/utcUXJ51mR3xzyVtUVaCMKfd7WdOIr/3IBskMlbkOAVjl42FkHsSYZAQZQEKEwdLa7201qrDojEdmNNcXiCvqeLJK5RrHK1Q0clzTJi2HMzIo1Xz22oNJ8NCW7E6jykZz/jp0sbHWpxTp2L8U= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 20 01:17:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13285106 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A93FEB64D9 for ; Tue, 20 Jun 2023 01:17:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D3038D0003; Mon, 19 Jun 2023 21:17:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6822F8D0002; Mon, 19 Jun 2023 21:17:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5230B8D0003; Mon, 19 Jun 2023 21:17:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 39C2B8D0001 for ; Mon, 19 Jun 2023 21:17:33 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0336C8050C for ; Tue, 20 Jun 2023 01:17:32 +0000 (UTC) X-FDA: 80921363586.06.1C57138 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2070.outbound.protection.outlook.com [40.107.92.70]) by imf16.hostedemail.com (Postfix) with ESMTP id DD2E1180014 for ; Tue, 20 Jun 2023 01:17:29 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="DuFfD3/+"; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf16.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.92.70 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687223850; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lQZhGUwkoU04C3ryaMpvsp8ELkjH/HHSIJHZlngWhEc=; b=nqoKAjLlV6vVzL+x7SstHTNmk3tNNRBk5t31eHrqllA/5Qsv27VN4EW1m53AyvDITg4bXC SXp3TPdSIDxI6PV/B/IP1j/cvGfJnQnQdM7+97cVwx/O42O+WJCCyrj4/ZwOhhEDp8Lu3q ONBZ7F5QVkHNGI7RCEx5VrTH9u5xF48= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="DuFfD3/+"; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf16.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.92.70 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687223850; a=rsa-sha256; cv=pass; b=ItMT33j2Sx21TMMcYrna0vdMedonOWOfzCJuiykFQmSSMgehw1veZ+NZSuYkVzRBRx555u IAIBXV+uOKmSmWSqfngCIJBje99qDyqhMnL5cYFf++ADGe1MRb4h4Y6NN6mZA0q5eex9qA giDTGAfDeJdLmzdpAEg2tdbEskbtEds= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FlvJv67lxOYFQcXQ1l/j1w2GdPy6UMW0Z747ygdko2qaam7M6UmkKmD2bPjUOhpUTVh1Gjb2ehFayqX7RH6ZNAsNr6g3U5kiRgnX4fbQp5JbLoEO53/vJx2JSdC9R78E1Mn6dKUr2HuTXtMNECOrwqX/lQUrjACfhM+7F3M0CDre9SIBJAp/prTdqctyNf5meYHUnfSET7BY5YE5JP9xV38aB1y8+YyQP35XySptwo+oeAqzsxU02SuHSBbNHMwrHmbQbGKi3x9Z07JE9Oj8llwLHczzzjRqeL5Wd9gfyfB6kht8p1X88XPIj2EcZWsvgv/YFi0ocvaiI/437Y6ayQ== 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=lQZhGUwkoU04C3ryaMpvsp8ELkjH/HHSIJHZlngWhEc=; b=fif1m3bUE2JzsfkjvuwZPzE/DpcJbA22WWXwovqKtuLSWZfGMFWTlYKwg6QXROyOjL720EuDZick404G5rrD1MDCzh741qRumv+JYXzXXx10BauWleodrIfxfd2fB5+9HmVEZkimXXG6AgpPn8mv4uKvP07VHomvKG+4qOWtNj35qpmJYfCfOa8kAFJ32tuPzYeI05PJIMzwxz7TGApUDzecFnmp3QX6Z6zjYNUkcmD65GwZtR8dLz6qQ0Bs7fl3YfoZuB/DcvNdrcKApNbOTrNXpcUB9B9ZP18DPkTxicr5+6WALs+vIAB3utrg/QeeGf8XvZfMpxjDbHDnJyKAgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com 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=lQZhGUwkoU04C3ryaMpvsp8ELkjH/HHSIJHZlngWhEc=; b=DuFfD3/+AK6g1xZB4WJ6v1rZk72ET9aSyc037210l3K4drrCZL2G8ID+qYWzWT7DqfTTf0/lvGYDNHZ1J/XxLYnKarM9FDSFpvWFMPxG/s5lvRBY6qfzal628OHxgUGVydJ2VITPpUbB3x7sSaWElfy7gLfUzSnILHk4in9DGHSr3/KB2R86XsrhBa0cMkqkpiO2r58KyhVPJKvzZIy/lXjwB2sKSM9JFtUcggD7JhwuQg9WhiAhhhZ5DpaRHhbKVWcWLq9i5LIGeiO032GhmCpnU51D5Mh/wYxbDEt4EwDbzqJG9A+rPaw1ysl+SzDSCERQi6iAo2zfVuivVvUExw== Received: from SA1PR02CA0007.namprd02.prod.outlook.com (2603:10b6:806:2cf::18) by MN2PR12MB4288.namprd12.prod.outlook.com (2603:10b6:208:1d2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:27 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:2cf:cafe::ad) by SA1PR02CA0007.outlook.office365.com (2603:10b6:806:2cf::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:26 +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 SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:27 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Mon, 19 Jun 2023 18:17:21 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:21 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:21 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 02/11] selftests/mm: fix unused variable warnings in hugetlb-madvise.c, migration.c Date: Mon, 19 Jun 2023 18:17:10 -0700 Message-ID: <20230620011719.155379-4-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|MN2PR12MB4288:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a834292-c643-4a9d-dceb-08db712c1caa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NyohEzqtaKpeQcuMKVUtYdyEL0NrUli5DUZW5KA/QcsRw3PjayjMpfi3Tk85Rzj5i7lsmDIegP2WV4IE6ymUoOh1sto4GqNWq2J8bYv87eysj3PH7rfgVjsv/AqaJmld2VpBXnUgfBIfmBM7I0VB7nxcfGNGGuZcGsM+hW65vVJ5EWCxmwvY7bPnAf9T91VKEldtDUc0/4qlomaF9vAwfyN2RZnPzzGPGZ/zjZcWFtxMPetjam6eaJV+8Qc+gGEbCDUsHBNkXJJsyTvh8e7TyuLJw9wjaoGS2kvJy0aDFSjCKKSaqlf2/E117rBC8dBfNIZSVRMKZWQfRXz8cRWOKkDz63NGY+XJ4bMA/jTWFfE2FyYzx6+4JZ43fKwKa4RkxtaVixL0ypeFcrDlawHxevlQ/GoytqH+1xfJ4BhYMV9B5xtIFvmgHfTQr0Dqk+fmjjdg97Dh61Wc0QBlHjXlRQ0B9PE51uacCUpbvlYVve/aavrSmI5IBoFpwKDMweyLVH2CMr7Z6l36L3QjRfg2p6u0AdBY5fqaigsPR59mk+Mstbg1+K3nnhJkGxNRvb/DLe4a3bJmryYX9ROnvU2j0UKAp8fmBAu/39ETWDgFqHuBbLJJNXA5minUAZ7rIqN0oNJP5ExJDgBJWJAUoH8QYl7JrHGTIN9WRrMWmyUXxjx0nHB1v5RtSkCWVJ9obdvK5cxJrUkJ2aNm5DayYE3afQ3LocMb5Ob4rzTO/e57WhJsQm2jsdeToCAUzmMr1izz 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)(136003)(346002)(39860400002)(396003)(376002)(451199021)(46966006)(36840700001)(40470700004)(478600001)(336012)(83380400001)(426003)(47076005)(86362001)(6666004)(7696005)(7636003)(356005)(54906003)(70586007)(82740400003)(110136005)(316002)(70206006)(26005)(1076003)(4326008)(186003)(2616005)(8676002)(8936002)(5660300002)(2906002)(40460700003)(41300700001)(40480700001)(36756003)(36860700001)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:27.5266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a834292-c643-4a9d-dceb-08db712c1caa 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: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4288 X-Rspamd-Queue-Id: DD2E1180014 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 94ayz5wff74j6y93w6mmjwq5o3i3bhrc X-HE-Tag: 1687223849-783148 X-HE-Meta: U2FsdGVkX1/N2dTiwjPDcolmnefVS4+cvRfw7ifCDegMbr+ocLJpV9OYFtkTICIWpbqS+0q3THjvmCf0JTbdyOcWXnE+rk6bCer53NB1yLhUWeubWFp96HTu/UpIteJ6K6JqXxtZRCa5rYZG8/s/OpgIKXM3OkK6677vQDTTc/VPFHxdAiD0DDuDXPk8T2aLguPCXQux7QYDfKiVQZ9MEVaW8og8GmqGOAyYWk9z9LzhjanolSjO7CMNF8vknoRRv9rHnuoTVGXg3nVTWeDNl5AXkT3/edvZRym38B/dzoipEjuAoUJifvfjVdGw/KBA2cHUp9UXImpkhs/rHFxxTJoATUZWmQnkAK5H5EnnzFBDT8KvRPV+0nquXGjZeC2uvzR5/sRL7DS9eME1ftbwOgPbS1BYYpdLrJ3ltEDnq0BguCW02nFODxk6pkUAp9BDOniUjRDUQWSdiA/3lP1tYLJsbJV+Zabu2yit2VrJOHNUmdv3mJwh1svtTBCXf64Py/c+zZmtlwNBJtQ0xRBeq2OJXZH1c2DubQO91BIt6veahMOmE8BJZu5105Z+C8Z8TYePFvLIFJa6FkJx0mfHwdwf1ErYKg1rC2A3c88yxAEuSRmRq9jYckD6OMNYTiZFZWtW7PoDj/kXVDSFQdDOm9xpgtcQri6GdZQAXcQQ8LneRoSSagKglOSzBQXC+mYb2kgfuagmkIG9gVdip3Ku/1W6KGVF0O7w5077c66MAt8JHDun5QHV4+9R9aF5Fb+bl1nZrcR24wTg93DHIdF3xLG64BOTlGmn9ypm3WoD6XXi3hT2OiCvDTS07ZSEsrv8ZxFhV2uDHGx3atUf1Z+0SBsDHyROb3cfHunz/auSMppjN/WtNuLL+EmZBHAYpE0W9CmBrqXSysKQXgiM0BAiWnnMz6nErWilRpWy5uQLTkYkRgM41/wP5JSxunnugu7Zr3iPMSwt2TVDmOV+SgN jkqpWSvu KoXS0imdbLybITrcMnGrKAiEqKpSp24X3oprbNuKhS3VNxfgyLYC2jVy2A5UZ13Fxw5uXPGmbL4ryVGouZT6uUZ3J7BXDM4U2/cjj2IH4eDUGIJ38my/dKiBOnOzw/M5Gtq61W+3D4EyVsau88S6WOOxnrOnnpyL6dkpBbxr0Gj2bq3YNczJlhAq/kEsNiu8Hy7MDA0+fo86nFubism2Siq42ozn5QdmZX3z/e6z4nWxADSxUKGbu0VLExOLI2nHlmHU/QnK8IM7lIAk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Cc: David Hildenbrand Cc: 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 20 01:17:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13285108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F100FEB64D9 for ; Tue, 20 Jun 2023 01:17:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3531A8D0005; Mon, 19 Jun 2023 21:17:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F0D08D0002; Mon, 19 Jun 2023 21:17:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE7E98D0005; Mon, 19 Jun 2023 21:17:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D37518D0002 for ; Mon, 19 Jun 2023 21:17:34 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A1AA240500 for ; Tue, 20 Jun 2023 01:17:34 +0000 (UTC) X-FDA: 80921363628.29.2847181 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2075.outbound.protection.outlook.com [40.107.101.75]) by imf20.hostedemail.com (Postfix) with ESMTP id 920D31C0004 for ; Tue, 20 Jun 2023 01:17:31 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=qRrXPykz; spf=pass (imf20.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.101.75 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687223851; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=S08M6qCxf7uj+kvbpIUgDzdHbXyg5xFGSG/3z4Es1Z0=; b=J1qz0RCFD8LVaQdt62jAR8O3927XzXchYdOqiAec5AoecdFjtvrnJ4NN9n1vlMS+Yx996k Iqu4L46zKucN6itH6gEXrXgDzGV2ZT2zvxqrZvgUl0a+WnTao87cxrSeqSSUM9ndnpiGvo i1WNDFqT/0U30jzKlZMQ/wq4byuGqXU= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687223851; a=rsa-sha256; cv=pass; b=qyWW+NvTbv0hMdFIVdRKkbBDt4R/+fNumKwugF94309Hg3S2p69kUKA3Vow6ztJmUO/iMk /JZvu6zTJTKn8fJlhSL0KoscPhjzqzoLzYFGRt16SDt+//iCHL982ZNv3Twl7jODuHblgZ qam/Y1M92vw+8d11HjNa5kvcjWJ3Ah4= ARC-Authentication-Results: i=2; imf20.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=qRrXPykz; spf=pass (imf20.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.101.75 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gJh/ElfXvtySmgnjlyNkeXRiq9BFzj5R2n1acYXzC38k295aSHHkAjOEVMYMpyhIn1ID5lPUd4+4dzM2qFiFr2p5gFk5QhUWkx0mk90St+3LbvRaAt+hO7njJWns5KHvsdo2hNOJfsabJGrzyrjyPq38g/BdLX/XJMEBcS0duKf3V6yP23kWVKd25a+MBumIg+ghMdy6R/hmDZQhHAOhathvLk3ubP5W4fwbd44Np31qC0rIg4SIfwHA330OfHgmi9QhFfIfdRLDL5u3JkdpyNf4HcJ4HaeuGb0R1yde0Z/+iTl98XdAn/RVz6eMpsL2k7WAgDktHyIxrjfWnJKtDw== 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=S08M6qCxf7uj+kvbpIUgDzdHbXyg5xFGSG/3z4Es1Z0=; b=LbzunH2C7NTPTh9MIZ9lAjGBJH+odC6Ym1EcrKHmXfISRJpOaiTVmyY74caDHQHEsTryOuBmCN2wTFCUaa5WgWx6chgG47C4oIVZzM+2f4CF+Ik2DQXyWCYHwiA3SrqNY0SLrYLhPnAkJfsKh6xjU0Bh6DETX7ZdmnJppcXR8fh3ou8HBLdPfAVBbtBJiK7zphukCK0rIV3pMDkvo9L4XPAmiAm7XNj5VqSn82rOsNsVfBydWzLJ8MJ1XcW67AzbpPr8tFalN9X4UUmAiAn4K7vy1SOcJUDP7uuEcJGKgOFI+yP0SdlxfPrCtkeBMA5V/oOE4In5z2uGQ1TKAeK03g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com 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=S08M6qCxf7uj+kvbpIUgDzdHbXyg5xFGSG/3z4Es1Z0=; b=qRrXPykzU07YXHBWaouyzmJ2ngdu8d1Oqm/M2PUnQY0LQCm+W5bER51V0K84vvfMQdT/qvz+t/P7JfeKjimE3bmRaH4VF001839ny0XRw9v79JEMG74ypSgO5+MYMp+d154RRWfWUdL2Wd3PCHCaJzyvRsQ1WqFxxo+EN2w3hsnwzHxnKlyPk7rOna+gV/gI+PP5k9raWM5nw4iVctGmyxdGEofK71QIegaD4qCSE86rIVGLy/ZMsGPQoNIB5yJuQ0TgnvLwtzvBW2keiPlK97lW4dN0qCrXfTVPZKuiGL/FOF8qZCGRDHLVQs+Tx2FhoTjzF8WW2iParTmpdRMKpw== Received: from SA1P222CA0010.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::12) by PH0PR12MB5629.namprd12.prod.outlook.com (2603:10b6:510:141::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:28 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10b6:806:22c:cafe::d8) by SA1P222CA0010.outlook.office365.com (2603:10b6:806:22c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.44 via Frontend Transport; Tue, 20 Jun 2023 01: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 SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:28 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Mon, 19 Jun 2023 18:17:22 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:22 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:21 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 03/11] selftests/mm: fix "warning: expression which evaluates to zero..." in mlock2-tests.c Date: Mon, 19 Jun 2023 18:17:11 -0700 Message-ID: <20230620011719.155379-5-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|PH0PR12MB5629:EE_ X-MS-Office365-Filtering-Correlation-Id: 5dc43935-c505-4b20-cc17-08db712c1d15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ao0QKS/BWIR/4K+dSl1hpv/tFm7clkZKgDV72RcTulKklp9YYH5eeVA7to2OnPEywNmrE9UKlRK073iigo0f+yFRJrcP0Np2yx9A2VHB1JDTcBRmS3BQ7Q41GaBAVJcnTZd9dWGY+AhUJZV2mlvfbNKyOpSFNjetEJnmMEkJdcuvTNYjwFIWy/4aA0ZG1b+3CuEOhXYuZvHd0TOV3nAl0+JIHMJ8QKdN3ibGGHyypMeUX+cH7lqxYemvMawXClUbZJaIjnWad/EsE1UrgBuygeUMUtFrcdnWMgWlMnSVcwQVKRiuHBJDdvpYFn6DSZ0HvxaCp2KqLp49wCE8f5wauelXofbG2Y87QBmVtN3f7mK0iugXeVnaSOy/EVRTPV8WvLcU4vJ+cytF3og1O1I+jod0GxYEkzhbGXDg8RF/izcXVbX01kACuI8axMwHFZwVCoY9l23wdDW7OfgQQjQYQLGNj6/bTJutKz5WVFdC9Fvx5XCHAlZ6i7fKeR0F2oXYdx9yVuP3wvG78+qIKxQ3bDcXahaix2Tqt+y8AsXo2E/0lf0Y52NZ/xJFTp4o+cTpTFUfU3VgQL4OmtOaPH+Rpfk82JwML2DuK+Qx+TTQbYkezZ6nBdPMI2/1XPLANaB8rDe5mejUzdTuVqcERR4jG90VF9OfBgKOJJiXCWB6JzjD+AykkzRHGJgNr5jeNBGoud/OP1OmTsodqmbslt+TVMsnipwqKuDdJPfd/PYzXzKUg4J1nJ/6mIopEiqrurm6 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)(136003)(346002)(376002)(39860400002)(396003)(451199021)(36840700001)(40470700004)(46966006)(356005)(336012)(426003)(2616005)(86362001)(7636003)(83380400001)(4744005)(47076005)(36860700001)(2906002)(5660300002)(82740400003)(4326008)(40460700003)(54906003)(110136005)(82310400005)(70586007)(186003)(8676002)(70206006)(8936002)(478600001)(36756003)(41300700001)(40480700001)(1076003)(26005)(7696005)(6666004)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:28.2274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5dc43935-c505-4b20-cc17-08db712c1d15 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: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5629 X-Rspamd-Queue-Id: 920D31C0004 X-Rspam-User: X-Stat-Signature: gan88bjw66khe7q5mgkbfcxjzac8orqy X-Rspamd-Server: rspam03 X-HE-Tag: 1687223851-252650 X-HE-Meta: U2FsdGVkX180wU2V3Qt8RDBNISNOanumHIK4czQsErxCtvmUUuA1E08P9cVO4J4WHxJFI9SttNQzqdRSC2fKwActG+gFwjTR1I2CVHP++a3vVdrertGfQDoyxQf2ss5sVTGGqY9OXd+r0+Bc4WYIBaQGkFw+gOVGvmI9sNN8mxt3fINmXIX/B/ka4PyZS50lfS9j2Z733tjYlzzVcOraGIl/8t6keIqiiSNV7+wWCv04RYaYy26TEJdMgNU4+R4IY4yXfFycHHsMBJxWF+fJUutcml0SsyDU+obAq01Jy/4wTzeX6yrbanGMxLNglJXYzWkmcT2DaaHOzfYg1uROczXKitgb6WsbweoVyl9hbFO7nppNiMCWPFbcE/LgM13HNjb6NrEL8yghzXCYR18imMc2f7J7cjeQJkAC+QzS8+XubDG+4KCEyjCcMAc3sZx2zoQV09GQjEFYd3hCD27tutAajfMD/HtCgZ5AkoYEjGV2lhpD0XCG5AlFRPg6OZfTuBlMCiNrztFzShCVtzdrJQqP2bqTW9qbbXTmyo5NpnQ57JWCyIQGsWaRP0yJRrko2zzz8nZ5UguX8jYpSBVyUXD4w4Lu4guHyRNUORO3Y1V8RM0qIMPsjg0MGKvjv4bAFdVwAwRoVuumytwIavph+vsJhPkohZ7Wmm7NJnAzSzU8XnGHs8b3ZqLjkM/qALA9e0/DXX6yvFaGAhYXbfjauiHYW6sqftKFup5q8lk855uYcDBTTIsH6InOkww5IAXQujdzVXcL1lORVWXgYW5tXe2mNjSpE6SINb4ZyQ8oc+CAtfojMDoETFvI0WTE3vIfKlK3SE4KUWHIkaAjY/8MJWQg4u8s/2s8VfTudde73dB48p59nd+J9/BurqFQMQ8/WgfnKtISACUUSEw1s8mRMg1cKhsWLDfQqbDIGAg5i28jty9XJNeU5Ff4LgjroSYqo/V/JkeYt3pV7BjOWZv 8g5stHaj Z/hwnM20Jc8qqSPobP85iMUis2Zlkww2VJxvF+15Rqz/HbSWtgPmByvDtT4j7LFUH4H4/dhsiwp5bhoSdMAnfZxcHG5ROgfcOR/y4rtuJ2izJ0Vb/ji2DWD3GwfIhPc2B+6yY0GuZnEy0pYbyT8RIbuoBWB8lLQRwXTbGtW/acaTR5xH+wRVsht/kxvsnOODZ7OnKLDYBaPTQff0O636/+a+aWMingeqFu6qixk23hICcKGU1KyuWhBGUgbP2MpMY0pDxROty04ZPStw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- 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 20 01:17:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13285111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2928EB64DC for ; Tue, 20 Jun 2023 01:17:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B8FD18D0009; Mon, 19 Jun 2023 21:17:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF09C8D0007; Mon, 19 Jun 2023 21:17:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9423D8D0009; Mon, 19 Jun 2023 21:17:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6B2298D0007 for ; Mon, 19 Jun 2023 21:17:37 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3566C1C7C48 for ; Tue, 20 Jun 2023 01:17:37 +0000 (UTC) X-FDA: 80921363754.11.CC0EF77 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by imf16.hostedemail.com (Postfix) with ESMTP id 40F75180012 for ; Tue, 20 Jun 2023 01:17:34 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=OzQaOX91; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf16.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.236.41 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687223854; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cvdHBj5yApv+3mwcH6LWSMXJlHljQnJdtS4CV2ZOt8I=; b=GMGt7rUqqbcEva4utj8QGF3YG07BGqt0Zm7t+4LS237cd1EkKq8mvmoMuKlCfIv7dhtiba QB5x5sNiySZrJO+2nBFBxzUOG91QMnVAjKRktI9eJcGzl77TlepvrVLTHA259/ICXjUVZl 6bAVRhiI3zOjdFY2lWgSvgwW+Zi5mSw= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=OzQaOX91; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf16.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.236.41 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687223854; a=rsa-sha256; cv=pass; b=UKvE4SwU/cmlcG8ZhYiZyANzB/nKzLMH7yr7vDT1jbCQnMFMBF7wuqA6/WdV8H9R/vUZKx 3uOuqGWna/GTdlKEB5FhgTY7bbsDtUQIFz7FB2dYqa/baUxl+qmzM4xMOwGNvVPWD1LpQI R86Hx1IcuX8ZqDenIxx9gOSBe9txm7c= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N7brwF2IUaVKKtJo6FAdCtwt+LvqPGUovVA+JBf0D2BD8949TcCCaqP7OAdFjIxuTt8LUG/t9izJyt1e+oNDzjmyolGorN9u13bqpvzgzFsGEOjSt02+HL3dN4y+ikPHEKby3Z5rqFDaXRCLnru5qZOJQNSxfX+q72ig8v60+rFY3++6OrUOjzPvHS+neOvlDMnjcLjBsufQOJqFwMv6bzn2oAn/pwpYCW9u3hFCzoAm2ByvSlSMETC4HV235Kg2Ey3f14Jw3n2vdHqEU3ID3oSHTtuLN88jc6cooJVcJT0lgdNJv4dlChapjZZqqJ4f1EEfLdzHvrBVpPdTBx1//A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cvdHBj5yApv+3mwcH6LWSMXJlHljQnJdtS4CV2ZOt8I=; b=LiRJhv9vZWRQUYZb46WArDXYgGvcnKzbkLNPjjE1CGw4/ehNkiYTqeiHnDWLZv7+eNJw0ceq0DOgXUObE53ewJDgSGWCWAgu7qJu12s2vlFyDfikIjr1qZ35qO9OmbSwWM8GtvgHVhP68VjIGKvR34Oyq5KsHwJdumYeUlruwGCTJKqmD13navXeyxQFjOqu2FhDXtvkXJd23+5CApghiZ5hCTx2JmbOsQaFRrCtukX6t4Loqqtn1XwUC9+U9imO0RrkZMffapuAavIry72OYbIOnrx/Of+nrJ6F+EF52NKtYJdv4bH4Qs6iRr2K8SIlbvaQhxwz+KYXNolADIMswQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com 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=OzQaOX91pAZfoRNfnbY4LFAebi5dE+ZKyw7TpQI6clNcyn6K6e4SstfJJyH/YpXvAByiLlh2u8rKh5Nkv9rbsh8ZEEU7EnqqMwMDrSIb0w6GZCSNvOJvrco+a0FXKwITbuJbWkj0MVg9Ty+YCfXErOBdrfjjq7bihAdzjoaNAsSYdRF8CJ4Rlb5RteeQZ1gyKizb87yrLA4QYhBVMLcHXpD4FpLsMRqV8Vvf2BYjxLHNsHETqxNjJR792zokQwXjmSYDmRiuDqBo1EInvx02+D992+q2lboRIwcAOMYcm/UHMIOqAwJgY5fkErUqQ1L8VOd2zMN5qMLykLgLjPw+hA== Received: from SJ0PR13CA0084.namprd13.prod.outlook.com (2603:10b6:a03:2c4::29) by DS7PR12MB5958.namprd12.prod.outlook.com (2603:10b6:8:7d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:31 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2c4:cafe::44) by SJ0PR13CA0084.outlook.office365.com (2603:10b6:a03:2c4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.20 via Frontend Transport; Tue, 20 Jun 2023 01:17:31 +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 DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:31 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Mon, 19 Jun 2023 18:17:22 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:22 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:22 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 04/11] selftests/mm: fix invocation of tests that are run via shell scripts Date: Mon, 19 Jun 2023 18:17:12 -0700 Message-ID: <20230620011719.155379-6-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT069:EE_|DS7PR12MB5958:EE_ X-MS-Office365-Filtering-Correlation-Id: e0713533-9bc8-4b39-b872-08db712c1ef3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1hdJME0ht5nOVxtfdnwbLMaqXiI7VFqO4QhAZffGyEQcekRntckPeGnYUyp8x9cEC1SacSmuSN4eIs+8Dy9rphZjSRIbP36CIKUcw9Uv5WAFQzuL2pX2LQ3+WrDrZ5xM8LuBDu+oRyN+yQjxhGoE7RZby6DPb+qSWcXmvjZGjpRDsswer2m0wlR4gBACMZUlSiynDS349oVZazOFNhyAKAv9Ss52O9mlSDELx+u+BkA8o+tDmYs6EbprQfIl1AZhHNyLrIH9LGxYIecgB6CWFuNoHe8bHStcXsAq4nQ8ewjVRa8mffHOsPzovFX/Y3y8fSYLWB4CcvTlqCQUdQmx3wcf+oHpLGlcM+qfCpBzycG5uYDwWiAJVfy9aHDgcOPkCNyvTzNHOOCwVbfWUMbOvlINZx5dbCNhi9duKO75JRVZHix/BiqFnXbfvZPaQjrq5rzPQ7noTduewV1REqE7pUsHTiPqiVM8geuQPvYnMYrjQSxU5AyVnPc27w6YHlEWt7VicQYP3PU/s9pNGuzedfhBTWvWCF4YIu3aHQreSs+C3afqOEiZidzUSKRM0IEcQocskNpnVGTBxtL/IG/VAp2iwl3V1x3ii1tmc5Lt5GKu4StETgLPLAt9Fk9t58kJhAmVNOIOWFCFyEq7Bk+vl+G80bRNV/G8SiG8bMErElBe+EyVrxVQ6qKT67nO3OwDNu+Rfox8CfRn113zq/DsoS5D65XEG7+Oua2Rj01xbZEs9QoTYkQizskuyuJbKcXY 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)(136003)(346002)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(478600001)(70206006)(70586007)(36756003)(8676002)(41300700001)(4326008)(7636003)(47076005)(356005)(40480700001)(2616005)(426003)(83380400001)(336012)(82310400005)(86362001)(7696005)(5660300002)(2906002)(54906003)(110136005)(316002)(8936002)(40460700003)(1076003)(26005)(186003)(6666004)(82740400003)(36860700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:31.3439 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0713533-9bc8-4b39-b872-08db712c1ef3 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: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5958 X-Rspam-User: X-Stat-Signature: ran5fkcx6wkk1hwinp11dt8jbzqxnf3x X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 40F75180012 X-HE-Tag: 1687223854-646284 X-HE-Meta: U2FsdGVkX18pW+yb9DFCBELLa9v4yOinF33XwWItTiBu0O3y384jOXwd+QWMSN+dMh9oWfHnHlAy6sghLA/ZNHkkqGNHqCUPet0+DG7e5WXWkcDAPdaBJGz1itpARs48kp0ITTyBi2nybYnZuBYU91gY8eMVBszSLZRIWxIzY93iqvChpMcxGyUwJa2PCZhjEkNgn65WSVVldz+EX96XBCTejqe1Q19tFq+zFdGVaqQmlFyilj3wn7tXtjWmIYAfCBbjwzx0qJ+iAzmbbDLIJsKM0r4v5SafIfgzrZZQedFFHDIPgsXuve1aHQwTBKE4OkDz/uEbCISi7uIkT0yLLDI956u9sERHaCAJJ9H/vM6Udhx9EO5TKLSypa5row0VOTcoqWtGW/eTsa/ppzMkXEFuloJsHTLc0y+R14Sxy5kmFAeFBHZ67Unev4xwyFOVy5VX9BaHyTL5kY0oC4Pw/Q2iB1/I9hWnfNCLDms9h7aXNde68KG5lLW0EJnhmzL6SyFVotuDIjBKz0xHig2G9zWUdqtiFtvLqVQgk1zsts5Pn2wN4qUqJx/z36g/hst/WVuALbVF5Jj7hOGQRtMWsbLYQvhmdfv7k7NsaXnsXLD8ctd4UqQLqWyZORdwPJcwyZ33IH0zdZsjhs+AdhX0Qlmlfg2h6f5p//HnDOJ+1kSeTrN+bTXBYbBl0FYWnAPBdcPAqi/diKcdPULNBY2S32IMkLkruA8SUgO8eGUPtm2flhNqFbXm6lCwP0c26xEjt9ywRbicw/BbxiZaidQgtfs4+07s4Zn9nc48/1QTjgtAPo9YYPASKNBch08UlLfC7pnue09Vr+XvzWjyHB1+zCnDr8kr6q8+DzfOM67E1d3+9eSym1H2vHxwjvarNuRFKG+LAaaQh3ETcAaMzF5+83NtUr248hkycO/57DeoG8riwFyfbbdlUSB4ghBu4dmamgnsXA69sHnEmlEKYyA xeF0Cku1 O+Pml5JnLZsFbBNLMA7Fn3EWOQJnIWyLZD0sXVR43MnbJ0LqGla9JhPL2nWOKtgaVDMB+2Dy23sT/GUFwFZKQu2PbvFEgUySFNzUFBuBQvcXGOV5HyDADx2gRMxuEbvD1JbWl9H6ofjcPonG/xrzaQjvxaB2MrAVJb0VGZuY9WFFmc7JMwXPpdN60caSf+v7MRGLfQ8jQDUdMEZlfASjjuESgnoOxO1r6c0dI5OhQwJEGuQ8l/rcrxqPHobC/nrPhJ7/vJlvihtJZlrH6aZe5mnY0x4WykLn9T9YiaZukcyKeob6woDfjzn2yTGph5xNHaZCLCb3Eam07HjE4lNrZ01DDnMrv9mNeOOmk X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 20 01:17:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13285114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61564EB64DC for ; Tue, 20 Jun 2023 01:17:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EEC7A8D0007; Mon, 19 Jun 2023 21:17:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E25F18D000D; Mon, 19 Jun 2023 21:17:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A03928D000B; Mon, 19 Jun 2023 21:17:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 641368D0007 for ; Mon, 19 Jun 2023 21:17:40 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 41417404BA for ; Tue, 20 Jun 2023 01:17:40 +0000 (UTC) X-FDA: 80921363880.27.87996FB Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2085.outbound.protection.outlook.com [40.107.220.85]) by imf13.hostedemail.com (Postfix) with ESMTP id 345102000E for ; Tue, 20 Jun 2023 01:17:36 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=jR8oVN9A; spf=pass (imf13.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.220.85 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687223857; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PNITXhlW7/50q8EibhFIrDa2v1XwHbp1VFAUfpMqVhA=; b=Qn8lCJoQaOoPaRT78tA83gBLHnh5e/CvdjKNTWIaYyg0pdrzhTrMlx7CiKIUHF/8aEtIxk 3KHzuB/X/2tGWJE/mbzAMF676trSwW1iwLS8NHZ9cl/Aa/p4qAscFpu2sGkELz1hpc3a2z +FmBR0ahCboAYKMWyIYujK6ZibrKAU8= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=jR8oVN9A; spf=pass (imf13.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.220.85 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687223857; a=rsa-sha256; cv=pass; b=I0SVmVDW45QS2RfDgrfsVs7eXXdKQBbMvuZy7cs0W1gJqq0gdgJWOt5mlPD98Z5fA9VQN3 pgX238ZkT7o5Y8VhJ05N6ZUksnEx3BVBVIzS4oh6pIpeDo+eLzUxNRWYi4KrSy4aBqt4OM OXS18CkGHLNfzePshCTZE70Mg4Zvek4= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nENOMRcIwHu9FxJu9qd6AAdd8QDYw8kNg2FZGBi9c/vslCNxZB5LaOPDz7/cujE86Yo7yq8N6aSzN4MKdpRBc3lTJUf3WC04anQol+qHM/oon8UymhsnF7cX1aK5TxcDaywakCaeEdx3mQTjFvjC67Fano1uju1Pq73g21lauz7EVWJIBsuceiLVCDm2jTFr8ZKw/ZldbD/0jm88CnvzYo6kFS+Iw0VEfUQRx6BPHAxUGjGvqKbeTp07V3VZvKOWY0bn13pAj85lLmqBe71hOCYsGbEjSJ+xat8GhPrl84lh0niSXXEA7MLPdaIumcp5HDQc7UEOZvtRTisglfdM5g== 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=PNITXhlW7/50q8EibhFIrDa2v1XwHbp1VFAUfpMqVhA=; b=mzN+PuZwZR5bssL/hDJJlC38S/OD/IJCUm3ySJqOwhJDyUgkFJs10kE2Wl0KaLtUpysnOhvxj2RQOEcLTSJBQodHO5KwVR13hjbVyrBmCl+odUc5P0HQbx/5c0LmWtz21eY/Ta7SgRgBY/qsUmP+VFUGosUvbFzuY4FTZHODhMyazIuQBeHu4yXR4OwSX7xFV+Em6prssPr5onUIA4m88K6u+1tRcLXeqtpPVmDXJ8S6R2KMmi7vS+1joDWKdpwRmqQK9eNpTM5AIh7Gi+ESrPmjrZJPLH1AZ2GKa3R2dqvnDDm/9tCubd1GNXjQtoO1Y9BiQ3hiBKhYR9eYPzbMqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com 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=PNITXhlW7/50q8EibhFIrDa2v1XwHbp1VFAUfpMqVhA=; b=jR8oVN9AU2BcZsmuXx5nDrjtpnFTeB/Vo8Ye9vTxV5XyGec10HaoU0FM22v9GxLx62L6iocpzXF+gnRXrrnpNOJgZSHRKVLYuVxp1765M2xnxTlnBOgoXrfn1hQXIt7g+48tAXGe4t3UHquM+/NFZ9jgSGVmfdqDlCCGdNIf7GffHv8YQSwmmpoBQVLfGBTn7OKd35a7ZwYAF+G2FVLSW3UqoKS+GzAR/Dr27yYMlOVZ+pVTn7Y99H9DPPKRcKxxcUETudcOskiCRGNtMKlrE8csicxMwkN9+S0xu5P00Ek1uaufz1HcXxzLRBwmCeLDGmy8TqUYoNRxjh29EpELiw== Received: from SJ0PR13CA0066.namprd13.prod.outlook.com (2603:10b6:a03:2c4::11) by PH7PR12MB5902.namprd12.prod.outlook.com (2603:10b6:510:1d6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:32 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2c4:cafe::f7) by SJ0PR13CA0066.outlook.office365.com (2603:10b6:a03:2c4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.20 via Frontend Transport; Tue, 20 Jun 2023 01:17:32 +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 DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:32 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Mon, 19 Jun 2023 18:17:23 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:22 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:22 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 06/11] selftests/mm: fix two -Wformat-security warnings in uffd builds Date: Mon, 19 Jun 2023 18:17:14 -0700 Message-ID: <20230620011719.155379-8-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT069:EE_|PH7PR12MB5902:EE_ X-MS-Office365-Filtering-Correlation-Id: f6f40616-c612-420e-4e75-08db712c1f6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T/3n+HgODfg6Zo2JstGcGTNFtgVJwUyjMO1+NqAi5xXJN7ptMQ2JkIZorqaL25VkWZurttFVpj8VtmK2XlQRs5jSW7ZrKBxo8tDaxMxhRm8UL88IERW7+sqzzE7KZl7LQ1cMLR82RIwCxH2HC1YRZcBf/F8MHvkGngoI3S6XwzyPMCUHORiddhzN9GlRhqQE6iWBKSx25sAOX3SfFBXPXPMUtyRGO34Nznh0e1JPmSeBozk4/mGUjUY/tyhcFCm2iIJRSqRaq7qhofPQsEgVtVFRPePLzhg6zsKaBxLrenhiN0nbvWn5Ioh8U2MBOhrdkoKSUXqBcwKOiFO/z/CXoJI50T/DrRYT/p95wCMed2UvxV1v70+X7QBfSkfuYB1UnN7EjbqebVxlmOBd/veHpUHOzKtLxIRVUUCINoXkh3zKaalpiwjuQdglkI7KxLsbkvZznJD3LzPM2FvO45Fujii1zHayXufaNKawU8trRd7wV+8fsSpuY25djJ0b4z7m5H6YX2jA2VsGoaW/KgjbNfDkj8RfkuWeQha1LLNMbAbRwJl9hBUXjcL2751KVX99GlHs2pmNsZhPhXwB+MUXiRkpEBno2o2UAW8HcrUGwIBwRPsV742ltuenaYIop3BjWhV+qR8uuHMyX62VM8p8Pn5/me51/0mXBRYRBJtnIFPJpbL2t/8QHLqABsgJe2OQwvXjCkuAC+mPWkhSTBD/fyb5zzKif51lOYbYTLxVlIHrCMywB+GjyK2+NJEJtCuL 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)(39860400002)(396003)(136003)(376002)(451199021)(40470700004)(46966006)(36840700001)(186003)(26005)(1076003)(82740400003)(36860700001)(40460700003)(2616005)(40480700001)(47076005)(7636003)(356005)(336012)(426003)(83380400001)(82310400005)(478600001)(4326008)(41300700001)(70206006)(70586007)(36756003)(8676002)(316002)(8936002)(54906003)(110136005)(15650500001)(7696005)(86362001)(6666004)(2906002)(5660300002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:32.1407 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6f40616-c612-420e-4e75-08db712c1f6d 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: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5902 X-Rspamd-Queue-Id: 345102000E X-Rspam-User: X-Stat-Signature: jsqqn9ziw8zf4sxh4i1w134cyoir6ohb X-Rspamd-Server: rspam01 X-HE-Tag: 1687223856-229101 X-HE-Meta: U2FsdGVkX19DMocNTJn0dCp9ujOL4l7ppLeVvZ3jqhkcbeYfaYhvJ+N1p7cld49b0k8sCEGvNSdqzSoJKpfaZMtCubK21t1U9wcjnIx1R1Kwxnmr39bQIUliHmEkKmY/wIpM9+fZITtVCN/NULkrth7WLrjI5nBEJvuras+q39NcWEQAzDHVR9BUkFQsdiDW44gE+3RmtarNKoC6CQxnT4pvakKMXoxdwwrfIYnnZ7vq8/4hZTVRJLzYHVfVXDdKQCeLjI89cGH9BVSGWsnshwW/LzENgw5OlN3vhkFltgJK9w9UH47V0l/PgbI43qQ4i/zY8qRDg5emI35cqdkOM38axOR3EIHapjKJH8skokHWH73QIqeFumNBgAYJbYftnFTMYcXWXn6pyT8tdYqx/TUca1Me0oeZxdtTwJQZE2JzvCpTisGdm1LZlYqs8Aq8radRIeslkMcLfmsuDM6B4l/AD13FS3S8wmjYv4uexgHLdl0AJs0qxG8Z5T4tH8n5WSf73tBVYE/bQsKbj41EiXbuBzoZXhFyihfF3Y4oFdlx9jtuZsYmeSX1Gh/XQxuesPoPnDbUq2Mc1A4T5ac6hsld0RzWGUjhxhyvaNMs/1anPUwKJ5Wfr5smyeHfwLmC81qsAFOoNNyUqKei1Qa9VsGmcGpKGhNEgE80PjOr/zMsB+7AJ8Vkv+lcu0z8+z8F/YrkTvP8soXRYmRUkibgWxSo95qGXgZ2+Mgd4Dx1cIZxeMhTLZAB37jqc/XQLGOl37Kui9Nd9h5V+zdXaEhcqNCB2FdWM/TN56CLrEeEXrzLfN+Olvbio9tiaTERpYSTlbJs4AYAtIxsG12/XKUXPGiBtVY6CQa5y4dCicAFxyOf2l0c/0wbaIVGxJrwD8/tMrvjvgIQutmK19pRspTwWUq7BWWkCpT0OLOZOdJhlerIAczgBMEGu2TiToRbZ9b8/f40KdwhEq+RJyn3maJ s3I50c3S 1B6r+zhHw6sRvJdFYii3hgzb0/TatFD/2k2vA6YRFBp+eWIm3GFPrFgzcfr++LF+TAE4gk5b/8pMyNKdouEMlvYQbCzvVdIbb2DXTwKeOyKI2UQwHu8NakUQ4wIKnKT08Yr46SrcVXZtxHWKQdL7yxbr3DnG56/gqz7x/PvljFL77rwu6XbVNY22a4AhrlNvHJG6UzqW7qPNCd+NIOy03WBBvLPs55uM8PobVsl4iNTsuZWBFqBP2QP2kLBxxOBVZznBvnAjNLnr+Kf4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Cc: David Hildenbrand Cc: 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 20 01:17:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13285109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 811DEEB64DA for ; Tue, 20 Jun 2023 01:17:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A7478D0006; Mon, 19 Jun 2023 21:17:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12C2C8D0007; Mon, 19 Jun 2023 21:17:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D87408D0006; Mon, 19 Jun 2023 21:17:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BD8D98D0002 for ; Mon, 19 Jun 2023 21:17:35 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8D930AE82E for ; Tue, 20 Jun 2023 01:17:35 +0000 (UTC) X-FDA: 80921363670.21.44E18A8 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by imf18.hostedemail.com (Postfix) with ESMTP id 876701C0014 for ; Tue, 20 Jun 2023 01:17:32 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=TQtaRKoT; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf18.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.236.40 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687223852; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NAgHsicGbXE7/y+61Ec/TG4fp5QK6NCUPay76C4Qy/s=; b=OzAfd3Zya2wZGl3PVAXRyZQDiUi8ZvITaFcNMhRlzi1k95w7usRkWUUGRV+NAx+vyuhAf1 0fDRZPcSeqHedCDrjV13JSCBzVWFI4ZerSIXR3g2P4unr9Dn3NUppVeieWBio2iOiZm5JC NiIao0zFxEhzh+AXBg/V0+l/19Awj/A= ARC-Authentication-Results: i=2; imf18.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=TQtaRKoT; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf18.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.236.40 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687223852; a=rsa-sha256; cv=pass; b=hltXUvr+kCRObL9v0PCdt3o/tpYmPUGU5GjzhyMwZ0VRGpLZXVnP97+yFAWCi5t352lqM6 dEyIF/go71oMslh6P7I0DsBbk0r6bR9Sz2z0jyF9YGlKA0H7DLolPpZqlztQ78/oSvOWRL TX/+0CNVGYtBaXAv5Z2Xfar1q/3/fAA= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z/qCte+UO/aJxYx6S7Sg3Cn9tvL181TKnyO5EiPsRm1AeRX4b5b62+F4Dro/QF0a56xst0vRwzr3GSGADoXYYqKvJGQHRBK6m98sCUTq1Zd53SVEK2eqp3rTh+Gd1ILDnb3MICguCH0YIWrOo8O80SysAXXFACoXiTuZdUV+49/kkMUYrkGSpWU0iBGzjVqfRe+yEHMp5x8aPakaW+8Xf3HfPeKiZj53xG+ZKkSSBJQbRExoxikNvgxp+gwRAfe3hb1ET3fGFZCKNWqfm+0Azo3rKsqaOfHFhJhQ9jhP787W6pFFliowCazGjTLQDyB5iXNHYmm3p4xyVjszcS6J6g== 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=fEGVmKbVOGd/81SKuP1P7NH3EchbLJJa6Gbyo4vG7knSIMDN4gCcKYA0XJ5y/5DapHnlpISXb5Chei22plekwtXr+Xr3RLoWikwsUnmRljwBxm6na/W4FObthgLP02i4kRrHvosHIKJ4mRl8omr2GYk/rB4lKGlLMvZLquei9iTS2nDdLGUSk4X4yC9a6UYaV0sYpPXAa5YbZ9XQFC2Sb9LnssNWcffiiRbgEAHPqaRVWnEDJ6hWno+06zDM+fHbN6xQlplNpLPAghny1schny1Q2CqxCcSPTsY5Pw2VmaMpnOF4P/zAR8I57qT/XyYTONCc+WT5xKA7dTVJ6H0L7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com 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=TQtaRKoTsRXcos7BLB+e3jHbLm7EbjxS7jw8ivJN474NSEKa5ZwkvH3MQuEJ+OXQmmmLTx+YD3oywXHccZuWxH6KM79heldyGPg6IGezn0xFdDf9QoP3L+2yGNrymNzoKDdyhDA04PJhY5RrmUWnCpCnRyaWWULaYKKhgazTOwAPCb3f6adCoQKVnK/IdiLiNuOLJVTzBsiV68CYrMOax6f7RTiN28cFFeNp5Re7DNUl2mv7sPFaaxEzjmDl3we3Ws8Rb2eg+AKWu1uDf8fLgU2qnYzzy+E5Wc6D0upPtcotcLZaD7KTripJbNi0cysUVpvAXlcaHzVjtaHxDmjfXQ== Received: from SA1PR02CA0006.namprd02.prod.outlook.com (2603:10b6:806:2cf::15) by DM4PR12MB6375.namprd12.prod.outlook.com (2603:10b6:8:a2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Tue, 20 Jun 2023 01:17:30 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:2cf:cafe::5d) by SA1PR02CA0006.outlook.office365.com (2603:10b6:806:2cf::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:28 +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 SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:29 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Mon, 19 Jun 2023 18:17:23 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:23 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:23 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 07/11] selftests/mm: fix a "possibly uninitialized" warning in pkey-x86.h Date: Mon, 19 Jun 2023 18:17:15 -0700 Message-ID: <20230620011719.155379-9-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|DM4PR12MB6375:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bbed8b2-9385-4bca-a469-08db712c1e17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xVPHgg1hlmhmbWUPHlyyt00twUTOkvQAv6CECljfOtJ4GKCbBDJMlzFeH6hA0FAO5SPhQ+jDdhP6mP9GQ8AH7zwvQkOaTTCiBfg3jD7mUrZdGS/53tmny+1Z/zRtrWNby4g+OuRoQ1n70O81u8Ay46ctJD4HNkMGIUbU8KgOErwRvxB4NP1khgbNXkBvpHuLaLmhHLwYKjEDebxNcSIWcu5PfGw6ROmLMYRXT3JIQgdRlSw7xxKfBTGz0GT/YVVUCP1BlTi/5sCVblclh68bGFz0tZt3mtYpNeNP0hVzWcBa1AUTurb4AAxe0wqR6+YhdHlLGGuQDACTk0XnC07nhK8u2GXT//sadiqYAPYxYAUODMJ6vA3oswZfhyFfhgRKnBXlYzR+AO486nkGCcZ07UMwzSfCLN5YWjBLWM6uohs3hVnzC97bbzMkcOC/j0xrWsGJw6GEXz2+I0HXBAwhY436wwUBS6s/PKGGRIA4MN1X2UOdAL0Sj3bK+2/PjvENXlzmd1yYg6ULpHygE3y5T/UuwBKLH1dcrSvucejW8fLEx/2YpwAE2i+CnBBtBf/x2GGzFQeUvcwhu8JwHHu1vQMwcQsKA3qflbTRBtZVMW9S/PLlkCYGFRCDMtVl/iHSa+RWsqNlSVsokYZ4BV3RVJ0sw77Xd5kOwqTYshI2Bpxhx5MN+8bWBQKaUnAqpsuLFvKj00a+Un209nd42c+hIayOIRydBUQA4cK0SCrwaOr2w7H8Vjye5nbEqlG2xSz5 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)(136003)(346002)(396003)(39860400002)(376002)(451199021)(46966006)(36840700001)(40470700004)(8676002)(8936002)(82740400003)(356005)(5660300002)(7636003)(26005)(1076003)(186003)(7696005)(6666004)(40480700001)(47076005)(86362001)(36860700001)(2616005)(83380400001)(336012)(426003)(40460700003)(478600001)(110136005)(54906003)(41300700001)(36756003)(316002)(4326008)(70206006)(4744005)(70586007)(2906002)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:29.9172 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bbed8b2-9385-4bca-a469-08db712c1e17 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: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6375 X-Rspamd-Queue-Id: 876701C0014 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: jyonpoyibpf5ygx59bny6f36mukxubb7 X-HE-Tag: 1687223852-503172 X-HE-Meta: U2FsdGVkX1+1xBoQjHOjai6CdWxMC9C20vb2iXm/o1UOkxU5A7U9PIU+49U8ZS8c4HlgiQPe2nIHV5kLQrVc8FR0VlLOpAiXsI5p+yFOwrO2c69R4Wf9szia4ziupX8b0lcmLSTK3klZ3nZQ0BlyP8t7HsMQFlpZVRn+/O0fzt3YcN/eE29G+xSeKkGWexTvywpVVeu8XiYYGpkFeWfA0195QzgN+vp/STZc42+W46BDh/vxnorSI30gempEBy6tTIIUH3hSwIdX6wzFyIhTiuPKU7/noJBbv/a51dsc7VK/KUVD2klg12e0sDlm7uGw7qaWDiWReDnh8ASNvCOUUsJMFM6zbTrTzrQ2gNnpJtqk+GrZlk2WpIEDVmuTV1VvKPtqSlMPBOdcUjVF07LBsK09qQ02+j2vUgPU8j+I35pMP5AXdJAyEqmAkQGygpaXv1MrPPXb7KuxW2GSIxtx3iG44trs/hKff06H8BEpyPOfrSaArKKjxRByMiJ+1cxvKEOLTpNBdJZqUrZ/fa1T1TlcWP+1gw9AP1tAWNCOaY10T6vbCXgrccYVpwNNR93j/Q544cx+LdroCrQNAr1hAlhoT9rLpP8BrPQ2DDNK033S7EzDiS4k9D7buaiQBxPOuaNJ22/8c/ioKtt2cvJeb7bOFJzo0OCXSet9aoRrnRD1tR69aDP+KdPHs0zSeLTb7Q0Y4VlbSi5NVublKzPdY1KeY/Hh2B+nEkHswcoYi7nCYvEqcSoxtXUpQ4jDgS+gI3EIbttwUXstkuRYBZjC49/K8aED90BsJLXjs1YzPUgSR4+hOUilM00tpjCbDz1VTmEH770wjhbcrKf6YQwxTh82Ki929CKljJFRb1SVV8G1SQVaSJ5pesBBHmecD6WlEzF4Iax47rMmPPIoymj3F/R80Cba7660eGCfm8ikx+elOJfXfpT8LVyn4JYgaQRrxzbFBzD7xWIII8Hn7sZ lszE/p55 G3Mg3XJHvq+G0cwyVGN5HersvdOS2dPb3XSsYWtNA3Drm+mZ00ASFq66RDx1uMTasu1rwykSbwAQ0V84KxNdtbIq2LWis9XxfgJ8Mk8sPWRheYTHWsStCuSulXINCWpTagP9sxHrjR20vXu6UHzr+0PC+lsiYrOpx0H1Nlwo2OCz/2LssYBfR4kQqUmqFnxRZhJAHZLhXNT4blZS7bKY0so5wXMcUyMemiqWLQUgBIV5Xpa3Ch++67GoGbvUSdtyb7/mR2Mv257vETS/a+vpO0AWTu9OlbJqCaU5pzMKcApsXtpHDHBbiA8lqJ9nCVtNEAFV0D5YbrDiFm8ILD/8JGCJl9rXrzwvUJlDP X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 20 01:17:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13285113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D377EB64DA for ; Tue, 20 Jun 2023 01:17:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C03778D000C; Mon, 19 Jun 2023 21:17:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B8C0C8D0007; Mon, 19 Jun 2023 21:17:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F5EA8D000C; Mon, 19 Jun 2023 21:17:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 646718D000B for ; Mon, 19 Jun 2023 21:17:40 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3E9C6AF711 for ; Tue, 20 Jun 2023 01:17:40 +0000 (UTC) X-FDA: 80921363880.30.A51BAFB Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061.outbound.protection.outlook.com [40.107.223.61]) by imf04.hostedemail.com (Postfix) with ESMTP id 1266740009 for ; Tue, 20 Jun 2023 01:17:36 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=SbT+l55B; spf=pass (imf04.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.223.61 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687223857; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=r7qWJ0iKcBH5AScsmOvvAEPpASsgJNPE7K/FjHHYXLU=; b=YJTsA1iU2zE5kVe+jRa264zZA1VaqyUaLbbkxrIJSr6HduS4YXMu3W/0spVKPRgx2dwYDc ZlYcJe2o4KB76k3PlGL6N49JSWrk2SzOQdJwILQ0fBTtMRgKkHx6aAe4wP/iygaRypUsRm e+iOuJbNm8c0dxxtYHskobmLBFEcR0E= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687223857; a=rsa-sha256; cv=pass; b=3isXAnyVtzannmaEZagBGCDAF/h/Kp7RtshI2mIqD3JANmpbjjKAdPqJF1iFFUo68xifek lE5Dj1kNYvuOgaxh0vHRhyxdT0Nio1685xwppIxgELe0x4A92ud6r+gFXVfw01owN6j0BK mfHftxuyTWlyWmXfxGWRTEHR3Tvk2pY= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=SbT+l55B; spf=pass (imf04.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.223.61 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HaGLqZdQUyrSn34bQAA00UCiIxSIrJjTfCNeZh+wdsmMtKn6Q1LuIH9ZS2WH4VtINhpelx6ncqyp9WHx+pDyEx/63GdLjbA3F4W4jZd2tP0zwHPTzRtvdkculEwpEnLvUyJXpUrOOhyTuu+2r2PQCjFyQMHnub2SnN51w8puVGCfGVFV8KZrjD92GC2pI4KwcTE1jz4gSV8TFXeAfgrXi0cswjzJkjqIccFP3wuqk+3ch2G5hB40Wz7iXZTMERgdYHn3X79xNo5q7hSEEaWfqWMWLeQnp21zikKkQpZq6NqNfONZ4L71DLoS5QEB2w4F0Dn4Q3snAq0WPvSneL3gpg== 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=VxSIArXYwrlSzOhnPD9mUZt+APk1z3haZMSD6+BrcfPl9SqeW5UmGLwa6F8IkwLUfKUHChDy8XlYR0IySNuZat5T2tci/zhbs9R1bKxDDngN9Rf2vB9eh2oQ0QVSUlKbtRLT4DN1KKFiW8qqrOsl8fgOH9HJZSF0ZZDMj0xJUPiWarDYH90Y7biIOdQV4o/PHzBXalNS6bPAPi4iZeDbPROCsHrOdufHlNMCC7Wg2ds/mRlTJR81HFsNjsPvyVYxqnlk9MkhjJsDraVg5+9u7oR9e5e/Sc0Jl8EfI3bjOgxTwxZByZepuVzdFynZ8EEsy97IVLdkOmXnjAiu89FjkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com 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=SbT+l55BOgfdunkORb4oXnB5J6O2o45OPbMqi1ZFnPDYcMXlkKIApsTanogXg9wR1l+SsUDd45WSdyPD9O3CCUe+hjsbWT+VpZVC041/7lbNOIlXYU+JfWtCepO2e0xkr8EbBEqyX9YCh1fHIFfQs8tuwGRfay3mZoCRC8JdaCYJTTqrI+s25EwPcSsbRv64w5WZUqmei92K90/ZGguaSz4BzODw6ppOqtgHA3uDUb6Hu6kW1cEuoSTXXTLr2MSC/2vkK2CzSEl2F/evvGPYS1eTPK1lFUUui8nDvJHdL8y4F+9wgMSmMe6pfYoFRiTg33UhF5WjO7urMWIZ7ejMZA== Received: from SJ0PR13CA0082.namprd13.prod.outlook.com (2603:10b6:a03:2c4::27) by SA1PR12MB7199.namprd12.prod.outlook.com (2603:10b6:806:2bc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:34 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2c4:cafe::74) by SJ0PR13CA0082.outlook.office365.com (2603:10b6:a03:2c4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.20 via Frontend Transport; Tue, 20 Jun 2023 01:17:34 +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 DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:33 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Mon, 19 Jun 2023 18:17:24 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:23 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:23 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu , Muhammad Usama Anjum Subject: [PATCH v2 08/11] selftests/mm: fix uffd-unit-tests.c build failure due to missing MADV_COLLAPSE Date: Mon, 19 Jun 2023 18:17:16 -0700 Message-ID: <20230620011719.155379-10-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT069:EE_|SA1PR12MB7199:EE_ X-MS-Office365-Filtering-Correlation-Id: 357b87cc-2927-470d-01b5-08db712c2089 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h2DJACpwOOaBPQAlSCSmAlRJrd1GxOI+922JxlbOw9HAcliTwUA66JKqeayqI4CG9SW5b/99cU7tu42N+T5lEkMjOTpEbXx2cUEJgfcrBIVZ97juS5FXztBMuph2T5yP3qGTq6VjkRlK1BQiNyJdKNIFBe1R/ln9miwqacuEvolqFehF9eiU8YaMHXNrdtF0S1eTjswU3+rlzIVb04Jsxf2ZH9dS574jNZcGdSQV7I0R+LcvcnQSErD+UaxiCmpOtdBLtJzVwGDR2XbhvOeg/PEK2f7kYKVzsUkuHc4BZ8XvIfLq/tE00xSgdxb7Ad6pzE/27l1nhAFZFLCeQPwVUBG8ixSgl8fCzvXmezEyWeYfT9S7Djski6ayjj7we2RpV0aOcy2NF4PHEoJW3CZc50SDXjzP8XLxzU1HtM6pPE5oJtc2ovZNMjSxL63QSzzX9dE8NCQnHzvhmLn8Hikdkwz2CtMcFekiDT1vF099d+Z+/Fblpckg2OgjLHOankrjDEYYjOKk78tT+JYNTAdlG5klKspUNzK0YKDCfR/KBIr7Sk9BQ4mptj7F4UrdKPDk4faqG64hIqn+WxqtCXXippmcdB8LWlVcBiAiAqSKAk080lB5l8egZJvLU8c99dvlzrsUW4+8/S29ICVrN2LQpSSVFq1yGijlEnTZd3Yv3OiSH4Vdc/hwe0tkoAyIwO96Z0NFCu9XtEWEIClKTW2zxj3htAorBLy5i8hcHIeG7RJajKeb6rBU9qbvmC0638rQ 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)(39860400002)(346002)(376002)(396003)(451199021)(36840700001)(40470700004)(46966006)(186003)(82310400005)(70206006)(70586007)(8936002)(8676002)(82740400003)(5660300002)(110136005)(54906003)(4326008)(40460700003)(316002)(6666004)(7696005)(478600001)(41300700001)(36756003)(26005)(1076003)(40480700001)(336012)(426003)(356005)(47076005)(7636003)(86362001)(2906002)(83380400001)(36860700001)(2616005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:33.9844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 357b87cc-2927-470d-01b5-08db712c2089 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: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7199 X-Rspamd-Queue-Id: 1266740009 X-Rspam-User: X-Stat-Signature: en7jrgchhm15c8x7fxdph11wdncxqi9g X-Rspamd-Server: rspam03 X-HE-Tag: 1687223856-126903 X-HE-Meta: U2FsdGVkX1/K8B9WPPPwnpr9NrKB3xJo5oYch8QQtIFcbg6OOuvuNTEumSlodF5NGH5IVLb9Av7IwGqG9JvS7xoCawAnmtuYEQvCNqJY0AeVj/1AqZ0/1Mul87mXgK0mOkcVe6eqBz9+Xvt2FvMB86nYUsxJQex/9+xLaLZGobHr2koKwD1gwM3Fi1D0Dopt5MI6bIyVJ2t+TTlriaN2eStj9ojAlmhMcRNVIFnh0fbHinndTRA01KfD7h4PSMDHYdd1yJE4QELQMfbwDKM5qqu5QB/BbPGB0tcyaXNs0HlEAEFhsbDdWllipQjQdXsDK0vmF4U8SSbjUCXx5gQ27gA+L+TTm9I/n57ijq0nI6/KInk6jFzSkhz2n9XWA5rV4rKw4wkmXhJVl6M75XSRoUbuXCnQCvntCSMPv9r1haMFkcpbQcvsQyhc2wbcLYrzrJ0A0IHRcmJVUW9Z+udRJirOFTcNmxCpai+OFPBeOISFDPuyl74YETAS9i87ZcZX5v1bR2hORT/Bd8ry2t8NR+nt8E/XT51uD9dB+NI1SPvzZRDrRcsNuHhwBrCWkgXtXe96KeG2BJ3lSoRLHY14dvJMWealwYh+CK53Xny94dS+BerhPyBmOtK5bQi+gxtrf9xvM7brLlWznHcmqoizbaPgj1WxJ5SIOFkWQTqP7oNFVidYbM4DSio59aHAXTsxfRJHtBFUnVYL+y5h6jIjW/510Sfs7n67jzx4UqmSpWe5Wov9Ez1qVMnbE1TKluc+4GsOYPjRQk5xMPMTpDtF71LXlqpxFsx6z7Lv4NamTQMMfEIl3wUhwWpDZiDmMnguSfcpSZXrxmKuy9OVNZXn7YoWqcTDJuKKRrhoDHmjX0Brt6imMCkpfwywygRgQBxhgsue7a/YXCEEjA6/ozvP5dsLQwKD6sDiEsTpHVWSX4/6SqgUpy3XzW9PaeDZrkoVRO8MO5oqcQTHp9yuJW7 sllREuZv ev1e4xs9VaBJB6KSU4t6JjjDKlr2N/CWJP+b9/Sv2s8OU4DwIK8zn8QJ+h8RFXROveruGJEdWR45YfDyeoqROSf3md7EOC2QoIpQD0D5Dx20BLUsUl9xL3aHWZ9UvkBWNv66l5RoX/bEte5Y88DgG3x1vQdwP3u1/yOxIL+uf6F2tTjS8DquNal5yglfWHZOh434CRyOoxWga7Bj3m6RBkx15AvVTQMM7pUwl79bFLQKn8Pm0VVKNyx2tP55rby9Z0xIxjKKFLaaNkXHrbjZWH2OZ0isQRQApQN/+LG04v6TAzKuVHQ1seYIUZkqISTMT5J3cLNVR40i1vXm0mwTz0efMPd2kMbFN91iYau3kDzzf7dA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 20 01:17:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13285112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 966EEEB64DB for ; Tue, 20 Jun 2023 01:17:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D40B8D000A; Mon, 19 Jun 2023 21:17:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65C598D0007; Mon, 19 Jun 2023 21:17:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43AE08D000A; Mon, 19 Jun 2023 21:17:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 15F428D0007 for ; Mon, 19 Jun 2023 21:17:38 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DB7DF8050A for ; Tue, 20 Jun 2023 01:17:37 +0000 (UTC) X-FDA: 80921363754.12.7FDDB97 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2052.outbound.protection.outlook.com [40.107.220.52]) by imf08.hostedemail.com (Postfix) with ESMTP id B0559160009 for ; Tue, 20 Jun 2023 01:17:34 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=SIwQg1o+; spf=pass (imf08.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.220.52 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687223854; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lcAlKHerk5VQh9Nf0GPXXyu2H5vBR4yo7s+VUgObnFs=; b=k+JdYEZoa/UeIOjPZ7Kova+eF+RGgL4/nEOta/2Q0EKQPKTmzPTplo+in3HWiYfCsduI2t FavVUHQwG0pEHTnv/+K2jIQ4g54UTfk4Bze/Rso+5XZ1Xld8mMrkRO/+VMmYF72Q6tQloD aGzhu32H2LiK9izIJAGzcM9xg+G/aXA= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687223854; a=rsa-sha256; cv=pass; b=GXIh/4JxEkiBIe0xfplj8tkS8F1fF3WUev7za4zraW1KhwhBIZ2ZWNav4E82wJpewVts3Y aC2Xr9iEXgDJbIMyBz/HnIhITFtkbJEKhTedKmt+dvWhHbW/bsWxj2h5/I/7IhGkzK5YdA 78EriUUMD/WsL1ch1mLJj81dZzhS0sI= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=SIwQg1o+; spf=pass (imf08.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.220.52 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bIGfCuzUzu5g0HZ+VTdldCh87mFNiiFQOvNerHIHEWfLUiL62ta9kjhYxhWhdnnPCjQTp7TtYPwllyBHfBiqpzLc3HrjSTabRTkf7GXqOgFmUHyx+qVYRIFhkc2vB66xbIj0fSKXcJ+1wVVAJ4LyF+TdI2wcrF8Bnkp9sX/++Lx1YJcmmLuOd+fSSvHsWNxUVEmoeyU9bDOBw/BKIsFH3YuYFi4gcdMiG9Oh4y3D3RywZbp3bEHIJMgIdOoaRUf+OXuNdONRrThy8ju7/2CnQmyofFT0m25IenvsD5kXcq/ndsBOiEYQy/q2cAuZ/yxWGy1UAAFCRIg8DOqMpvRPSA== 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=lcAlKHerk5VQh9Nf0GPXXyu2H5vBR4yo7s+VUgObnFs=; b=lNKxQeT8oYQORrOvsq8oZSTLw4NokgoI0HFcfsz95B37ulW9o/gNtyuuJ6A7EETlqlMsKPfjy2GbeAzqlMlIuqLwNahE5wNLQTv99Y39gKBQ5nXXZmH8xxlwuwvP93hPq/eROZev1TXSzGOgjY++lKqNjYbWfBCA1qm5d27EoQtPtM6uU0c18B6z5s+H1J7UBjU5v1OeVkr8jT4D27iOLQGdFVZxBUq47l3UPzy43eSfbDcDtQljAGANc8IOzIQd7y8VlWvyEVDh9DQBuRNznPvyfymcDzV1owl56So8IV9z6PEKPJJ4EV4gFjFTICg73pnbAFk0B0nb7eR2/BfC6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com 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=lcAlKHerk5VQh9Nf0GPXXyu2H5vBR4yo7s+VUgObnFs=; b=SIwQg1o+9Lplkbm53VvSvbt7Gy3tmKAFwLFjSbpwe8OUxVeWzPb32hDU1uYHOmbqTFqN7pEqkjBx29DPlKAMFczEGQRQGqZkKdo+yY70jYIXiRbAzkqMhOUpqFDgK/iBLjMKa659NNoz4tL2cfyBBBwKH7fsPpsnJUY45V58DvnrxWmjQEMw3HtHaE2xtqvZx8lTde/lCeugDYzNbDPTYNUPiLEnyPgiEpm0W/Kw99RfqZIqmRbRQUEh4kKkHnhXejRh3FYyPDzFWofnaAZrLburFNhSvvu7SstyPNQmLkG3LLjVK3GahdRIz5ZGhwZK+9MfG4aIt7oojMnFekH1Jw== Received: from SA1P222CA0010.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::12) by DS0PR12MB7557.namprd12.prod.outlook.com (2603:10b6:8:130::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Tue, 20 Jun 2023 01:17:32 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10b6:806:22c:cafe::d8) by SA1P222CA0010.outlook.office365.com (2603:10b6:806:22c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.44 via Frontend Transport; Tue, 20 Jun 2023 01:17:29 +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 SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:31 +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; Mon, 19 Jun 2023 18:17:24 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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; Mon, 19 Jun 2023 18:17:24 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:24 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 10/11] selftests/mm: move uffd* routines from vm_util.c to uffd-common.c Date: Mon, 19 Jun 2023 18:17:18 -0700 Message-ID: <20230620011719.155379-12-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|DS0PR12MB7557:EE_ X-MS-Office365-Filtering-Correlation-Id: 8675e8b7-af85-4e64-2a4f-08db712c1f1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u0fOJC2zkjlIrgLWUOj/cZmm7Lw5yAFDhm6S44yFUMK7ORxQK8nMD0VfL2JL3sVo6FPjUv97RaH4efHwmxn+ifmlfLg7zWRU5MKx7zudVhlcroO95cMLl4xe8d80RDXvLhtayKkd985JZtE1KtmtPPT7dEFg30eeZi7ggPw0DLmQRlorK32NQJetqqXXkI0+bj/VjYEBio7VkCpmNZROAooE+5EU9y3TdI4ARvfZL16s4/Rzzaedav6KVvYHhpfrv0fxVjyJM3HTRTXaaISxYV0jhf13HBn1ntC839AgLuhgwE7OhFJKmEI49JJsDdIe/8FEqPoQU4gHLX0HM9gYixAZOvbZ5uBgVpvobwQeyRSvjEOxZOuw3GXpHMkcYAMConehzXLcZ0M+fHYQto2s902S1MSumWxQcpxdhD0bC4c5gyQTyqSKuUcYG7ZbUkgkP42k+8Mw+GkLv/IJf8hWE/mcY6NT5dPHsf1O5l86Bs4B49fO9FTRKDOA/zPFL5o+efE1/3ls/dwmK5yJLl0NzV4aB81lYwEjgfEBwF1uGtWE3r3jrQhEoDHV553NecTuKc4zpycJ409/gF3qsyzWBEBYvqVkz+uoOzQaLBlQfR9aZEN6j7MgtrYiAMjPr3RHmP3RHiphEvOprHT8mF8upHcVjljIsDm3lRzRFwaO6D0RmrEFClTawKE4klsWua3iZ/9vsktWfsmli0Rrd1Gn4irlEj+anrsdY/vKTES8qjM= 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)(136003)(376002)(346002)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(356005)(336012)(426003)(2616005)(86362001)(83380400001)(2906002)(47076005)(7636003)(36860700001)(5660300002)(82740400003)(4326008)(40460700003)(54906003)(110136005)(82310400005)(70586007)(186003)(70206006)(8676002)(8936002)(478600001)(36756003)(41300700001)(40480700001)(1076003)(26005)(7696005)(6666004)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:31.6180 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8675e8b7-af85-4e64-2a4f-08db712c1f1b 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: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7557 X-Rspamd-Queue-Id: B0559160009 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: shhhy89smqy949dc375cr3thzoa86au3 X-HE-Tag: 1687223854-637983 X-HE-Meta: U2FsdGVkX18isHPiV+OZvlfedzBBLROnv7LwY7nZhZjNGOpW4tAaz8x7jWsfyZ4XEJL1gNEIauWM0vhqz575IrDc8qozrbgDgZ9PvOPyhA3qPCbRfYZDjYlq69wlWERzF2DQHKBhfKZd55lWdZ9/Iezbrlx3Ou7nuIqWyt/9tmyESrkF9t7xlnKKSfnsqGogPYSS/C8A4PgzQNw6KQgDATUBcDyprMakGp2/kWKUMKVuDlSPtB9E8A78A+pPkqTmJ35srwEnDLAHbX7bO5wszDIZ1F8PwHhgnKoY5xYhUrjeUA+qq0YxMs13mF3yldFxFUgJNyO6FNjMNCs7W2SJ4GUBeYZ977+JxdNuxbFz7xd4KVjgAKaY2OKpANtD6vyLXoDH9DOaSo3KIGKQUPg3iiPinObRn46Ob02/H1NCulYBJgyX699hn2rYlkSwQiFiz/XUw9kOffIzIQ2bQba6vSIxivRcJ212Fw12DfekD2hG1uzDCVXOJYlPt9CMbTKBVFVwdmSOagiuF8MPh/PeYkLmjeJemlgn1Fi2/XEkI2MB+/vlz/+OgjB7fUfk2K/mfAgWiE0gk5sSaYRLnjTgz5NO7kLoQRWrz0lTi/0jKg66zVB8qVn4fs/fcQKFJnswKNDVf6KrUodCN73nA0QexnXjPrsjbv9RU89/FWP06pzfaNyzo50Q6O/NhQnYkUW/dwf5n8tz5kDtD+gVQewaPHkxrOwFmKLIaRIJkqyOeo0OwByiuXicawigy5TYHDNAdyo8s0BreDc6AYs4Q3FFrY9BdLHWt0dyndiTs11BBlgIAgL7D4U7uyd2rlvQnflR43zlCdZyrEeA3QkwvE5bZxYrFzjxkkAIT2hRcbSc7c8HLofmk/ncmxUFU0ocTVW41BhGN3zRVr4lnSZCT37ZDaCCIUfGtl4duPmBZiv9A2EJTkkbVOx7ma3kO1hjJTqPJkhI90tZma2Rj/aAaIY kkliSVNG Yst5LNCZuq8ccn+QKVho3ekHM82INAyqcyos3bsSTaAUa8+y325iJC8e30vrhoTt6uum0nK/kIfXdBh0QfspJ2r8tD4Uq6udjwJDKxgkJMDMYdkET0H/qJuGS+QZPH9uJnrtJ9ZZr5uDRWbr8znkexw8DQ5bt8FLgetof98h6p6wsGobp6sIvt83WGm5k++OVI4NSRqEvzLY/NVzeqYbeg5KA7CWlBFYlvrGTaT1vLK5U4Ra5PjtuhrZjKX3iEOD5ZQxzAwEIzWCdOYcjkFBoryyg/0QnEm88Pzcpc3nsGwtG7F3q1/RbW7O3Iw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Move the uffd*() routines to their natural home. Note that ksm_functional_tests.c also depend, intentionally (due to a recent commit [1]), upon uffd-common.[ch]. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/Makefile | 7 +- tools/testing/selftests/mm/hugepage-mremap.c | 2 +- .../selftests/mm/ksm_functional_tests.c | 2 +- tools/testing/selftests/mm/uffd-common.c | 105 ++++++++++++++++++ tools/testing/selftests/mm/uffd-common.h | 12 +- tools/testing/selftests/mm/vm_util.c | 104 ----------------- tools/testing/selftests/mm/vm_util.h | 10 -- 7 files changed, 122 insertions(+), 120 deletions(-) diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 23af4633f0f4..a15572758954 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -109,8 +109,11 @@ include ../lib.mk $(TEST_GEN_PROGS): vm_util.c -$(OUTPUT)/uffd-stress: uffd-common.c -$(OUTPUT)/uffd-unit-tests: uffd-common.c +$(OUTPUT)/uffd-stress: uffd-common.c +$(OUTPUT)/uffd-unit-tests: uffd-common.c +$(OUTPUT)/hugepage-mremap: uffd-common.c +$(OUTPUT)/write_to_hugetlbfs: uffd-common.c +$(OUTPUT)/ksm_functional_tests: uffd-common.c ifeq ($(MACHINE),x86_64) BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32)) diff --git a/tools/testing/selftests/mm/hugepage-mremap.c b/tools/testing/selftests/mm/hugepage-mremap.c index cabd0084f57b..8158fe909f5e 100644 --- a/tools/testing/selftests/mm/hugepage-mremap.c +++ b/tools/testing/selftests/mm/hugepage-mremap.c @@ -24,7 +24,7 @@ #include #include #include -#include "vm_util.h" +#include "uffd-common.h" #define DEFAULT_LENGTH_MB 10UL #define MB_TO_BYTES(x) (x * 1024 * 1024) diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c index 26853badae70..648188ad73fa 100644 --- a/tools/testing/selftests/mm/ksm_functional_tests.c +++ b/tools/testing/selftests/mm/ksm_functional_tests.c @@ -22,7 +22,7 @@ #include #include "../kselftest.h" -#include "vm_util.h" +#include "uffd-common.h" #define KiB 1024u #define MiB (1024 * KiB) diff --git a/tools/testing/selftests/mm/uffd-common.c b/tools/testing/selftests/mm/uffd-common.c index 61c6250adf93..e1ad63668a05 100644 --- a/tools/testing/selftests/mm/uffd-common.c +++ b/tools/testing/selftests/mm/uffd-common.c @@ -6,6 +6,7 @@ */ #include "uffd-common.h" +#include "vm_util.h" #define BASE_PMD_ADDR ((void *)(1UL << 30)) @@ -616,3 +617,107 @@ int copy_page(int ufd, unsigned long offset, bool wp) { return __copy_page(ufd, offset, false, wp); } + +/* If `ioctls' non-NULL, the allowed ioctls will be returned into the var */ +int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, + bool miss, bool wp, bool minor, uint64_t *ioctls) +{ + struct uffdio_register uffdio_register = { 0 }; + uint64_t mode = 0; + int ret = 0; + + if (miss) + mode |= UFFDIO_REGISTER_MODE_MISSING; + if (wp) + mode |= UFFDIO_REGISTER_MODE_WP; + if (minor) + mode |= UFFDIO_REGISTER_MODE_MINOR; + + uffdio_register.range.start = (unsigned long)addr; + uffdio_register.range.len = len; + uffdio_register.mode = mode; + + if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1) + ret = -errno; + else if (ioctls) + *ioctls = uffdio_register.ioctls; + + return ret; +} + +int uffd_register(int uffd, void *addr, uint64_t len, + bool miss, bool wp, bool minor) +{ + return uffd_register_with_ioctls(uffd, addr, len, + miss, wp, minor, NULL); +} + +int uffd_unregister(int uffd, void *addr, uint64_t len) +{ + struct uffdio_range range = { .start = (uintptr_t)addr, .len = len }; + int ret = 0; + + if (ioctl(uffd, UFFDIO_UNREGISTER, &range) == -1) + ret = -errno; + + 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/uffd-common.h b/tools/testing/selftests/mm/uffd-common.h index 6068f2346b86..a1cdb78c0762 100644 --- a/tools/testing/selftests/mm/uffd-common.h +++ b/tools/testing/selftests/mm/uffd-common.h @@ -19,8 +19,6 @@ #include #include #include -#include -#include #include #include #include @@ -110,6 +108,16 @@ 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_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); + #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 01296c17df02..c64a0134f83c 100644 --- a/tools/testing/selftests/mm/vm_util.c +++ b/tools/testing/selftests/mm/vm_util.c @@ -198,110 +198,6 @@ unsigned long default_huge_page_size(void) return hps; } -/* If `ioctls' non-NULL, the allowed ioctls will be returned into the var */ -int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, - bool miss, bool wp, bool minor, uint64_t *ioctls) -{ - struct uffdio_register uffdio_register = { 0 }; - uint64_t mode = 0; - int ret = 0; - - if (miss) - mode |= UFFDIO_REGISTER_MODE_MISSING; - if (wp) - mode |= UFFDIO_REGISTER_MODE_WP; - if (minor) - mode |= UFFDIO_REGISTER_MODE_MINOR; - - uffdio_register.range.start = (unsigned long)addr; - uffdio_register.range.len = len; - uffdio_register.mode = mode; - - if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1) - ret = -errno; - else if (ioctls) - *ioctls = uffdio_register.ioctls; - - return ret; -} - -int uffd_register(int uffd, void *addr, uint64_t len, - bool miss, bool wp, bool minor) -{ - return uffd_register_with_ioctls(uffd, addr, len, - miss, wp, minor, NULL); -} - -int uffd_unregister(int uffd, void *addr, uint64_t len) -{ - struct uffdio_range range = { .start = (uintptr_t)addr, .len = len }; - int ret = 0; - - if (ioctl(uffd, UFFDIO_UNREGISTER, &range) == -1) - ret = -errno; - - 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; -} - unsigned int psize(void) { if (!__page_size) diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 8aa543a3678b..f04f82771cd0 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -33,16 +33,6 @@ bool check_huge_shmem(void *addr, int nr_hpages, uint64_t hpage_size); int64_t allocate_transhuge(void *ptr, int pagemap_fd); 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); - /* * On ppc64 this will only work with radix 2M hugepage size */