Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp308724pxb; Wed, 25 Aug 2021 03:59:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEYNQvNeMyuqxMaGQi37PNd5rHY9xYhHTbcdrR160GMC30XcMAwWkrNKC5NyL1YHQeHwxM X-Received: by 2002:a05:6402:895:: with SMTP id e21mr20888920edy.54.1629889152387; Wed, 25 Aug 2021 03:59:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629889152; cv=none; d=google.com; s=arc-20160816; b=jD7oA+/qf47mT+jkhEyaNF43J1w/JVvwdj+47Y6lITPF5o3m5y4XpvUADMfSfBxyTC aCbtRi9xFI4/7g6FtLFxjz9GrUB9g+u7w2BSSzeFjxDVqzS9pMeO6RM/BlWNVkDyECSX Vm433dMvoxy0Pro/f4kV2EJmdp2USIaxRjAFjhLUph9eEGLnBO9zjXyhwZFnE+zIda4J 4Zt8luRaee4UodjMHGuzo6Ub7V1Qg93D+tdAuLxm2R2Ts0oRmo65MNNyCh8BZ2Iu7NIK qDBAy1NVZtorGHRKwZzw/e0/V5lrdzpvKnvcaSkXs9QtJSizvM4RqzPPA+Xea+lgiFOP U8tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=N5tlL59/nHij3pSGKVUTlc7qI4Ci91DfXEbSTPnHakw=; b=XMzvYU5C8lnoVSIh75KiVxKU7Mn8c0CyqgtEFk7XhDl5UC0S9JRijAnIgZLlYOltGk zgaNAWYKpRcDpLIzopL17CX/nm7eKn9g+Xai88eA1g25EIItvxq+PNbLlk2McAxHVt/G TNTSjmBoY04yfkrpf8KFkC/SYyZVz7Dfri05j84rYYSNjFmsTHC7Kc+P5zkBrAKBcSs9 O+RmEyE6zyPp0pPgEOlDWUBZ/YrznRCQW8WUpENYMLTM10F/TECL3MQI9Ei/htfRvoy7 IhCjwUEy1BMUYg8zLPvDrlDM0l1sd7lw8EeHSG5Ialzw5f96Gwi2mwNUf+BadOBc9vp8 dhaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HTPiJObE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o5si12944870eju.351.2021.08.25.03.58.48; Wed, 25 Aug 2021 03:59:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HTPiJObE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239054AbhHYKzi (ORCPT + 99 others); Wed, 25 Aug 2021 06:55:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:50098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239811AbhHYKzg (ORCPT ); Wed, 25 Aug 2021 06:55:36 -0400 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.