Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1863076ybt; Sun, 21 Jun 2020 01:38:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXUbknivFGXW/J3MVlDKEXLpAtdjDkixZbI0j5k+1JhcJ8wDvupKQPx86cIHKgrSNeHsQE X-Received: by 2002:a05:6402:3135:: with SMTP id dd21mr11117345edb.110.1592728691772; Sun, 21 Jun 2020 01:38:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592728691; cv=none; d=google.com; s=arc-20160816; b=Qc4C5wk4GJcFTxafGcpkJBIhlgGD1BhHD9yjXmgw+BC0fl6RztfaIQaNRNfvsmw+gi ys3f/FKEs5ElgMf6NwYiiAKnXHWN9xIpjoX62nUPS/8IM3O5Te34ShBqXYuHvp6lA/9s O+6xcicsKZ6AvGmNVsXbXbcmMpoHUxYwZ6qtm0zrki0QszILMPFPcT1XdRc66H09CpKz NElqN19ca0kOLqiVmvf9id+FNORy8ARExNbwSVKgGFbnUhbmJdRd5rGnpYV+s16eJLqV 2Cw6fajlwiUqIpZu9qnm9WRJekMuOcEOSmW4uE98W/v5JZ2La31GAT5y5MUHoDNZ81cQ 6rUA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=3vX67BYMkp1qtlQngWd0bUD24sWfk78vkelXwRUvg2U=; b=Shzk1GPW2Sn7OKiCfU6m5H64YvDBuqGZJJRi+XzAHsgc9BraIRpjsErzRkE9/DZNYm Cu0AScXWzRHYLFDZFox/2URx6ApLR7O2yxoHbgpfNIKgraSO+9cGkzGXfrXtMQY3SDMN XMF1DBJutn+Za7+RmReJ8KidcIUG88h1hbXw0blkOqww35/I0GQ+U9LHM1d3VmwVu+Mn z5Oiv+Cz+fF7gTb+yudNoUl84mxuleyA+KZctebsxwYpsydzzYHUK9kghgdLsAlL7yD9 BmYUtsjc7GyoS1vr3ngQ6iYreN8zX+3jeBwB0pE8g+DqxT93W/uODNy6fEk9nA96+oT4 oLRA== 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 z26si2970753edx.269.2020.06.21.01.37.49; Sun, 21 Jun 2020 01:38:11 -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 S1729588AbgFUIfb convert rfc822-to-8bit (ORCPT + 99 others); Sun, 21 Jun 2020 04:35:31 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:46069 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729533AbgFUIfa (ORCPT ); Sun, 21 Jun 2020 04:35:30 -0400 Received: by mail-ot1-f65.google.com with SMTP id m2so10655879otr.12 for ; Sun, 21 Jun 2020 01:35:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=hPqD5KPRADuy466IsAAiRxi638VjNc9fQS26UU0hUmk=; b=FOVJyJqMd3Lm2l5bqRCXhZY9urizJo/5JuUdg6EeoAXm0zLaNwpxlC078zt1vfi4QF DHWItpacLOzX2eSinMjByjztVHv+L4XKr3OlwcmNbSrR8PcOvHi2rwiDlFGouvT1irXk obgyB3e7CgdJjOw0iR7/Y5+aVJk29ughpSewWfjpGbiQI8SSntQ+jdVL3nzMCbqYDXXv G+4ZO/JHvLwAd6+uJSc8mYKpDk+Sq5E5LNM2j39gu8S+hrgj++Y9Hy/mcZvSarWyQzGu TWV3pzKZ52idJeSCKocXfq9BS4vxTZXgSOjFdX/IQ7JmYOVznm3AKzyGvO4CV9p4fMIR qB2w== X-Gm-Message-State: AOAM530d6UevIEKau+Sn9VO5OUko80X5eoB6hx37NrKdai8wY0m/FwWX fbxYg8IYwLZn/jknZmUALSduO+0+Lff7FVLBD7g= X-Received: by 2002:a05:6830:141a:: with SMTP id v26mr9756776otp.250.1592728529630; Sun, 21 Jun 2020 01:35:29 -0700 (PDT) MIME-Version: 1.0 References: <20200608132217.29945-1-geert@linux-m68k.org> <20200620200936.GA106151@roeck-us.net> In-Reply-To: <20200620200936.GA106151@roeck-us.net> From: Geert Uytterhoeven Date: Sun, 21 Jun 2020 10:35:18 +0200 Message-ID: Subject: Re: [PATCH v2] dma-pool: Fix too large DMA pools on medium systems To: Guenter Roeck Cc: Christoph Hellwig , Marek Szyprowski , Robin Murphy , David Rientjes , Linux IOMMU , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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()? Does replacing all SZ_128K by SZ_256K in my patch help? That would waste^H^H^H^H^Hallocate 256 KiB or 512 KiB more, though. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds