Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp577672iol; Sat, 11 Jun 2022 11:50:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhk7KtesIGZR7w7Mtn5T35B9obOqlHox1qTA5NJpw+2JljzLqNEyXbfQXoz7yOW1ov6S4k X-Received: by 2002:a17:90a:408f:b0:1d1:d1ba:2abb with SMTP id l15-20020a17090a408f00b001d1d1ba2abbmr6395166pjg.152.1654973402127; Sat, 11 Jun 2022 11:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654973402; cv=none; d=google.com; s=arc-20160816; b=tVS6b4AUrQX4x0dv1YRyO7GusikvQcFGzC2VNnN92681KG4+xEMc8Yn5jjf0/uXf/a MeFtaYjjGg2d9sFxvcmv4gfQOMGyIhKjzJ2lMqxzjX/XpRdTFZM9z83DHcBsOUCkVQ0U hgza3LGOUk2RopKX5hwsiOA2wKa5PsqUA+BmJ9cFyntcxVhacIjOhc9eIqvaLoC3cwUK V5lYIMziDFc+mf8pZpOZbwqN7yPX+YmDuGV6sYWyQqJ1KHHUlLIws7U5RW2TdoTNk14i Idsljf9AcxPpIxOaeU4a23CrQE7GyyDubjhZSBbLSJX20FUAcaVvjY/xmg89jIctOMGK nTyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=pcxlPosDuNYZLF+xkyfBuM18/wNn6c4mtAX4pgyPBoM=; b=SAi5cjnfoUg+lhsYjGtuKKfoCHYETKnwJM4RpW6X2cz+TUI650rDSn6SW+PkhOyGAD 62YTgaZ3EsGkO0hQlzuxf1hs4YziXsvL8dLoa7Vn5CXYrMGLn856JilbftQHZUSAGnQW tUL20luUmhOKOSHmTdfeE2qoShfzbEM2lK+vANU56GSmV3PORI4db7sntrRbRANAKedX Ift/yVll+J2uxyYqek9AsWJ1a+oE0aWc+B1ReZ5dD+DtpAdCtY35oOP6nbatWDV1F4ME 8Eus6leZs76v3a8gvoiOg2xwBav0WkFEHfYk05TL5kLxW0pYjAyZaS/E/wetoU7Yf6xt 55Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ePeFudFC; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a65594c000000b003fdbc3c8301si3432467pgu.662.2022.06.11.11.49.50; Sat, 11 Jun 2022 11:50:02 -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=@redhat.com header.s=mimecast20190719 header.b=ePeFudFC; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230074AbiFKS35 (ORCPT + 99 others); Sat, 11 Jun 2022 14:29:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbiFKS34 (ORCPT ); Sat, 11 Jun 2022 14:29:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 38A9331DF6 for ; Sat, 11 Jun 2022 11:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654972193; 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: in-reply-to:in-reply-to:references:references; bh=pcxlPosDuNYZLF+xkyfBuM18/wNn6c4mtAX4pgyPBoM=; b=ePeFudFCCDGY04ZeegNWbbFJghLadIh6+WKyk8exsido+JdRHV4+Y2yrX+dw7y39z7XnyY UWUe49kNumxWFaq/Z73TP8uv79OhRmyGNZ6vqsEWCVxX3Gw7DNCVnSYTastVcgiujNEixZ LnKOBUpO9j6DgN+7UGvNkymEoynvD8o= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-625-PF_55YNENt67CvBYqOhIhg-1; Sat, 11 Jun 2022 14:29:51 -0400 X-MC-Unique: PF_55YNENt67CvBYqOhIhg-1 Received: by mail-wm1-f69.google.com with SMTP id o2-20020a05600c510200b0039747b0216fso3235385wms.0 for ; Sat, 11 Jun 2022 11:29:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=pcxlPosDuNYZLF+xkyfBuM18/wNn6c4mtAX4pgyPBoM=; b=GVtdEFQr7GAy2VguElSW8zo0zGrNNohSfM534kmR0Z2j70NajUwqCO5xetIC42m9Im YwB/H/KmkBZ/jPiYUnn7Wqqt+ODyLFDcQscaBFYquIwkFVGsfWgoEHqW9hWP05Q5rawn HOXxKPtIPtS71ujz55l6UP8QB9zpYKoZXOJt2WhnvOC4kw70HZ94pOiwO7EMZDq7X/7v u+aQyuDLHAzIW6QVZ4S+GdGWHPcWiXSPf9xht/ypaDHoOFNutA0uKX5TmoIDaxz3gfcs bpxItgiW5jU60z0tot+jRnCbeFd5/I6hO+NySFEaWgBKDDxXkopaOhnRKENIq9Lft8RW 0gQA== X-Gm-Message-State: AOAM533juM7vBbsguMvI02zbGMa3O0eH9t/Uu9UQf1PQ2fC//wUrUTbO Qv5cUSzdrqMqBhoIHdH0xHlv+A7a31i0Zp/2xYM89H0gkPpXfTrZi4SKTysjf5/a4tDDQX7wq4y IviS83I7e9thX3bsZc/v10XX0 X-Received: by 2002:a05:600c:3790:b0:39c:7dc2:aea0 with SMTP id o16-20020a05600c379000b0039c7dc2aea0mr6010385wmr.112.1654972190627; Sat, 11 Jun 2022 11:29:50 -0700 (PDT) X-Received: by 2002:a05:600c:3790:b0:39c:7dc2:aea0 with SMTP id o16-20020a05600c379000b0039c7dc2aea0mr6010368wmr.112.1654972190341; Sat, 11 Jun 2022 11:29:50 -0700 (PDT) Received: from ?IPV6:2003:cb:c719:c400:dc43:2462:b7e5:dd7e? (p200300cbc719c400dc432462b7e5dd7e.dip0.t-ipconnect.de. [2003:cb:c719:c400:dc43:2462:b7e5:dd7e]) by smtp.gmail.com with ESMTPSA id p24-20020a05600c1d9800b0039c8a22554bsm728282wms.27.2022.06.11.11.29.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Jun 2022 11:29:49 -0700 (PDT) Message-ID: Date: Sat, 11 Jun 2022 20:29:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-US To: Alex Williamson , 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 References: <165490039431.944052.12458624139225785964.stgit@omen> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH] mm: Re-allow pinning of zero pfns In-Reply-To: <165490039431.944052.12458624139225785964.stgit@omen> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 11.06.22 00:35, Alex Williamson wrote: > 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. I wonder which setups can reliably work with a long-term pin on a shared zeropage. In a MAP_PRIVATE mapping, any write access via the page tables will end up replacing the shared zeropage with an anonymous page. Something similar should apply in MAP_SHARED mappings, when lazily allocating disk blocks. In the future, we might trigger unsharing when taking a R/O pin for the shared zeropage, just like we do as of now upstream for shared anonymous pages (!PageAnonExclusive). And something similar could then be done when finding a !anon page in a MAP_SHARED mapping. > > Fixes: 1c563432588d ("mm: fix is_pinnable_page against a cma page") Having that said, it indeed looks like that was an unintended change. Acked-by: David Hildenbrand > Signed-off-by: Alex Williamson > --- > > 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) > > -- Thanks, David / dhildenb