From patchwork Sat Jun 3 02:15:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266010 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B7B4C77B7A for ; Sat, 3 Jun 2023 02:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237191AbjFCCQs (ORCPT ); Fri, 2 Jun 2023 22:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237078AbjFCCQY (ORCPT ); Fri, 2 Jun 2023 22:16:24 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2053.outbound.protection.outlook.com [40.107.244.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68C9DE4D; Fri, 2 Jun 2023 19:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ODv0xcaYn5mX2+HkG42Df6fSo8OOPTubad2Cnj5pDZabQH72geVKJhvvXjnnl6d6sOLvPQWmINRgOtepltqLQkI6u+fpLXRba1dbOF1dZN7j1wkbOTlUPLUfT2qdDfF2ZZPjtePI3CyQbbdUUByBvVVDNQNf7ZJbYm6cVl5o9FH7K5rh5X8EfKAuOWuF6op7l4dVW1uXCGz0Qitmtej2+ku24KEVU524HlwpIknoBAuNSUSVMSTsNMkyORXMdKM7jmiPFQkk2F89kdFady8CEUrbmF0JqWA7pnMNes/bgXY4OMHzAB8t5ymi32HkLkLmIvl2K/23ij4hK8JbH9NObA== 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=Zn9G016FmRzYerGneMBU/aHo4lRLQ+I0odlfY53xNE7qgAaCrSwi4fkRLypNRnzFCeoB+lPGiw/R3Kf4WDPzq2IHcQAUdvehMCLLRR9SGZe3V29Rpgq9SyhmQcgQ706B83mWRds5Ew8L7DiAH1cAld3UwY5v4HN9RyjF3aYpdhujEuTRxaBgmDJHUaX6stTPt9WGO2mdn09hTN8Bpe01FIqqjYv1tSVonPBLFhc47uWL/M0fHRUN6dp5sKq6FPJEakXR2PuwXkfLlrk+Pffyuyj0Vv/ol5txLiKtOMZ48F6mq/z5hrE25b4lUcOBYJnXtKh4i/c5AEWBXuhNdYSRRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iP9o5A+zo7bJweh4Rc7yXQPSG4GKmkDno5NX83EjreQ=; b=BvaiXKgg1abiN0CbWMN5v1pxgd0ZC8oiQsbOv0kqz+iKm0nNT10dZLiGLnDktE0VWdU47LJY32X8C45E/L9b7vub9a8UzgNirxfAEeqAuz3IAcW5bgfIslHn9mIuA1pR8DPrPJvjoS6acuyDx5vHFvnVjzx2oic5HJxSadExNNlqrjYAyG/G58PWFGi1GvdqdXUwNFrilelMFkJaZxIw+K04L0FoAa6wdUmhUUuOGa3WJqcvhx5ydqhBfYMrlyI+PkOimn/sGnWLsCyHzOwobQygI2TO33DoDObixEQ5yq67jn5Qc6/2bs2+A2T0/jn0rAaaHm5GdGKphar+1ekWzw== Received: from BN0PR07CA0013.namprd07.prod.outlook.com (2603:10b6:408:141::19) by DM4PR12MB6109.namprd12.prod.outlook.com (2603:10b6:8:ae::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.25; Sat, 3 Jun 2023 02:16:19 +0000 Received: from BN8NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::a8) by BN0PR07CA0013.outlook.office365.com (2603:10b6:408:141::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.26 via Frontend Transport; Sat, 3 Jun 2023 02:16:19 +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 BN8NAM11FT044.mail.protection.outlook.com (10.13.177.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:19 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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; Fri, 2 Jun 2023 19:16:06 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 2 Jun 2023 19:16:06 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:05 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v2 01/11] selftests/mm: fix uffd-stress unused function warning Date: Fri, 2 Jun 2023 19:15:48 -0700 Message-ID: <20230603021558.95299-2-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT044:EE_|DM4PR12MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fb603c1-dde0-4f64-f8d7-08db63d88506 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B3ycATQ5S/ugBAf+Rk1FYIxFC4Xi/XjdtE9YKJ0mL1VP4ym+jruxrvnoyU4weVaAKygN2qNOe+HNtSfEGxy8Td5wbg7A3RU+ZWeujztbADa1e8BSYzBZUokhONYmoZ9esrpbm091etcov1z9hcjan8ug5cBUFUQasbEyjlvpArZxaDt2WHZrDnae3n7j6kzrv3pSDzWfTYjBSUAkS0wE5pMKiBqvX4vgLsD+2l4kNAbvkeP4gRmQLTphWGKfBRQp3/lS3Vlfrx+bdgne7V3qyMkmjpvxgy4yomMcVCJtBY8rytfyPENzZ2f4/DnGr6wgivomycT+qmDi9vRP6gcGaU1TdthxvezKp05nr4B0CZ4WbROoYryuX8i3ThC/OtxdfAhOsTGWnHe53A3FUCKNvD/hv7kxzOKE8Xc6Do75aDjAbsq4YEQBAIBX2yUAlMWsiUFxtGGzaVjbjb0QN84RpF4b3xLf9cHRahgq8two6wmoOMsCVjvUhS0JLaZokWw9zzTs0J7kqWSj9ohXXQ6j0UpciFGAc9awcXvyRuHY1tvgOtJAZn8WA9cQY4AC4i+6dSfZwPgC3r6xe9TT3qKfWPPQSau8QK68cKDRgZmoCm7rklEIm6JNALsC2Jkj/1tSx/eG+XU7sv4aihm0jjSRw9+pdv5I8I3c/N9ivQwN2Sb5+VNKTwADH24oTNprKCVClba0gVjuf9nCudg3ufjLm0ybVJt4XCrW9riyp+v1aWifw/86g1kvHDEc430AffOw 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)(346002)(39860400002)(396003)(136003)(451199021)(36840700001)(46966006)(40470700004)(186003)(86362001)(54906003)(40460700003)(36756003)(40480700001)(478600001)(82310400005)(6666004)(107886003)(8676002)(7696005)(1076003)(26005)(41300700001)(8936002)(83380400001)(316002)(426003)(336012)(2906002)(4744005)(36860700001)(5660300002)(47076005)(70206006)(356005)(7636003)(70586007)(6916009)(4326008)(2616005)(82740400003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:19.6938 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fb603c1-dde0-4f64-f8d7-08db63d88506 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: BN8NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6109 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org uffd_minor_feature() was unused. Remove it in order to fix the associated clang build warning. Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/uffd-stress.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index f1ad9eef1c3a..995ff13e74c7 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -88,16 +88,6 @@ static void uffd_stats_reset(struct uffd_args *args, unsigned long n_cpus) } } -static inline uint64_t uffd_minor_feature(void) -{ - if (test_type == TEST_HUGETLB && map_shared) - return UFFD_FEATURE_MINOR_HUGETLBFS; - else if (test_type == TEST_SHMEM) - return UFFD_FEATURE_MINOR_SHMEM; - else - return 0; -} - static void *locking_thread(void *arg) { unsigned long cpu = (unsigned long) arg; From patchwork Sat Jun 3 02:15:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB8D0C77B7A for ; Sat, 3 Jun 2023 02:16:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236643AbjFCCQR (ORCPT ); Fri, 2 Jun 2023 22:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235768AbjFCCQQ (ORCPT ); Fri, 2 Jun 2023 22:16:16 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2052.outbound.protection.outlook.com [40.107.92.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB746E50; Fri, 2 Jun 2023 19:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yr/dHVBDkg4fEY1auOksrxB+HY23ZzoVV1Miv4gF5rlXi8NV4oK/lBam/8TGoOQ1LmJsoduJGzn3ExgPhlzGY5cNJkR/ZtcdHMmxF59ja1RPukwjWACcKw7XgiKSk4DRDOiRES6bi5sSfwPDudZ9YeQ69GFKr2fFA/QaOkyh6Ww5D2NCh9b5t0hpLridKCK+Rk3Hxj5hHhvwjm3mPZTQwgggp1frwU/yqHFKk3S6JlU/QI/3wvB4DVGQL4WrySZ5jySE2y0T8UrZHuz2ELW/BUHfXLsxrBmQeoewbu8i9HalIL6TX6hDz6g50DuMJ8HLUQPo6iyE3Hj1OvQn1Ourmg== 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=Hb36wA6dRAyiq9W3Ltlvz3CuPxTSfPrwxniPW73RhQfOuR0JcfHZsyh38RS9+AnzT0/mXY/q/JC0LJvh3PKrBSpuud7O5PeIO8tsZRkH1vt4F2JaoDR2U8JfglevVWzO04E7oWmBDArf/ULKVD5XOE2pGDW9GuRejq4kWSr0+G8gfZXDfO2O9aadCePQD71zHG7JXMzU6kbXsOos6CuNO/NVNIuRE3hL/1EFkAJ7KTNaGXeP5Cd9BTkp7A9J9dJo9u2LKxE6BOolQIYO4eKItT6UXqOJJYmReHXxCaAy/lNpepziyzpY4Tj1O+Dif8eCV0/1kvE+rTVsDqiQbT9kog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lQZhGUwkoU04C3ryaMpvsp8ELkjH/HHSIJHZlngWhEc=; b=JuVr7N7pPUhQfpFKDPfiI3Z+HavWQkb83KpDVu4Zwp1vmgsYmPmynqA8ojwRCk+x9rzadIySfdMokYRED+tBUqy4d22mEdGziV1iX7qoSV5CL19/KOGrZEKRJEh7a30bmcbecSPAgVMR+zceWe4PfJyRlEjf3WtGwWfse4JxPUBixW5Q8cKojqNz/WfEN7zvjpcdfCquFzzfI6WMS0fySNzPx23f5CGSE7SDPnNCsV1PWARkNR0hmIgQKJGpCit3rJPUCPSNZixDMo8IxZegX2zcJ6XARjtFv5q4a9T3AoLI9FUWUOpuU321KyQxkUuW7Lg+FiLarLhTUDRk1pznVw== Received: from DM6PR08CA0036.namprd08.prod.outlook.com (2603:10b6:5:80::49) by BY5PR12MB4148.namprd12.prod.outlook.com (2603:10b6:a03:208::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28; Sat, 3 Jun 2023 02:16:13 +0000 Received: from DM6NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::89) by DM6PR08CA0036.outlook.office365.com (2603:10b6:5:80::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.26 via Frontend Transport; Sat, 3 Jun 2023 02:16:12 +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 DM6NAM11FT018.mail.protection.outlook.com (10.13.172.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:12 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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; Fri, 2 Jun 2023 19:16:06 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 2 Jun 2023 19:16:06 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:06 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v2 02/11] selftests/mm: fix unused variable warnings in hugetlb-madvise.c, migration.c Date: Fri, 2 Jun 2023 19:15:49 -0700 Message-ID: <20230603021558.95299-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT018:EE_|BY5PR12MB4148:EE_ X-MS-Office365-Filtering-Correlation-Id: 91d7e732-6a60-42fc-b98f-08db63d880de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T5DUClvMxV3rKsFAPWZuyCdOYaQ+O7lnv/Oau7TJ1zljJ9uYgrAifuhPWYJXWlC97QAEGr0XqFViyLTuIQP9kVM4f4zcKl9C/04c98yirmfETKFwolsSqZoo14E90fIotOhABcG9fO3hWODzzRT/zGc+++kJ7SqDGRfQPAKz4+SfnE40IHAcotYLtUhNy9wZg+k4ng9BRuKU/6aFz4ORFVCCUYSc1XLJ4V5m29t0lnMflIVsCzCbg1W0r9fF5AvhsWliNrLVttjqL7x82deLDDzQZoNk6A76grUC/MRU5AJ/f2q12Atj5TCc/2Irs8cUIDG77+zvY2WldJRgMF8cYJg7HJC4LuKBKkbbNgbTXQJLaXUUGMSctCxuLOLq2GUMZXgwM78GVUhaxQI+pa50KdoHleUZEuEQcnNSI8AV9MTo2prhIP895VAah7J2yyfY+Lhq4hkrESFXjyLtWgf0E/Y5CMPgM2F5qSvxPSJl+04IqNm4BggV8Zgv6n4UqpQyhI1J3rmYvY0yD95CobBhewx8LNKDw+sNqs7ofn1Va/MW9XeYnadu6WbJjDy3zSHWCvFKHcK0Nt2rXGVy8+29YF/iR61yp0HzKDQsgQ+eJvNcYL8V7IqNaui3xQecvNmwEpTC9n4yfjfsovEDbPrL13YQYlPu6CdRNdSoFCJXGFRIHQ3265V6YtLE1WMEuN1fabDR1/9Ous8ErQZ/OvqMhEiWICctuCNQKNog2Bcm5asWAF8Vjj38dgVRonAlprOP 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)(376002)(39860400002)(396003)(346002)(136003)(451199021)(46966006)(36840700001)(40470700004)(1076003)(26005)(186003)(41300700001)(47076005)(107886003)(83380400001)(36860700001)(7696005)(336012)(426003)(2616005)(40460700003)(54906003)(478600001)(6666004)(4326008)(6916009)(7636003)(70206006)(70586007)(40480700001)(356005)(82740400003)(316002)(82310400005)(8936002)(8676002)(5660300002)(2906002)(86362001)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:12.7660 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91d7e732-6a60-42fc-b98f-08db63d880de 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: DM6NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4148 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Dummy variables are required in order to make these two (similar) routines work, so in both cases, declare the variables as volatile in order to avoid the clang compiler warning. Furthermore, in order to ensure that each test actually does what is intended, add an asm volatile invocation (thanks to David Hildenbrand for the suggestion), with a clarifying comment so that it survives future maintenance. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu --- 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 Sat Jun 3 02:15:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F06B0C7EE2A for ; Sat, 3 Jun 2023 02:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237085AbjFCCQn (ORCPT ); Fri, 2 Jun 2023 22:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237070AbjFCCQY (ORCPT ); Fri, 2 Jun 2023 22:16:24 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2054.outbound.protection.outlook.com [40.107.237.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 813AAE59; Fri, 2 Jun 2023 19:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VV6FLV5pff9hLsDatj2El0T/ow/JqXsTB25pmjR4SDVw8xnOtWrjJBGUonc2uJeH8JzL3iej3nnnXhhzaYrsuRt341/g4OQ4KfmkfPvqWW+k91Hzm6H1cnMLurUvFyTTnirkmbnCpFsewPplPrSEyH2zUznBo2ubKwzgayFlN8WjQarCNTvIglAZSKcktJAQT8aU9O807eGOtKmMmI0//ULS/Bxv5iXm4GAe29G8TRb1msi8+aB+hrOS6rLPgPBjq+i7Kgtirw7JUBZSn9I324CcGiPlt156Pao3cZ2AuvoGaHPxGuI28EWMdMNFNcm7VrfytQ7kRL2yPEWtQVn2FA== 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=NEvx2FmuvNyjKK8QlOc6hFT6Y73UJyC2JHkTqTidcZsyjjOKX15B9x1fRv6tStXvAHwLEy1+XOso9b+vFsuU67UGugjcOesycxTeVoPP/N6lr+4P8WTORv8OidgieDaUu+jrKgVrtIEx8d7NdPon09t/hTquMuBpXraLth1kjg9svJ6x/0wu0MJ9RQ9BHj9cB4oSyb6nkpz2jCiNbwTI+AVxP36Y/TMPDoPNCFwL1i7SeOBnYEGI0WEVcn/I7QlS2cy7wPnH17LCLrzm+1I2a+gXSKzhHCiSs6canBFUNBQtGqKU0ZtkmZA1nhw6u0rLGgELHez5hf1t65Yz/9aKDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S08M6qCxf7uj+kvbpIUgDzdHbXyg5xFGSG/3z4Es1Z0=; b=Q8DS1aZQTa4JD4GG+etFFtxHcmglTd3wwD1MWVa88YeAv/CQUW400IYeHNyBHBsfePsjRofqwclYxLZhOPa6LV2DxLKvoD8kY2G240SiIocHurYbf6dlReTF9cnXvg4ldtTTEtmj/RI3q5X+BwpYjzxPXtyrk7rkeNALeVl1hfnWJSmqbrvfh4suSxxqw1EBBjhCYzTZi4+zBLKeI+Q/ogt7OEMCqxPfDRwjRiA/+3F+Zyp8k/ye6vBm4AeZsBDmjiADVMyjX4J6r8QeHcCITGXbFAwt0CL7jO/VyDInBb2HqIZKtc3sQhq10++G3BIXMFwKGSIJw/emOSg3uCgpVA== Received: from BN0PR07CA0002.namprd07.prod.outlook.com (2603:10b6:408:141::17) by MN2PR12MB4487.namprd12.prod.outlook.com (2603:10b6:208:264::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.27; Sat, 3 Jun 2023 02:16:20 +0000 Received: from BN8NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::d3) by BN0PR07CA0002.outlook.office365.com (2603:10b6:408:141::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.26 via Frontend Transport; Sat, 3 Jun 2023 02:16:20 +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 BN8NAM11FT044.mail.protection.outlook.com (10.13.177.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:20 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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; Fri, 2 Jun 2023 19:16:07 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 2 Jun 2023 19:16:06 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:06 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v2 03/11] selftests/mm: fix "warning: expression which evaluates to zero..." in mlock2-tests.c Date: Fri, 2 Jun 2023 19:15:50 -0700 Message-ID: <20230603021558.95299-4-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT044:EE_|MN2PR12MB4487:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a3027a1-f891-4d0e-8ebf-08db63d88580 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AiCJJMDGvbPxsKulWMxttmazFQNskF66+XZ8A8azwvDMb6mf9tUvqRpH31/wsnBGIoIGeKUkKHI4+zVHmlmQ/AvYOxfql+T9wnaJeERmxon1ubM2XdxyiBqDZi0aKnS1JmT32JMRth3i5ec4ygLRPxuKupkHq0QGajJqq0vqDYdIsaLu8qgN9vpc/LmVfyJkLFcboWQrCv6MHLPi21ZpsFNqq74rHm0umI+bEJzXnCNgIsfuf8F/WrE15wQKt/C8B8Teyj66Kz5b2mp3d+aHQ28IUUI/hFbIlEL11Myt4vxe7y/FlrKYT0KT0pv2WEzTGO/HDwcG4BnPgkvXZzpCjjqFZsavqdPl1VHZLML9b+8mvktEXV44Butixsur0ziLyNmr24xzTjKgBg89cLD4EU2qxBqkomawsgFGfWQ3zMwnBEv7bTsSCRD1S0FoyQjMpA/M6AF3mtOWzIIkvymJHpJ0ZeT+zGfB/uXiKD79jKcxJ7gxV/0TwrJJT1BYPtrpzLRG40JhVw2XsVe+/WWZjWIF/3I2lEWquFxm9YKjeCFgpu/XP/UOWt7XdcKhhgQffVLViUHvX3RsYj5uxF7y8TGNwMfa2Ydg/8+3/U7w4AJiD+cmT5y6jiGuSb0ncf3bnKtXVwQD6oZ1eGY1DMdziqkhwbJRwX8WmNwFCUSvfjUOHf3IyP4qxHeTsr4tka8KGPLbTowPaO/IhmoaHejHm0eek3x0HK2BsD5FvggFL23DtfpLVh46xITUaHsgFtyg 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)(376002)(39860400002)(136003)(396003)(451199021)(36840700001)(40470700004)(46966006)(186003)(36860700001)(86362001)(47076005)(6666004)(2906002)(4744005)(316002)(70586007)(7696005)(8676002)(4326008)(6916009)(83380400001)(8936002)(70206006)(7636003)(107886003)(41300700001)(36756003)(356005)(5660300002)(336012)(426003)(478600001)(2616005)(40460700003)(40480700001)(82310400005)(54906003)(82740400003)(1076003)(26005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:20.5063 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a3027a1-f891-4d0e-8ebf-08db63d88580 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: BN8NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4487 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The stop variable is a char*, and the code was assigning a char value to it. This was generating a warning when compiling with clang. However, as both David and Peter pointed out, stop is not even used after the problematic assignment to a char type. So just delete that line entirely. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard Reviewed-by: David Hildenbrand --- 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 Sat Jun 3 02:15:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89CA9C7EE2A for ; Sat, 3 Jun 2023 02:16:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236921AbjFCCQS (ORCPT ); Fri, 2 Jun 2023 22:16:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229802AbjFCCQQ (ORCPT ); Fri, 2 Jun 2023 22:16:16 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2076.outbound.protection.outlook.com [40.107.93.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BDE4E4D; Fri, 2 Jun 2023 19:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UijT4dEha26jLc/VP7RZfgOaYO8EccJbvXrvATFy2MhP7+MliTyms29v5FdhpQftM0az8BwO9x7VpuemvcChFxqoTu/nYsSILTb5QWteIJ1COhuiSjiQAvTlP8inGQtHaJ3tU6l56is06uPL4++uTVNZiRQMZke1hgG/Zxj0OuJAM9nzLc6AKmzP+wNxtrn121LRjbEBkItvGxe8VjBSVCAKMatMDDQsiFLmxmKCvkF0fan9fmMkOhEkK8fqwPg5iJ8HFYAKblu/Slr3Yf2AEIu8mw4PiiZ9kiaNauOfBrt4PjLth49bUGeaNsoPX6XKQ7SYpAyZfPdATHvwRBS9NQ== 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=jYI9yCc5KNutAAMzuMNIhtgZn9Z0uMQhOF7mfqUsyiVcGPQiS8n1NIfSqHDlhZYsXh7cKsme5ifsJ8GgdJjdp+c/DSUA42cmMI+rH38xDqQjYBCPRXUr5kFrLrzCbxT6SMqVlyocdeM/2l2v9zoEGe1vJkv6MOBN3nfMrQlEPvZsQS4jNNoYZcFLZqsG6EC1Rg4VHfGmxLA7yRdAGo4WzJPvw2eJ5/bywzxdkXL9OCOnrfdUsDxKVcbpCnIdvcKAK8cekunFKmDAECWfKhPPYZANn5AmETLWUciApC+sd4hjRbHi81aXNVLBkXlrxPbJ/rsxFPdmNORjQyGILOzzyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cvdHBj5yApv+3mwcH6LWSMXJlHljQnJdtS4CV2ZOt8I=; b=qXJGc/dZ74K9YC/RLWY0ud/u1B0theGdJdf+IZMnGg+XEVZeh2LbPMW44wpkYHnts97eY6pp+2c+6kadXLd40A1flWWhiK7cAJIKjx5+h5SyGY170b9c+fv84gh6Kq73A4EJsh3ZH0MSdTXXT2F/4FrMr9rBNgwVMxG36zdBp4LHVWd2bm42Oo7lLxTLS2mAJBmcHTfCY9DHxvxdhyW6e69vwOwRU9iB/Na5deU7ebOwFGXTWvEr1CsAaJIt+Oppth7KWPyb+3DvY3uwYP5frRDs43sIIcaLMsc9XgS51uoDvUpQfvwcZO2SfGl6mL3hjLA41NgJz9ekBmCu3Ub+GA== Received: from DM6PR08CA0022.namprd08.prod.outlook.com (2603:10b6:5:80::35) by BL1PR12MB5828.namprd12.prod.outlook.com (2603:10b6:208:397::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28; Sat, 3 Jun 2023 02:16:13 +0000 Received: from DM6NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::9d) by DM6PR08CA0022.outlook.office365.com (2603:10b6:5:80::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.26 via Frontend Transport; Sat, 3 Jun 2023 02:16:13 +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 DM6NAM11FT018.mail.protection.outlook.com (10.13.172.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:13 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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; Fri, 2 Jun 2023 19:16:07 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 2 Jun 2023 19:16:07 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:07 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v2 04/11] selftests/mm: fix invocation of tests that are run via shell scripts Date: Fri, 2 Jun 2023 19:15:51 -0700 Message-ID: <20230603021558.95299-5-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT018:EE_|BL1PR12MB5828:EE_ X-MS-Office365-Filtering-Correlation-Id: cae54a2b-1ecb-43c0-b36d-08db63d8813b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YHXVVICQjNzu0XwqQK6e08dj0iBJLsdeYeF/yGV0SqzGQXoIf/6S6qZ8UY+NVSiUS5nqV6Hhwgk8zlbh2kTiGN2EDhQurU+pIcB4rB2KCInnGhcFxC0wMoCKgorDcZPsZwCq+wN3/BiF0sehfku7yNc/wV3nt/6Rx3LlT2JO8qh6G4Pclb3QkbFRXa1+GNPghcmvzmtTdgjzaZ6jbxwuKWt4gr5bIzWbeTBah/vj8dEsqnAHZ70QzyxR3/ManWfqFeFUNpYVw0yFmSMk37ChcnbQ9J1p+6p2ZcTDr4k5N03P2tHH8EvdMf9NGFWpIUWRuvuqJaNMcWI3QIXrQG1S8kiToBct4IssKzoArzDlZox+t30JN8GNqanguRTPYv6+DiFrXgFuN1I+4N7TzcdOBhVGf4rnYR1wuK7SV16W3tsmG//bXF0cd0C6A3u4OoGQrHrz4Jw5PNT/NK9rnTtX6aXJRwHwdgZgziNMZUs1KOi07QBrOT5+he2xKs7BeS17SOHQwVGNYOLBQB7g7OmNUMajZDDeEaihXu/BasjzItQXodbTs64sH5R9WMdaoq1k8NmwkPkeSZhxWzZgHAFhcR+WXPh+Tc2HR+wSPAmnWfjQMfM+Hio8D82Yu6gdtFkeW9yXPbr9Z0bTbCWXAKNhboKyvUtZl8FECt4WJtCeZWFbiLpjymTK9SjCqUjaS6rHxcBl4VMBJzgiFvQTVVqtMibemfLaKxAj+Eu5DGSbGqkIfKh64q2rmNcHtTI7egpu 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)(376002)(136003)(346002)(396003)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(316002)(356005)(2906002)(47076005)(186003)(82740400003)(5660300002)(36860700001)(8936002)(8676002)(426003)(336012)(70586007)(70206006)(6916009)(54906003)(4326008)(83380400001)(7636003)(41300700001)(2616005)(40460700003)(478600001)(86362001)(6666004)(26005)(7696005)(40480700001)(107886003)(1076003)(36756003)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:13.3910 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cae54a2b-1ecb-43c0-b36d-08db63d8813b 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: DM6NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5828 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org We cannot depend upon git to reliably retain the executable bit on shell scripts, or so I was told several years ago while working on this same run_vmtests.sh script. And sure enough, things such as test_hmm.sh are lately failing to run, due to lacking execute permissions. Fix this by explicitly adding "bash" to each of the shell script invocations. Leave fixing the overall approach to another day. Acked-by: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/run_vmtests.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 4893eb60d96d..8f81432e4bac 100644 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -242,18 +242,18 @@ if [ $VADDR64 -ne 0 ]; then if [ "$ARCH" == "$ARCH_ARM64" ]; then echo 6 > /proc/sys/vm/nr_hugepages fi - CATEGORY="hugevm" run_test ./va_high_addr_switch.sh + CATEGORY="hugevm" run_test bash ./va_high_addr_switch.sh if [ "$ARCH" == "$ARCH_ARM64" ]; then echo $prev_nr_hugepages > /proc/sys/vm/nr_hugepages fi fi # VADDR64 # vmalloc stability smoke test -CATEGORY="vmalloc" run_test ./test_vmalloc.sh smoke +CATEGORY="vmalloc" run_test bash ./test_vmalloc.sh smoke CATEGORY="mremap" run_test ./mremap_dontunmap -CATEGORY="hmm" run_test ./test_hmm.sh smoke +CATEGORY="hmm" run_test bash ./test_hmm.sh smoke # MADV_POPULATE_READ and MADV_POPULATE_WRITE tests CATEGORY="madv_populate" run_test ./madv_populate From patchwork Sat Jun 3 02:15:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266011 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC828C7EE2A for ; Sat, 3 Jun 2023 02:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237208AbjFCCQt (ORCPT ); Fri, 2 Jun 2023 22:16:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237128AbjFCCQZ (ORCPT ); Fri, 2 Jun 2023 22:16:25 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2064.outbound.protection.outlook.com [40.107.220.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09048E60; Fri, 2 Jun 2023 19:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h+GUOELodQSFJtgUeZ8N62Kylc5cHUtPDTcvOPUY3EXTizswi+NgN5Fw+v7f8WHpj4H8F2lbrJZizljU9MXUYRPsIg9hxN2oCMoKvCBMxQRfq1ciF065TDNviaA/C+ZlWI9mWHc64FZSLBPwdDClfuEQkPOClgq+1MrerH6CPbPXAUCKNDyrZ7LTahwXyCOucrRdShwq1l7/qqfzc9EczF2aqWWg42KboGyjxXlGjtOJQPYVIY8wKdABK4FA3AjW2QBa/cemhEnTWcXew0LMhuAM4nzA0GFnJOoVvpoozd53gNC05tMpZMpx0NajGgzjqMfNsVhybQv33XVfG1Pd9A== 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=ToV4OSx3QPDe8A2n5xRR83mlRss/zXSB19ewrV89/Lc=; b=FVbVeITpIg3rzhuIDKMmhvcryHEp8UW13hnSHqgLQrLygbXoExVF7F17y5ci8ChuKDmClOBpxmAPUc0xbTq/3ae0daR4RIYMuBcuaPqO2IcNJ9ZX40ZnZfc5tAxvSl4TXQCyx2ZddFcQMW1V4h3FFL9+YKTL+5Hu20TXO3hhQt/B3Z6xK8aaz82HUr5TmJb2ZeNiA9xWs0l/epIWvUGdU+sBwNJkn4SyHi87zlrDPYBC+LGvgfodCgDtxUDj0lxWwZDi6wRfdd8PO0BhZwgdwnMDE8Zx+saU+ajBs2jL8hQwUtCcEgualoMkbcTu2GljOiIl8+xrduIXhXh47pfgOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ToV4OSx3QPDe8A2n5xRR83mlRss/zXSB19ewrV89/Lc=; b=YtNmyWpoZbvA+ObWgnQgIxEcXP8geKJh1KcfYYs67RwkpUOd4gZO0rPjiDX6t3ncwfLay860KiLZL/kzc5aylM8wbIWnHsRwtCCfRiXRFtIkrQx0rm16nVn/hmgVTkGKXlUdz6YBafe+4hFjJaWL2jCruEkKMUhZ2mC0Kj+Q6sHjJzSdDVG8sLh1OveTxzIm1rjf7/2ZSF47LLvup2Y8rrc7lOewedRZXIjGtCSOuLt4lysxwmCTCAGxsvqtR3gK/XFqck3MPEjuB9dFsHH18KOFhps2rb+JxoWXfVKuP9d43orzwY1QeL71QQGbFg3CGrFZukJ2jEtdytUcSrW+og== Received: from BN0PR07CA0022.namprd07.prod.outlook.com (2603:10b6:408:141::14) by DS0PR12MB7656.namprd12.prod.outlook.com (2603:10b6:8:11f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.27; Sat, 3 Jun 2023 02:16:21 +0000 Received: from BN8NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::5c) by BN0PR07CA0022.outlook.office365.com (2603:10b6:408:141::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.26 via Frontend Transport; Sat, 3 Jun 2023 02:16:21 +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 BN8NAM11FT044.mail.protection.outlook.com (10.13.177.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:21 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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; Fri, 2 Jun 2023 19:16:07 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 2 Jun 2023 19:16:07 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:07 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v2 05/11] selftests/mm: .gitignore: add mkdirty, va_high_addr_switch Date: Fri, 2 Jun 2023 19:15:52 -0700 Message-ID: <20230603021558.95299-6-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT044:EE_|DS0PR12MB7656:EE_ X-MS-Office365-Filtering-Correlation-Id: 99103549-f104-4f08-4d98-08db63d885e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XBffJa2/V1BFw1YUkR4xCDIiEXFOD7cbGd++TXxqQhH8zNIvNtZQURJ/FXPv4lMiWG2SKieOkOl8fMtRiV2uEVeZX05olIPT7X1F7NThYEQboZrM04eUQHHzOlmLh/FSnGnR2yq9VPyWZnzvSjVuATBrUCBPbu4Uu1lRPziIQ2OwW13FAkzOIvt5GWgPTtD3/mkPwZjrzOzkicsTsqy2BSMdpHw52IrxFm3gV/qT143H7JlbNCLx8lW9MnZFy07ZhJgdroPwuDBLzqHMs+P8c7u/xnngjMTLezEFLorc+TqAhzWWmEI9HeiotVNKKnVbwdW7yyfEAyUZCRdEv9id0liguuPIaytMVthUHOXWX/zhk6lFot2ZCjmbCr0uoufaa+xegX27dUcnkqp4cMS/kS2Hq+eWPLNCQWAaOP3xzrHbpFbDqQHVJ3oBS70SFlt5SRsIbbPzHy08lPat1lP+g2gUymFIusUVCADHZoJ0F2DwIm9oDY1eDlilorEnBTPmLpgWAtPaiGd5sORgKVL6yV1R1GN1JoE3x/W9cTzzMoruIxZ2lmGVPdBGmEWTLR56j3ZGbRWoy+5JnxLGo8b4umai4euBXPagkpYOIfb2GnVItxDzpJu2aZVPlrXxgt5SA6nDWWiblujgJc6HtruUy6vmVjMlBFaR8CSMDO112VSLs1uZAn2mYg4zsnLP/0qPh7iY6hv/EWGFZzuGH6ATjOJ9xz6PbL01039yn2NNBSrhv5d+t9Z9QQcbZcJVO9EI 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)(396003)(346002)(376002)(39860400002)(451199021)(36840700001)(40470700004)(46966006)(40460700003)(478600001)(54906003)(86362001)(47076005)(36860700001)(107886003)(186003)(26005)(1076003)(426003)(336012)(2616005)(356005)(82740400003)(82310400005)(7636003)(36756003)(6666004)(7696005)(40480700001)(316002)(70586007)(70206006)(6916009)(4326008)(4744005)(2906002)(8936002)(8676002)(41300700001)(5660300002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:21.1468 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99103549-f104-4f08-4d98-08db63d885e2 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: BN8NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7656 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org These new build products were left out of .gitignore, so add them now. Reviewed-by: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard Reviewed-by: Peter Xu --- tools/testing/selftests/mm/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/mm/.gitignore b/tools/testing/selftests/mm/.gitignore index 8917455f4f51..ab215303d8e9 100644 --- a/tools/testing/selftests/mm/.gitignore +++ b/tools/testing/selftests/mm/.gitignore @@ -39,3 +39,5 @@ local_config.h local_config.mk ksm_functional_tests mdwe_test +mkdirty +va_high_addr_switch \ No newline at end of file From patchwork Sat Jun 3 02:15:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266004 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 197FDC7EE2C for ; Sat, 3 Jun 2023 02:16:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236959AbjFCCQT (ORCPT ); Fri, 2 Jun 2023 22:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236573AbjFCCQR (ORCPT ); Fri, 2 Jun 2023 22:16:17 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2075.outbound.protection.outlook.com [40.107.92.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B6CDE51; Fri, 2 Jun 2023 19:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dpS51/F1YLuFu1bnkvawE+aJpHkKh4Map7kb8Ihkhfd+gC613hjINne6Oc45NCXZmjMDovtrOhtgeyyPfDyYSlBYgn/Wi40ffk9Mto5uO58gpr+ULqd+pxEzIMgQzWOA2PHKHwY6bLlBGFwjNtSN86ijlMpeNjTwyICYIxv6vBFk2+vL374EtGmFHMVphkK9tHo4kLQ2qxyPTy7EXu5Ha3k/Ap3vcK6iN22K7CYkXJl/VVvQZRfwtUNxl0FXfN1lvTxDr4TAt/wbxUX7Z0I5CVdqkqbK1+UgC/loukuCmUI0jedxrouyglFxXsTWwsnq3SfJwBB8PcRIwYgKSJi2Mg== 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=OFZ9ODze72b/F0BN+vC+j6zPplgkW/Kce9tZ9wnqsNTyOC0aQNLJMuH3fEDblZJJr04qmn4yKKC2++WdmKVzyra/9EGpEgQDWQ9VYRPkWqESIH3VhaE/zXrrzLavS6H0lgnBzJNUMK7J5A7eyw5hOGOu2fHLAOQ3qXxCayGSkSTX19DBarcO5SrfCuRtbfdjJL6Yr13W//vVX48dB91q/G50CB9P9w8vRM7VoduR2ZrJIYKEKAAyJmTDMZSZdEhlCW3TYyrr6xCjCmzhnqXDV+2AhqVeLTjSFtmVY8Yrh3gv+XexTdd9heUPF73p7/jCJmtIfFhkQ2m8Lplef9xreQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PNITXhlW7/50q8EibhFIrDa2v1XwHbp1VFAUfpMqVhA=; b=KYm8H5ffBg0Bhiu0x6Z4VhT8DN1SIG6e7cFPCbBjkp2ZFbbtLD1SF+3fH4cEJl+d9wguQl3Dd7BbyDhsGoIFu8SxcTIYZ2lx4eYrRsk02dH1YmWrlW7rLto8tGl/5h7U8zWAzZY7apGxd+TeCzN6fzIxCjM4TZcfX6k8sUH+4I9R5wgXn+yPZnpC1a0Fkr5SWo8Rw7AeUyTsEf/zXkaiZDlTJtRmNPEdpU1kdpi7t6iyG7nnk1EfsSn1sCBKzbAMaan6bML9yDujFeNuvcIW8KTTxJICffq+raiAx7xg6A1QJFSpVGqQpD3UeIDtD+oA9xg8KRa+8oRO5TX/cGfElA== Received: from DM6PR08CA0036.namprd08.prod.outlook.com (2603:10b6:5:80::49) by CY8PR12MB8298.namprd12.prod.outlook.com (2603:10b6:930:7c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28; Sat, 3 Jun 2023 02:16:14 +0000 Received: from DM6NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::89) by DM6PR08CA0036.outlook.office365.com (2603:10b6:5:80::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.26 via Frontend Transport; Sat, 3 Jun 2023 02:16:14 +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 DM6NAM11FT018.mail.protection.outlook.com (10.13.172.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:13 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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; Fri, 2 Jun 2023 19:16:08 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 2 Jun 2023 19:16:07 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:07 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v2 06/11] selftests/mm: fix two -Wformat-security warnings in uffd builds Date: Fri, 2 Jun 2023 19:15:53 -0700 Message-ID: <20230603021558.95299-7-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT018:EE_|CY8PR12MB8298:EE_ X-MS-Office365-Filtering-Correlation-Id: b9a1ac45-7e00-4acd-4aff-08db63d88196 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l6GrvjepMgXX4Yp7sGZ8SZ58SCeNQVZ/Uj7hhVXkNSGOh5E9k6pSesgEE+DZ6Vd+qAg8JXIxzGStWRftgR/KUQ8/dBB+GRaVZZ5JO72Sa9mkezQ2Di3l0EVssgyX2/Z7tsNy2JtUvhLMGRH3tQy7jWcnjoAPJz3ffkU4FkMhxNeSRTTg8abM97H1mZEcRgJZU7Wy7cBREehyJgzKyeo+NNMbb6znoMsMHkGXCsfUnKdsa01mUDU2IqfHLKO+k8ds89VCtEgetKcBEeHHwprkA5moEtH4Mj8NG9XQdKrFnx725FrCtkuw5ISAolv2CuiK5wKzngBomsFpLzkM4taoR8hP/YAql+Txk4tq3l3FG23wz9NXReTYWNA4yRne5i1KzxicnKEDv4MGhVfvMJ83oh6sp4nni+fttvqx3M7yX4ALwzK5qvgkPgym46bEbj8SeeMJnWJBJNID0Y9wgJfQljLw3NZ/JqlPdBeq5FkHyNMBTxw2PLC88ve7Eq3UgJtq6CoYO9FLsxpB7+y2lBhr3XQktoMdF30voGq1ANDVToglB7WAgT8U1EwzaVimps00vTjnY8MIyvW+s5mgOPY1FQ0hyZDOZudAACbeEsm3Qh+kmhlNVZJloiNgwxQWBv0nt15YUzvk/98xcNd6KdTa/DWmre5JCR2YVixcgjwo01ytuOacFmIJb/9iTZgGJ9XCR8WvRWmNYJvTyIHDD1/HJ0NpCxF7pVzWr1osMMpG1lY/4ezEYFlmcpX3fVlc0gHl X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199021)(36840700001)(46966006)(40470700004)(316002)(7636003)(356005)(15650500001)(2906002)(47076005)(186003)(82740400003)(5660300002)(36860700001)(336012)(8936002)(426003)(8676002)(54906003)(70206006)(70586007)(4326008)(6916009)(83380400001)(41300700001)(2616005)(86362001)(478600001)(40460700003)(6666004)(26005)(7696005)(40480700001)(107886003)(36756003)(1076003)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:13.9847 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9a1ac45-7e00-4acd-4aff-08db63d88196 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: DM6NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8298 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The uffd tests generate two compile time warnings from clang's -Wformat-security setting. These trigger at the call sites for uffd_test_start() and uffd_test_skip(). 1) Fix the uffd_test_start() issue by removing the intermediate test_name variable (thanks to David Hildenbrand for showing how to do this). 2) Fix the uffd_test_skip() issue by observing that there is no need for a macro and a variable args approach, because all callers of uffd_test_skip() pass in a simple char* string, without any format specifiers. So just change uffd_test_skip() into a regular C function. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu --- 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 Sat Jun 3 02:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266012 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B7B0C77B7A for ; Sat, 3 Jun 2023 02:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237223AbjFCCQw (ORCPT ); Fri, 2 Jun 2023 22:16:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237161AbjFCCQc (ORCPT ); Fri, 2 Jun 2023 22:16:32 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2088.outbound.protection.outlook.com [40.107.244.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E22FE51; Fri, 2 Jun 2023 19:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GctmxXwc1KzrMcPKtC4bFBdF18Tq8Fvx3XIXqfWL7bszbUxHTDMHtOYGQkXWx2K89H2l5xVjWP91GkwZev40myuNktu3q4Ey9KnKWIyoUbR27PU/ChBm8VU3jJAxrvqlyG0vVRRKE1dSiiUO+jTX0xeXqumfuYKsGDKqXDKT8noMlGO225cjMqgB3LWEv2KXf6YHcNv85Kp+xv/q//l61nz2V/tt2uZSQsBJesODBRZ+m99EuYxt7YC8C/6HqpK39QfShlpSdBch1M1G0ztaAAAJryRN2f9yVFFUqAUMqaeGdMHR1D3k6GHsseTfDMw5aran/uwdCljGRcUQMNH5Hw== 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=EG3WIBkfd9R/MpUDztYzE00rJQqPz1NxWMYlsKDptFOzpHaF5tZQhz2nrVJqacsdC0K8jVUhAJ63fWng/tpOi2zruhkuA1LxkgAUghclpkgB3DJbR1eQE8x2yY6Hi2dPa/RjCt+w9p9IwNHDijKOraJUbytX4m0eFTTK3iat6nVJBecMXWd/hI/b/sS2XOZfzOEnphwdEzWyzqX5KurRs25hNcSgYhG+KdNsZwCHH5TTIBLDCSBseghHfugjq97FUTYfplb2qXlDRaCGZFbirg3/M2fTI4Ska89N6EGMYkhGhwnpGWk1H0Jxyr5lZvW+u1wsCJuFZKS16tUlZK3o2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NAgHsicGbXE7/y+61Ec/TG4fp5QK6NCUPay76C4Qy/s=; b=oUKZRpkGyLvMoK3wAqp2OJFWuSZTx5/59zOGYWSRblw9ZQpAo4pc7Pw7KY2zEZUKC9kR/L/Jd0p+TbGt/6U+TnpFCxjaXDbLtGEK4e09EDmDvgmLoxzy2C5cgyBksjUzW69k6eeR+ymKHhqXAIdaKJKindYfGeBOhZj/TilYPL3dUu3vXHlgsegapg4rdcCIRkBRFdM0Auhu3QbQ33j43ULE1iUcjaxVSICzUZGNKZUMv6YVo5hDqQnMS6A+5nfivdNMu68lyzpmx4alwASkIqWyXyDZ+HV+zfKV7AQlTjaeD7PtDAO3BQEZZTDJ54vI6ZUnbmNQ246RFb6BFqaKhg== Received: from BN9PR03CA0604.namprd03.prod.outlook.com (2603:10b6:408:106::9) by SA1PR12MB5669.namprd12.prod.outlook.com (2603:10b6:806:237::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.26; Sat, 3 Jun 2023 02:16:22 +0000 Received: from BN8NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::5c) by BN9PR03CA0604.outlook.office365.com (2603:10b6:408:106::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT051.mail.protection.outlook.com (10.13.177.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:21 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 2 Jun 2023 19:16:08 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Fri, 2 Jun 2023 19:16:08 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:08 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v2 07/11] selftests/mm: fix a "possibly uninitialized" warning in pkey-x86.h Date: Fri, 2 Jun 2023 19:15:54 -0700 Message-ID: <20230603021558.95299-8-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT051:EE_|SA1PR12MB5669:EE_ X-MS-Office365-Filtering-Correlation-Id: 44ca2b62-876b-40f5-5b85-08db63d8862e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S90U94XXVLZ/TLsq4/SAX5i0GfONXKsvYdY1089LwZLkJVp4Is12igWRP36EaUskKwJIM7qVTGE7r+2jsHCWuSv/g3yYIANX+I2HjoJfp2b5mJKH0hWwo5miRz+97/ksJhTInwnEEsiBf/egsS1YF26LUNaHdUt8FSPnJkr+Qb226tfxaxTNFj62OICQ1n7E9u1P8LP65x7xw3jGunm4PkUHls5Ic2bL//VEas59vMhznRsF5cVaiG+xtuwwo1qPX9rpU+K52ABF9ia9jC5aHqQxwlukagWDT/9JAZtlauqBDneebow5Pr6B/xCZ8SiyUuGzKdh1qEPlc1TueIH1Hxg3pzHHeqGWE02vVKEuY9LcWCUq1Ol+++RLlg2v8V7hqF555Q8D9bu91/Uprdrjidf+yEyrzmCOUci1+xxcNTQ9I/e37CVIHLfBGsoqrme4mZ6vqoFVdNhDKbg6rtgNL0TNxremBNq0eNn2OV6qeE0tt/z507soxXjEkNUUPFhRKLBg4PLChvDVg/je3xQFRjPdQ0Exw4k3+lmmkLQ01eT70Go8EY3Ox0l2dCFXGNvDZRkvLPAH2cMUwkVbokK6ewJOOe4Z3cZ3T/Rz7C0EcUGoIp4WwPbjesVZ4Y5iCztFvfa0PtCPgqz8hWl9fTW/IpnC3rU3RW5VdYXKOrvFdMGL7bujsd4y2Vy/JtsCJido4BgZC44k6bmps0802qCPWVTLvp2nLoLbKRLZ+JH3FYdQNQYmTAjdIDLCf/4e1At+ X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(346002)(376002)(396003)(451199021)(36840700001)(40470700004)(46966006)(186003)(478600001)(82310400005)(86362001)(316002)(7696005)(6916009)(70206006)(70586007)(4326008)(41300700001)(36756003)(54906003)(6666004)(40460700003)(107886003)(40480700001)(36860700001)(5660300002)(47076005)(82740400003)(2906002)(26005)(83380400001)(2616005)(4744005)(356005)(7636003)(8936002)(426003)(336012)(8676002)(1076003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:21.6296 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44ca2b62-876b-40f5-5b85-08db63d8862e 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: BN8NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5669 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This fixes a real bug, too, because xstate_size() was assuming that the stack variable xstate_size was initialized to zero. That's not guaranteed nor even especially likely. Reviewed-by: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/pkey-x86.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/pkey-x86.h b/tools/testing/selftests/mm/pkey-x86.h index 72c14cd3ddc7..e32ae8a1cd99 100644 --- a/tools/testing/selftests/mm/pkey-x86.h +++ b/tools/testing/selftests/mm/pkey-x86.h @@ -132,7 +132,7 @@ int pkey_reg_xstate_offset(void) unsigned int ecx; unsigned int edx; int xstate_offset; - int xstate_size; + int xstate_size = 0; unsigned long XSTATE_CPUID = 0xd; int leaf; From patchwork Sat Jun 3 02:15:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266005 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E2E8C7EE2A for ; Sat, 3 Jun 2023 02:16:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229802AbjFCCQX (ORCPT ); Fri, 2 Jun 2023 22:16:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236970AbjFCCQU (ORCPT ); Fri, 2 Jun 2023 22:16:20 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2044.outbound.protection.outlook.com [40.107.96.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA495E4D; Fri, 2 Jun 2023 19:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jgvSi9dSbKVMcY+CgQwG2SKhOukNJgmgwMICDh82nbVonRjZja3P1mg1izMhzxCO2AFxBwNX2zSBtkcXR2lvpUTgxY3NvNWbm8CZMNXNPCeROGwQcpWEO3dIIFd4E9eXoPUjUjQ/vM1fN1voWw1mweRcT6e5DUgOSHW7L1dumc851GZjaXPYlBnHCiEIg7VCZC01s2VdRAA0jf3P5cw2L1E7qGR/+BNYSc4v55Nr/tlXdiNvek+OrA8JVQ8oUeo+h4klMioPW2CmYCyHxBC6E/nUfplnpbyMuCKHtO0bCqF2AXWFuhwdy7nTL0e0aKtqQ46DStqXFuGmgyKw4a22RA== 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=YKhQUjW1ovBgO+ZNgp+ye7ws9uBtrORudLnIQHelZQphhRgGauN5HNrVyscPhGF4Z7BGZ+dG1DCD6yA+ZwXS3RywKY0PnkCDRkT8R3syvqdr9MhX3UXd9scGarEs6E9q/Sw4AOQznF+qt2bJnT5O8TZV5AKkdAvNpsEm8HZD6tP5nsCIayohsDzu7/PD6UZvCKk8AJqzt7D9EL7VpSnHUhigTZIss/eRqKnxbcfQ+k7PsueF802HaekFEOnDuefCRAI7yNmontEke4RCWW9jqRwzSyFo1FBpxKTsUapf189kG7XTYq7Fsdm/Wzw4cZbLWnixFsNL6/NuuVXvcEzJww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r7qWJ0iKcBH5AScsmOvvAEPpASsgJNPE7K/FjHHYXLU=; b=T+kwaTEri7b1E2Fiz+lE/Cx+qu4HUGHgz5z8Ry34UH0YNjx/cg+ayUy846jpQ8iUc0FzqCUwiftnWztDVsSIwK+1UXDD5++4V7m0+aNbTjhLSp7U1dhhkvXAfG8m/IMm3T+nwgKVld9cW3g21hILxefGnkfnIntw1inXTL1HOYbOThiG8wVuaNaxkdjusy14BcYVGOhEEa9dNDm3S1J+VS/+gff6W3l9sZtN4ZMpsFQrMbcLAGnuCNVQNGsOlg7YeSv/i0kRSOc2w+ZysICLQsSBr49kSYg3Xs3acT4OCHhu74xljguL6GNnpjHh1/U3ViBq6yG7u0aXbNbru8eFdg== Received: from DM6PR13CA0008.namprd13.prod.outlook.com (2603:10b6:5:bc::21) by MW4PR12MB7191.namprd12.prod.outlook.com (2603:10b6:303:22d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28; Sat, 3 Jun 2023 02:16:15 +0000 Received: from DM6NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:5:bc:cafe::54) by DM6PR13CA0008.outlook.office365.com (2603:10b6:5:bc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Sat, 3 Jun 2023 02:16:15 +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 DM6NAM11FT048.mail.protection.outlook.com (10.13.173.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24 via Frontend Transport; Sat, 3 Jun 2023 02:16:15 +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; Fri, 2 Jun 2023 19:16:08 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Fri, 2 Jun 2023 19:16:08 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:08 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard , "Muhammad Usama Anjum" Subject: [PATCH v2 08/11] selftests/mm: fix uffd-unit-tests.c build failure due to missing MADV_COLLAPSE Date: Fri, 2 Jun 2023 19:15:55 -0700 Message-ID: <20230603021558.95299-9-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT048:EE_|MW4PR12MB7191:EE_ X-MS-Office365-Filtering-Correlation-Id: 7413a83a-9fe6-4415-5259-08db63d8823d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nr0aRGhqo8cpXsOta8vimurzvq1Cu8pWwPJNbdshFg390LbktTr7mjClIX1+L88vdPvs2x/EQYxnZ/DmMiXOOPZGqwBmSH+dnmhnIw6qKD8DE8lbyZ1Xvg1W5dyDzwDD3h6XN4Sr8MmwHAZA+qQZFUepUCVoQY6TSZCoyyWtXO90jB06BGM7Znb1CzayQZ2hMiuqKUfl/jOVP1fhKELa6154GvqpIku3zOuly//Io/0pgnwn4m8RktJWsJsOguZIkcsYP9AFOFkT0bYhIcy/vp4WUuyVfQvz30CfHwghT5YN2OjbX1jfOcA+PNMJLhKJ3jQgy513ZcEA798hrQNZSnp1+P/BNqxHM0yZirP59bZmW3vLjiGxzI+iIKRe9fqZQ8qiqSssjSAIQpo2WxxBm9sVlWp91DbR39Xem2Ujvzf+XB1yQOOPMQlW7xIXJ9aGh9Hi8ZK+0E+a1oSzik4HQWPVsmCmEy+cR5SW2RWDaqALJ0DmlLLPvdh6z7PH2RnZvbwIVoyEUle7ocH0zCq1sKDdzqbiEBkp0CkX2hkU1lnkpRP0FFbkSO1G2SYdPqBIxfLEBn9xqSpOJpbO7AHJqZfMOcw9utgpcm6bMXPluvI4BFOJcIFGrW3Mac0Ctzrh+k8E/dPXv5IW63lpdNJFi2EWVk/aB8Yc8xggB8aHdFXUCtRDpraLOEcls2bxTlUA7HcwOZtClCxlfA8lx/cFDdbOxYHvM7cWCqYZMl1gvRr2dSLxKop2Ce+/C2MkDn5E 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)(39860400002)(136003)(346002)(376002)(451199021)(36840700001)(40470700004)(46966006)(36860700001)(47076005)(83380400001)(40480700001)(86362001)(40460700003)(82310400005)(82740400003)(356005)(7636003)(478600001)(6666004)(7696005)(54906003)(8676002)(8936002)(5660300002)(70586007)(4326008)(70206006)(6916009)(41300700001)(2906002)(316002)(2616005)(426003)(336012)(26005)(1076003)(36756003)(186003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:15.0793 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7413a83a-9fe6-4415-5259-08db63d8823d 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: DM6NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7191 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org MADV_PAGEOUT, MADV_POPULATE_READ, MADV_COLLAPSE are conditionally defined as necessary. However, that was being done in .c files, and a new build failure came up that would have been automatically avoided had these been in a common header file. So consolidate and move them all to vm_util.h, which fixes the build failure. An alternative approach from Muhammad Usama Anjum was: rely on "make headers" being required, and include asm-generic/mman-common.h. This works in the sense that it builds, but it still generates warnings about duplicate MADV_* symbols, and the goal here is to get a fully clean (no warnings) build here. Reviewed-by: David Hildenbrand Cc: Peter Xu Cc: Muhammad Usama Anjum Signed-off-by: John Hubbard --- tools/testing/selftests/mm/cow.c | 7 ------- tools/testing/selftests/mm/khugepaged.c | 10 ---------- tools/testing/selftests/mm/vm_util.h | 10 ++++++++++ 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index dc9d6fe86028..8882b05ec9c8 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -30,13 +30,6 @@ #include "../kselftest.h" #include "vm_util.h" -#ifndef MADV_PAGEOUT -#define MADV_PAGEOUT 21 -#endif -#ifndef MADV_COLLAPSE -#define MADV_COLLAPSE 25 -#endif - static size_t pagesize; static int pagemap_fd; static size_t thpsize; diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c index 97adc0f34f9c..e88ee039d0eb 100644 --- a/tools/testing/selftests/mm/khugepaged.c +++ b/tools/testing/selftests/mm/khugepaged.c @@ -22,16 +22,6 @@ #include "vm_util.h" -#ifndef MADV_PAGEOUT -#define MADV_PAGEOUT 21 -#endif -#ifndef MADV_POPULATE_READ -#define MADV_POPULATE_READ 22 -#endif -#ifndef MADV_COLLAPSE -#define MADV_COLLAPSE 25 -#endif - #define BASE_ADDR ((void *)(1UL << 30)) static unsigned long hpage_pmd_size; static unsigned long page_size; diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index b950bd16083a..07f39ed2efba 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -63,3 +63,13 @@ int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, #define PAGEMAP_PRESENT(ent) (((ent) & (1ull << 63)) != 0) #define PAGEMAP_PFN(ent) ((ent) & ((1ull << 55) - 1)) + +#ifndef MADV_PAGEOUT +#define MADV_PAGEOUT 21 +#endif +#ifndef MADV_POPULATE_READ +#define MADV_POPULATE_READ 22 +#endif +#ifndef MADV_COLLAPSE +#define MADV_COLLAPSE 25 +#endif From patchwork Sat Jun 3 02:15:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3ADAC7EE2A for ; Sat, 3 Jun 2023 02:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237074AbjFCCQy (ORCPT ); Fri, 2 Jun 2023 22:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237196AbjFCCQs (ORCPT ); Fri, 2 Jun 2023 22:16:48 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2088.outbound.protection.outlook.com [40.107.93.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF9ADE74; Fri, 2 Jun 2023 19:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E0wvmzMX2+2lgTlGV7+gto7RjltVDuDcJ4EUgBPfOqWKHBi349MiK3mAuRAQA0LkcgjMzzMXnhvy8liOr50rBTlrUSYtZgiMz7w8EYS72+fLiZzr48HjXI5A8c64x98QZZm6JewQrriNl1kc3hgYrJvdMqNARjWbHKEyeiCzbYNdbTb24zAW2qgtHEDi0w4+f2zR7CGLCguLO8GBEdpgNu+nUItTOZcEXxe1NVU4o/9BKpZumEpcqBBSYtIWE+KGPUep9S2uaf2oTh+tHwJGFPWx/angdN+YN3zYaFhxJaWnkKsLoZoOMD0LeEKD83wCkvb328zz01fQ77dJPoHOgA== 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=1DWMqFfWmcM0S74ipR90Z5t8Em5oNzomwf7Su2Dj4R4=; b=kNzp/bAEy19hfRkRKK6QPpeiYkzY+cUNeFDmfUWE+62TBp3ZMvsqqlxtJViVReODiuf7JU1NoaBO0aqboxHr2Ui1Duoj97gSMM/19GNuqQX94Vbj3rpSNckd9XpWlJn23ioFQf+xgetrC5L24HRVCqQ5BQnwUt9YAGlsNCQBAYxXsUcZTIQeTuWajrv0Xlc98btnnTTcRr7aM4c82sbeNNCDeZrT65zEybX8iM53k0fWI6BzaQwNWjlOscJoyy+GRAOlP73N9BYo565YLn54NaiDD5/yDs2bNrEC9n6zrUhwGCr3Vcnnsafj1tX/kADqY0QM/qsm2yGeBervdO7Ilw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1DWMqFfWmcM0S74ipR90Z5t8Em5oNzomwf7Su2Dj4R4=; b=UyepBzWfehO7MgNo3y09cOBnplR2kwSIug7lDAlrS0810ErTRvFZJc2690uqVH0t5dYlGuMeO4QfsqhzPs7ji69zfqXG8qOZFs76PqfJTg2FjlKsMNgnErtvfuMqO0VjPRxcd3cfbA/VQTckhazivCPTOxYJ3qXxbyi3SbX/y9WIbtAl3aimDV5iwjRE/eJ57y26pKC1h8R411jUmVDL07m75XwfEDSJQCXQvD3to8/p22vHrxc4oWoi9Y+bP68a3bAHgBmLdkh3RZ7dcBhBJFBWfBVnnchDHOnlcIgcN4kMOcgneSN2aV7peakqhrtTwHE5X3n623pLreRvMBlErg== Received: from BN9PR03CA0603.namprd03.prod.outlook.com (2603:10b6:408:106::8) by PH7PR12MB6764.namprd12.prod.outlook.com (2603:10b6:510:1ae::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.26; Sat, 3 Jun 2023 02:16:23 +0000 Received: from BN8NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::8f) by BN9PR03CA0603.outlook.office365.com (2603:10b6:408:106::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.31 via Frontend Transport; Sat, 3 Jun 2023 02:16:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT051.mail.protection.outlook.com (10.13.177.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:22 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 2 Jun 2023 19:16:09 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Fri, 2 Jun 2023 19:16:08 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:08 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v2 09/11] selftests/mm: move psize(), pshift() into vm_utils.c Date: Fri, 2 Jun 2023 19:15:56 -0700 Message-ID: <20230603021558.95299-10-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT051:EE_|PH7PR12MB6764:EE_ X-MS-Office365-Filtering-Correlation-Id: 407d3725-fac4-4239-cc21-08db63d886ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gMGmq3uSy47cK0QCBP8nvRopexopyt98f8rAjhRSt6kcCMjIJln+Jd124MEdJKEnM7wzPgKenr2OH859KMAqAuRAJ6/HJ2d/D/zc2dL4RwWOqOZTVo9m9DWhJQ89CMcifgjNb21Ei/B1hUffraT2q+6wpbMePAjGQiWDtKoKiwS/mtGW8+mTS4/lZAJm6nCoRaZ/Z7puKdQQdQTULDFu6LZiUdbr8Xa2uWb4gtD65aHOsWj9HA6oVhqIamfQIQpDB81KZbGaFc7RoOrQZqlCl3kiQVTWjNarfvqo8fyEzRgkB/1cz2LL7M2l6nI0ZbzQqTmZ6oHVwrlUT7f9s7RE1h5uEBVAcqceyPcho+J5R/mEywh6sLmhTIAmyTtZlXY8io8pdBWnW4kuYpI+edf7NmC17E7PDFSKfkzluWOzHomLK8CxtPRhLi07525ZwLc7KQdDLNR00jNPZHeLT/YEjwcM/WAUEsXGWSwWXef5D3zJuCO1yUl1IgBAOQMEbbKIU9ruGNsL50q9xsrw9Ks1BsvDutIecehzMtXqR8yZ7rsLzBsc/Hj2ngG2lRRFgLUqIpYf5Lh7+rkSIG/zbbrHyM53A/FnGwfwk+amTvKmCr0vdULof0namXujL6DBkF30x2C3YYPkd62pbgK/G48EVFiqLiUNnML2ywdbB+UbRig7unqumOasib+NqHombP6bwttuZmJa+1ic19pGSzA0+oEc/GfPrUCXFL43RiOE5boQ+QwnZfqNVe4f3tKs7Mvc X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(39860400002)(346002)(136003)(451199021)(40470700004)(46966006)(36840700001)(82310400005)(36860700001)(83380400001)(40480700001)(426003)(336012)(47076005)(7636003)(82740400003)(4326008)(356005)(36756003)(41300700001)(316002)(6666004)(1076003)(7696005)(26005)(6916009)(107886003)(70586007)(70206006)(8936002)(2906002)(40460700003)(5660300002)(8676002)(2616005)(54906003)(478600001)(86362001)(186003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:22.8646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 407d3725-fac4-4239-cc21-08db63d886ea 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: BN8NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6764 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This is in preparation for linking test programs with both vm_utils.c and uffd-common.c. The static inline routines, while normally not a problem, in this case complicate an already fragile header file situation: the header files including other header files leads to compilation failures in a subsequent patch that moves code around. Anyway, there is no particular need for inlining here, so turn these into normal functions, as a workaround to avoid refactoring the header file includes for now. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/vm_util.c | 14 ++++++++++++++ tools/testing/selftests/mm/vm_util.h | 16 ++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c index 9b06a5034808..01296c17df02 100644 --- a/tools/testing/selftests/mm/vm_util.c +++ b/tools/testing/selftests/mm/vm_util.c @@ -301,3 +301,17 @@ int uffd_get_features(uint64_t *features) return 0; } + +unsigned int psize(void) +{ + if (!__page_size) + __page_size = sysconf(_SC_PAGESIZE); + return __page_size; +} + +unsigned int pshift(void) +{ + if (!__page_shift) + __page_shift = (ffsl(psize()) - 1); + return __page_shift; +} diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 07f39ed2efba..8aa543a3678b 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -3,7 +3,6 @@ #include #include #include -#include /* ffsl() */ #include /* _SC_PAGESIZE */ #define BIT_ULL(nr) (1ULL << (nr)) @@ -17,19 +16,8 @@ extern unsigned int __page_size; extern unsigned int __page_shift; -static inline unsigned int psize(void) -{ - if (!__page_size) - __page_size = sysconf(_SC_PAGESIZE); - return __page_size; -} - -static inline unsigned int pshift(void) -{ - if (!__page_shift) - __page_shift = (ffsl(psize()) - 1); - return __page_shift; -} +unsigned int psize(void); +unsigned int pshift(void); uint64_t pagemap_get_entry(int fd, char *start); bool pagemap_is_softdirty(int fd, char *start); From patchwork Sat Jun 3 02:15:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F19F5C7EE2A for ; Sat, 3 Jun 2023 02:16:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235954AbjFCCQ0 (ORCPT ); Fri, 2 Jun 2023 22:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236891AbjFCCQW (ORCPT ); Fri, 2 Jun 2023 22:16:22 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF412E51; Fri, 2 Jun 2023 19:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m9Ear+/SCRaCx+W+EfXa3zK3+7ueA6SEbXdMi8Wi8IxJ633NMeM5x8/VG++bj8XV9RHOud8LTrF0osXqbe7WJlqjOBK/btp1Yv21gV6blMYpR9W+h+JO8KxrcFycHbQRyHJjiBXqBwtYnSS//NYEHRB1aiu5re5KRupcpnEEYKv4AV9matG1CtbNAMOes062XaWfUZBADfBjfJAx6jOzoPFT+RzGN6yfNSFzhxan73HNC/HcVWnq3f0nE36Tzw/mUdwcsPFW8tQofXaJo/AXrIrtpTKivLqbQUBf4Z/UDRks61n1JgTGjYuZA2n6gI1QfY/Jg68S0WmWJdOWZBLy/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lcAlKHerk5VQh9Nf0GPXXyu2H5vBR4yo7s+VUgObnFs=; b=hYcYjI7iDVb46vrq1eDMlu91xrFM2ZYsG07XVurPydy0gMBa/wXDs5T3oBRxBJhmyJ57aVWPbLPkA6FWqLEtRcmMO3lX3bTMEOvXibH0MyMxigBl3tFEDb06uRGktFcTfV+UIxT8svyGb5tdKLAk8Zuv8a/M+LZlzTjj1vtWBsiDJ/NmJ0ankNcnAG74W6UaGtq9VxofBpA76KfXgJlG9OurvE0AlSM1rMeNYaFGY8JXlri0mw1GXq/hmPv8PswbhgxJ8kMbVkqgz2wHNr4fnIEwS51bSlbCGwjn5tLuMDeLczuE8OlVNS0AjZteqhHgz4Cu5QrUa3XftiHBN+ywrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lcAlKHerk5VQh9Nf0GPXXyu2H5vBR4yo7s+VUgObnFs=; b=YDp7oB/QOhbid8330Q6LrtGivQpWHJdS7P56IEXHRRjlZKG5b4cUTHyYTKElgN5/34JwKEEHhu0eKSmchjm+9Yo6TF2iBzHE/InheRe8UXVA7U9SgGqjIhZefvtPw/MiIUEF79tH4iT+9lCQ0JL9X3x8tvmjO2lNhuQplb39c+qPnbIS/Expq6brT8QA//Wq/nH92zDd3Kr6JgZO86OpKfFcfUOfUg0Icj3lvoCk/EVgu4Ehdi+SX0HpP4xFeUrcRzPDpnbqLoqZYwCtPmBjYvnl5GsjvRHZbJUVeM2F454Sugox7O/2Lp7UKysd3+viEiYsDHPGWpTbA6rIOHEUxQ== Received: from DM6PR07CA0101.namprd07.prod.outlook.com (2603:10b6:5:337::34) by MN2PR12MB4111.namprd12.prod.outlook.com (2603:10b6:208:1de::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28; Sat, 3 Jun 2023 02:16:17 +0000 Received: from DM6NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:5:337:cafe::71) by DM6PR07CA0101.outlook.office365.com (2603:10b6:5:337::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.26 via Frontend Transport; Sat, 3 Jun 2023 02:16:17 +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 DM6NAM11FT053.mail.protection.outlook.com (10.13.173.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28 via Frontend Transport; Sat, 3 Jun 2023 02:16:17 +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; Fri, 2 Jun 2023 19:16:09 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Fri, 2 Jun 2023 19:16:09 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:09 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard Subject: [PATCH v2 10/11] selftests/mm: move uffd* routines from vm_util.c to uffd-common.c Date: Fri, 2 Jun 2023 19:15:57 -0700 Message-ID: <20230603021558.95299-11-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT053:EE_|MN2PR12MB4111:EE_ X-MS-Office365-Filtering-Correlation-Id: f3e5c188-8562-4b8c-27fc-08db63d8839e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zRH4Lziu2uTMYsjOoQoDaOxP3aJd7SS784tyb/lUqgHSXf/rpQEiTUeSiAPMNx3oUnrMvPlYR2x0LYwVgqKQh/bLD+mfW6aesDUpyasMF6YbBXJyLEN7gcVFYkXT+4D8MgP8GVc2hjdKwvE+GW3HylY+h+agrObp7diDLIEVj6iQm2WPItKo7ySygFc2e74NUDv+LJ19zhvT92on+srvDXk6IyLTmn0pgHWVnjuqCSUkt0wVF2Luo2RrDNul0S7LPhX5HfRcKwZumKqaIWRfifCreNkGB7FLb5fmG6TT1z39e72WUadmGLmASU63zvleoKU90UeJZfoOezktgNZjqwt4zW/Mazsqr4XOFSu49oAsJzhDgnKDuaoaO9UbCbMRYb+AVA9pdJNGeyHpqjAPrEV6r/p29jz1u5PT1mbJMYPfSMpFAdthsgfNtYbFr5sFQwYPRiT1U2h2uQMCobrIRqqoKps356hEj57amXaRN/b00oeRdardsrgNUsSd3TZ02117Q/oFgsZkchokOG/5ROgJIr3UKt5OfA29Lcds1J4GY5DhStoLOaSBLEgD6sBJsh1KdJto1cVjop12NUF4hNaIgecyhoadwkt5FR2xsb6UFY/QzFuSYuTfGGJQzuld9YOlrbxnN7efKu1B8lycK/2JKEF2fJIoAabGaicNrsBXi3NteodDyfxsVWxj67I+oGEn5pwHv4qXh1x/uvyHSGmp/9LXq74DWoa0Td2s45E= 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)(376002)(346002)(136003)(39860400002)(396003)(451199021)(46966006)(36840700001)(40470700004)(8676002)(8936002)(5660300002)(316002)(41300700001)(2906002)(4326008)(70206006)(70586007)(6916009)(54906003)(6666004)(7696005)(426003)(26005)(1076003)(336012)(186003)(36756003)(107886003)(2616005)(47076005)(83380400001)(36860700001)(7636003)(356005)(478600001)(82310400005)(40460700003)(82740400003)(40480700001)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:17.3760 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3e5c188-8562-4b8c-27fc-08db63d8839e 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: DM6NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4111 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 Acked-by: David Hildenbrand --- 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 */ From patchwork Sat Jun 3 02:15:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13266006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97169C7EE2C for ; Sat, 3 Jun 2023 02:16:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236800AbjFCCQY (ORCPT ); Fri, 2 Jun 2023 22:16:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236979AbjFCCQV (ORCPT ); Fri, 2 Jun 2023 22:16:21 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 641B7E50; Fri, 2 Jun 2023 19:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KUWL+FWzusZCsXa3496iA4IrJcIx1sCKGbwQxMvWawi7ygVrFpM2byfOY9J4rr1FsBMWLCcUM4lQP+a6L/K49804WRjcLgiJuLlMo0jxl4WWLgP99BFuXD85jvwAGgoOzxDLm0h7apFV+phVNSZL5zgYSITnr3SylhxUqEJiNeRLcq9HFBU2K3nrYeYIFIEsgnjqHeON3lE77IKtwrJXEoOJZ1AJWGRd874E6GGxXThHL0pg6pi3Yz96xzyskUkTt3B/MnE8CHRpAY70zxxr/X7XDSzWcYF87UagIJTdEVkweKWkPFHqQUARZLZ++ow5okkVGruHzpjvabfgPPaicw== 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=kCV4OGw85JdREHNb90EA9+G/fEjEeMMfpbm2v13o33o=; b=S39PLRU/pLCimfpFWhiFIS+Pq8WWQt+9UKC+JDoa0uB5EDODX8qOPAIrG6ObvHlhXTqrLBQXodXAIe7AIcbHzQNpdXCtNtrKbJ9sYvTneEbyf15BEubrMb7PfKhNznPGse+nq7R20myPdfMAqcJdxWsmlVloLNqtg7Mz1GWbCwMW90/1u4WkmsnfB9+sv60IdnlMwC30J52TuM5Fi+2sqxMBlBvyj7E2qqWCIr5AT9qJil74rlIHFVFB7OAyD1vX9xY4ZsU9l4SHEnOWntwB39QZb8U94mUBYWg4waIlfJVI4TP3b3JGLPz5yy1wyHIB44JfGAtEg1IDryvMy3kpqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kCV4OGw85JdREHNb90EA9+G/fEjEeMMfpbm2v13o33o=; b=IFD2JA6b4dzfMo//LIseiwBGNQlJhDeGsWjn1hl4QeB0COmEZiOipLpp3Lzu+hwd8Y4oSefwxNNLr309j/mf002gE2UfAt4HI0ojpJkfzYB2osZz2bcBerQZEwnM1JNJi/dvO9aNrPPVexcmlpdfk7P/+vs9LvvX6OqwiQ9488ZIpgJ+kqWoDnbOhHEIwUXlf5jUN8MkJDa7C+DUGMjpo585Obflex+j8FObwO6vQMZ6OR7BpS7M85xwmyEZccVjgPkkjguevMzzjZijKn3iW41gg/DZO4hzR5blIMRYAfMZlV9L8tIXrlJV18Fb2CkZ/ddDAakaPO0xUcSSlYZTwA== Received: from DM6PR13CA0008.namprd13.prod.outlook.com (2603:10b6:5:bc::21) by DM4PR12MB5722.namprd12.prod.outlook.com (2603:10b6:8:5d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.27; Sat, 3 Jun 2023 02:16:18 +0000 Received: from DM6NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:5:bc:cafe::54) by DM6PR13CA0008.outlook.office365.com (2603:10b6:5:bc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Sat, 3 Jun 2023 02:16:18 +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 DM6NAM11FT048.mail.protection.outlook.com (10.13.173.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24 via Frontend Transport; Sat, 3 Jun 2023 02:16:18 +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; Fri, 2 Jun 2023 19:16:10 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Fri, 2 Jun 2023 19:16:09 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Fri, 2 Jun 2023 19:16:09 -0700 From: John Hubbard To: Andrew Morton CC: David Hildenbrand , Peter Xu , "Shuah Khan" , Nathan Chancellor , , , LKML , John Hubbard , "Muhammad Usama Anjum" , Jonathan Corbet , Subject: [PATCH v2 11/11] Documentation: kselftest: "make headers" is a prerequisite Date: Fri, 2 Jun 2023 19:15:58 -0700 Message-ID: <20230603021558.95299-12-jhubbard@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230603021558.95299-1-jhubbard@nvidia.com> References: <20230603021558.95299-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT048:EE_|DM4PR12MB5722:EE_ X-MS-Office365-Filtering-Correlation-Id: 23ca7e7f-de61-4145-f36a-08db63d8840b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MLfwVrGrq1zwE18u6qZn7XDLHadZq2ULwUAhGN3WlJQUP7TCIVVfWwBf+2DH8FazyPKw2IUXCXnXxytQqrONT/tyhRmfyleI3JxF/ObrPaKnnZBU6VUuqakCe2cp8BHGA2mBM4QEfI01aL7EVTacE5HCKOlRemTSuuW226K7PPrpvAw65+Zbx/n8lr9q7ly7wid5aMVMCJ5ZpYQmn6/GDsguSbUY56ekhVTnTE0ZSvbz1qQBLJCv/jZexgsXo+vcuOSz9hWHcaIkkFOj6XljYIijWbpg57oSYxAWBpOm4+IOwX89cXPxPFoDclsx1rUPVlW6gKtSoBHlCM6ijFygXlNbJ2QlsFWiiOs0TtMCp7aBkByWOEfFKVPIDUMannBpYMp1qkf9tD+XfeRMd5/NbTXaDOBPpD4S+bzPkdRuSsAnKTwps8mBSAlCnVTocEq/pem5fPohL08PyvVGNm1N5bjch6QhYeRNWfSE6Xg1FHie8k4cfRfgSuziN6GLXM4I5563zJG6SQWdtSN3vWXArWiH4c4ocvMmuveJ8WnqzfKDxEHqaW5+w4KsWbY+/JV4S0/yCoFmkn/rwFKLjCcwD/wuONATu/XkQPwku/NyeRw7BHVuRtZkWJkR1Pd3WeGInHTSithhn4dw+afQ9zoN+sXjWJvsk4Cx2TwCD4dC8bI2w82FVKoQrV1wXWYjSMLqm+pEjmSLegt5NKgzDnA+DKyglS4b0BYi0jU185jTBshrqAXK8+sFeqHpIBS+RlaFlN+5eKRnKVGjBjQAn+y20BLaUnR6VKN39jFvpuClWng= 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)(346002)(39860400002)(136003)(396003)(376002)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(6666004)(186003)(1076003)(82310400005)(7696005)(82740400003)(83380400001)(2616005)(7636003)(356005)(426003)(26005)(336012)(966005)(36860700001)(47076005)(54906003)(86362001)(478600001)(316002)(36756003)(8676002)(40480700001)(41300700001)(70586007)(4326008)(70206006)(8936002)(6916009)(7416002)(5660300002)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 02:16:18.0956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23ca7e7f-de61-4145-f36a-08db63d8840b 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: DM6NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5722 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org As per a discussion with Muhammad Usama Anjum [1], the following is how one is supposed to build selftests: make headers && make -C tools/testing/selftests/mm However, that's not yet documented anywhere. So add it to Documentation/dev-tools/kselftest.rst . [1] https://lore.kernel.org/all/bf910fa5-0c96-3707-cce4-5bcc656b6274@collabora.com/ Cc: David Hildenbrand Cc: Peter Xu Cc: Muhammad Usama Anjum Cc: Jonathan Corbet Cc: linux-doc@vger.kernel.org Signed-off-by: John Hubbard Reviewed-by: David Hildenbrand --- Documentation/dev-tools/kselftest.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst index 12b575b76b20..6e35d042199c 100644 --- a/Documentation/dev-tools/kselftest.rst +++ b/Documentation/dev-tools/kselftest.rst @@ -36,6 +36,7 @@ Running the selftests (hotplug tests are run in limited mode) To build the tests:: + $ make headers $ make -C tools/testing/selftests To run the tests::