Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5211509ybl; Tue, 27 Aug 2019 00:51:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJXlzZqzWPHZATAxpEuoNEuMWlj0gpPs7+IGDnPquZ21fZcB+WB9epTBouvkqsh7qVU8iH X-Received: by 2002:a62:76d5:: with SMTP id r204mr24262804pfc.252.1566892306573; Tue, 27 Aug 2019 00:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892306; cv=none; d=google.com; s=arc-20160816; b=oWUKV6Xb39bvBXzXA68m8rzhFVYfgznAeab1KGmt20tMhbdAgWaRAXkz356LgdKXoz czwekjiznDa2DDEFHKaCYazsIvTBWCUJ/3wkbo0aoIjcjYf5lBIsGWkSMaUhpIKrmDEL LbnuZvwbZROYz1tkef28g5Ywk2wuveflxYE96vpRPBxOr3duS4l4ra3EsZe+p5dZYJY4 cV9nR8lP2hZMiv9FBCmu6nuEFWBDqNGetwIchhCpULJbXERVoWbE0nbSsCWKKaCqF0jz bo/VEgdqj+OZpp19+JGHXgni4iVKyjq8E0XPsipgHAinxtDZbenH6kS7JUwvDqjCyRJ+ b+kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fcHpw0zoyxmRGDWwTthx5qikuzKr5kY/vFOZTNMQrV0=; b=Py/yKmtLGXl22t6Q8dRRAww2Bp/uena5xW1+r7ApiwZwuXmJPogwS4YZ40nn+OeEl8 jQdRijhI7nwsgt0y57O/PpCLXd6+PcwB7nY7n1dTBZsYSOmScL35e/qvSiC7bU+YCrfw 3HiF5RA9f/rOxAlRE5UCaG3pcm3OqDVurcUGrIXG5PulqSfjaYNGow7uxKRl6rA3zTpT GZZlzGCdeZGi6HBPPbaCv/1eLaajrtm6ORabO6ZCfJVbUKVoaByOjAO7eZwBAAOxxNo5 bKg790MY55u0jQj3+xKvKtpXFiSW2SPi1GHH6dAHnq9UCZTbwj5V1RlWBi6iNcf5z9Nd ITug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si12056504plt.276.2019.08.27.00.51.31; Tue, 27 Aug 2019 00:51:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728832AbfH0Hu1 (ORCPT + 99 others); Tue, 27 Aug 2019 03:50:27 -0400 Received: from verein.lst.de ([213.95.11.211]:54480 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728704AbfH0Hu1 (ORCPT ); Tue, 27 Aug 2019 03:50:27 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 4577B68B05; Tue, 27 Aug 2019 09:50:21 +0200 (CEST) Date: Tue, 27 Aug 2019 09:50:21 +0200 From: Christoph Hellwig To: Masahiro Yamada Cc: Christoph Hellwig , Nicolin Chen , linux-mmc , Ulf Hansson , Adrian Hunter , Robin Murphy , Marek Szyprowski , vdumpa@nvidia.com, Russell King , Catalin Marinas , Will Deacon , Chris Zankel , Max Filippov , Joerg Roedel , David Woodhouse , Tony Lindgren , Andrew Morton , Stephen Rothwell , Thierry Reding , Kees Cook , iamjoonsoo.kim@lge.com, Wolfram Sang , linux-arm-kernel , Linux Kernel Mailing List , linux-xtensa@linux-xtensa.org, iommu@lists.linux-foundation.org Subject: Re: [PATCH v2 2/2] dma-contiguous: Use fallback alloc_pages for single pages Message-ID: <20190827075021.GA953@lst.de> References: <20190506223334.1834-1-nicoleotsuka@gmail.com> <20190506223334.1834-3-nicoleotsuka@gmail.com> <20190825011025.GA23410@lst.de> <20190826073320.GA11712@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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 27, 2019 at 04:45:20PM +0900, Masahiro Yamada wrote: > On Mon, Aug 26, 2019 at 4:33 PM Christoph Hellwig wrote: > > > > On Mon, Aug 26, 2019 at 11:05:00AM +0900, Masahiro Yamada wrote: > > > This is included in v5.3-rc6 > > > so I tested it. > > > > So there is no allocation failure, but you get I/O errors later? > > Right. > > > > > Does the device use a device-private CMA area? > > Not sure. > My driver is drivers/mmc/host/sdhci-cadence.c > It reuses routines in drivers/mmc/host/sdhci.c > > > > > Does it work with Linux > > 5.2 if CONFIG_DMA_CMA is disabled? > > No. > 5.2 + disable CONFIG_DMA_CMA > failed in the same way. So it seems like the device wants CMA memory. I guess the patch below will fix it, but that isn't the solution. Can you try it to confirm? In the end it probably assumes a dma mask it doesn't set that the CMA memory satisfies or something similar. diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index 69cfb4345388..bd2f24aa7f19 100644 --- a/kernel/dma/contiguous.c +++ b/kernel/dma/contiguous.c @@ -236,7 +236,7 @@ struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) if (dev && dev->cma_area) cma = dev->cma_area; - else if (count > 1) + else cma = dma_contiguous_default_area; /* CMA can be used only in the context which permits sleeping */