Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1532363ybt; Sat, 20 Jun 2020 13:12:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo3C2kKrF6GN9ABsFITGNaHsPKhc0w7+RJbJDBGuO5VDA0RGQx0NF8sd7xDbxF6Jf0TpJ1 X-Received: by 2002:a50:f983:: with SMTP id q3mr9942914edn.259.1592683959785; Sat, 20 Jun 2020 13:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592683959; cv=none; d=google.com; s=arc-20160816; b=URCwwEcuZgi6+OmyoGeHCORn+h/Va0FfNRUMife3GJfIpUXkyvV465C3Leb+ahxkUi l7Z1obcqdCkTD8y7/T0ShyCTlCkocn+nq0BaTDPWv+NTnP+yIJI7NGNYHK907ocu5mFo 552Bd9JdzuawPa2Mi4as3NHlwc9djQmZPcEeShYSM1gtK+H3wcQ+QCM8ijKiCqnriy+l eaxAEOwnJrJD8VzsTxNzIaaj8uCSTDe60k2m+JYp2Vm72a2+6JYktHZiv2JAg7nUZg8z vEb9sW2KIATAzePhgwbGfvcI8o3mOxdGNJ8Z8JZYBCwB2NaZuNGpLy1FyN85OWfUpjM7 p4Ig== 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:dkim-signature; bh=iRX0OPkrMjtIh+IZlLNQE9USdarPLnAiygVqscVAq+o=; b=HfzjwwgfjPXernag7NXrUoeppOYF/4noFNn5l9EPSM3BC2koagSr/DGHR/20hJUhX4 zLMz3av/zQTLiEUKJIUJp/940eghRnGnImULnNfXxSSXHgiJpvf/c/LUiM6TsvXnXEkE zBd0/ZOE57rgOy352fm6OASUT9ogblVQq82Pc3F3TmcigjY0XVoqvKO/ff6X8B13c6nS fLE5C/npi/C3IzzYwWYgCtw8ZTIuTTSyXPSwD+zQ6P18CDQdT1VyCxBfcwgebw9Mwq2y kni8gJfqHzXJUGdCNCXnD2WQcZno6ZvOdRkP+i4Mfv9oP/zv69b4/ap7Ac7ppQEBAYox FJrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="Vp2Fr3N/"; 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 l11si6250841edw.591.2020.06.20.13.12.17; Sat, 20 Jun 2020 13:12:39 -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="Vp2Fr3N/"; 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 S1728730AbgFTUKj (ORCPT + 99 others); Sat, 20 Jun 2020 16:10:39 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43483 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728665AbgFTUKi (ORCPT ); Sat, 20 Jun 2020 16:10:38 -0400 Received: by mail-pl1-f195.google.com with SMTP id g12so5586265pll.10 for ; Sat, 20 Jun 2020 13:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=iRX0OPkrMjtIh+IZlLNQE9USdarPLnAiygVqscVAq+o=; b=Vp2Fr3N/AURy1KyePwnHI0cazWHmCk7MDLKFosyoUKWLEXQ4LrxbcX32Ph9y8jhALB O/eBIuUuZ0qmZKDed/riTNoDf3lzXfgcFJJIPsJX67XzFHWhQ8G7pJ2wh1zIsrrwEPM9 CFNTTPMeFY4GYmC9ssoJPAG219oQ0sL245dKghz0ZtDTbatuov8erXjNsQmn382/QRB9 Gf4dfP2cwRwmarUED3grIFRwO3XE5Cc2FMiQPLm9rnK5lzTeOVM/dZmCUhCsy3shikza gGGzSX7coIjsty7LdzyQm3k9ci3UJLghu9NnZ2PrsEZZ6s6qI3Nq7F1vjBzA892DhOss uLrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=iRX0OPkrMjtIh+IZlLNQE9USdarPLnAiygVqscVAq+o=; b=krjwYgU7OdMGv3vvdj+2fFWMFqxoiW6LCTrXYLaMlQvTAihzcKukx4E1KHRPuSmtrf scGeKmEIlduVxs5+NH0ktGYJLMBCi92XplNmGUFLq2wYbFniZ6/beRh/7kFHrYlFq+k7 3C84o+tI0lcpRQJV82L8TbaGSknFdPtRuJOq8vwC71fXU7QHwqYi4BZzsxz8mrbV35il UPB+Vx38BNy+3TdCZ2Yrf/kDE9n2CU/4gj8A+5Ua0teXMjC/9Zx7sY1/O1VgDcB1C4hT Q61802BQquDu0rcDy5iMo/+U2JDiZKQTci8S9DwONT9MO/oSHom7zUsLinmuaMu+EZ29 +YjQ== X-Gm-Message-State: AOAM531Ket1zrJyozZlFvMS47whiLSSHDK1u3yiBkmpQ0pzZcBiczw2C /r4Pfz1Ls3tIz8hBqYReDvE= X-Received: by 2002:a17:902:8681:: with SMTP id g1mr13031314plo.161.1592683777739; Sat, 20 Jun 2020 13:09:37 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id v9sm9376740pfe.198.2020.06.20.13.09.36 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 20 Jun 2020 13:09:37 -0700 (PDT) Date: Sat, 20 Jun 2020 13:09:36 -0700 From: Guenter Roeck To: Geert Uytterhoeven Cc: Christoph Hellwig , Marek Szyprowski , Robin Murphy , David Rientjes , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] dma-pool: Fix too large DMA pools on medium systems Message-ID: <20200620200936.GA106151@roeck-us.net> References: <20200608132217.29945-1-geert@linux-m68k.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200608132217.29945-1-geert@linux-m68k.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Guenter