From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE36BC433B4 for ; Thu, 13 May 2021 15:06:02 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5AE28613BF for ; Thu, 13 May 2021 15:06:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AE28613BF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1tiz8Yzb/9Olax5E3TSmFA80D8CXD9QNAKbQkjv5Ixs=; b=ffNEjI9tnJKED/UXDC4n0/xFV jS6SS2Q8qQAQVRjD0SgSw1NqmtGHgH+iJt5a0S+u0gNrI8zkV1p43RBf8rNjBrN7Rt7XPW24OVUCp kA94l8j2nzUpCLWYbt0EWWLJx1p6hG7wgvmhGl29QdSBhYVG1kfEDfvFsmxDEhhnEzrmEw/4QXi8k FEQj3nc4oCIskQ0SlWgYUsNLZRgJVgYytLOHblJh9RlcpFmBggxPdSByIwl2QeN9vp03T3Z0Hq1XM XfZ9GHHBwBwSOeQsFX/UcNqddLe0D4twbIjinfeZV6OBoCMyuqfqsdg7UwThYqW3JLwaGlU5VlAhe 1X1YTlmGw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lhCsZ-005pAs-U5; Thu, 13 May 2021 15:04:00 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhCsW-005pAf-T1 for linux-arm-kernel@desiato.infradead.org; Thu, 13 May 2021 15:03:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=d4JYrMYSTp+7yiC4aF5GM7qWW9FDrLZO69hCUma8ZqA=; b=I3jKGDCucEfjAldvdoFfoYmhGL g66U7GV8E5iA4RT840aP6AN4UGKKXPjsvkTQqpFZIvY5aXNd/A+EeqJfMhw6BWyhVWtSSxNTJd8pJ TT/GxNAjkxQcY3DmS1xtPjEloDGTR4prBeGm6vfgBKQds7LB0fOAXFU/dQwZ6yOHzyliqDfgEHqIE 2lmVcsSIhxzoevXZ5lYN4ovZgsFOb7TnumT5VWR3Ra3RjO9x+XMLoTUZpR7D3m5ayZdUI7/EHqwvj Pnp8NKWTHtW6KPcUC1ZmT+vd01wUKIwb7jjsAt08a24c07TcJ+4foi+hvQMyskfrHkQNk74B1Njmb kZz4nMKQ==; Received: from mout.kundenserver.de ([212.227.126.135]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhCsT-00BLI9-IN for linux-arm-kernel@lists.infradead.org; Thu, 13 May 2021 15:03:55 +0000 Received: from mail-ot1-f48.google.com ([209.85.210.48]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MMoOy-1lxlmk0s5s-00Ii2K for ; Thu, 13 May 2021 17:03:34 +0200 Received: by mail-ot1-f48.google.com with SMTP id n32-20020a9d1ea30000b02902a53d6ad4bdso23823967otn.3 for ; Thu, 13 May 2021 08:03:33 -0700 (PDT) X-Gm-Message-State: AOAM530rPL5+kGmCr5jxUpMAkRy1vpbjVhQApMVnvewtrv8xq19BDhDP bpAl7p+eGoq531iXOBUsZVUD6szuDsVZcZKVQLM= X-Google-Smtp-Source: ABdhPJyHwElcAb7dTrZJ7xJbxeajaKkAJI5KqkPhGNksluWOy4D4xNvEQ+2HJis93kkeCXGgLlRQndZa/ocz4HAu3yw= X-Received: by 2002:a05:6830:1f52:: with SMTP id u18mr22697094oth.298.1620918212279; Thu, 13 May 2021 08:03:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Thu, 13 May 2021 17:02:32 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] PCI: dynamically map ECAM regions To: Russell King Cc: Bjorn Helgaas , Linux ARM , linux-pci X-Provags-ID: V03:K1:TUrUfHJhBPpFQpy8e/JcrGmjY7Z0AKq1OmDMxPM5zg8nUOZieSX hm+0lIT1XYr56awIkrrxkkQm48hKMVpZI7q0bA9mZFo0hylA/Yf9/j+tiZ6NgYHnUWZLtH0 /9r4gsKUPKZpwa7hOrXTgbmZbS/zYlWEQtG8FEElOzMrQZDuX0K6WN7DKvFZ+srBhxYn+Ny ZCSlgA6L+Td6pELkciicQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:/OyJGln4cY4=:EkcsEl8SEoL2tbfz8c2Fb7 T9LgsVl3lW/kEM40MhSfSUpY3wFEto+/XNxmn5BsCkFSf8kBjS3jX2T0UW4yZSspdt+RrCw27 AJmKVs3aYkpkEoa7/lrOwHXp7AHNdKl/KK8fbacoBwt+8cANXmgZo3tfkxFZZoEuM3V1OaRl6 GzHzAclLBzLs0bnKLxoleRHRZso1F/CPVtFQzus2ipxLW/xzUhsNCRJ5DyBAu4lUP57nF1MU/ NnRxXv6i5qlwHb7oahNI5PAo/gJE9OoTzhx95UpNMZ9IwtP+qdFSbVQjNfaMmp2gZeub/GRJl 8OcHb9XKqkQ1LJF6W+zAhVQWqtZxhfAYEINrXA+j/gj96a0iz7dLlA/bGhprBfcwgUPgOrPxK ZuRUNxGmxCN1VFURJ04eXCrkKG33keMZTDoWVFAtofQ37/vUEg/FtdNyV+Ly+Ja9DKXOwiv2T MY7Fzu0gQHh41YzVrdNXZ9G26KAa6BKSJ9yuW+UdiMbupPrGSjTUY3w0Z2bBHJ7+41FCoeZ/0 GKxejHTNY5oRcyHpS1XTBI= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210513_080353_942840_DDFC6BD9 X-CRM114-Status: GOOD ( 18.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, May 13, 2021 at 4:18 PM Russell King wrote: > > Attempting to boot 32-bit ARM kernels under QEMU's 3.x virt models > fails when we have more than 512M of RAM in the model as we run out > of vmalloc space for the PCI ECAM regions. This failure will be > silent when running libvirt, as the console in that situation is a > PCI device. > > In this configuration, the kernel maps the whole ECAM, which QEMU > sets up for 256 buses, even when maybe only seven buses are in use. > Each bus uses 1M of ECAM space, and ioremap() adds an additional > guard page between allocations. The kernel vmap allocator will > align these regions to 512K, resulting in each mapping eating 1.5M > of vmalloc space. This means we need 384M of vmalloc space just to > map all of these, which is very wasteful of resources. > > Fix this by only mapping the ECAM for buses we are going to be using. > In my setups, this is around seven buses in most guests, which is > 10.5M of vmalloc space - way smaller than the 384M that would > otherwise be required. This also means that the kernel can boot > without forcing extra RAM into highmem with the vmalloc= argument, > or decreasing the virtual RAM available to the guest. > > Suggested-by: Arnd Bergmann > Signed-off-by: Russell King Looks good to me. I wonder if we should actually mark this for stable backports. It is a somewhat invasive change, so there is a regression risk, but it's also likely that others will run into this problem on distro kernels. Reviewed-by: Arnd Bergmann _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel