Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2878067ybt; Mon, 22 Jun 2020 09:12:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdTtGLgwjePh5jonGmVB5m0TU7iFfiKm7gUgaM6/YPaQXbXCDmFdSWaxmKM0Ck6xs/3wXu X-Received: by 2002:a17:906:97cd:: with SMTP id ef13mr15430129ejb.165.1592842334485; Mon, 22 Jun 2020 09:12:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592842334; cv=none; d=google.com; s=arc-20160816; b=maACRSada/iVzKIW8+rMOKXma7RP8JDp8GFNaYLQIVr8LRJy3GUTPNem8z/IQL/6fk ZmUkWdgh5tc2pPtofgzpV3RaCLlfhiyuZh/CGxJ9jaBebIlKurMy2KdpDSAPhoVfJdUK FYIrzvP4fHZRgjHdeepWHq+fLJewVA+zjg2nGh/0xsBuvmtT+7KdYy9ke66CEV5HrCFZ 1A39nbfetDEfU4goryLdrTT4+ZMaoRyxJtwMKdczTs1PhuQBM47CnwPdgj+OISzrqttR 9rW5OdNZw/FQLuvBSJzVrCjkJM0NCx3CY71GOiBRJQq+8sFI6kVCb0jOXvVGwjgeGteR sAdw== 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=ufDu1XaJFYWNSfEGTHgPe/mmyg+yPD8k3iya3tb/fxo=; b=EM+WTwqPZwq62SANbHnuGFXZdl0bseAehbqH/dKAYqV6ETgYBmHGBlqsdBm8SjXXdI kE/APgDtNQSnPtp2VxZXsZZiBdfWYzPT8UtBFXPvx1u0rG/SnMkKp7KV55jNE80qybpc HFFvRWvFBzd6BfRZvOwAGE+17jbM6Sgx4JmR1Pu/QscEe6n/COc9omGt6ulrE/X21Its IfAwYek9UUMIpVu3ZMzGqr6urNJZpCnoPjW+stGFuzrzSX9ydI3wsART/8I0tQPnHF1Z puZ3GLhnwzNYwUneB+oAUwMvZZBvrOrdR7DExJ0ZguJa/Wxw0aI2pfno24hLYiP7iC1P E0tw== 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 k15si9171024edq.127.2020.06.22.09.11.51; Mon, 22 Jun 2020 09:12:14 -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 S1729580AbgFVQIF (ORCPT + 99 others); Mon, 22 Jun 2020 12:08:05 -0400 Received: from foss.arm.com ([217.140.110.172]:49234 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726328AbgFVQIE (ORCPT ); Mon, 22 Jun 2020 12:08:04 -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 CF4DA31B; Mon, 22 Jun 2020 09:08:03 -0700 (PDT) Received: from [10.57.9.128] (unknown [10.57.9.128]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1CA053F71E; Mon, 22 Jun 2020 09:07:55 -0700 (PDT) Subject: Re: [PATCH v2] dma-pool: Fix too large DMA pools on medium systems To: David Rientjes , Guenter Roeck Cc: Geert Uytterhoeven , Christoph Hellwig , Marek Szyprowski , Linux IOMMU , Linux Kernel Mailing List References: <20200608132217.29945-1-geert@linux-m68k.org> <20200620200936.GA106151@roeck-us.net> From: Robin Murphy Message-ID: <1287bffd-3363-0764-0309-32222b2b8c9a@arm.com> Date: Mon, 22 Jun 2020 17:07:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-21 21:20, David Rientjes wrote: > On Sun, 21 Jun 2020, Guenter Roeck wrote: > >>>> This patch results in a boot failure in some of my powerpc boot tests, >>>> specifically those testing boots from mptsas1068 devices. Error message: >>>> >>>> mptsas 0000:00:02.0: enabling device (0000 -> 0002) >>>> mptbase: ioc0: Initiating bringup >>>> ioc0: LSISAS1068 A0: Capabilities={Initiator} >>>> mptbase: ioc0: ERROR - Unable to allocate Reply, Request, Chain Buffers! >>>> mptbase: ioc0: ERROR - didn't initialize properly! (-3) >>>> mptsas: probe of 0000:00:02.0 failed with error -3 >>>> >>>> Configuration is bamboo:44x/bamboo_defconfig plus various added drivers. >>>> Qemu command line is >>>> >>>> qemu-system-ppc -kernel vmlinux -M bamboo \ >>>> -m 256 -no-reboot -snapshot -device mptsas1068,id=scsi \ >>>> -device scsi-hd,bus=scsi.0,drive=d0,wwn=0x5000c50015ea71ac -drive \ >>>> file=rootfs.ext2,format=raw,if=none,id=d0 \ >>>> --append "panic=-1 slub_debug=FZPUA root=/dev/sda mem=256M console=ttyS0" \ >>>> -monitor none -nographic >>>> >>>> canyonlands_defconfig with sam460ex machine and otherwise similar command line >>>> fails as well. >>>> >>>> Reverting this patch fixes the problem. >>> >>> This looks like the minimum value of 128 KiB is not sufficient, and the >>> bug is in the intention of 1d659236fb43c4d2 ("dma-pool: scale the >>> default DMA coherent pool size with memory capacity")? >>> Before, there was a single pool of (fixed) 256 KiB size, now there are >>> up to three coherent pools (DMA, DMA32, and kernel), albeit of smaller >>> size (128 KiB each). >>> >>> Can you print the requested size in drivers/message/fusion/mptbase.c: >>> PrimeIocFifos()? >> >> 172928 bytes >> >>> Does replacing all SZ_128K by SZ_256K in my patch help? >> >> Yes, it does. >> > > The new coherent pools should auto expand when they are close to being > depleted but there's no guarantee that it can be done fast enough. More to the point, it's never going to help if the pool is empty and one allocation is simply larger than the entire thing ;) Another angle, though, is to question why this driver is making such a large allocation with GFP_ATOMIC in the first place. At a glance it looks like there's no reason at all other than that it's still using the legacy pci_alloc_consistent() API, since every path to that appears to have CAN_SLEEP passed as its flag - modernising that would arguably be an even better long-term win. Robin. > Switching the min size to be the previous min size (256KB) seems like the > best option and it matches what > Documentation/admin-guide/kernel-parameters.txt still stays. > > I'll also send a patch to point in the right direction when this happens. >