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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B615BC433F5 for ; Wed, 23 Feb 2022 14:26:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 036E78D0008; Wed, 23 Feb 2022 09:26:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F01908D0001; Wed, 23 Feb 2022 09:26:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA3798D0008; Wed, 23 Feb 2022 09:26:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id B62EF8D0001 for ; Wed, 23 Feb 2022 09:26:01 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 507EA9F864 for ; Wed, 23 Feb 2022 14:26:01 +0000 (UTC) X-FDA: 79174268922.16.FE1B9A0 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf11.hostedemail.com (Postfix) with ESMTP id 5C5C540006 for ; Wed, 23 Feb 2022 14:26:00 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 8BB3D68AA6; Wed, 23 Feb 2022 15:25:55 +0100 (CET) Date: Wed, 23 Feb 2022 15:25:55 +0100 From: Christoph Hellwig To: Baoquan He Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, cl@linux.com, 42.hyeyoo@gmail.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz, David.Laight@aculab.com, david@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, steffen.klassert@secunet.com, netdev@vger.kernel.org, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, linux-s390@vger.kernel.org, michael@walle.cc, linux-i2c@vger.kernel.org, wsa@kernel.org Subject: Re: [PATCH 1/2] dma-mapping: check dma_mask for streaming mapping allocs Message-ID: <20220223142555.GA5986@lst.de> References: <20220219005221.634-1-bhe@redhat.com> <20220219005221.634-22-bhe@redhat.com> <20220219071730.GG26711@lst.de> <20220220084044.GC93179@MiWiFi-R3L-srv> <20220222084530.GA6210@lst.de> <20220222131120.GB10093@lst.de> <20220222155904.GA13323@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Stat-Signature: 9967phfk9b741ttog8g3t3tno4xi8ryd X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=none; spf=none (imf11.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de; dmarc=none X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5C5C540006 X-HE-Tag: 1645626360-295192 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, Feb 23, 2022 at 08:28:13AM +0800, Baoquan He wrote: > Could you tell more why this is wrong? According to > Documentation/core-api/dma-api.rst and DMA code, __dma_alloc_pages() is > the core function of dma_alloc_pages()/dma_alloc_noncoherent() which are > obviously streaming mapping, Why are they "obviously" streaming mappings? > why do we need to check > dev->coherent_dma_mask here? Because dev->coherent_dma_mask is the subset > of dev->dma_mask, it's safer to use dev->coherent_dma_mask in these > places? This is confusing, I talked to Hyeonggon in private mail, he has > the same feeling. Think of th coherent_dma_mask as dma_alloc_mask. It is the mask for the DMA memory allocator. dma_mask is the mask for the dma_map_* routines.