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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B4E6C432BE for ; Tue, 31 Aug 2021 16:56:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E363261056 for ; Tue, 31 Aug 2021 16:56:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240257AbhHaQ5v (ORCPT ); Tue, 31 Aug 2021 12:57:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:54952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238852AbhHaQ5t (ORCPT ); Tue, 31 Aug 2021 12:57:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D38B46103D; Tue, 31 Aug 2021 16:56:52 +0000 (UTC) Date: Tue, 31 Aug 2021 17:56:50 +0100 From: Catalin Marinas To: Linus Torvalds Cc: Christoph Hellwig , Will Deacon , Linux ARM , Linux Kernel Mailing List , Android Kernel Team Subject: Re: [GIT PULL] arm64 fix for 5.14 Message-ID: References: <20210826131747.GE26318@willie-the-truck> <20210827074041.GA24309@lst.de> <20210827171041.GA28149@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 27, 2021 at 10:16:27AM -0700, Linus Torvalds wrote: > On Fri, Aug 27, 2021 at 10:10 AM Christoph Hellwig wrote: > > They CCed me on their earlier discussion, but I did not catch up on it > > until you responded to the pull request If I understood it correct it > > was about a platform device mapping a MMIO region (like a PCI bar), > > but something about section alignment cause pfn_valid to mistrigger. > > Yeah, so I can easily see the maxpfn numbers can easily end up being > rounded up to a whole memory section etc. > > I think my suggested solution should JustWork(tm) - exactly because if > the area is then in that "this pfn is valid" area, it will > double-check the actual underlying page. > > That said, I think x86 avoids the problem another way - by just making > sure max_pfn is exact. That works too, as long as there are no holes > in the RAM map that might be used for PCI BAR's. > > So I think arm could fix it that way too, depending on their memory layout. The suggested solution in the original thread was to change the generic DMA code to use memblock_is_memory() instead of pfn_valid(): https://lore.kernel.org/lkml/b720e7c8-ca44-0a25-480b-05bf49d03c35@redhat.com/ Given how late we discovered this in the -rc cycle, the decision was to revert the pfn_valid() patch. We'll re-instate it at some point but someone needs to sanity check the other pfn_valid() call sites and the expected semantics. -- Catalin