From patchwork Fri Jun 10 22:35:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 12878143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96EACC43334 for ; Fri, 10 Jun 2022 22:35:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4F188D00EC; Fri, 10 Jun 2022 18:35:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BD6F58D00E2; Fri, 10 Jun 2022 18:35:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A515B8D00EC; Fri, 10 Jun 2022 18:35:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8FCF88D00E2 for ; Fri, 10 Jun 2022 18:35:27 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5165C34BD7 for ; Fri, 10 Jun 2022 22:35:27 +0000 (UTC) X-FDA: 79563783894.02.A09FC58 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 934F0A0060 for ; Fri, 10 Jun 2022 22:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654900526; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=brhqSH0cfxiVMdkhaA/t1am/po1k847+vpjU5c9Z/Ic=; b=Dqgp7c2b6YoThDb7y22GLOY3oiRKaohzjNR+MMO2MPK/078dFnlVDuXI6l0aZ/q64Lc1cM GIZvfHoFGYxwo/RzTdwy9J5iSzDne5RCUobnBEM05PIX6VuwuAYZ0isOm2g3j9uz9FrxVy IL1LbG9X2GynvkMf8nf+IxJGjyvqMak= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-ERtf0sUvPCO1L59yA4nI4Q-1; Fri, 10 Jun 2022 18:35:15 -0400 X-MC-Unique: ERtf0sUvPCO1L59yA4nI4Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F32FE801755; Fri, 10 Jun 2022 22:35:14 +0000 (UTC) Received: from [172.30.41.16] (unknown [10.22.35.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B37EC23DBF; Fri, 10 Jun 2022 22:35:14 +0000 (UTC) Subject: [PATCH] mm: Re-allow pinning of zero pfns From: Alex Williamson To: akpm@linux-foundation.org, minchan@kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, paulmck@kernel.org, jhubbard@nvidia.com, joaodias@google.com, jgg@ziepe.ca, david@redhat.com Date: Fri, 10 Jun 2022 16:35:13 -0600 Message-ID: <165490039431.944052.12458624139225785964.stgit@omen> User-Agent: StGit/1.5.dev2+g9ce680a52bd9 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1654900526; a=rsa-sha256; cv=none; b=weC/6DwMR0eux/wJJ37zm8WA2ZskrGlgVs0ChpHTgWlpMHFMkHk3wcawxaKMPnnI/Mxy3L K+9hyhn2g1sYpRoVJd4QnKKa8wjXRazscaTi07n2NkB3Hw7b0lmvFPCDGD7ACMsHMXcTUY CXV9gJr//xpTLML9Wf8gCYIue5fCIbw= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Dqgp7c2b; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf15.hostedemail.com: domain of alex.williamson@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=alex.williamson@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1654900526; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=brhqSH0cfxiVMdkhaA/t1am/po1k847+vpjU5c9Z/Ic=; b=ZcHLcyqDXUKVWSzqnd00QczmMDrlzyCJzpkazRwfzv22Do+FTF1x1lkfrDO4tO5tbZMMQz AYZHrFkepEXylEKH476iwJhwgO40c1QY9CPEetygBIfOCZv03GewN6a1611aab2huq1YLL 3XivGjBL07rRFT+e0p+ISzkscurTT98= X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 934F0A0060 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Dqgp7c2b; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf15.hostedemail.com: domain of alex.williamson@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=alex.williamson@redhat.com X-Stat-Signature: iopr8ny9w4bgazgmy37spcc61b3cjbf3 X-HE-Tag: 1654900526-827227 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The commit referenced below subtly and inadvertently changed the logic to disallow pinning of zero pfns. This breaks device assignment with vfio and potentially various other users of gup. Exclude the zero page test from the negation. Fixes: 1c563432588d ("mm: fix is_pinnable_page against a cma page") Signed-off-by: Alex Williamson Acked-by: Minchan Kim Acked-by: David Hildenbrand Reviewed-by: Alistair Popple --- At least I assume this was inadvertent... If there's a better fix, please run with it as I'm out of the office the 1st half of next week and would like to see this fixed ASAP. Thanks! include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index bc8f326be0ce..781fae17177d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1600,7 +1600,7 @@ static inline bool is_pinnable_page(struct page *page) if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE) return false; #endif - return !(is_zone_movable_page(page) || is_zero_pfn(page_to_pfn(page))); + return !is_zone_movable_page(page) || is_zero_pfn(page_to_pfn(page)); } #else static inline bool is_pinnable_page(struct page *page)