Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1999820ybt; Sun, 21 Jun 2020 06:14:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBZ0gReMd9V/LHyZ9S43V0NbBMdxCXD/4JVokkt0ypG3+FXZ0qdCFGefhqMyXCqlZY0dRY X-Received: by 2002:a17:906:4f87:: with SMTP id o7mr11551789eju.233.1592745290692; Sun, 21 Jun 2020 06:14:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592745290; cv=none; d=google.com; s=arc-20160816; b=dt8cc0vm9Hj77fCaDSdmpZm0CpoD92TToEnp6HLVpmAwkMsQ+5y6OPW8arT1ZwUeGJ fjbLPNvFS7Wv6Y/TbMcKFWuExlgbGVVJ5nKk12B2yATFUPrh7FQJGL36Q7EymQIPktmv 4vyC0z/jsFpU/2YphMHaLmnochVBjS5bsfgDA+RBrnZEuz8iesQlV7MVoUtzlycv1RsX fLokFFTWntTn8BJcRCrsW7PYZKc1tWLXwdAJs4vFhxQvQM+U7XFpij4izA07MMaUWuZp QlgQUEzd3aLLGGZ8mnU64iBsh+GN62f2WFUqwIEKMKMoCuidPpXeaFgwb1DrkKd4wA2O w3cw== 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:autocrypt:from:references:cc:to:subject:dkim-signature; bh=IkUGdQWMXK+kOz7YHBuqdTcLCfEzkHSPew/c4ZoAYIk=; b=PMj1cxuoTwKLptCteZIYbOk4y0yKrZCrKtMlv/ujMKcc83tlnY+0z3HoTkP1zoA+xJ HOAGHGNBq76/5y2nxE5BUWdg9GojhBaxP5RGZjzxOOlNjAYj7lhb3GIeZzvnaD/sMUpO sRbX15URU3mG4PpDt8ReCGTbGemFs7ZMWwZ/rrBg5xyZvbZaXwjadoThkvzR6pzx/Tl3 kyKjwK6BSPHyoqQa53wwtJlHs9umv33CHbSkUPpYQULAzLNkunlX43JZStw3uMaEqqJo 3bruCv289I8b9bQ2r/AkaVlSollmvu61c8Iv8TvQWZMfHjU7SDtAoNKeLJAzn24rP/+2 a63Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ajr+lcAh; 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 gt15si956193ejb.747.2020.06.21.06.14.28; Sun, 21 Jun 2020 06:14:50 -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=fail header.i=@gmail.com header.s=20161025 header.b=ajr+lcAh; 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 S1730122AbgFUNLf (ORCPT + 99 others); Sun, 21 Jun 2020 09:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730016AbgFUNLe (ORCPT ); Sun, 21 Jun 2020 09:11:34 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44E53C061794 for ; Sun, 21 Jun 2020 06:11:34 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id ne5so6692078pjb.5 for ; Sun, 21 Jun 2020 06:11:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=IkUGdQWMXK+kOz7YHBuqdTcLCfEzkHSPew/c4ZoAYIk=; b=ajr+lcAhyDq9MPdPbrMwTbTTH+zjhMpGwfMVO0yR/5wICP92yFw/c7bp6W62Q/gUG3 b9c+GVPgsaiVuALC44jEwUPxCXYfK8di21S1Q5BrAEhPWhgBAcMa1GyRX+WgiDiMJhYO rieZ7eX4lxQP1QvSSHbW9SiTpWpUB1W/XmZBuUAKSnIXpM0E3oqxRlm+q5r1hJBvXAxj ewTgQ27yQdDVmzCGmebwYFMZNPzye98bwxU2C/FDdq6CexZoYhUeeUap8nmj+cqqNAtC uSdxRCoz1u5zXlMOle7mswb6H2gwfN0VR30WZGN+v0XXEeUf+/9v9NU/YXuAtpIf9Jtm SXKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=IkUGdQWMXK+kOz7YHBuqdTcLCfEzkHSPew/c4ZoAYIk=; b=oD3w93P4f9pWsXGf06Rcybg6jr0pxm685ZIApmP90u5jcIGLIVYCPHr0jYwBoFTXfy +BiHDKJft03ggLfl7UX5+jdRv+sdhyCpG+1cLuBWDzAPq8Aaovg6QgOarWAfstyckNMo yIsZBEB3mKoOQTruMQ0necaQfn693nerHJIJKyl8k3NmwFaDtJywqKF7mk4L/ckI6Zkr rI/+nQDethiuPCypUBkriKkQhyepa317zznpA6mLfo5DLDj8sXugVcMBWF6ugXhqXSkp I+htvjluXnMiQx6vzr6OmgyCh0zWaJgvslHxKkR1PvUI2hu6AhFoHNwRqVRsj7eJQiA+ ywSw== X-Gm-Message-State: AOAM531ZBgIf2hwUei4L5X9JSoiEwu3bJQdWeMAOC9FQZNmdHK6wzXaH Ymybicv34j+2GJZSpw60FzSgIwfR X-Received: by 2002:a17:90a:247:: with SMTP id t7mr13142876pje.33.1592745092569; Sun, 21 Jun 2020 06:11:32 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id m9sm8554036pgq.61.2020.06.21.06.11.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Jun 2020 06:11:31 -0700 (PDT) Subject: Re: [PATCH v2] dma-pool: Fix too large DMA pools on medium systems To: Geert Uytterhoeven Cc: Christoph Hellwig , Marek Szyprowski , Robin Murphy , David Rientjes , Linux IOMMU , Linux Kernel Mailing List References: <20200608132217.29945-1-geert@linux-m68k.org> <20200620200936.GA106151@roeck-us.net> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92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g5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: Date: Sun, 21 Jun 2020 06:11:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/21/20 1:35 AM, Geert Uytterhoeven wrote: > Hi Günter, > > On Sat, Jun 20, 2020 at 10:09 PM Guenter Roeck wrote: >> On Mon, Jun 08, 2020 at 03:22:17PM +0200, Geert Uytterhoeven wrote: >>> On systems with at least 32 MiB, but less than 32 GiB of RAM, the DMA >>> memory pools are much larger than intended (e.g. 2 MiB instead of 128 >>> KiB on a 256 MiB system). >>> >>> Fix this by correcting the calculation of the number of GiBs of RAM in >>> the system. Invert the order of the min/max operations, to keep on >>> calculating in pages until the last step, which aids readability. >>> >>> Fixes: 1d659236fb43c4d2 ("dma-pool: scale the default DMA coherent pool size with memory capacity") >>> Signed-off-by: Geert Uytterhoeven >>> Acked-by: David Rientjes >> >> 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. Guenter