Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2175177rwd; Sun, 28 May 2023 09:33:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Yjax7t4oMXnW9/CD03QcLEe5ACaFXjp8jv1yinR06tkZyd3dtd60XYMYX9vIrmxS7fiRL X-Received: by 2002:a17:90b:1c12:b0:255:dc71:737d with SMTP id oc18-20020a17090b1c1200b00255dc71737dmr8572919pjb.43.1685291583356; Sun, 28 May 2023 09:33:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685291583; cv=pass; d=google.com; s=arc-20160816; b=AZ+Ks+GOv0x84zwQ0hWS5K1YLzFbA+EbT97REfQL9fcoeUj91WjelalafBoAKW97kn WEjnSydKFw7cluXqzOEuNWkJxN4gWTqeW3RMS1pP4f89jKJVd9xVZLq7tq5oEepqO5XW Siqm6FiaRZw8iOqaG2RZgr427HiEyoKoJ/wh3oV5mMjnCJ2tKuU5tQSWRENke4xfISOR r7m6aMg1GGzvpE5Ae8lxDXp9Yoy8dD0Fts+FvGIMqTLMTDz63k3vj8WKAf+FWyyDyC5Q v9YwHsC0QuaTvtY8MzfpY96l+nzmzQwgK8zC+ihWCan1aLFJ//RqDWHyWmbkDqCSYaia L7Jg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IE3aLbFzfbyCaa4VUjajZbfNckV1Azuo35Q0Mcm/LEQ=; b=Z4PBh4SKPrl6oHYqMlhhQ6tWMEX0lwEnWr0dYjxMP0M44fDLo3loyUK+fAC+s3n9Ol wvWineBbgKUTONaIG6WRwpVx900nMsI1J792X8EQIHw0M6LbP1JAM9hjEZCOI3aHuAc7 /o2H2u5fyUHbgmG3oBw+WnUlt5fo0E88z1mCd7UBr68jidcGMWGjx4jUj9p1YKaA7pIk W4+STdCV6FKALkKp6e8OQg9m8LD1Cwh9FuaQmloIUOC/Hi/L6uGW27hlHVUbiYTaHafX KK2KjnVQsW06pajcFs429yD2crQYeSv+vz02A4jrY+qySCEijBYQ9LBBKgNA9/P2V3h1 5JMA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="fIvNK/CI"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk2-20020a17090b4a0200b0024e1172c1d5si6514915pjb.155.2023.05.28.09.32.50; Sun, 28 May 2023 09:33:03 -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="fIvNK/CI"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=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 S229660AbjE1QWe (ORCPT + 99 others); Sun, 28 May 2023 12:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjE1QWc (ORCPT ); Sun, 28 May 2023 12:22:32 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2079.outbound.protection.outlook.com [40.107.94.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DF4DB9; Sun, 28 May 2023 09:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jYms2NDHR+Yc1v4DrQaUF4DvQWDZhrvCJz11PpDh0zOSnOGnd5t9r0OR6uYbIo1ar6z4rGy+UVRO4CCqNfiUb/4hHxT0AmSrrFpCz5pQPVxUzbpjeDmcJ91kN4aBrLg8pNvuZtvBPZWYBwXUTZaynwpG9BnPHYLoCcqHB6GEhkgtLZZurT79xQyRk36LbEtv+af11V0WgpxZmvPmy+BYP/bXtEK9jQ+LRMeYUvH4QBDM7vkqgFTNjI5++m8EV6PZLBgZVv29ocFYBAHckDWvqvEcnkP+vI+vm5iwjpb7x4stG2Fk7ecGbEpaNGzQ2bpbpHd6/J56rC9K3QsUR1Tb0A== 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=IE3aLbFzfbyCaa4VUjajZbfNckV1Azuo35Q0Mcm/LEQ=; b=MlcViFxbxjW0reX6KWnpCx77ZodWQcWzmSS7divsPmIImdI1KrAUElvbuEtmzmN6hTqU0GO4e8nFiWi4MysFt9lDG+6Mn0n10tXMKb5Rr8Ztxt/N9NRQLfVk+9vMR7H0x6l3JDta9G19OFcYh4AE9YeRQkDimGj5N8X5GrAwu0J2RlcfYnseZ1Q88FYPny+faHq9sllZnb+kMlCQCxBD1RdilnSFibrVXhGNVO6yZOAGuJUqMGRtoQ+GM1TPcUczaVE/4+eu7VbagQTgqhCuL294+o8zw27MN924IXqd918SObCCd6M8e4R4BPKULkgDQtFgWPHiqJOvYZaWUksXCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IE3aLbFzfbyCaa4VUjajZbfNckV1Azuo35Q0Mcm/LEQ=; b=fIvNK/CIf7Yrl7dtCU1VxFni1ShE5XlKOVZAH5FYWhMJCLH7ym2CuCN0w5P5oDM0uhbwhKfUALqL3Z4U3ZUPnKHa8/atlDlB6NghsBilDE/JXxYVqTEBfDWZlJkZgVR2KDHIL7x1/PWFZc57tKiQK6oaK9Q/mn+kSLinNfx8SoFXifEV9T0CPHfAEPNCd6N0VeyrEDBeOAKlbtamAYxcAt3BxJujdO0k/x6Yy9xu8eKZYW6+xhZ8lLCvCSpwoV8G/b/Ma5fzicCdfBqafHDh9PjURnUK6/0q6rzBlxuPzeO97PxT34KWdyc+2JQF8jctAdUUjbJOKjLjHei2paOFmw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by CH3PR12MB7690.namprd12.prod.outlook.com (2603:10b6:610:14e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.22; Sun, 28 May 2023 16:22:21 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab%6]) with mapi id 15.20.6433.017; Sun, 28 May 2023 16:22:21 +0000 Date: Sun, 28 May 2023 13:22:19 -0300 From: Jason Gunthorpe To: Lorenzo Stoakes Cc: Arnd Bergmann , Andrew Morton , Arnd Bergmann , Catalin Marinas , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH] [suggestion] mm/gup: avoid IS_ERR_OR_NULL Message-ID: References: <20230519093953.10972-1-arnd@kernel.org> <5b071f65-7f87-4a7b-a76a-f4a1c1568ae7@lucifer.local> <1ca47b8a-292c-47ab-aa6f-ca24fdfc0d3c@lucifer.local> <0bc9dc2b-0da6-4d5c-96af-e21aa287eecb@lucifer.local> <617c2e26-8450-4a35-9b47-c0482921f030@lucifer.local> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <617c2e26-8450-4a35-9b47-c0482921f030@lucifer.local> X-ClientProxiedBy: MN2PR01CA0019.prod.exchangelabs.com (2603:10b6:208:10c::32) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|CH3PR12MB7690:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d54f8ba-419a-489c-f6a7-08db5f97b66b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gGcHrRVwpASTm5kLQttkysOX2FhbQikQsA/B4SOb93KCONXMQvc5D+MRsNOy2HYsJggLTEPXbTmWUqahz/3TzALxXm+ZSNV0cWtGSnY8mEXksXJ5YLe7BeCO0lUEjuGF5raAaDRS+qZABpF/jQ9vwCSO5Y3b0qxuBnENJYrxTxRFXipuAQ7Cdnst8Qiw0leSl6vWmv2ERnYvPJ0N4srbqovDlimCN3ai5bVfnVpS+bvF6BmrG+LnQZtczCGJvFdB1M/tWzyq1G2CNO6exzgcVJQWnb5GtOdZYNCzPZ+e1sBdsPjMphctRBfCJi3Exd5e9ksE9cEdxujRtlL+w9rqptUbkshlldW5tMkdxKvuoEOh7OQEU5d7x6uqQLcZsFxFNTOyXazSX92Qklxl9c4brSGG63qzSsj3dIrOsODRyKbolBJPDr5uFjQuHPlk9G55qZ7LrHMO5CtzehU0PCoom18+2pxJvoMjBEuuZMCK3CaxQWxQK+NDiuNdZRnoxvLr0OSuA1rUmnRZ/CDeopcpvuydix8JFw7Gpj7Dq86xCjXa1H0m91odIWRqT2Gl6eIb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(376002)(346002)(366004)(396003)(451199021)(6486002)(86362001)(41300700001)(6916009)(4326008)(316002)(66476007)(66556008)(36756003)(66946007)(7416002)(5660300002)(186003)(2906002)(6506007)(6512007)(26005)(2616005)(83380400001)(38100700002)(478600001)(54906003)(8676002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?n6jEK66z4Azqz9222LSywSYczi2Vtxsu5sVhl3Xp5t7++AOI91E1XYwsHi+i?= =?us-ascii?Q?qkSHLaaP5nd7YMHrTZjsdEJSSMAJYIwtx7RIaMkbWcjb2AEz/VST0y6AkLUK?= =?us-ascii?Q?xuQ8iUCgC5yr1D6I8L8GVUJC4vKPTL5IzhG6ATXMsHeVXT4LERp6T692JJfl?= =?us-ascii?Q?ChX3mmvsJ0D2rcZgVvbeeiqHXolU+GE7xckbTz25K3oRl9gVjfSUjx/pMai+?= =?us-ascii?Q?jFZY7VZj1y5WvIpvlxb3ZxEenWXTpnZidvKG2IyJ7ZFbN+1iBqrnwPivz45x?= =?us-ascii?Q?g7oGbFkloaoZobrJFNaevIRhI+cEfSvWRSrxWxZa/SXkRkWbRYtQ+4B8bBjP?= =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WIzq2etIiF6fARuCQXV7Fqrka?= =?us-ascii?Q?Kq9Dm/JPZkL3T8OGd4Grm5sIQ+UB6CZYSucy6w6yhp7gVZXM6wKNVfxG9e7y?= =?us-ascii?Q?Ssy7BjVuG434Ooiz9M7yp93iMMuydsgl9ov7K6XauqcXVHC+LfWkfTcv7Qpn?= =?us-ascii?Q?/VNz1P0sWQ7cxExeEjW0zLWFPaC4La8rRwKHC+pKIvG3RxXpefZqHvN43Ncy?= =?us-ascii?Q?/Y3ZuhGfbElHbwdS4ld/hE6drzPs2GX7Ytg1S1tmWmcvDnjXQAhP++cVMU7n?= =?us-ascii?Q?xLDfhrjHMHZgxUCE1MdSKBRpfSectsDZ/f8mHcjaVUKtxQoo4DfWqNNBM0c7?= =?us-ascii?Q?z5BQkFYBjH6xEHJPOzw=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d54f8ba-419a-489c-f6a7-08db5f97b66b X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2023 16:22:20.9819 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F4FBulXovieQH3xwbLotTcxuLq6DbuVU+jJVp74BQXsF+buXIV65bQIX8kQHbzQk X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7690 X-Spam-Status: No, score=-2.3 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 autolearn=ham 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 On Sun, May 28, 2023 at 04:13:44PM +0100, Lorenzo Stoakes wrote: > On Sat, May 27, 2023 at 06:52:01AM -0300, Jason Gunthorpe wrote: > > On Sat, May 20, 2023 at 10:12:40AM +0100, Lorenzo Stoakes wrote: > > > > No, this returning 0 on failure is a foot gun. Failing to pin a single > > > > page is always an error, the only question is what sub reason caused > > > > the error to happen. There is no third case where it is not an error. > > > > > > The uprobe path thinks otherwise, but maybe the answer is that we just need > > > to -EFAULT on missing VMA and -EPERM on invalid flags. > > > > I think uprobe is just broken to think there is a third outcome. Let's > > just fix it instead of trying to pretend it makes sense. > > Sure, will take a look at that if I get a chance. We can at the very least > adjust get_user_page_vma_remote() with this fixed. > > Do you feel that a partially successful pinning for other GUP callers > should equally be treated as an error (and pages unpinned -> return error > code)? In that instance we'd need to audit things somewhat. That seems more deeply ingrained at least, I'm not as keen to change it as to get rid of the 0 return result. Jason