From patchwork Tue Aug 9 04:42:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 12939343 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 87CEBC19F2D for ; Tue, 9 Aug 2022 04:42:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 772B86B0071; Tue, 9 Aug 2022 00:42:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 722268E0002; Tue, 9 Aug 2022 00:42:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 612368E0001; Tue, 9 Aug 2022 00:42:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 555286B0071 for ; Tue, 9 Aug 2022 00:42:31 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1B59B402BD for ; Tue, 9 Aug 2022 04:42:31 +0000 (UTC) X-FDA: 79778808102.16.674518F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 469BD160043 for ; Tue, 9 Aug 2022 04:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660020149; 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=BlkMUNnQfHAAc9Zb2R9TXNs9DLVuz8hzAnIjW1VF8OI=; b=SasCES8GCC4Qa2/Lmb81Q84ZTt8gCAOXAFydg+FFIfkIvLO2jX2zhRbQT9J6yNZx5NzHsk krfeha9XkfNHqZzlFNBQpgOWJysFMS2pooazHDOagTmQVGE3l9NlVhPK6+GviMDtaLI8mP 0zfhxCbKEd04tb7kvpRMrK8aOe4FgVg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-159-kG-sxVehO-qafeikoZmd3Q-1; Tue, 09 Aug 2022 00:42:26 -0400 X-MC-Unique: kG-sxVehO-qafeikoZmd3Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35FE73C01D9B; Tue, 9 Aug 2022 04:42:26 +0000 (UTC) Received: from [172.30.41.16] (unknown [10.22.18.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B4732026D4C; Tue, 9 Aug 2022 04:42:25 +0000 (UTC) Subject: [PATCH] mm: re-allow pinning of zero pfns (again) From: Alex Williamson To: alex.sierra@amd.com, akpm@linux-foundation.org Cc: hch@lst.de, Felix.Kuehling@amd.com, apopple@nvidia.com, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Mon, 08 Aug 2022 22:42:24 -0600 Message-ID: <166002010021.381133.11357879752637949308.stgit@omen> User-Agent: StGit/1.5.dev2+g9ce680a52bd9 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SasCES8G; spf=pass (imf08.hostedemail.com: domain of alex.williamson@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=alex.williamson@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660020150; a=rsa-sha256; cv=none; b=Zcpj3O5RCCCrj6ekO+M8hnrZb9B5KCA69MM7aCl8jbw0ZUu0Ou0F79/khI21PcCiKruj0Y GSOhM+cxKgayf+IurDvMwZcSpvb3HlJyQenoUqQlNGfdop2hG/xvT97r7NvghV6BzbeLVI 3ON8IyZfYJT0yGcdFweoDRQhGVPWVdQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660020150; 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=BlkMUNnQfHAAc9Zb2R9TXNs9DLVuz8hzAnIjW1VF8OI=; b=tPOg7dh0/vcllGB4tbSgAH46PvIGtFD7QrbeNdLYwMOy3S2nmeZB+FaFZBQ5SFxQSWFxGJ r9SUDke6iPF7IjOCV7OJHoo9iZ4b9yKNDZ6NENzFCLJoikX8fyrbmMUH6/8RwNNl93mrFu ZrtstVCwUrfet6yXRRNgENIa5GZkBEQ= X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 469BD160043 X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SasCES8G; spf=pass (imf08.hostedemail.com: domain of alex.williamson@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=alex.williamson@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: 5wc61wi6iowyyhhonouiwrxe15hg1dpw X-HE-Tag: 1660020150-439547 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 below referenced commit makes the same error as 1c563432588d ("mm: fix is_pinnable_page against a cma page"), re-interpreting the logic to exclude pinning of the zero page, which breaks device assignment with vfio. Link: https://lore.kernel.org/all/165490039431.944052.12458624139225785964.stgit@omen Fixes: f25cbb7a95a2 ("mm: add zone device coherent type memory support") Signed-off-by: Alex Williamson Reviewed-by: David Hildenbrand --- include/linux/mm.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 18e01474cf6b..772279ed7010 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1544,9 +1544,8 @@ static inline bool is_longterm_pinnable_page(struct page *page) if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE) return false; #endif - return !(is_device_coherent_page(page) || - is_zone_movable_page(page) || - is_zero_pfn(page_to_pfn(page))); + return !(is_device_coherent_page(page) || is_zone_movable_page(page)) || + is_zero_pfn(page_to_pfn(page)); } #else static inline bool is_longterm_pinnable_page(struct page *page)