From patchwork Tue Jun 20 01:17:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110224 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352185vqr; Mon, 19 Jun 2023 18:19:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65z8ucfzW6sbWAhpGnkNWbfFoAkCJAhct2JmO1P1mHbH1carBedw8WCLu3JWP+IBoaBYlT X-Received: by 2002:a05:6a20:a122:b0:11c:fd2d:ea75 with SMTP id q34-20020a056a20a12200b0011cfd2dea75mr11053554pzk.14.1687223954486; Mon, 19 Jun 2023 18:19:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223954; cv=pass; d=google.com; s=arc-20160816; b=XNSffs6b7hT4dsFu5uSPUgcwOqw+lkURR/WsTjFQB79HZt85aULWtvCAlqLFm7+ISV YWLRbHMJ6A3ub9JjGQv5UB7J2FRCzZiaESK/1oh0XzK7x7eDkkGYnUdzESuUAmYPSZOd uiE+SjlZ1Ipw6YcRe+ojln2zb0+pssvqPDJAGrACcYa2AgoAevv09q3sYfxKJ6r7GEkI 0dS6HDUKIl7G1gFwZaALKoqr2mB9I3gZHw6ZnFAFGcklO5dBdtOjcFYXKd01Uvs/ks5T 64SxdXwgnoGqGZsvZFIq7WIcTDF9kU8xBPbmW98yv1YU7Xl/n/a7nJD5s3R3CjMxjezz kmCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iP9o5A+zo7bJweh4Rc7yXQPSG4GKmkDno5NX83EjreQ=; b=I057JA1v9sjvBBmo0ZThHAe2vrXFh/Y8ngOhtDaTB1xjJ6jUqEaEuIjemKvAZw33H2 crsX0SKEIiPlcn1x6MDesFTRD+N0VzumaxxKEIAeWIwIGs6yRg6mO55T8Gmn91mdFCy0 j2JwUFzPcaDB+YANOyd4qELriwbf9hQJxQYf9DTV3nrMV/gfXybTeiVY5W+zZj3+kayl FsP7c1r5qg6sbB2BSYr7ZnV+M4GvatsDqE6Qz/s6sOPdcxXDAkyxofqLTUa/4lc6HSHF k/z7w40fUgPBN29HkeghDKjNimD792ZNPBAygAcWTUs5524ysvFmm3vy/ozdSgcSN+UN 3KmQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=tn1RRm8D; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a170902e80700b001a699fc81e8si142371plg.98.2023.06.19.18.19.01; Mon, 19 Jun 2023 18:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=tn1RRm8D; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230099AbjFTBRz (ORCPT + 99 others); Mon, 19 Jun 2023 21:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbjFTBRj (ORCPT ); Mon, 19 Jun 2023 21:17:39 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2071.outbound.protection.outlook.com [40.107.220.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0CDF19A for ; Mon, 19 Jun 2023 18:17:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ye3LYtuT1M1IXmZgTQNVOt8Lj3FQ1IyTTI5aOFVqT5yvpBzJ45alRZIzo+jVRNkq564/J/x86cvGd+d3RxzDD2LENCGaXkhI85Qm8+76Ri3vkvdRW9qsGUm6w+mr9sRC3F6vMGt7hpRTtcaJedoDALDuwprIO2ZOywc+y9zSRIlucCmvuWIm80eqOyaqBA59cn/6W7MNBywwAnV7/3ctqCYCEfaYU5P1zndgNpgna+AMsYBmelTsfpiyyjaRdI+0hdhKkgcZbgmxpwWNaFYgf9J5M5xif/c5czq0aukLfHhgOX8o/9XHi0c4MOk0wFNXDZ0SDrc4CyJTlfUNLq2roA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iP9o5A+zo7bJweh4Rc7yXQPSG4GKmkDno5NX83EjreQ=; b=kInNYkIH2IM8KceOBH5gXw0vTqkn57iyIvADmIGkFhmf3xNje0xpZVVKWspoMLrvGB2/AkhfhVXWld2xoXPU/qLB0o2gt++JtfCQyoc8ah8V2yiuVYKlR7gRnQM4pHQib5cotwy35ZTSmQ2oYDyTPPw0FCrwVm0/RVMDyn1Khl6e+19xpIwbhnDuSFXGr7zQtJs9pPdnasrooEPEHh+i2sMu5ulOoKyALAtx+RNjn5rl5FcPqFRMJVE2QTGRkJpX4lePwoxdD6dBRF6k4TB6MKvc6ouB8NltCyWKV01DqoDjJFUOH08PnMst5siNjtu5WTA4CSIX9VpKCihunRLkMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iP9o5A+zo7bJweh4Rc7yXQPSG4GKmkDno5NX83EjreQ=; b=tn1RRm8DLqjXU9UiTJQcDt3h+2O93Ygo0GojKlWt5cLnqFiEclhj+N48pUNAvjd5FgwHS8bR4scn06vOgAN+sEma039o3MDCUp6yblJWyt+JjfKScoVrYp02w0/NekzyrkyQvxfICejzOSluV+UFXkNpRAITjTl+t0qmMJluWnhEVPBmo0Efq5FWNz9qOD5Q8qPZMLpUqAfgYe8GpVKDVicge+C955lYuIkLN3RcHcADdgTtuuyedeU/act2pLzy+OCbGIrtD2vQWum3Mga8MsCW43l7qYjGx7qgQOHJH6pTsjC2/X5J0SV98kxs2KMSQFva+XSIE8Pec4fDt0lkSA== Received: from SJ0PR13CA0076.namprd13.prod.outlook.com (2603:10b6:a03:2c4::21) by LV2PR12MB5990.namprd12.prod.outlook.com (2603:10b6:408:170::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Tue, 20 Jun 2023 01:17:30 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2c4:cafe::c9) by SJ0PR13CA0076.outlook.office365.com (2603:10b6:a03:2c4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.20 via Frontend Transport; Tue, 20 Jun 2023 01:17:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:29 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:21 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:21 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:21 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 01/11] selftests/mm: fix uffd-stress unused function warning Date: Mon, 19 Jun 2023 18:17:09 -0700 Message-ID: <20230620011719.155379-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT069:EE_|LV2PR12MB5990:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e5db98e-4a20-4a4b-e01d-08db712c1db1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cbrTX2hbqEXVUecY2Sx225TXnfoF7a/S+9KcMbgPWgUprG2wzUd94jaelHG3U+/4+MCifGTBbPaJl5/51WVXzNXphRCoE3BIZOENPWdaKnrT+tnLaIjDZejSAKmHmdMM1ldrGM9ujvjmnNLLny7USwLGrk4dMQTHh7GLxx3HHoUWxaJaiqdD2QpXVCxCzhECrelsjE7kHKhijzlvB5Jx83/jruUzeAghgPdW2TJaOeP6ZLpCvaU/Mw0ziLLTIlZlHIHehNZzu/WW4WQD2iPMZ/nnsgzLNJEIai1iYcMRvTK28Bt1nOAPbKRqXV4O2AQGbP2IhxthzLkJUlCeplYB3SuaufwP3xBJLRykNRu0R9WFiq+sXo45DOXH34UV3KGHKE899sYDuvivQMACwE0UVHghWOQl6MEgxE2YM/e5tH9Jd7N1txcMdqMLzNvIjrRk+NIXdWmEmyv4vAsIlzJClKWroSnH6m0l6IQhNK8q5nYcxVECL9BMPKl/EkygMHgXARDVdLikqHqlNMB1mkB5FnXCp0u4z5TO2I9tmjFD9M6HMwjRaddBB+he8Bm+jzhFSfNd3gx/puqwlx1hvsxgCHClS8O0RWAUkycvtgYMYzvnZJh8GBpfKxN+i+pgYAV/oC12956G6M4Im2kKqofpqSZogB1noX/ce+u8kHL9+NXksE0uaNXlMCkeqzQfbnxghVCeMCa31riDI0fTTM8oA2B/4cbsYp08GIqRtMvNNKIL5Jmf4T/k7nrtrCOOljrC X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(396003)(346002)(376002)(451199021)(36840700001)(46966006)(40470700004)(4744005)(2906002)(36860700001)(40480700001)(8936002)(8676002)(5660300002)(316002)(6666004)(7696005)(41300700001)(36756003)(54906003)(110136005)(82310400005)(4326008)(70206006)(70586007)(40460700003)(478600001)(2616005)(83380400001)(82740400003)(356005)(7636003)(47076005)(336012)(186003)(426003)(1076003)(26005)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:29.2347 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e5db98e-4a20-4a4b-e01d-08db712c1db1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5990 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182545531483245?= X-GMAIL-MSGID: =?utf-8?q?1769182545531483245?= uffd_minor_feature() was unused. Remove it in order to fix the associated clang build warning. Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/uffd-stress.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index f1ad9eef1c3a..995ff13e74c7 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -88,16 +88,6 @@ static void uffd_stats_reset(struct uffd_args *args, unsigned long n_cpus) } } -static inline uint64_t uffd_minor_feature(void) -{ - if (test_type == TEST_HUGETLB && map_shared) - return UFFD_FEATURE_MINOR_HUGETLBFS; - else if (test_type == TEST_SHMEM) - return UFFD_FEATURE_MINOR_SHMEM; - else - return 0; -} - static void *locking_thread(void *arg) { unsigned long cpu = (unsigned long) arg; From patchwork Tue Jun 20 01:17:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352141vqr; Mon, 19 Jun 2023 18:19:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sE/4ze5ET4uRKIjsptnH4c6WhWRaagoTMXI0FAymRdx08Z6yXce8XttKD281g03szC7JE X-Received: by 2002:a9d:7396:0:b0:6b1:8402:47e2 with SMTP id j22-20020a9d7396000000b006b1840247e2mr5609704otk.35.1687223946236; Mon, 19 Jun 2023 18:19:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223946; cv=pass; d=google.com; s=arc-20160816; b=wPCIZ3IXWvSz1EoGh+O22zCYuSjF8pcl5KVnMJy24+PAPfQ5T27+RSsf7/HAQqaEok 2jYmXz9agbz7a/2OJuLms89vVf2bly9cOb2X6CaI95lg7gSWmcON3B8+Z1j6Npbic/uO o5V5/hk1tf49KtN0Th95y8GvwrYF4tJp3KagbZnpl0Y/AAbFCw7YGDUnZMKsAxaTnASI nspwYHEokfZVb0QFsSOJs5HVmNJSWBIm7urS1StZaZBMGNDF7f5lQoqMzi/coPWGM8O1 quztrCcUALbV7R0DyRnBj/PYZ1JFhIAW8bHP4lm5SRsaQQCB/xBppDJMJ011nETfoXmn BsBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lQZhGUwkoU04C3ryaMpvsp8ELkjH/HHSIJHZlngWhEc=; b=wJNKkfyTmlscubwZ/zqDjJVMS1SUql6HxgXaAVVXuysxvsTJcqPH773BqBEB4d6s0D Mn3uv7lFh6S9ToYu4NubUi8lmMb4vK/5lhpY6o320LV7p+6zscOahpDpqJtTo3Pvn2Br lDEVjQJs0Wp725FrdT7ZuM6k7Bz0p4x+GwgVGgzDo/x+ZKH+5VIlXX04cKrG5wTonA9B tFBQdN7KEjBaUCKBRqkBxDJerwyl4BkBXaURNtHjDLBtTbXhnzGnVMucEf8dYcOxoKsO mEmiDuAk2dYzljWEO3hCqBnwU6Emv+WLgUvvObKH/Qw06yWVeWX3sy5pEvq8wuG40nVL HVkg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="DuFfD3/+"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w29-20020a63935d000000b0052cbf501db2si669130pgm.68.2023.06.19.18.18.50; Mon, 19 Jun 2023 18:19:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="DuFfD3/+"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230058AbjFTBRh (ORCPT + 99 others); Mon, 19 Jun 2023 21:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjFTBRb (ORCPT ); Mon, 19 Jun 2023 21:17:31 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20611.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8a::611]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A51419A for ; Mon, 19 Jun 2023 18:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FlvJv67lxOYFQcXQ1l/j1w2GdPy6UMW0Z747ygdko2qaam7M6UmkKmD2bPjUOhpUTVh1Gjb2ehFayqX7RH6ZNAsNr6g3U5kiRgnX4fbQp5JbLoEO53/vJx2JSdC9R78E1Mn6dKUr2HuTXtMNECOrwqX/lQUrjACfhM+7F3M0CDre9SIBJAp/prTdqctyNf5meYHUnfSET7BY5YE5JP9xV38aB1y8+YyQP35XySptwo+oeAqzsxU02SuHSBbNHMwrHmbQbGKi3x9Z07JE9Oj8llwLHczzzjRqeL5Wd9gfyfB6kht8p1X88XPIj2EcZWsvgv/YFi0ocvaiI/437Y6ayQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lQZhGUwkoU04C3ryaMpvsp8ELkjH/HHSIJHZlngWhEc=; b=fif1m3bUE2JzsfkjvuwZPzE/DpcJbA22WWXwovqKtuLSWZfGMFWTlYKwg6QXROyOjL720EuDZick404G5rrD1MDCzh741qRumv+JYXzXXx10BauWleodrIfxfd2fB5+9HmVEZkimXXG6AgpPn8mv4uKvP07VHomvKG+4qOWtNj35qpmJYfCfOa8kAFJ32tuPzYeI05PJIMzwxz7TGApUDzecFnmp3QX6Z6zjYNUkcmD65GwZtR8dLz6qQ0Bs7fl3YfoZuB/DcvNdrcKApNbOTrNXpcUB9B9ZP18DPkTxicr5+6WALs+vIAB3utrg/QeeGf8XvZfMpxjDbHDnJyKAgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lQZhGUwkoU04C3ryaMpvsp8ELkjH/HHSIJHZlngWhEc=; b=DuFfD3/+AK6g1xZB4WJ6v1rZk72ET9aSyc037210l3K4drrCZL2G8ID+qYWzWT7DqfTTf0/lvGYDNHZ1J/XxLYnKarM9FDSFpvWFMPxG/s5lvRBY6qfzal628OHxgUGVydJ2VITPpUbB3x7sSaWElfy7gLfUzSnILHk4in9DGHSr3/KB2R86XsrhBa0cMkqkpiO2r58KyhVPJKvzZIy/lXjwB2sKSM9JFtUcggD7JhwuQg9WhiAhhhZ5DpaRHhbKVWcWLq9i5LIGeiO032GhmCpnU51D5Mh/wYxbDEt4EwDbzqJG9A+rPaw1ysl+SzDSCERQi6iAo2zfVuivVvUExw== Received: from SA1PR02CA0007.namprd02.prod.outlook.com (2603:10b6:806:2cf::18) by MN2PR12MB4288.namprd12.prod.outlook.com (2603:10b6:208:1d2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:27 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:2cf:cafe::ad) by SA1PR02CA0007.outlook.office365.com (2603:10b6:806:2cf::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:27 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:21 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:21 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:21 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 02/11] selftests/mm: fix unused variable warnings in hugetlb-madvise.c, migration.c Date: Mon, 19 Jun 2023 18:17:10 -0700 Message-ID: <20230620011719.155379-4-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|MN2PR12MB4288:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a834292-c643-4a9d-dceb-08db712c1caa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NyohEzqtaKpeQcuMKVUtYdyEL0NrUli5DUZW5KA/QcsRw3PjayjMpfi3Tk85Rzj5i7lsmDIegP2WV4IE6ymUoOh1sto4GqNWq2J8bYv87eysj3PH7rfgVjsv/AqaJmld2VpBXnUgfBIfmBM7I0VB7nxcfGNGGuZcGsM+hW65vVJ5EWCxmwvY7bPnAf9T91VKEldtDUc0/4qlomaF9vAwfyN2RZnPzzGPGZ/zjZcWFtxMPetjam6eaJV+8Qc+gGEbCDUsHBNkXJJsyTvh8e7TyuLJw9wjaoGS2kvJy0aDFSjCKKSaqlf2/E117rBC8dBfNIZSVRMKZWQfRXz8cRWOKkDz63NGY+XJ4bMA/jTWFfE2FyYzx6+4JZ43fKwKa4RkxtaVixL0ypeFcrDlawHxevlQ/GoytqH+1xfJ4BhYMV9B5xtIFvmgHfTQr0Dqk+fmjjdg97Dh61Wc0QBlHjXlRQ0B9PE51uacCUpbvlYVve/aavrSmI5IBoFpwKDMweyLVH2CMr7Z6l36L3QjRfg2p6u0AdBY5fqaigsPR59mk+Mstbg1+K3nnhJkGxNRvb/DLe4a3bJmryYX9ROnvU2j0UKAp8fmBAu/39ETWDgFqHuBbLJJNXA5minUAZ7rIqN0oNJP5ExJDgBJWJAUoH8QYl7JrHGTIN9WRrMWmyUXxjx0nHB1v5RtSkCWVJ9obdvK5cxJrUkJ2aNm5DayYE3afQ3LocMb5Ob4rzTO/e57WhJsQm2jsdeToCAUzmMr1izz X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(346002)(39860400002)(396003)(376002)(451199021)(46966006)(36840700001)(40470700004)(478600001)(336012)(83380400001)(426003)(47076005)(86362001)(6666004)(7696005)(7636003)(356005)(54906003)(70586007)(82740400003)(110136005)(316002)(70206006)(26005)(1076003)(4326008)(186003)(2616005)(8676002)(8936002)(5660300002)(2906002)(40460700003)(41300700001)(40480700001)(36756003)(36860700001)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:27.5266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a834292-c643-4a9d-dceb-08db712c1caa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4288 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182536317979346?= X-GMAIL-MSGID: =?utf-8?q?1769182536317979346?= Dummy variables are required in order to make these two (similar) routines work, so in both cases, declare the variables as volatile in order to avoid the clang compiler warning. Furthermore, in order to ensure that each test actually does what is intended, add an asm volatile invocation (thanks to David Hildenbrand for the suggestion), with a clarifying comment so that it survives future maintenance. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/hugetlb-madvise.c | 8 ++++++-- tools/testing/selftests/mm/migration.c | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/hugetlb-madvise.c b/tools/testing/selftests/mm/hugetlb-madvise.c index 28426e30d9bc..d55322df4b73 100644 --- a/tools/testing/selftests/mm/hugetlb-madvise.c +++ b/tools/testing/selftests/mm/hugetlb-madvise.c @@ -65,11 +65,15 @@ void write_fault_pages(void *addr, unsigned long nr_pages) void read_fault_pages(void *addr, unsigned long nr_pages) { - unsigned long dummy = 0; + volatile unsigned long dummy = 0; unsigned long i; - for (i = 0; i < nr_pages; i++) + for (i = 0; i < nr_pages; i++) { dummy += *((unsigned long *)(addr + (i * huge_page_size))); + + /* Prevent the compiler from optimizing out the entire loop: */ + asm volatile("" : "+r" (dummy)); + } } int main(int argc, char **argv) diff --git a/tools/testing/selftests/mm/migration.c b/tools/testing/selftests/mm/migration.c index 1cec8425e3ca..379581567f27 100644 --- a/tools/testing/selftests/mm/migration.c +++ b/tools/testing/selftests/mm/migration.c @@ -95,12 +95,15 @@ int migrate(uint64_t *ptr, int n1, int n2) void *access_mem(void *ptr) { - uint64_t y = 0; + volatile uint64_t y = 0; volatile uint64_t *x = ptr; while (1) { pthread_testcancel(); y += *x; + + /* Prevent the compiler from optimizing out the writes to y: */ + asm volatile("" : "+r" (y)); } return NULL; From patchwork Tue Jun 20 01:17:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352104vqr; Mon, 19 Jun 2023 18:19:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Okg44i8+qQdRQuv6SdI+lykyl8cUYN1a3TkclUJFOH/PG8NyeUVCPto1tTjn235KSsLNK X-Received: by 2002:a17:903:2306:b0:1b0:7123:6ee8 with SMTP id d6-20020a170903230600b001b071236ee8mr14167323plh.61.1687223939912; Mon, 19 Jun 2023 18:18:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223939; cv=pass; d=google.com; s=arc-20160816; b=ScFKaVtgUANZS8i7EHq5ttTRhZh3PtT7efUhJ/Lko/wkUF39+BydwhjOl/+WGhwxhr f4MDAeK5rZG8IXDoK6vNNRAtdcLBpo+Q8QJ+SjI1wyHI+bWCp8lSP4f1eRrf8+TFATk9 P4s8aSKPPse03tzJBYdSZ6hpPpaiqxGZJLU8oLkuXB/3pd4jjtmlqmnbKsOKkyyOpLKw dZ3N8GOZajQQlr7OvOAlWyqchSPkzsZ8ZA/0WAEROGMd/NCyvOV4vT9+UKug3oG/LK2p F3s17xDJn+a9Qwgu8WfpbuvgRAifxMr/k2dHZMPkqLmVuQDt/9sPKz07wr1M/uG75F2Q dzFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S08M6qCxf7uj+kvbpIUgDzdHbXyg5xFGSG/3z4Es1Z0=; b=nRXqFBi4gPUQtprhuJZxFfwYiKjkoYxlfdL/MwLRCQqqfaqhsYnhIUoVVCZjYQ1+wi W54caPmb7a1Awz1B+Ck6BLBDboeKUo0xKjtqJTQj1fbUpY26M82u+SM03MxFLTsGwJhJ AVjJXxm93etezviBpahjOZFMH3AJF9yMKwp8X5BLct33+XFZQmGa146Sr89FlpFdJD/F A+b8Nhixx0fPGB2gdBe8vLv9owy3i54cLxD5KELvCOg2ixMKgmgeQ1ywCe+EcRIQDgo0 2VJia1hNRhKnx5KdVDTojnnE/Af+2exYo9P9R3WxrRvNSnx9Sb/LiIqETEziJiOuMrB/ 7MBA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=qRrXPykz; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kp13-20020a170903280d00b001aaf91ae3acsi788014plb.485.2023.06.19.18.18.45; Mon, 19 Jun 2023 18:18:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=qRrXPykz; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230013AbjFTBRf (ORCPT + 99 others); Mon, 19 Jun 2023 21:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjFTBRb (ORCPT ); Mon, 19 Jun 2023 21:17:31 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2042.outbound.protection.outlook.com [40.107.101.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46820197 for ; Mon, 19 Jun 2023 18:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gJh/ElfXvtySmgnjlyNkeXRiq9BFzj5R2n1acYXzC38k295aSHHkAjOEVMYMpyhIn1ID5lPUd4+4dzM2qFiFr2p5gFk5QhUWkx0mk90St+3LbvRaAt+hO7njJWns5KHvsdo2hNOJfsabJGrzyrjyPq38g/BdLX/XJMEBcS0duKf3V6yP23kWVKd25a+MBumIg+ghMdy6R/hmDZQhHAOhathvLk3ubP5W4fwbd44Np31qC0rIg4SIfwHA330OfHgmi9QhFfIfdRLDL5u3JkdpyNf4HcJ4HaeuGb0R1yde0Z/+iTl98XdAn/RVz6eMpsL2k7WAgDktHyIxrjfWnJKtDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S08M6qCxf7uj+kvbpIUgDzdHbXyg5xFGSG/3z4Es1Z0=; b=LbzunH2C7NTPTh9MIZ9lAjGBJH+odC6Ym1EcrKHmXfISRJpOaiTVmyY74caDHQHEsTryOuBmCN2wTFCUaa5WgWx6chgG47C4oIVZzM+2f4CF+Ik2DQXyWCYHwiA3SrqNY0SLrYLhPnAkJfsKh6xjU0Bh6DETX7ZdmnJppcXR8fh3ou8HBLdPfAVBbtBJiK7zphukCK0rIV3pMDkvo9L4XPAmiAm7XNj5VqSn82rOsNsVfBydWzLJ8MJ1XcW67AzbpPr8tFalN9X4UUmAiAn4K7vy1SOcJUDP7uuEcJGKgOFI+yP0SdlxfPrCtkeBMA5V/oOE4In5z2uGQ1TKAeK03g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S08M6qCxf7uj+kvbpIUgDzdHbXyg5xFGSG/3z4Es1Z0=; b=qRrXPykzU07YXHBWaouyzmJ2ngdu8d1Oqm/M2PUnQY0LQCm+W5bER51V0K84vvfMQdT/qvz+t/P7JfeKjimE3bmRaH4VF001839ny0XRw9v79JEMG74ypSgO5+MYMp+d154RRWfWUdL2Wd3PCHCaJzyvRsQ1WqFxxo+EN2w3hsnwzHxnKlyPk7rOna+gV/gI+PP5k9raWM5nw4iVctGmyxdGEofK71QIegaD4qCSE86rIVGLy/ZMsGPQoNIB5yJuQ0TgnvLwtzvBW2keiPlK97lW4dN0qCrXfTVPZKuiGL/FOF8qZCGRDHLVQs+Tx2FhoTjzF8WW2iParTmpdRMKpw== Received: from SA1P222CA0010.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::12) by PH0PR12MB5629.namprd12.prod.outlook.com (2603:10b6:510:141::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:28 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10b6:806:22c:cafe::d8) by SA1P222CA0010.outlook.office365.com (2603:10b6:806:22c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.44 via Frontend Transport; Tue, 20 Jun 2023 01:17:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:28 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:22 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:22 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:21 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 03/11] selftests/mm: fix "warning: expression which evaluates to zero..." in mlock2-tests.c Date: Mon, 19 Jun 2023 18:17:11 -0700 Message-ID: <20230620011719.155379-5-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|PH0PR12MB5629:EE_ X-MS-Office365-Filtering-Correlation-Id: 5dc43935-c505-4b20-cc17-08db712c1d15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ao0QKS/BWIR/4K+dSl1hpv/tFm7clkZKgDV72RcTulKklp9YYH5eeVA7to2OnPEywNmrE9UKlRK073iigo0f+yFRJrcP0Np2yx9A2VHB1JDTcBRmS3BQ7Q41GaBAVJcnTZd9dWGY+AhUJZV2mlvfbNKyOpSFNjetEJnmMEkJdcuvTNYjwFIWy/4aA0ZG1b+3CuEOhXYuZvHd0TOV3nAl0+JIHMJ8QKdN3ibGGHyypMeUX+cH7lqxYemvMawXClUbZJaIjnWad/EsE1UrgBuygeUMUtFrcdnWMgWlMnSVcwQVKRiuHBJDdvpYFn6DSZ0HvxaCp2KqLp49wCE8f5wauelXofbG2Y87QBmVtN3f7mK0iugXeVnaSOy/EVRTPV8WvLcU4vJ+cytF3og1O1I+jod0GxYEkzhbGXDg8RF/izcXVbX01kACuI8axMwHFZwVCoY9l23wdDW7OfgQQjQYQLGNj6/bTJutKz5WVFdC9Fvx5XCHAlZ6i7fKeR0F2oXYdx9yVuP3wvG78+qIKxQ3bDcXahaix2Tqt+y8AsXo2E/0lf0Y52NZ/xJFTp4o+cTpTFUfU3VgQL4OmtOaPH+Rpfk82JwML2DuK+Qx+TTQbYkezZ6nBdPMI2/1XPLANaB8rDe5mejUzdTuVqcERR4jG90VF9OfBgKOJJiXCWB6JzjD+AykkzRHGJgNr5jeNBGoud/OP1OmTsodqmbslt+TVMsnipwqKuDdJPfd/PYzXzKUg4J1nJ/6mIopEiqrurm6 X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(346002)(376002)(39860400002)(396003)(451199021)(36840700001)(40470700004)(46966006)(356005)(336012)(426003)(2616005)(86362001)(7636003)(83380400001)(4744005)(47076005)(36860700001)(2906002)(5660300002)(82740400003)(4326008)(40460700003)(54906003)(110136005)(82310400005)(70586007)(186003)(8676002)(70206006)(8936002)(478600001)(36756003)(41300700001)(40480700001)(1076003)(26005)(7696005)(6666004)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:28.2274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5dc43935-c505-4b20-cc17-08db712c1d15 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5629 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182529799314026?= X-GMAIL-MSGID: =?utf-8?q?1769182529799314026?= The stop variable is a char*, and the code was assigning a char value to it. This was generating a warning when compiling with clang. However, as both David and Peter pointed out, stop is not even used after the problematic assignment to a char type. So just delete that line entirely. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/mlock2-tests.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/mm/mlock2-tests.c b/tools/testing/selftests/mm/mlock2-tests.c index 11b2301f3aa3..80cddc0de206 100644 --- a/tools/testing/selftests/mm/mlock2-tests.c +++ b/tools/testing/selftests/mm/mlock2-tests.c @@ -50,7 +50,6 @@ static int get_vm_area(unsigned long addr, struct vm_boundaries *area) printf("cannot parse /proc/self/maps\n"); goto out; } - stop = '\0'; sscanf(line, "%lx", &start); sscanf(end_addr, "%lx", &end); From patchwork Tue Jun 20 01:17:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352177vqr; Mon, 19 Jun 2023 18:19:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Off5X3020skMDwqeSaxA+pVWbTmEBU0x/qK554I8z0jIHL/MT4OkOrKXnDCclmturEDf0 X-Received: by 2002:a05:6a20:7f99:b0:10e:d4fb:b031 with SMTP id d25-20020a056a207f9900b0010ed4fbb031mr7547755pzj.61.1687223953416; Mon, 19 Jun 2023 18:19:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223953; cv=pass; d=google.com; s=arc-20160816; b=FA+72bPex/RTLbEHcUMS8mNtURw4u8CnjZWhn//qxF2lj9XNbDW1mhdZucqugQxJ1O PIIJw5/ipfwAZmFK/E2/65ArOi4gLFTGctmEgONDzXpvzaYHnm5llVaieXErCItDrGnN 6APvHFlR0qLW95XOt6JjqgDqCuU4If11zIgdjD+JThEEl5mlQNLl1floj1nLU1kifcNR 6lSjDQkx3ul+9XmO6DuQQj/L7ufxe51fgBMF+R7gSTQGynVdobZJ37TdKLZ/Ng7xHlqE 3juBiUb0Ga04YonveDHUegdiMFhnqHJvvf37IeahVU4aUQn9mUSFL7KYJ0tFx3jM3Em/ RzEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cvdHBj5yApv+3mwcH6LWSMXJlHljQnJdtS4CV2ZOt8I=; b=bUGg0hpnCWVNwnQ7W2CfSzDRaSgK0pCSfhmnxPbMa1WkecgZq+/Y3noThRK86L7x+v Pcsg0lgxUJIOGv9YDU4j/D01+0yz845bnoplYoOsSZf5E3lt8rmMSUADGvUEOuP/tuJ0 ygjwjeZBeWTSXa4ucTVIwDLJZMpu9FFqLMGJz/X2j6C5DlvCfHknnwpIFzAVppPPv3qb WpSR6CjzKbLufrVaq9YD2PCKIkGUefv/xnmpdp4+KmVBC/gFUXCYwFg/03nnlWQ4lBak +ev43pO9FaLQ0lYGkkECYUnOxhJ1stHQPs0qmPfvPHKd+zFR3/J03WHoh0NFM2PBlM0S Ba0A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=OzQaOX91; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jn9-20020a170903050900b001b3a001a0dbsi760284plb.361.2023.06.19.18.19.01; Mon, 19 Jun 2023 18:19:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=OzQaOX91; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230120AbjFTBRv (ORCPT + 99 others); Mon, 19 Jun 2023 21:17:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbjFTBRi (ORCPT ); Mon, 19 Jun 2023 21:17:38 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7712E1A7 for ; Mon, 19 Jun 2023 18:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N7brwF2IUaVKKtJo6FAdCtwt+LvqPGUovVA+JBf0D2BD8949TcCCaqP7OAdFjIxuTt8LUG/t9izJyt1e+oNDzjmyolGorN9u13bqpvzgzFsGEOjSt02+HL3dN4y+ikPHEKby3Z5rqFDaXRCLnru5qZOJQNSxfX+q72ig8v60+rFY3++6OrUOjzPvHS+neOvlDMnjcLjBsufQOJqFwMv6bzn2oAn/pwpYCW9u3hFCzoAm2ByvSlSMETC4HV235Kg2Ey3f14Jw3n2vdHqEU3ID3oSHTtuLN88jc6cooJVcJT0lgdNJv4dlChapjZZqqJ4f1EEfLdzHvrBVpPdTBx1//A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cvdHBj5yApv+3mwcH6LWSMXJlHljQnJdtS4CV2ZOt8I=; b=LiRJhv9vZWRQUYZb46WArDXYgGvcnKzbkLNPjjE1CGw4/ehNkiYTqeiHnDWLZv7+eNJw0ceq0DOgXUObE53ewJDgSGWCWAgu7qJu12s2vlFyDfikIjr1qZ35qO9OmbSwWM8GtvgHVhP68VjIGKvR34Oyq5KsHwJdumYeUlruwGCTJKqmD13navXeyxQFjOqu2FhDXtvkXJd23+5CApghiZ5hCTx2JmbOsQaFRrCtukX6t4Loqqtn1XwUC9+U9imO0RrkZMffapuAavIry72OYbIOnrx/Of+nrJ6F+EF52NKtYJdv4bH4Qs6iRr2K8SIlbvaQhxwz+KYXNolADIMswQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cvdHBj5yApv+3mwcH6LWSMXJlHljQnJdtS4CV2ZOt8I=; b=OzQaOX91pAZfoRNfnbY4LFAebi5dE+ZKyw7TpQI6clNcyn6K6e4SstfJJyH/YpXvAByiLlh2u8rKh5Nkv9rbsh8ZEEU7EnqqMwMDrSIb0w6GZCSNvOJvrco+a0FXKwITbuJbWkj0MVg9Ty+YCfXErOBdrfjjq7bihAdzjoaNAsSYdRF8CJ4Rlb5RteeQZ1gyKizb87yrLA4QYhBVMLcHXpD4FpLsMRqV8Vvf2BYjxLHNsHETqxNjJR792zokQwXjmSYDmRiuDqBo1EInvx02+D992+q2lboRIwcAOMYcm/UHMIOqAwJgY5fkErUqQ1L8VOd2zMN5qMLykLgLjPw+hA== Received: from SJ0PR13CA0084.namprd13.prod.outlook.com (2603:10b6:a03:2c4::29) by DS7PR12MB5958.namprd12.prod.outlook.com (2603:10b6:8:7d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:31 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2c4:cafe::44) by SJ0PR13CA0084.outlook.office365.com (2603:10b6:a03:2c4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.20 via Frontend Transport; Tue, 20 Jun 2023 01:17:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:31 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:22 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:22 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:22 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 04/11] selftests/mm: fix invocation of tests that are run via shell scripts Date: Mon, 19 Jun 2023 18:17:12 -0700 Message-ID: <20230620011719.155379-6-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT069:EE_|DS7PR12MB5958:EE_ X-MS-Office365-Filtering-Correlation-Id: e0713533-9bc8-4b39-b872-08db712c1ef3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1hdJME0ht5nOVxtfdnwbLMaqXiI7VFqO4QhAZffGyEQcekRntckPeGnYUyp8x9cEC1SacSmuSN4eIs+8Dy9rphZjSRIbP36CIKUcw9Uv5WAFQzuL2pX2LQ3+WrDrZ5xM8LuBDu+oRyN+yQjxhGoE7RZby6DPb+qSWcXmvjZGjpRDsswer2m0wlR4gBACMZUlSiynDS349oVZazOFNhyAKAv9Ss52O9mlSDELx+u+BkA8o+tDmYs6EbprQfIl1AZhHNyLrIH9LGxYIecgB6CWFuNoHe8bHStcXsAq4nQ8ewjVRa8mffHOsPzovFX/Y3y8fSYLWB4CcvTlqCQUdQmx3wcf+oHpLGlcM+qfCpBzycG5uYDwWiAJVfy9aHDgcOPkCNyvTzNHOOCwVbfWUMbOvlINZx5dbCNhi9duKO75JRVZHix/BiqFnXbfvZPaQjrq5rzPQ7noTduewV1REqE7pUsHTiPqiVM8geuQPvYnMYrjQSxU5AyVnPc27w6YHlEWt7VicQYP3PU/s9pNGuzedfhBTWvWCF4YIu3aHQreSs+C3afqOEiZidzUSKRM0IEcQocskNpnVGTBxtL/IG/VAp2iwl3V1x3ii1tmc5Lt5GKu4StETgLPLAt9Fk9t58kJhAmVNOIOWFCFyEq7Bk+vl+G80bRNV/G8SiG8bMErElBe+EyVrxVQ6qKT67nO3OwDNu+Rfox8CfRn113zq/DsoS5D65XEG7+Oua2Rj01xbZEs9QoTYkQizskuyuJbKcXY X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(478600001)(70206006)(70586007)(36756003)(8676002)(41300700001)(4326008)(7636003)(47076005)(356005)(40480700001)(2616005)(426003)(83380400001)(336012)(82310400005)(86362001)(7696005)(5660300002)(2906002)(54906003)(110136005)(316002)(8936002)(40460700003)(1076003)(26005)(186003)(6666004)(82740400003)(36860700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:31.3439 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0713533-9bc8-4b39-b872-08db712c1ef3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5958 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182543955593440?= X-GMAIL-MSGID: =?utf-8?q?1769182543955593440?= We cannot depend upon git to reliably retain the executable bit on shell scripts, or so I was told several years ago while working on this same run_vmtests.sh script. And sure enough, things such as test_hmm.sh are lately failing to run, due to lacking execute permissions. Fix this by explicitly adding "bash" to each of the shell script invocations. Leave fixing the overall approach to another day. Acked-by: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/run_vmtests.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 4893eb60d96d..8f81432e4bac 100644 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -242,18 +242,18 @@ if [ $VADDR64 -ne 0 ]; then if [ "$ARCH" == "$ARCH_ARM64" ]; then echo 6 > /proc/sys/vm/nr_hugepages fi - CATEGORY="hugevm" run_test ./va_high_addr_switch.sh + CATEGORY="hugevm" run_test bash ./va_high_addr_switch.sh if [ "$ARCH" == "$ARCH_ARM64" ]; then echo $prev_nr_hugepages > /proc/sys/vm/nr_hugepages fi fi # VADDR64 # vmalloc stability smoke test -CATEGORY="vmalloc" run_test ./test_vmalloc.sh smoke +CATEGORY="vmalloc" run_test bash ./test_vmalloc.sh smoke CATEGORY="mremap" run_test ./mremap_dontunmap -CATEGORY="hmm" run_test ./test_hmm.sh smoke +CATEGORY="hmm" run_test bash ./test_hmm.sh smoke # MADV_POPULATE_READ and MADV_POPULATE_WRITE tests CATEGORY="madv_populate" run_test ./madv_populate From patchwork Tue Jun 20 01:17:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352152vqr; Mon, 19 Jun 2023 18:19:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4kIJrXkpTXtQbV/U7Ho86Y9Uhjskvo0efet4CUwtncvjbCGyO8ityU3oRW90g29Ls0u0rw X-Received: by 2002:a05:6a20:4320:b0:122:5ed2:b510 with SMTP id h32-20020a056a20432000b001225ed2b510mr2189808pzk.9.1687223948647; Mon, 19 Jun 2023 18:19:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223948; cv=pass; d=google.com; s=arc-20160816; b=XLcqUCQ7zMZjlb43b1JdDjRSWupXA2pSnDzFhCExoYvYLSdbzh48zgSI4J+krk45Jg 3qI3wApSEAmZN+sbVbWdl83YyPsRKJjFt2gE1M5gyprgr1qDjhvFswnlzvAzsxGVSLeX yy8DB/MuVlJjVbwE8ar8E9vIQ+HUP1SOoxRYAcxe3sfmqILz6df2NJ0WWhrm9QMSiA5Z mmrA5lgvDbXZ0J6fUTfOkYjhpnvBirtS2mRlyG4Mbm7s2+Q39R95JNngAcBi+o8/A9r0 mbzphyTQGmIpXODHYITk6Rpkj3E4w210gDGVnd25Y4IUoUdAwQ++QHISbw7EyNV7M58W J+bQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ToV4OSx3QPDe8A2n5xRR83mlRss/zXSB19ewrV89/Lc=; b=MVzY0DVzdvRpLNQ2nq5nQsE9ypa94C1CPX3GXSCxkfgK7HISjKdr6LURBDPqGcfpIn 66IF+vevfSgfZ7QffiuR/iZCDVKc0MHBqVf4GlTS8CZBQpUaq1nSgqVkm0MgfdFu0cSm k+ehz7lOdQSN1bq5Hs0r40c5cOz/0eJCpGUMs6Dlg1egXLKdnehZUMH0yuZpFBdhJVKX 7LEGovtmvYux5ywuBndVIM6XcbTEOBrCZisyGwZMir3sFtFYbsSAeRacZ7z0XOSv2fNO o15KG1NDIFAMOdRbQt8ktBrkauwzTqsakhfktU5Za0+21Gi9HQMVHikE3kg4M0G2TccH vwZA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="sxrkxh9/"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k64-20020a638443000000b005526bd13604si626210pgd.701.2023.06.19.18.18.56; Mon, 19 Jun 2023 18:19:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="sxrkxh9/"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230115AbjFTBRs (ORCPT + 99 others); Mon, 19 Jun 2023 21:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbjFTBRh (ORCPT ); Mon, 19 Jun 2023 21:17:37 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 021591A4 for ; Mon, 19 Jun 2023 18:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=briS3izfefAlpqtvsxXj+GDuRLVfL8j+dGW64vE/Y+cFbAMOPZ+fpdtD8MjZ1Yh4neG+CyL6vPlkL81xmvl7BLQuCn200Q173ukUiN3sugcccpPtm6G4g2c2Lt6Zn0GQvB/cQGJcMnMB52DZO72C1KFvG4Z6YXQWrjkkJNdWzikH01Lc5DP6lW0qsLYtGVocJzCvd/cBazwZ88AitUZznpORL0WQKqk6iAvLsdNCIkybVMkdrP3R2b/Cd8Crv4JV8aJNg1X1DJIeRzaHpVtRx+d3WQUJv4tIoJGIXGIozfT4VWpvFKvLtiESGCyqwF7JaDS2/NEXYjDL1JpWayoLQQ== 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=FwRd8AmBxTx+iiNFME6enSNbzdDLDVp13+EAkgKt5E7pVI56AjPr7X9AAZHZmzcZWUEGOx17uXIp6FwRd1tcQV0resM66FxW9g53cB59hx14aLr0XonJWy9iyG1gbqrzaAQoFXwkANYeGdZsGMQjpr/cM6Ko9E8dvEa8GRosY9wsSw6x7monFEg83KDIUc5P+bz0VN2ZZuxDGBOZbZw6MnVWipwJ+SuCpM6YMQdbgotmjLbM0T/SXbVvyfFgOC0voDiHVOXRg8CLrqzRFD4Djh7SIA2ofb64z7HX6MaaTohD59QU986pvynNk+oKFwxAS5s54nQr3W9u9STvFFBDzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ToV4OSx3QPDe8A2n5xRR83mlRss/zXSB19ewrV89/Lc=; b=sxrkxh9/kV8tz+ictTW8nFCBzF86TG80VpmmQwvOYAJMc4d1HhPUTr4iohsZ72BOogfwFuajeZjzzaQTnrOuLFxVVCNsWN2j+FDlKWfS3OMgWNXZc/gA8rm3nGYllb0FfqI7n1cbQG6uPxIdp7dnO7p0MDSv//Pa0CvWVja3mjzT8SM8UfAG5sCPkecPclcSlVoBMGQN2wQSd7Y0uQ6dJKHdR3hbzBqzQOI1C93bVgydbebZ4mACQY5EI3ayC3P1yKX8jRemaW/1LfAU70x3D0lSSe7uVOZBZs1z4hcd0dMIQZUVH0r24/yQjrLc6K3+j8bq+1wFxtExri6gZHisvw== Received: from SA1PR02CA0007.namprd02.prod.outlook.com (2603:10b6:806:2cf::18) by BL1PR12MB5128.namprd12.prod.outlook.com (2603:10b6:208:316::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Tue, 20 Jun 2023 01:17:29 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:2cf:cafe::ad) by SA1PR02CA0007.outlook.office365.com (2603:10b6:806:2cf::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:29 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:22 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:22 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:22 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 05/11] selftests/mm: .gitignore: add mkdirty, va_high_addr_switch Date: Mon, 19 Jun 2023 18:17:13 -0700 Message-ID: <20230620011719.155379-7-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|BL1PR12MB5128:EE_ X-MS-Office365-Filtering-Correlation-Id: 062919ea-3105-4d1f-1e04-08db712c1dd0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A7TXdtNcupxPcQPInqgEiMrdFmBH0c22yZ4TnH9U/bcv224FYzr+1hIekb92HYbJkb66wXmnBDfB99QUgZbz6cjLNcv6eb+LREEBsOUxt1ToJK1CFTb/L6YOF01PaUgtV12V2xN4cv8sf24KJcbS3wWiSktCVKntG4DsZ+eb/BUeHsQPNtc2Dg/4JvNuLzw1WjwWI1mMPu6EuiQnEQkZt7hQtVhrWbBwd9v6VsbSKwFCBJFsfWe1wm2FzbE7NZfd4fq4kH+1aD2Fq1NETIJhIEw134WKWCeghjH0WQpQs25jVI4qjNN+2FNkHKsjy5rn3hnFP8vdLU3I+pbLtygPxG3PSuSqD40LNu2hrSpU5pZBP4+QBJrhl1P6fPkV4Djtp7WZ6eUfr2Ad8nYOgGrz61htlDHIua4oH4ZbX2mqtjdgYKlxhwMqQuBKRzh1kNmKKPVChWjs5wa88gl2IKXb3nB3kNeFT/npE1vMmZJUUXMsWlOeG1YWhqeXIlt5BVvkxWc0bNo0QT1NQhN2JqLsjtl5I7pfMOKSs2/t6/Bs8w9GUyupMWNF8eXE/1ac8UYpz/ZyAZcBDUIvWCkq1aFEmsMArLJt0H79nnm4KMfrVDEOEm48gKOXFFxjQOIW5rF2DELTM9Z37OjgYkpcbkHA8yOo/BFIkV/ppGqqgJMyp5ZnZLTBjQ93gB+DYxXNk6ec1N957K2yqjLC5wPUhkGwJYHxio3coiq2229GnXAgmBu7oyuvdEDtSIewoH70TyAt 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)(396003)(39860400002)(346002)(451199021)(36840700001)(40470700004)(46966006)(478600001)(6666004)(70206006)(70586007)(36756003)(8676002)(41300700001)(4326008)(7636003)(356005)(2616005)(47076005)(40480700001)(426003)(336012)(82310400005)(86362001)(7696005)(2906002)(5660300002)(110136005)(54906003)(8936002)(316002)(4744005)(40460700003)(1076003)(26005)(186003)(82740400003)(36860700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:29.4329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 062919ea-3105-4d1f-1e04-08db712c1dd0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5128 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182539052056421?= X-GMAIL-MSGID: =?utf-8?q?1769182539052056421?= 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 --- tools/testing/selftests/mm/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/mm/.gitignore b/tools/testing/selftests/mm/.gitignore index 8917455f4f51..ab215303d8e9 100644 --- a/tools/testing/selftests/mm/.gitignore +++ b/tools/testing/selftests/mm/.gitignore @@ -39,3 +39,5 @@ local_config.h local_config.mk ksm_functional_tests mdwe_test +mkdirty +va_high_addr_switch \ No newline at end of file From patchwork Tue Jun 20 01:17:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110228 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352408vqr; Mon, 19 Jun 2023 18:19:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4L+rOlI2ZjGZsvtpbFt1f1tJTXwiua2pS45Ux3MOAmo5+3kJr27XXk+56kFFEowZjcdAYC X-Received: by 2002:a05:6808:285:b0:39a:bcbd:d0d5 with SMTP id z5-20020a056808028500b0039abcbdd0d5mr8092395oic.51.1687223988389; Mon, 19 Jun 2023 18:19:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223988; cv=pass; d=google.com; s=arc-20160816; b=abEK1Qmwl++zLyMzbf/ywVvxDfEtIpFU9dgMkvqs4v24w5iqo8pfMMIrRJ5rJT4VkO 28pJj+gVWMmO/BA9yU7mRwnFmVr616rs9DYzsZ0F1rxePDCdD1zHVsT+tV5robZKmvvO ePqzKdkWl/6holP6Ykh8gNDzqkLKeZpru/bMcPwyhlSfVONj193HhIKHuDRnezRZ/fAK bKNuVutZ2X4UM60Hnu6f3Z6dqawPUFTVI7aqCZRCt6ErvI+FH28CTEaCLGETkd6P6Vo7 IZxF1nfc88JZYguihk3Dg5OCyKnmiOjJnUWnLV3SWy3DJhLJNw8m2/j0hqvQk+GQ3gAH +xig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PNITXhlW7/50q8EibhFIrDa2v1XwHbp1VFAUfpMqVhA=; b=BahdR/5euO2i0D3RaCkLX8pifewsol8wVYUof/Sg+mWllq2TSlbgLRGVmUMeibzaPJ 3WYg1EdFaWAFRajBrBC71Pndrny1Ga2FZbvLG8hRN3uYpEOF3FlMEE//NFa9LMQTRKbl 05GnnDY+f9MBqvZ8tVz+oR+a/KSiOOfihfP8gsEXAteTsm1pNxxeuP5Ae0//2o+rnfbW yPxpVjASz9Vz6uZBHKpdokZQU7z5tdjAKV4jA2kDbC2u4svFhWOocl7wZ11rfLZgErCN KOlbuUsCd9pOSMb4MmiIxbYy0UB1J8Cjyof25vOUtN3+X0gxxHodfSQzvW7tBA6ieAN6 s5eQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=jR8oVN9A; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u13-20020a170902a60d00b001a9265e6fdasi783494plq.268.2023.06.19.18.19.36; Mon, 19 Jun 2023 18:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=jR8oVN9A; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230097AbjFTBSL (ORCPT + 99 others); Mon, 19 Jun 2023 21:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230098AbjFTBRm (ORCPT ); Mon, 19 Jun 2023 21:17:42 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2068.outbound.protection.outlook.com [40.107.220.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EF3F1B0 for ; Mon, 19 Jun 2023 18:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nENOMRcIwHu9FxJu9qd6AAdd8QDYw8kNg2FZGBi9c/vslCNxZB5LaOPDz7/cujE86Yo7yq8N6aSzN4MKdpRBc3lTJUf3WC04anQol+qHM/oon8UymhsnF7cX1aK5TxcDaywakCaeEdx3mQTjFvjC67Fano1uju1Pq73g21lauz7EVWJIBsuceiLVCDm2jTFr8ZKw/ZldbD/0jm88CnvzYo6kFS+Iw0VEfUQRx6BPHAxUGjGvqKbeTp07V3VZvKOWY0bn13pAj85lLmqBe71hOCYsGbEjSJ+xat8GhPrl84lh0niSXXEA7MLPdaIumcp5HDQc7UEOZvtRTisglfdM5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PNITXhlW7/50q8EibhFIrDa2v1XwHbp1VFAUfpMqVhA=; b=mzN+PuZwZR5bssL/hDJJlC38S/OD/IJCUm3ySJqOwhJDyUgkFJs10kE2Wl0KaLtUpysnOhvxj2RQOEcLTSJBQodHO5KwVR13hjbVyrBmCl+odUc5P0HQbx/5c0LmWtz21eY/Ta7SgRgBY/qsUmP+VFUGosUvbFzuY4FTZHODhMyazIuQBeHu4yXR4OwSX7xFV+Em6prssPr5onUIA4m88K6u+1tRcLXeqtpPVmDXJ8S6R2KMmi7vS+1joDWKdpwRmqQK9eNpTM5AIh7Gi+ESrPmjrZJPLH1AZ2GKa3R2dqvnDDm/9tCubd1GNXjQtoO1Y9BiQ3hiBKhYR9eYPzbMqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PNITXhlW7/50q8EibhFIrDa2v1XwHbp1VFAUfpMqVhA=; b=jR8oVN9AU2BcZsmuXx5nDrjtpnFTeB/Vo8Ye9vTxV5XyGec10HaoU0FM22v9GxLx62L6iocpzXF+gnRXrrnpNOJgZSHRKVLYuVxp1765M2xnxTlnBOgoXrfn1hQXIt7g+48tAXGe4t3UHquM+/NFZ9jgSGVmfdqDlCCGdNIf7GffHv8YQSwmmpoBQVLfGBTn7OKd35a7ZwYAF+G2FVLSW3UqoKS+GzAR/Dr27yYMlOVZ+pVTn7Y99H9DPPKRcKxxcUETudcOskiCRGNtMKlrE8csicxMwkN9+S0xu5P00Ek1uaufz1HcXxzLRBwmCeLDGmy8TqUYoNRxjh29EpELiw== Received: from SJ0PR13CA0066.namprd13.prod.outlook.com (2603:10b6:a03:2c4::11) by PH7PR12MB5902.namprd12.prod.outlook.com (2603:10b6:510:1d6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:32 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2c4:cafe::f7) by SJ0PR13CA0066.outlook.office365.com (2603:10b6:a03:2c4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.20 via Frontend Transport; Tue, 20 Jun 2023 01:17:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:32 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:23 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:22 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:22 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 06/11] selftests/mm: fix two -Wformat-security warnings in uffd builds Date: Mon, 19 Jun 2023 18:17:14 -0700 Message-ID: <20230620011719.155379-8-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT069:EE_|PH7PR12MB5902:EE_ X-MS-Office365-Filtering-Correlation-Id: f6f40616-c612-420e-4e75-08db712c1f6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T/3n+HgODfg6Zo2JstGcGTNFtgVJwUyjMO1+NqAi5xXJN7ptMQ2JkIZorqaL25VkWZurttFVpj8VtmK2XlQRs5jSW7ZrKBxo8tDaxMxhRm8UL88IERW7+sqzzE7KZl7LQ1cMLR82RIwCxH2HC1YRZcBf/F8MHvkGngoI3S6XwzyPMCUHORiddhzN9GlRhqQE6iWBKSx25sAOX3SfFBXPXPMUtyRGO34Nznh0e1JPmSeBozk4/mGUjUY/tyhcFCm2iIJRSqRaq7qhofPQsEgVtVFRPePLzhg6zsKaBxLrenhiN0nbvWn5Ioh8U2MBOhrdkoKSUXqBcwKOiFO/z/CXoJI50T/DrRYT/p95wCMed2UvxV1v70+X7QBfSkfuYB1UnN7EjbqebVxlmOBd/veHpUHOzKtLxIRVUUCINoXkh3zKaalpiwjuQdglkI7KxLsbkvZznJD3LzPM2FvO45Fujii1zHayXufaNKawU8trRd7wV+8fsSpuY25djJ0b4z7m5H6YX2jA2VsGoaW/KgjbNfDkj8RfkuWeQha1LLNMbAbRwJl9hBUXjcL2751KVX99GlHs2pmNsZhPhXwB+MUXiRkpEBno2o2UAW8HcrUGwIBwRPsV742ltuenaYIop3BjWhV+qR8uuHMyX62VM8p8Pn5/me51/0mXBRYRBJtnIFPJpbL2t/8QHLqABsgJe2OQwvXjCkuAC+mPWkhSTBD/fyb5zzKif51lOYbYTLxVlIHrCMywB+GjyK2+NJEJtCuL X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(396003)(136003)(376002)(451199021)(40470700004)(46966006)(36840700001)(186003)(26005)(1076003)(82740400003)(36860700001)(40460700003)(2616005)(40480700001)(47076005)(7636003)(356005)(336012)(426003)(83380400001)(82310400005)(478600001)(4326008)(41300700001)(70206006)(70586007)(36756003)(8676002)(316002)(8936002)(54906003)(110136005)(15650500001)(7696005)(86362001)(6666004)(2906002)(5660300002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:32.1407 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6f40616-c612-420e-4e75-08db712c1f6d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5902 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182580936534485?= X-GMAIL-MSGID: =?utf-8?q?1769182580936534485?= The uffd tests generate two compile time warnings from clang's -Wformat-security setting. These trigger at the call sites for uffd_test_start() and uffd_test_skip(). 1) Fix the uffd_test_start() issue by removing the intermediate test_name variable (thanks to David Hildenbrand for showing how to do this). 2) Fix the uffd_test_skip() issue by observing that there is no need for a macro and a variable args approach, because all callers of uffd_test_skip() pass in a simple char* string, without any format specifiers. So just change uffd_test_skip() into a regular C function. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/uffd-unit-tests.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c index 269c86768a02..04d91f144d1c 100644 --- a/tools/testing/selftests/mm/uffd-unit-tests.c +++ b/tools/testing/selftests/mm/uffd-unit-tests.c @@ -109,12 +109,11 @@ static void uffd_test_pass(void) ksft_inc_fail_cnt(); \ } while (0) -#define uffd_test_skip(...) do { \ - printf("skipped [reason: "); \ - printf(__VA_ARGS__); \ - printf("]\n"); \ - ksft_inc_xskip_cnt(); \ - } while (0) +static void uffd_test_skip(const char *message) +{ + printf("skipped [reason: %s]\n", message); + ksft_inc_xskip_cnt(); +} /* * Returns 1 if specific userfaultfd supported, 0 otherwise. Note, we'll @@ -1149,7 +1148,6 @@ int main(int argc, char *argv[]) uffd_test_case_t *test; mem_type_t *mem_type; uffd_test_args_t args; - char test_name[128]; const char *errmsg; int has_uffd, opt; int i, j; @@ -1192,10 +1190,8 @@ int main(int argc, char *argv[]) mem_type = &mem_types[j]; if (!(test->mem_targets & mem_type->mem_flag)) continue; - snprintf(test_name, sizeof(test_name), - "%s on %s", test->name, mem_type->name); - uffd_test_start(test_name); + uffd_test_start("%s on %s", test->name, mem_type->name); if (!uffd_feature_supported(test)) { uffd_test_skip("feature missing"); continue; From patchwork Tue Jun 20 01:17:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352153vqr; Mon, 19 Jun 2023 18:19:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5qWghTruXdj5ME2YFtf0YES8PhB6S7ZVZh9g34KUejaSRONTKqN2oH47Px98wINS0OHh5q X-Received: by 2002:a17:90a:5105:b0:25d:cfff:264e with SMTP id t5-20020a17090a510500b0025dcfff264emr5952254pjh.26.1687223948702; Mon, 19 Jun 2023 18:19:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223948; cv=pass; d=google.com; s=arc-20160816; b=fEresrcqyCqTE1lQ6k3e1amroXTfPKR+CUa/jI5TLJpuD0B3AXY8d9+subjcUg+8St OwuWDiaw2Vrq5aDNj+4pJhFaessADqAe7BbEe7XbHxNrA0+dY3C7w0VfDL4ek8vnVPlV hW1UqAvarqaJ5p5iaft13LTaa1ygethQ00tkNikdReTqrNVqRFTAo0w5s+wODvecBI1F fNVpWxS/ug2ycWgH0kPgMBtdHkNisOqP3cnPWhpC/tV1YxvqZ9dLjMyezMrKc23qrPUs 1wNfsEBSrR5chZy6LSthACNYhVR9zH76mmcM3ZawVEga34e30nYImpY32FcVrOhd+yOU So5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NAgHsicGbXE7/y+61Ec/TG4fp5QK6NCUPay76C4Qy/s=; b=nV51LMoOWxzSGBqD1mfYVS8soRG+dKwoI/tOREqqd9lKWXXt/9CqR6iiktFQ3qoBgp a+f/AppXbp+L3HPxpkmGph93TVJHGhg9xUYIzTHA4kJ9qYL4Th4MTzlFhqx5+ekEUQKv SxI7ZC2AEJWSgs8CMbbsEMWi5yiy3lWTahVlUS+yZ1KP87RoGQV56YoBO5PQk/w+4/RG 7SqQvohaDLVlS9WgFnLrB1OtUCNzAmnOK4DuHCVNF0AOVoaLXOCA1BcJog3yaTqwsRI8 ugwJAhgv2m+oxMMxDNvyrjEpTrbAEI8/8oH+mW68nNn2bkPiXdgdxZRIH9PyOyKsIfmF s4wA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=TQtaRKoT; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a17090ad3c300b0025359a570fesi824449pjw.19.2023.06.19.18.18.52; Mon, 19 Jun 2023 18:19:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=TQtaRKoT; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230087AbjFTBRo (ORCPT + 99 others); Mon, 19 Jun 2023 21:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230051AbjFTBRh (ORCPT ); Mon, 19 Jun 2023 21:17:37 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A882197 for ; Mon, 19 Jun 2023 18:17:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z/qCte+UO/aJxYx6S7Sg3Cn9tvL181TKnyO5EiPsRm1AeRX4b5b62+F4Dro/QF0a56xst0vRwzr3GSGADoXYYqKvJGQHRBK6m98sCUTq1Zd53SVEK2eqp3rTh+Gd1ILDnb3MICguCH0YIWrOo8O80SysAXXFACoXiTuZdUV+49/kkMUYrkGSpWU0iBGzjVqfRe+yEHMp5x8aPakaW+8Xf3HfPeKiZj53xG+ZKkSSBJQbRExoxikNvgxp+gwRAfe3hb1ET3fGFZCKNWqfm+0Azo3rKsqaOfHFhJhQ9jhP787W6pFFliowCazGjTLQDyB5iXNHYmm3p4xyVjszcS6J6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NAgHsicGbXE7/y+61Ec/TG4fp5QK6NCUPay76C4Qy/s=; b=fEGVmKbVOGd/81SKuP1P7NH3EchbLJJa6Gbyo4vG7knSIMDN4gCcKYA0XJ5y/5DapHnlpISXb5Chei22plekwtXr+Xr3RLoWikwsUnmRljwBxm6na/W4FObthgLP02i4kRrHvosHIKJ4mRl8omr2GYk/rB4lKGlLMvZLquei9iTS2nDdLGUSk4X4yC9a6UYaV0sYpPXAa5YbZ9XQFC2Sb9LnssNWcffiiRbgEAHPqaRVWnEDJ6hWno+06zDM+fHbN6xQlplNpLPAghny1schny1Q2CqxCcSPTsY5Pw2VmaMpnOF4P/zAR8I57qT/XyYTONCc+WT5xKA7dTVJ6H0L7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NAgHsicGbXE7/y+61Ec/TG4fp5QK6NCUPay76C4Qy/s=; b=TQtaRKoTsRXcos7BLB+e3jHbLm7EbjxS7jw8ivJN474NSEKa5ZwkvH3MQuEJ+OXQmmmLTx+YD3oywXHccZuWxH6KM79heldyGPg6IGezn0xFdDf9QoP3L+2yGNrymNzoKDdyhDA04PJhY5RrmUWnCpCnRyaWWULaYKKhgazTOwAPCb3f6adCoQKVnK/IdiLiNuOLJVTzBsiV68CYrMOax6f7RTiN28cFFeNp5Re7DNUl2mv7sPFaaxEzjmDl3we3Ws8Rb2eg+AKWu1uDf8fLgU2qnYzzy+E5Wc6D0upPtcotcLZaD7KTripJbNi0cysUVpvAXlcaHzVjtaHxDmjfXQ== Received: from SA1PR02CA0006.namprd02.prod.outlook.com (2603:10b6:806:2cf::15) by DM4PR12MB6375.namprd12.prod.outlook.com (2603:10b6:8:a2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Tue, 20 Jun 2023 01:17:30 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:2cf:cafe::5d) by SA1PR02CA0006.outlook.office365.com (2603:10b6:806:2cf::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:29 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:23 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:23 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:23 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 07/11] selftests/mm: fix a "possibly uninitialized" warning in pkey-x86.h Date: Mon, 19 Jun 2023 18:17:15 -0700 Message-ID: <20230620011719.155379-9-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|DM4PR12MB6375:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bbed8b2-9385-4bca-a469-08db712c1e17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xVPHgg1hlmhmbWUPHlyyt00twUTOkvQAv6CECljfOtJ4GKCbBDJMlzFeH6hA0FAO5SPhQ+jDdhP6mP9GQ8AH7zwvQkOaTTCiBfg3jD7mUrZdGS/53tmny+1Z/zRtrWNby4g+OuRoQ1n70O81u8Ay46ctJD4HNkMGIUbU8KgOErwRvxB4NP1khgbNXkBvpHuLaLmhHLwYKjEDebxNcSIWcu5PfGw6ROmLMYRXT3JIQgdRlSw7xxKfBTGz0GT/YVVUCP1BlTi/5sCVblclh68bGFz0tZt3mtYpNeNP0hVzWcBa1AUTurb4AAxe0wqR6+YhdHlLGGuQDACTk0XnC07nhK8u2GXT//sadiqYAPYxYAUODMJ6vA3oswZfhyFfhgRKnBXlYzR+AO486nkGCcZ07UMwzSfCLN5YWjBLWM6uohs3hVnzC97bbzMkcOC/j0xrWsGJw6GEXz2+I0HXBAwhY436wwUBS6s/PKGGRIA4MN1X2UOdAL0Sj3bK+2/PjvENXlzmd1yYg6ULpHygE3y5T/UuwBKLH1dcrSvucejW8fLEx/2YpwAE2i+CnBBtBf/x2GGzFQeUvcwhu8JwHHu1vQMwcQsKA3qflbTRBtZVMW9S/PLlkCYGFRCDMtVl/iHSa+RWsqNlSVsokYZ4BV3RVJ0sw77Xd5kOwqTYshI2Bpxhx5MN+8bWBQKaUnAqpsuLFvKj00a+Un209nd42c+hIayOIRydBUQA4cK0SCrwaOr2w7H8Vjye5nbEqlG2xSz5 X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(346002)(396003)(39860400002)(376002)(451199021)(46966006)(36840700001)(40470700004)(8676002)(8936002)(82740400003)(356005)(5660300002)(7636003)(26005)(1076003)(186003)(7696005)(6666004)(40480700001)(47076005)(86362001)(36860700001)(2616005)(83380400001)(336012)(426003)(40460700003)(478600001)(110136005)(54906003)(41300700001)(36756003)(316002)(4326008)(70206006)(4744005)(70586007)(2906002)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:29.9172 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bbed8b2-9385-4bca-a469-08db712c1e17 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6375 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182539271940018?= X-GMAIL-MSGID: =?utf-8?q?1769182539271940018?= This fixes a real bug, too, because xstate_size() was assuming that the stack variable xstate_size was initialized to zero. That's not guaranteed nor even especially likely. Reviewed-by: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/pkey-x86.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/pkey-x86.h b/tools/testing/selftests/mm/pkey-x86.h index 72c14cd3ddc7..e32ae8a1cd99 100644 --- a/tools/testing/selftests/mm/pkey-x86.h +++ b/tools/testing/selftests/mm/pkey-x86.h @@ -132,7 +132,7 @@ int pkey_reg_xstate_offset(void) unsigned int ecx; unsigned int edx; int xstate_offset; - int xstate_size; + int xstate_size = 0; unsigned long XSTATE_CPUID = 0xd; int leaf; From patchwork Tue Jun 20 01:17:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352243vqr; Mon, 19 Jun 2023 18:19:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ZB8mxOGCIGZHZbXiVBlOAeuUOgAaCP0M39MexXvFF/ILtcU754nJtXxpY40SPRad2ICww X-Received: by 2002:a05:6358:ce26:b0:12b:c8d5:f10b with SMTP id gt38-20020a056358ce2600b0012bc8d5f10bmr3167386rwb.29.1687223962478; Mon, 19 Jun 2023 18:19:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223962; cv=pass; d=google.com; s=arc-20160816; b=gLOtasSjEEJwh6cUcCwF88uTSoO9YE86kDQt5qzeE+oG2bKOsROq/gLCQeHeaDVBQY BaeSf61cVBHa7H8Zp8fgCvlVe5+DBY5+p6lxGzi3eQH+599c/z8vWj/2u2bSczmdWUNm 0QPX0WJyKV0Jz02aXaT9SYAW63D0uiBWm0IiGnb/B+AYEwEy9UcwBANWBk1QMFV/4pBG 9uw2ht2ZCwV29JbW26D4DJmYMegoGaQSDtJgi5Pf15h+TD1cXmvUpFmNYotcnb7TAVcB QCiYxdyV4Af70elgWJQEu7GXTwN/tW2inZc6n9fN8S4/btRCbZdyBEfO2X3PZeJIdh85 QUfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r7qWJ0iKcBH5AScsmOvvAEPpASsgJNPE7K/FjHHYXLU=; b=PkG6o6hAp5WQTrynHz/Y6XClnFYexJMQZKDeDvCZftWETbVc8U0ZYg627pBwTRPitr YhXUaHOsVqsmM9RKVQHhhpsUnnXPvX1t7DNQNLLYZM1wxsfnY442eshVciy7gvMaHc+r YCWkqj7p9233Dkd8jrEW9ODwCbT//5Og7Q4xxhud4P77R4Isonbx2ahOUjsNYjBTIwFc 7HNYbIzzuD6IZIDwcpiA7RcADrLf8LNJdAaJevF0cJcrKQdkM/QTadOLTbU/PaO9DDcy hrAgaB0Aa2EMHcrQUgjX21cheAhsQeYslBpHGg6T3KjHCeh6uIPdVnakxrvx+Uje1Wgn 6SZA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SbT+l55B; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a63e742000000b0054fd670e85fsi578070pgk.233.2023.06.19.18.19.09; Mon, 19 Jun 2023 18:19:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SbT+l55B; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230164AbjFTBSF (ORCPT + 99 others); Mon, 19 Jun 2023 21:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230097AbjFTBRm (ORCPT ); Mon, 19 Jun 2023 21:17:42 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2063.outbound.protection.outlook.com [40.107.223.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42E4B1A3 for ; Mon, 19 Jun 2023 18:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HaGLqZdQUyrSn34bQAA00UCiIxSIrJjTfCNeZh+wdsmMtKn6Q1LuIH9ZS2WH4VtINhpelx6ncqyp9WHx+pDyEx/63GdLjbA3F4W4jZd2tP0zwHPTzRtvdkculEwpEnLvUyJXpUrOOhyTuu+2r2PQCjFyQMHnub2SnN51w8puVGCfGVFV8KZrjD92GC2pI4KwcTE1jz4gSV8TFXeAfgrXi0cswjzJkjqIccFP3wuqk+3ch2G5hB40Wz7iXZTMERgdYHn3X79xNo5q7hSEEaWfqWMWLeQnp21zikKkQpZq6NqNfONZ4L71DLoS5QEB2w4F0Dn4Q3snAq0WPvSneL3gpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r7qWJ0iKcBH5AScsmOvvAEPpASsgJNPE7K/FjHHYXLU=; b=VxSIArXYwrlSzOhnPD9mUZt+APk1z3haZMSD6+BrcfPl9SqeW5UmGLwa6F8IkwLUfKUHChDy8XlYR0IySNuZat5T2tci/zhbs9R1bKxDDngN9Rf2vB9eh2oQ0QVSUlKbtRLT4DN1KKFiW8qqrOsl8fgOH9HJZSF0ZZDMj0xJUPiWarDYH90Y7biIOdQV4o/PHzBXalNS6bPAPi4iZeDbPROCsHrOdufHlNMCC7Wg2ds/mRlTJR81HFsNjsPvyVYxqnlk9MkhjJsDraVg5+9u7oR9e5e/Sc0Jl8EfI3bjOgxTwxZByZepuVzdFynZ8EEsy97IVLdkOmXnjAiu89FjkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r7qWJ0iKcBH5AScsmOvvAEPpASsgJNPE7K/FjHHYXLU=; b=SbT+l55BOgfdunkORb4oXnB5J6O2o45OPbMqi1ZFnPDYcMXlkKIApsTanogXg9wR1l+SsUDd45WSdyPD9O3CCUe+hjsbWT+VpZVC041/7lbNOIlXYU+JfWtCepO2e0xkr8EbBEqyX9YCh1fHIFfQs8tuwGRfay3mZoCRC8JdaCYJTTqrI+s25EwPcSsbRv64w5WZUqmei92K90/ZGguaSz4BzODw6ppOqtgHA3uDUb6Hu6kW1cEuoSTXXTLr2MSC/2vkK2CzSEl2F/evvGPYS1eTPK1lFUUui8nDvJHdL8y4F+9wgMSmMe6pfYoFRiTg33UhF5WjO7urMWIZ7ejMZA== Received: from SJ0PR13CA0082.namprd13.prod.outlook.com (2603:10b6:a03:2c4::27) by SA1PR12MB7199.namprd12.prod.outlook.com (2603:10b6:806:2bc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:34 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2c4:cafe::74) by SJ0PR13CA0082.outlook.office365.com (2603:10b6:a03:2c4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.20 via Frontend Transport; Tue, 20 Jun 2023 01:17:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:33 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:24 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:23 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:23 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu , Muhammad Usama Anjum Subject: [PATCH v2 08/11] selftests/mm: fix uffd-unit-tests.c build failure due to missing MADV_COLLAPSE Date: Mon, 19 Jun 2023 18:17:16 -0700 Message-ID: <20230620011719.155379-10-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT069:EE_|SA1PR12MB7199:EE_ X-MS-Office365-Filtering-Correlation-Id: 357b87cc-2927-470d-01b5-08db712c2089 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h2DJACpwOOaBPQAlSCSmAlRJrd1GxOI+922JxlbOw9HAcliTwUA66JKqeayqI4CG9SW5b/99cU7tu42N+T5lEkMjOTpEbXx2cUEJgfcrBIVZ97juS5FXztBMuph2T5yP3qGTq6VjkRlK1BQiNyJdKNIFBe1R/ln9miwqacuEvolqFehF9eiU8YaMHXNrdtF0S1eTjswU3+rlzIVb04Jsxf2ZH9dS574jNZcGdSQV7I0R+LcvcnQSErD+UaxiCmpOtdBLtJzVwGDR2XbhvOeg/PEK2f7kYKVzsUkuHc4BZ8XvIfLq/tE00xSgdxb7Ad6pzE/27l1nhAFZFLCeQPwVUBG8ixSgl8fCzvXmezEyWeYfT9S7Djski6ayjj7we2RpV0aOcy2NF4PHEoJW3CZc50SDXjzP8XLxzU1HtM6pPE5oJtc2ovZNMjSxL63QSzzX9dE8NCQnHzvhmLn8Hikdkwz2CtMcFekiDT1vF099d+Z+/Fblpckg2OgjLHOankrjDEYYjOKk78tT+JYNTAdlG5klKspUNzK0YKDCfR/KBIr7Sk9BQ4mptj7F4UrdKPDk4faqG64hIqn+WxqtCXXippmcdB8LWlVcBiAiAqSKAk080lB5l8egZJvLU8c99dvlzrsUW4+8/S29ICVrN2LQpSSVFq1yGijlEnTZd3Yv3OiSH4Vdc/hwe0tkoAyIwO96Z0NFCu9XtEWEIClKTW2zxj3htAorBLy5i8hcHIeG7RJajKeb6rBU9qbvmC0638rQ X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(346002)(376002)(396003)(451199021)(36840700001)(40470700004)(46966006)(186003)(82310400005)(70206006)(70586007)(8936002)(8676002)(82740400003)(5660300002)(110136005)(54906003)(4326008)(40460700003)(316002)(6666004)(7696005)(478600001)(41300700001)(36756003)(26005)(1076003)(40480700001)(336012)(426003)(356005)(47076005)(7636003)(86362001)(2906002)(83380400001)(36860700001)(2616005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:33.9844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 357b87cc-2927-470d-01b5-08db712c2089 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7199 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182553695611901?= X-GMAIL-MSGID: =?utf-8?q?1769182553695611901?= MADV_PAGEOUT, MADV_POPULATE_READ, MADV_COLLAPSE are conditionally defined as necessary. However, that was being done in .c files, and a new build failure came up that would have been automatically avoided had these been in a common header file. So consolidate and move them all to vm_util.h, which fixes the build failure. An alternative approach from Muhammad Usama Anjum was: rely on "make headers" being required, and include asm-generic/mman-common.h. This works in the sense that it builds, but it still generates warnings about duplicate MADV_* symbols, and the goal here is to get a fully clean (no warnings) build here. Reviewed-by: David Hildenbrand Cc: Peter Xu Cc: Muhammad Usama Anjum Signed-off-by: John Hubbard --- tools/testing/selftests/mm/cow.c | 7 ------- tools/testing/selftests/mm/khugepaged.c | 10 ---------- tools/testing/selftests/mm/vm_util.h | 10 ++++++++++ 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c index dc9d6fe86028..8882b05ec9c8 100644 --- a/tools/testing/selftests/mm/cow.c +++ b/tools/testing/selftests/mm/cow.c @@ -30,13 +30,6 @@ #include "../kselftest.h" #include "vm_util.h" -#ifndef MADV_PAGEOUT -#define MADV_PAGEOUT 21 -#endif -#ifndef MADV_COLLAPSE -#define MADV_COLLAPSE 25 -#endif - static size_t pagesize; static int pagemap_fd; static size_t thpsize; diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c index 97adc0f34f9c..e88ee039d0eb 100644 --- a/tools/testing/selftests/mm/khugepaged.c +++ b/tools/testing/selftests/mm/khugepaged.c @@ -22,16 +22,6 @@ #include "vm_util.h" -#ifndef MADV_PAGEOUT -#define MADV_PAGEOUT 21 -#endif -#ifndef MADV_POPULATE_READ -#define MADV_POPULATE_READ 22 -#endif -#ifndef MADV_COLLAPSE -#define MADV_COLLAPSE 25 -#endif - #define BASE_ADDR ((void *)(1UL << 30)) static unsigned long hpage_pmd_size; static unsigned long page_size; diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index b950bd16083a..07f39ed2efba 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -63,3 +63,13 @@ int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, #define PAGEMAP_PRESENT(ent) (((ent) & (1ull << 63)) != 0) #define PAGEMAP_PFN(ent) ((ent) & ((1ull << 55) - 1)) + +#ifndef MADV_PAGEOUT +#define MADV_PAGEOUT 21 +#endif +#ifndef MADV_POPULATE_READ +#define MADV_POPULATE_READ 22 +#endif +#ifndef MADV_COLLAPSE +#define MADV_COLLAPSE 25 +#endif From patchwork Tue Jun 20 01:17:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352218vqr; Mon, 19 Jun 2023 18:19:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ78KMDAZHLwz7vKmYs0HTwP8T64CWlEPY56kTej35BkpVMKJ0/RQ3axShgLwTvDQp/RDsuW X-Received: by 2002:a17:903:1c9:b0:1b2:4b28:794c with SMTP id e9-20020a17090301c900b001b24b28794cmr10330140plh.6.1687223958960; Mon, 19 Jun 2023 18:19:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223958; cv=pass; d=google.com; s=arc-20160816; b=ELuq7EQf75BBut5lK0uMcejnutx9QZi+4QhwyvWP3oANZEjwb36mI4XFeKd9EYbrZv XoWLQtVjApKEW4xd66QEVAQH5ww3KDpYj0sMb+T0essjYLB/FndxkJwk/3qD1nQ2J5op akwe/Pba/uP4NyDjafEKGYUaQ3iCymysm33Uh3jcTcOamfBWOfuCFJx918ai7MtpeTXf 3FBnB9d4e8GUrSs4RHnNa92xfKVIz9Ze0IdKynrt99CNHtTWuCOuZJu75NN4cLm6uQuo aUuk1xRfxr0wq+SPq5teXOVG7RrRw9vetdBn4ao0RN20I1+1pH2Hdm9tyuBiIuCs/T1s Ubmw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1DWMqFfWmcM0S74ipR90Z5t8Em5oNzomwf7Su2Dj4R4=; b=QZR7NubmVrcE0J8GwvM4lHWkRfYzVE179KbzkUWj3RlGumLPPVvHW+5O69+WSCcZ1u PY3Rdx+IhxGb76j9mu++qQtEEA90daH6UqYkg/blBTQZhetSjaWaUKuhp5c+v55+KH3s JZ/ltK4TGzqPziY2TIfmLcRrkrIca0p7rnCXnPXg/SanG4FHW+VmqlH2wd0DXelfXoC5 YjNKVQzWsJGwUMgVSA9o/HzB8hJ3EymBNvi/ArO5oiVEfQNm/Sbja1ffshV9sKF3Pn2G SoNdoW/7QXSN2v9tUi4EF5h0wTKCVL8DcqZqH2ED1OdQiyGpPrZJY/+/g3wcMQlnagwN eyjA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=dpy1OEzJ; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a170902cf4400b001a6e719421asi741000plg.366.2023.06.19.18.19.06; Mon, 19 Jun 2023 18:19:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=dpy1OEzJ; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbjFTBR6 (ORCPT + 99 others); Mon, 19 Jun 2023 21:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbjFTBRj (ORCPT ); Mon, 19 Jun 2023 21:17:39 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20607.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eab::607]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5856C1A5 for ; Mon, 19 Jun 2023 18:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C+bfb4+wOadMyFziIn9B2YE8uJpjiHGuVQ3aGd55Rc5g2EPFMMpFXztZ+1l72Zdb8PW4Zc4Dih1M4qvKdNTkFrgTr60z9QOWH/NzYFm/UQstKH2Pw8/x0eumqPJY+7dgbw48TIFdiaOGRGfZ7C1Xy3GPwjD56pDfzxQOc3WhDbxf+XrkKSsVnV79GETnSs22fNxv0wnheZgiUTqiF7P3Pobl7WbxdQNPTWkOpaT5w4ACHp16w3kKKavCFd225Z5wGkzTJ4fkAFas7PBZL/VDRgUA8NX5MI0BNS5F/5xAV4RO1bRKlafOXB+he5srHqBJuaDciwVve5a8jl11hE0xOQ== 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=LvK3mJ+f3wT7/B3h0z2DGxNsDCK7MeEkstwmZRKBC7OZ9cXAvBPeNhj6/xlIE1EcxQuM9bY5KvHjd+oMfrbvj8EO+iFuddGRXR7/SBFnES12fEX8ARgQXbxJXBDWiYaihpQ3IDQfl8hnDzFQrIL42HcdQg7urDhkwydu708oNF3MChKrDIXZKjh+PqUp66oQc+6TvFKDBBZi6lvdoEwzjWWbEYbJYsBjnPdlFjw0aJsRjbtuW44vvdUewkj/eanF195acFwJOMcEwg6PeC/aU5nQkIwLmR13ZH6ZfUepNRtE/2TeCcUWn0URTf9ZR2Hv2VP15F/IQDwg45pVJ2GD9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1DWMqFfWmcM0S74ipR90Z5t8Em5oNzomwf7Su2Dj4R4=; b=dpy1OEzJSDw8Yk1kC/IUWf461IjLK7tcw1vpOof2xtGTVXKuT6sGqkU8birP62dvv+gcydMKUItT8zO/kOOQXnnEOdSyUblfWJTWcepm+MtQjfwH9Kr87BXZO4O5hPfmtJ1x0nfECc0N6HkpOEfe7YuUkGdX7XpuqxEMb0mKeeTVA28PhuoYGGkA1Qzf8qnZFq/NggqN10fKeuVuyZw3ZVNa0BPBU+gDPfKmB8KfSa8omZ416ehYFBwcwPu3dvT8YcoM5/cRbqVcRQnXGA4Aoj1sFZ/L0OSFswenJ3abFn/hnRnHzyHcXKBRdb3C1NmuXCgbCQOIl7h8jaQBMKHMwg== Received: from SA1P222CA0028.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::30) by DS7PR12MB6023.namprd12.prod.outlook.com (2603:10b6:8:85::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:30 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10b6:806:22c:cafe::5a) by SA1P222CA0028.outlook.office365.com (2603:10b6:806:22c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.44 via Frontend Transport; Tue, 20 Jun 2023 01:17:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:30 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:24 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:23 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:23 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 09/11] selftests/mm: move psize(), pshift() into vm_utils.c Date: Mon, 19 Jun 2023 18:17:17 -0700 Message-ID: <20230620011719.155379-11-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|DS7PR12MB6023:EE_ X-MS-Office365-Filtering-Correlation-Id: 2238d7b7-92a2-471c-6d53-08db712c1e7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +ZCBp5tWmdj7pmlABKKWKbZ4UONcS5OP+7txez7jwpGlQwCjQIq2Z/9cJ+hN4teATs9DNTRBJyJ95+0WwuxLiv+SOemsZlESgv0uODEidGcu/Ud2dnBw+ms3uGbPnGVhCRYJ9DSK7oBh/7F9UlOPodn7V0VzqXXB///6crMZA6k+g0opiJ3IX6g3f3UyykvLpBMsRSegCjmYZUrwF1LBgpGfy9JuGMFgOrXGlR0Ean1IGFaYAQqsyHq5cPqxYVwzxxbUpyWBkMzrp2ERZco5A9z3lIomtnZMu6SFjn3vtJCW59C7bnKafWAJ0beHkv6CfIgzmveWXZBTQxw70ZRclnfIA71C0sdkLdX1v6NcNQK3KzRbJcjZoDIPcWoyzMo4ygOqnPDvIQkkAxSX8GU977CsfLKhhwbrIcl+Rdk+FilFSBfeLhcGKcAtR4LpPsDwVZRtL8PLn7/rH3/FfGgJNmbt+4qKAIgusubx36lCzVVi6eTHxRXC1seZKw6Y8QY/tXXpSSMfHyInm5AwOwEBernNJfZnPPzgN4Kfxo6jNDJH63DTSxdqY4BoIYFcwXeqtZD5Nx7lBZuMDnxgoD0BKI+uGbmvXfhPe5djUMAAVAjhzIC54EO+o/RFXZB6Eu+TiVlSHepxrvRr3Ky6Vs1cLiRAwn929LSX1SwQWNIFnXIw3wwzI+7srpBp3hd6EsnBWIVB53jXKHBsmIGvRFkfR6bJ5hbiFGye7NuwK/ahlMtX84R1CnO81T7zJn9RQx7D 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)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(186003)(110136005)(478600001)(7696005)(6666004)(86362001)(26005)(1076003)(54906003)(2616005)(336012)(426003)(316002)(82740400003)(83380400001)(70206006)(70586007)(356005)(4326008)(7636003)(36860700001)(47076005)(8676002)(8936002)(5660300002)(2906002)(40460700003)(41300700001)(40480700001)(36756003)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:30.5712 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2238d7b7-92a2-471c-6d53-08db712c1e7b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6023 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182549725621498?= X-GMAIL-MSGID: =?utf-8?q?1769182549725621498?= 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 Tue Jun 20 01:17:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 110226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3352238vqr; Mon, 19 Jun 2023 18:19:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7m7clj3CU8zYRukvrEfFLu1Nouxrrx2vLppkNZTgvpdx3tF1bYEAW+bQySoBYnaIab2U7U X-Received: by 2002:a17:90a:1db:b0:25e:8cfb:11cd with SMTP id 27-20020a17090a01db00b0025e8cfb11cdmr5736832pjd.46.1687223961284; Mon, 19 Jun 2023 18:19:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687223961; cv=pass; d=google.com; s=arc-20160816; b=rjPBty68w1uFUq9dwyC3PB4NVxcPgSTUOgZZpDM55ipgERhowd8qraDQgrSgxTtHEa 7F41FgLgLBwYOSFdzcb8TUzfsO8juvtdU+mUPpsgavW7QHn3oRfrhs/nZI/iwRqoDehD lVJCUQdDUKVGnVGHG9vC4pkQh/yNg08qAYFPwMP+tKwzZp/tYbb8gMIBIldaVNBRENPF dy38IL6+t9gF5wAC2/RjE24xaZCo04+IsAheADNfNAtRi1T+b4G0qsytI9TGLp8F0O/b K8qBuZgzPmbr1Q8sW9RqjILBBe3Diygo7IfZzKvEiQEsQiHFda5ZEJLFsW0l+gXgQ/vk mUWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lcAlKHerk5VQh9Nf0GPXXyu2H5vBR4yo7s+VUgObnFs=; b=qGOCtqkpN9tYzG86gjSBBvXZaJrfR2S6zVyY4A+hRnn48RZbD7wy43GHzO9LAc/RBp L0l05YMR/U9WRfmCx/wme4C4w8eYX0Okl8VQzxEwtBek7i/TCvdSC1krG7duAlBPZH0e mlsDmBZli4SP0oeyaTUKx/T0eJZKjccWR76xIOBMGMAegnqh39ADq7dGll8G259d3EYm niFXebKLzuao38lT7/CIVYAD1Mx5IzPf5s+bGEe8hdMHHs5s4kNCwCuziPMdAP2jg+A4 tznwIca8VorI0CBTdw3ZeOu7FU9IqQueyJv9eV0EZNJWBG8HLyEyyYXNO+8atpqwlMgw UUPw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SIwQg1o+; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t69-20020a638148000000b00528b78ddbdesi637037pgd.63.2023.06.19.18.19.08; Mon, 19 Jun 2023 18:19:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SIwQg1o+; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230108AbjFTBSC (ORCPT + 99 others); Mon, 19 Jun 2023 21:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230084AbjFTBRj (ORCPT ); Mon, 19 Jun 2023 21:17:39 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2055.outbound.protection.outlook.com [40.107.220.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E232FC for ; Mon, 19 Jun 2023 18:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bIGfCuzUzu5g0HZ+VTdldCh87mFNiiFQOvNerHIHEWfLUiL62ta9kjhYxhWhdnnPCjQTp7TtYPwllyBHfBiqpzLc3HrjSTabRTkf7GXqOgFmUHyx+qVYRIFhkc2vB66xbIj0fSKXcJ+1wVVAJ4LyF+TdI2wcrF8Bnkp9sX/++Lx1YJcmmLuOd+fSSvHsWNxUVEmoeyU9bDOBw/BKIsFH3YuYFi4gcdMiG9Oh4y3D3RywZbp3bEHIJMgIdOoaRUf+OXuNdONRrThy8ju7/2CnQmyofFT0m25IenvsD5kXcq/ndsBOiEYQy/q2cAuZ/yxWGy1UAAFCRIg8DOqMpvRPSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lcAlKHerk5VQh9Nf0GPXXyu2H5vBR4yo7s+VUgObnFs=; b=lNKxQeT8oYQORrOvsq8oZSTLw4NokgoI0HFcfsz95B37ulW9o/gNtyuuJ6A7EETlqlMsKPfjy2GbeAzqlMlIuqLwNahE5wNLQTv99Y39gKBQ5nXXZmH8xxlwuwvP93hPq/eROZev1TXSzGOgjY++lKqNjYbWfBCA1qm5d27EoQtPtM6uU0c18B6z5s+H1J7UBjU5v1OeVkr8jT4D27iOLQGdFVZxBUq47l3UPzy43eSfbDcDtQljAGANc8IOzIQd7y8VlWvyEVDh9DQBuRNznPvyfymcDzV1owl56So8IV9z6PEKPJJ4EV4gFjFTICg73pnbAFk0B0nb7eR2/BfC6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lcAlKHerk5VQh9Nf0GPXXyu2H5vBR4yo7s+VUgObnFs=; b=SIwQg1o+9Lplkbm53VvSvbt7Gy3tmKAFwLFjSbpwe8OUxVeWzPb32hDU1uYHOmbqTFqN7pEqkjBx29DPlKAMFczEGQRQGqZkKdo+yY70jYIXiRbAzkqMhOUpqFDgK/iBLjMKa659NNoz4tL2cfyBBBwKH7fsPpsnJUY45V58DvnrxWmjQEMw3HtHaE2xtqvZx8lTde/lCeugDYzNbDPTYNUPiLEnyPgiEpm0W/Kw99RfqZIqmRbRQUEh4kKkHnhXejRh3FYyPDzFWofnaAZrLburFNhSvvu7SstyPNQmLkG3LLjVK3GahdRIz5ZGhwZK+9MfG4aIt7oojMnFekH1Jw== Received: from SA1P222CA0010.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::12) by DS0PR12MB7557.namprd12.prod.outlook.com (2603:10b6:8:130::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Tue, 20 Jun 2023 01:17:32 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10b6:806:22c:cafe::d8) by SA1P222CA0010.outlook.office365.com (2603:10b6:806:22c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.44 via Frontend Transport; Tue, 20 Jun 2023 01:17:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:31 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:24 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:24 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:24 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard , Peter Xu Subject: [PATCH v2 10/11] selftests/mm: move uffd* routines from vm_util.c to uffd-common.c Date: Mon, 19 Jun 2023 18:17:18 -0700 Message-ID: <20230620011719.155379-12-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620011719.155379-1-jhubbard@nvidia.com> References: <20230620011719.155379-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|DS0PR12MB7557:EE_ X-MS-Office365-Filtering-Correlation-Id: 8675e8b7-af85-4e64-2a4f-08db712c1f1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u0fOJC2zkjlIrgLWUOj/cZmm7Lw5yAFDhm6S44yFUMK7ORxQK8nMD0VfL2JL3sVo6FPjUv97RaH4efHwmxn+ifmlfLg7zWRU5MKx7zudVhlcroO95cMLl4xe8d80RDXvLhtayKkd985JZtE1KtmtPPT7dEFg30eeZi7ggPw0DLmQRlorK32NQJetqqXXkI0+bj/VjYEBio7VkCpmNZROAooE+5EU9y3TdI4ARvfZL16s4/Rzzaedav6KVvYHhpfrv0fxVjyJM3HTRTXaaISxYV0jhf13HBn1ntC839AgLuhgwE7OhFJKmEI49JJsDdIe/8FEqPoQU4gHLX0HM9gYixAZOvbZ5uBgVpvobwQeyRSvjEOxZOuw3GXpHMkcYAMConehzXLcZ0M+fHYQto2s902S1MSumWxQcpxdhD0bC4c5gyQTyqSKuUcYG7ZbUkgkP42k+8Mw+GkLv/IJf8hWE/mcY6NT5dPHsf1O5l86Bs4B49fO9FTRKDOA/zPFL5o+efE1/3ls/dwmK5yJLl0NzV4aB81lYwEjgfEBwF1uGtWE3r3jrQhEoDHV553NecTuKc4zpycJ409/gF3qsyzWBEBYvqVkz+uoOzQaLBlQfR9aZEN6j7MgtrYiAMjPr3RHmP3RHiphEvOprHT8mF8upHcVjljIsDm3lRzRFwaO6D0RmrEFClTawKE4klsWua3iZ/9vsktWfsmli0Rrd1Gn4irlEj+anrsdY/vKTES8qjM= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(376002)(346002)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(356005)(336012)(426003)(2616005)(86362001)(83380400001)(2906002)(47076005)(7636003)(36860700001)(5660300002)(82740400003)(4326008)(40460700003)(54906003)(110136005)(82310400005)(70586007)(186003)(70206006)(8676002)(8936002)(478600001)(36756003)(41300700001)(40480700001)(1076003)(26005)(7696005)(6666004)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:31.6180 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8675e8b7-af85-4e64-2a4f-08db712c1f1b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7557 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769182552657343787?= X-GMAIL-MSGID: =?utf-8?q?1769182552657343787?= Move the uffd*() routines to their natural home. Note that ksm_functional_tests.c also depend, intentionally (due to a recent commit [1]), upon uffd-common.[ch]. Cc: David Hildenbrand Cc: Peter Xu Signed-off-by: John Hubbard --- tools/testing/selftests/mm/Makefile | 7 +- tools/testing/selftests/mm/hugepage-mremap.c | 2 +- .../selftests/mm/ksm_functional_tests.c | 2 +- tools/testing/selftests/mm/uffd-common.c | 105 ++++++++++++++++++ tools/testing/selftests/mm/uffd-common.h | 12 +- tools/testing/selftests/mm/vm_util.c | 104 ----------------- tools/testing/selftests/mm/vm_util.h | 10 -- 7 files changed, 122 insertions(+), 120 deletions(-) diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 23af4633f0f4..a15572758954 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -109,8 +109,11 @@ include ../lib.mk $(TEST_GEN_PROGS): vm_util.c -$(OUTPUT)/uffd-stress: uffd-common.c -$(OUTPUT)/uffd-unit-tests: uffd-common.c +$(OUTPUT)/uffd-stress: uffd-common.c +$(OUTPUT)/uffd-unit-tests: uffd-common.c +$(OUTPUT)/hugepage-mremap: uffd-common.c +$(OUTPUT)/write_to_hugetlbfs: uffd-common.c +$(OUTPUT)/ksm_functional_tests: uffd-common.c ifeq ($(MACHINE),x86_64) BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32)) diff --git a/tools/testing/selftests/mm/hugepage-mremap.c b/tools/testing/selftests/mm/hugepage-mremap.c index cabd0084f57b..8158fe909f5e 100644 --- a/tools/testing/selftests/mm/hugepage-mremap.c +++ b/tools/testing/selftests/mm/hugepage-mremap.c @@ -24,7 +24,7 @@ #include #include #include -#include "vm_util.h" +#include "uffd-common.h" #define DEFAULT_LENGTH_MB 10UL #define MB_TO_BYTES(x) (x * 1024 * 1024) diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c index 26853badae70..648188ad73fa 100644 --- a/tools/testing/selftests/mm/ksm_functional_tests.c +++ b/tools/testing/selftests/mm/ksm_functional_tests.c @@ -22,7 +22,7 @@ #include #include "../kselftest.h" -#include "vm_util.h" +#include "uffd-common.h" #define KiB 1024u #define MiB (1024 * KiB) diff --git a/tools/testing/selftests/mm/uffd-common.c b/tools/testing/selftests/mm/uffd-common.c index 61c6250adf93..e1ad63668a05 100644 --- a/tools/testing/selftests/mm/uffd-common.c +++ b/tools/testing/selftests/mm/uffd-common.c @@ -6,6 +6,7 @@ */ #include "uffd-common.h" +#include "vm_util.h" #define BASE_PMD_ADDR ((void *)(1UL << 30)) @@ -616,3 +617,107 @@ int copy_page(int ufd, unsigned long offset, bool wp) { return __copy_page(ufd, offset, false, wp); } + +/* If `ioctls' non-NULL, the allowed ioctls will be returned into the var */ +int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, + bool miss, bool wp, bool minor, uint64_t *ioctls) +{ + struct uffdio_register uffdio_register = { 0 }; + uint64_t mode = 0; + int ret = 0; + + if (miss) + mode |= UFFDIO_REGISTER_MODE_MISSING; + if (wp) + mode |= UFFDIO_REGISTER_MODE_WP; + if (minor) + mode |= UFFDIO_REGISTER_MODE_MINOR; + + uffdio_register.range.start = (unsigned long)addr; + uffdio_register.range.len = len; + uffdio_register.mode = mode; + + if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1) + ret = -errno; + else if (ioctls) + *ioctls = uffdio_register.ioctls; + + return ret; +} + +int uffd_register(int uffd, void *addr, uint64_t len, + bool miss, bool wp, bool minor) +{ + return uffd_register_with_ioctls(uffd, addr, len, + miss, wp, minor, NULL); +} + +int uffd_unregister(int uffd, void *addr, uint64_t len) +{ + struct uffdio_range range = { .start = (uintptr_t)addr, .len = len }; + int ret = 0; + + if (ioctl(uffd, UFFDIO_UNREGISTER, &range) == -1) + ret = -errno; + + return ret; +} + +int uffd_open_dev(unsigned int flags) +{ + int fd, uffd; + + fd = open("/dev/userfaultfd", O_RDWR | O_CLOEXEC); + if (fd < 0) + return fd; + uffd = ioctl(fd, USERFAULTFD_IOC_NEW, flags); + close(fd); + + return uffd; +} + +int uffd_open_sys(unsigned int flags) +{ +#ifdef __NR_userfaultfd + return syscall(__NR_userfaultfd, flags); +#else + return -1; +#endif +} + +int uffd_open(unsigned int flags) +{ + int uffd = uffd_open_sys(flags); + + if (uffd < 0) + uffd = uffd_open_dev(flags); + + return uffd; +} + +int uffd_get_features(uint64_t *features) +{ + struct uffdio_api uffdio_api = { .api = UFFD_API, .features = 0 }; + /* + * This should by default work in most kernels; the feature list + * will be the same no matter what we pass in here. + */ + int fd = uffd_open(UFFD_USER_MODE_ONLY); + + if (fd < 0) + /* Maybe the kernel is older than user-only mode? */ + fd = uffd_open(0); + + if (fd < 0) + return fd; + + if (ioctl(fd, UFFDIO_API, &uffdio_api)) { + close(fd); + return -errno; + } + + *features = uffdio_api.features; + close(fd); + + return 0; +} diff --git a/tools/testing/selftests/mm/uffd-common.h b/tools/testing/selftests/mm/uffd-common.h index 6068f2346b86..a1cdb78c0762 100644 --- a/tools/testing/selftests/mm/uffd-common.h +++ b/tools/testing/selftests/mm/uffd-common.h @@ -19,8 +19,6 @@ #include #include #include -#include -#include #include #include #include @@ -110,6 +108,16 @@ int __copy_page(int ufd, unsigned long offset, bool retry, bool wp); int copy_page(int ufd, unsigned long offset, bool wp); void *uffd_poll_thread(void *arg); +int uffd_register(int uffd, void *addr, uint64_t len, + bool miss, bool wp, bool minor); +int uffd_unregister(int uffd, void *addr, uint64_t len); +int uffd_open_dev(unsigned int flags); +int uffd_open_sys(unsigned int flags); +int uffd_open(unsigned int flags); +int uffd_get_features(uint64_t *features); +int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, + bool miss, bool wp, bool minor, uint64_t *ioctls); + #define TEST_ANON 1 #define TEST_HUGETLB 2 #define TEST_SHMEM 3 diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c index 01296c17df02..c64a0134f83c 100644 --- a/tools/testing/selftests/mm/vm_util.c +++ b/tools/testing/selftests/mm/vm_util.c @@ -198,110 +198,6 @@ unsigned long default_huge_page_size(void) return hps; } -/* If `ioctls' non-NULL, the allowed ioctls will be returned into the var */ -int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, - bool miss, bool wp, bool minor, uint64_t *ioctls) -{ - struct uffdio_register uffdio_register = { 0 }; - uint64_t mode = 0; - int ret = 0; - - if (miss) - mode |= UFFDIO_REGISTER_MODE_MISSING; - if (wp) - mode |= UFFDIO_REGISTER_MODE_WP; - if (minor) - mode |= UFFDIO_REGISTER_MODE_MINOR; - - uffdio_register.range.start = (unsigned long)addr; - uffdio_register.range.len = len; - uffdio_register.mode = mode; - - if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1) - ret = -errno; - else if (ioctls) - *ioctls = uffdio_register.ioctls; - - return ret; -} - -int uffd_register(int uffd, void *addr, uint64_t len, - bool miss, bool wp, bool minor) -{ - return uffd_register_with_ioctls(uffd, addr, len, - miss, wp, minor, NULL); -} - -int uffd_unregister(int uffd, void *addr, uint64_t len) -{ - struct uffdio_range range = { .start = (uintptr_t)addr, .len = len }; - int ret = 0; - - if (ioctl(uffd, UFFDIO_UNREGISTER, &range) == -1) - ret = -errno; - - return ret; -} - -int uffd_open_dev(unsigned int flags) -{ - int fd, uffd; - - fd = open("/dev/userfaultfd", O_RDWR | O_CLOEXEC); - if (fd < 0) - return fd; - uffd = ioctl(fd, USERFAULTFD_IOC_NEW, flags); - close(fd); - - return uffd; -} - -int uffd_open_sys(unsigned int flags) -{ -#ifdef __NR_userfaultfd - return syscall(__NR_userfaultfd, flags); -#else - return -1; -#endif -} - -int uffd_open(unsigned int flags) -{ - int uffd = uffd_open_sys(flags); - - if (uffd < 0) - uffd = uffd_open_dev(flags); - - return uffd; -} - -int uffd_get_features(uint64_t *features) -{ - struct uffdio_api uffdio_api = { .api = UFFD_API, .features = 0 }; - /* - * This should by default work in most kernels; the feature list - * will be the same no matter what we pass in here. - */ - int fd = uffd_open(UFFD_USER_MODE_ONLY); - - if (fd < 0) - /* Maybe the kernel is older than user-only mode? */ - fd = uffd_open(0); - - if (fd < 0) - return fd; - - if (ioctl(fd, UFFDIO_API, &uffdio_api)) { - close(fd); - return -errno; - } - - *features = uffdio_api.features; - close(fd); - - return 0; -} - unsigned int psize(void) { if (!__page_size) diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 8aa543a3678b..f04f82771cd0 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -33,16 +33,6 @@ bool check_huge_shmem(void *addr, int nr_hpages, uint64_t hpage_size); int64_t allocate_transhuge(void *ptr, int pagemap_fd); unsigned long default_huge_page_size(void); -int uffd_register(int uffd, void *addr, uint64_t len, - bool miss, bool wp, bool minor); -int uffd_unregister(int uffd, void *addr, uint64_t len); -int uffd_open_dev(unsigned int flags); -int uffd_open_sys(unsigned int flags); -int uffd_open(unsigned int flags); -int uffd_get_features(uint64_t *features); -int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, - bool miss, bool wp, bool minor, uint64_t *ioctls); - /* * On ppc64 this will only work with radix 2M hugepage size */