From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0157CC77B7C for ; Sun, 28 May 2023 15:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EoRJROCeB+Xa5ep/pTwvwH17k9B6aqPH3UzxbZDbuXY=; b=lNwKHN/VHNwcnK 98AtLOtL7FWIiNV7tj1PnjsmFKRWL9e+AzbRRvvzoiIzmqPIh0uZP48QZN2G1Caus2jNAgfDjnm85 sBQdEAehKn74c9Gl08QgmrSJuevpPlP7xhf5wOzUSKPcswveoAO5nl8BXODkepQUdLw3zAhkADjZl RrUPVYCxXaplbsOiAl7gOGF481nssCQWJ+2Mi0sIMvFTRuZLubHcEfGlTnww/87WcJv1pleFTNTsR wc1oQalGa0krpV9Q19VXtqvCmK3D6IUHmJcGswSFN5hsA0dCd50PY1hp2N2+ESib+UVWu0tFZqL4D w7jW4ijn2y2LvmxQRCmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q3I5j-007vnn-0B; Sun, 28 May 2023 15:13:55 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q3I5g-007vmE-0H for linux-arm-kernel@lists.infradead.org; Sun, 28 May 2023 15:13:53 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f6d7abe9a4so16237005e9.2 for ; Sun, 28 May 2023 08:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685286829; x=1687878829; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nO6qPJGhbjer7by395A2CsUOuGSa2fR1VydRgyfgHDk=; b=erfNpbFotB7E5jbaibixeaXmG8s3AeHT+jv50Gvw5fWKrTxcSlogKtUnvkQDzVYHbC DU1nrE3zjmfjM8zJ+arAlbBfxBynyKcfIfHWLVTSUttPOanjuM/4HA+8ZUjcHIdajuFD I8639rk7UEoYJqlssesl2bLMvoqxqNGX6jJMHHEtwn1IcixeTR5sZz5Hu46A6c8riWmF gVt3WlLQZGN6onadje4GFsBhdgXeJoK/BQHPpnpFS/UTpkmNAlhJAEg6dnaz/1DpNToe AMO0BSVYJeGCcTxNlZLGnpPmtWWUliM7nD7RE1Rh4s7MFf9Yu9fkrC03OB5bAGMY/Ux1 NB1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685286829; x=1687878829; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nO6qPJGhbjer7by395A2CsUOuGSa2fR1VydRgyfgHDk=; b=aLf4WZZ0ntOQVE6Ms6pfmxHwl7GyGoEujYCcB+PQiSD80azKuH3gp5lz7ADPdiD/h+ XmKuLFLQtLgFpBSND+FoNi06UYTv347XswwVzFC1S4M0JoBx8TNlU7LDUOqtQG0SAx3c Nl4q9zRsxFF34HSK9M6w03zhtPriTPrQ09fuAdphjUceDz5JxTQQMqgl1u7Zy7QYLiiM IYYfYTjkYyv1Dmj37F98TAxC0C2itj9UOTOayqtKbWo06mu937y8nBd3Mpes8Qm5y9wG gTS59FZG6WUtBHt48S8XpqhMLtkq7tYYI02PU/VLQ+ehGtEhC1DtmIkR1ldgRJ7sGAwp 7N1g== X-Gm-Message-State: AC+VfDz0fplvBys2oKF/QhPRkCqNDgf0ywkE8q/WDxK6uZZTO2aRBWUz wVZA01x+snof4s7qm6TJzmo= X-Google-Smtp-Source: ACHHUZ6upY0LxibB0+d/OjXuVJ8gDVl67OPt4kAEPLpVmfcLyBt7kE5+uyvnqX2TM52So4QBcmzDtQ== X-Received: by 2002:a05:600c:214f:b0:3f6:97e:b45d with SMTP id v15-20020a05600c214f00b003f6097eb45dmr7130383wml.24.1685286826878; Sun, 28 May 2023 08:13:46 -0700 (PDT) Received: from localhost (host81-154-179-160.range81-154.btcentralplus.com. [81.154.179.160]) by smtp.gmail.com with ESMTPSA id v7-20020a05600c214700b003f4f89bc48dsm15111555wml.15.2023.05.28.08.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 May 2023 08:13:45 -0700 (PDT) Date: Sun, 28 May 2023 16:13:44 +0100 From: Lorenzo Stoakes To: Jason Gunthorpe 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: <617c2e26-8450-4a35-9b47-c0482921f030@lucifer.local> 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230528_081352_122178_9146BAFB X-CRM114-Status: GOOD ( 23.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. I have a couple more GUP cleanups saved up, so could add that to my queue of things to look at between book work :) > > Jason > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel