Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp952976ybt; Wed, 8 Jul 2020 16:18:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywSDqkKIW9D29ej8zKCbljUnmmwW2GZu13U9fNEegnJcsgZLi2COOqQDBbbbSEuNFb8yuS X-Received: by 2002:a50:cbcd:: with SMTP id l13mr52049990edi.384.1594250324207; Wed, 08 Jul 2020 16:18:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594250324; cv=none; d=google.com; s=arc-20160816; b=pdBOUmujCFYFBpYoQYQbh1nTOv8/PeTHjB8gPK+ui96jfLznw4VUCinRielMnLqcNx JaKstGmCtm+fD3Y23tfp6j5FbsZwbcT3p3zueJ6N9z/Go2kp7q0Y2vcSXLaW52+hxz73 yVLjuC7/gZHJowq+yHe+zoVkl0h3u+FLwzTTIsE2YNrZQKkjf7A440tuH5nUAe85eXZq 2JTqIlfUkvRqWpD4pvTzXMnBBOTi9Jzp0tSS7pD0xoJW4vbVdOuYWukh0x3DI/cJwjMJ R7c8fD2CSjwg1Yn32na89cNclZsgTtMEbNliesqyXNJt2flDB4UbIr+O0eJ5B9Wqg9od +TzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=as+UW8AA1NlxO2PRRIf+tJXjnFGQAConmNkwiV59UpI=; b=VFK8wFhc+r1OjwgDg2Gf98+xYfwAS1ASYxBVX6uLmtvZowJu3EIBVq6TIa/6eErOQC swe5k+yuZxI3LUazSgjM4QAStu/KMrNTE/agwUHGJWLyQE09RgsXr4sBG6odhTLleACB 6rQjnie8w9q+RUSCAS4OvROzxQut0jBQkg2qjCMsIrhCp2xJR/seShwd2FHU4Qe1hkKz GPNZbLaKDT5DVF2saHBicrLeuw52uVD91PnUtSiLL2bcc4hJRPN/vFQyvA/4K0MY91kB f3Cnk6zVOH851kC+KlCAt+/WbXUN8VhXnYKyCR3Ni+mt8zAMXakkPrHOedMeXszUNGyH WbMA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si713675ejc.348.2020.07.08.16.18.21; Wed, 08 Jul 2020 16:18:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726465AbgGHXOw (ORCPT + 99 others); Wed, 8 Jul 2020 19:14:52 -0400 Received: from foss.arm.com ([217.140.110.172]:44326 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbgGHXOw (ORCPT ); Wed, 8 Jul 2020 19:14:52 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 328EE31B; Wed, 8 Jul 2020 16:14:51 -0700 (PDT) Received: from [192.168.122.166] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B6F4B3F9AB; Wed, 8 Jul 2020 16:14:50 -0700 (PDT) Subject: Re: [PATCH] dma-pool: Do not allocate pool memory from CMA To: Nicolas Saenz Julienne , Christoph Hellwig , Marek Szyprowski , Robin Murphy , David Rientjes Cc: linux-rpi-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org References: <20200708164936.9340-1-nsaenzjulienne@suse.de> From: Jeremy Linton Message-ID: Date: Wed, 8 Jul 2020 18:14:39 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200708164936.9340-1-nsaenzjulienne@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 7/8/20 11:49 AM, Nicolas Saenz Julienne wrote: > There is no guarantee to CMA's placement, so allocating a zone specific > atomic pool from CMA might return memory from a completely different > memory zone. So stop using it. > > Fixes: c84dc6e68a1d ("dma-pool: add additional coherent pools to map to gfp mask") > Reported-by: Jeremy Linton > Signed-off-by: Nicolas Saenz Julienne > --- With this patch and https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2226971.html the machine appears to be working fine with/without CMA and in both DT/ACPI mode. The JBOD/etc I was having problems with are working fine, and the rtlsdr seems to be working better now too (its still not perfect, but that is likely another issue). so: tested-by: Jeremy Linton thanks! > > An more costly alternative would be adding an option to > dma_alloc_from_contiguous() so it fails when the allocation doesn't fall > in a specific zone. > > kernel/dma/pool.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c > index 8cfa01243ed2..4bc1c46ae6ef 100644 > --- a/kernel/dma/pool.c > +++ b/kernel/dma/pool.c > @@ -6,7 +6,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -69,12 +68,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, > > do { > pool_size = 1 << (PAGE_SHIFT + order); > - > - if (dev_get_cma_area(NULL)) > - page = dma_alloc_from_contiguous(NULL, 1 << order, > - order, false); > - else > - page = alloc_pages(gfp, order); > + page = alloc_pages(gfp, order); > } while (!page && order-- > 0); > if (!page) > goto out; > @@ -118,8 +112,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, > dma_common_free_remap(addr, pool_size); > #endif > free_page: __maybe_unused > - if (!dma_release_from_contiguous(NULL, page, 1 << order)) > - __free_pages(page, order); > + __free_pages(page, order); > out: > return ret; > } >