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=-6.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 C515CC4338F for ; Wed, 25 Aug 2021 10:54:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4AF69610F8 for ; Wed, 25 Aug 2021 10:54:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4AF69610F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DD22E6B006C; Wed, 25 Aug 2021 06:54:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D81736B0071; Wed, 25 Aug 2021 06:54:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C95FA900002; Wed, 25 Aug 2021 06:54:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0051.hostedemail.com [216.40.44.51]) by kanga.kvack.org (Postfix) with ESMTP id AEABA6B006C for ; Wed, 25 Aug 2021 06:54:52 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 63F531828A81E for ; Wed, 25 Aug 2021 10:54:52 +0000 (UTC) X-FDA: 78513295224.29.768F2E7 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf28.hostedemail.com (Postfix) with ESMTP id 1A20D90000AD for ; Wed, 25 Aug 2021 10:54:52 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 8B3DE610D0; Wed, 25 Aug 2021 10:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629888891; bh=43dMkUgGcDYcyzWnolvQYPW9uYzAg+QlRlBiAYcHEqk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HTPiJObERgLnfoiCA+F1nMwZZ86Km8eMk/fEw72ai9DIWymU2fxJhScwVftlUfCBz 2nFJNucUUqJRrqJsXwboQwWqVBHyE1/KR1xSezpLFqa4Zsafe6QVI1sjQi1vwfLS3K LOefmynFQuDZO2qS0HQMaf/cI5YiKayJ07+n9DbL2N2vQUXG9DS37Pd6eUhrUavVPx SFN7Tfdo5cEyW4pvGTChmeFAtI9bnm+6DP8nhSnJgNOFvGns7UlNAd+shdGBOl+ZuZ B4ttJCYCo61dFcyiPpde6NMyaSFHFrgwIWkoCuvH4SMTJrWIhrMEyP+tbXA/n4flKW vbTbvJxvor/RA== Date: Wed, 25 Aug 2021 13:54:45 +0300 From: Mike Rapoport To: David Hildenbrand Cc: Catalin Marinas , Robin Murphy , Alex Bee , Will Deacon , Andrew Morton , Anshuman Khandual , Linux Kernel Mailing List , linux-mm@kvack.org, Linux ARM , Christoph Hellwig Subject: Re: [BUG 5.14] arm64/mm: dma memory mapping fails (in some cases) Message-ID: References: <20210824173741.GC623@arm.com> <0908ce39-7e30-91fa-68ef-11620f9596ae@arm.com> <60a11eba-2910-3b5f-ef96-97d4556c1596@redhat.com> <20210825102044.GA3420@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 1A20D90000AD Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HTPiJObE; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=rppt@kernel.org X-Rspamd-Server: rspam01 X-Stat-Signature: sbstdqqotth55z3seb8cirkgkoydc4o6 X-HE-Tag: 1629888892-477330 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: On Wed, Aug 25, 2021 at 12:38:31PM +0200, David Hildenbrand wrote: > On 25.08.21 12:20, Catalin Marinas wrote: > > > I can see the documentation for pfn_valid() does not claim anything more > > than the presence of an memmap entry. But I wonder whether the confusion > > is wider-spread than just the DMA code. At a quick grep, try_ram_remap() > > assumes __va() can be used on pfn_valid(), though I suspect it relies on > > the calling function to check that the resource was RAM. The arm64 > > kern_addr_valid() returns true based on pfn_valid() and kcore.c uses > > standard memcpy on it, which wouldn't work for I/O (should we change > > this check to pfn_is_map_memory() for arm64?). > > kern_addr_valid() checks that there is a direct map entry, and that the > mapped address has a valid mmap. (copied from x86-64) > > Would you expect to have a direct map for memory holes and similar (IOW, > !System RAM)? I don't see where will it bail out for an IOMEM mapping before doing the pfn_valid() check... -- Sincerely yours, Mike.