From patchwork Sun Aug 26 09:00:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 10576253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 51D54139B for ; Sun, 26 Aug 2018 09:03:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4796A29A6E for ; Sun, 26 Aug 2018 09:03:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3995F29A89; Sun, 26 Aug 2018 09:03:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 86E0729A6E for ; Sun, 26 Aug 2018 09:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=4neOlsndBY1StUlQxrWXBrE+mcqLEqtSIQZM4XZo8Zg=; b=o2M Ff8pHmhyi/7mU5t8RZIht33ToSe74jQftwifjrrKBEr2w+oe+sgPZMgw78EvdcR/9CSEZoFfZgSmd GnZI2dk0sUMAjodyXZzL665vF4XvOm3huEuVH3I+dKN4fTVYFWLtGvfcYc9HqgdL5mxu+6i2cm0Mu Yc/3/DuwBEw7oqbXkOmRMm3nVVzX45AQOJ0LhvZRg7wIyJ6XagSVMcgn2L0pjX8TTCke6E8wP6sx3 CaWIb4I7kq/NmcKpxAB/TjYspnSERVBl4rv3nu/usz+1T0RdJAVPGahdBoo9ouxTxJATLPEy+xHWD jMT15hLLEc0s/KGH4+EJlp26t5Fx3kQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftqx9-0002Tx-8F; Sun, 26 Aug 2018 09:03:23 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftqwz-0002Rf-OD for linux-arm-kernel@lists.infradead.org; Sun, 26 Aug 2018 09:03:20 +0000 Received: by mail-pf1-x441.google.com with SMTP id u24-v6so6356510pfn.13 for ; Sun, 26 Aug 2018 02:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=pg14ZlzEQoNOErv//mZr8+MOMBoTH9KIpT2VW0oBX/s=; b=ZCdoPlODc9p/hk4fIA3WdPqZMDwWyxFKXEzbeXRxGb8Svm6hiDu16NwF6qTxBREv77 ckDFYzpKxqdVaO66VQkIhGcqye69VWlwt695HJbgy/65W+G+A9UgeG/AXe24r8VJ/SnO 86FPbpKV7wtaOSFX2UQP+xYcdrHgh4tGZzA0sowPjvci50aQO5tD73F4jJ50Em+gufLW A5bBQKR2eYV9WOyoQfyGEKaLHqMdV5sXo/TBmALecWem0ClDu43XSR9e/dSJr4VRCtx5 WBXeBKjl+9BtkkPcUVnVoY+CmX1t5vtt46jOW/rlfjWmSEvezJzf/iHUx9Yn71YWrkbm TNXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pg14ZlzEQoNOErv//mZr8+MOMBoTH9KIpT2VW0oBX/s=; b=r2AryOc654D3aD2raWAv0UACVvR7ufPEBfvELC7VGkLlVdnRPYv2luCmXJ97twrT5Q vsJVJD+JcX5aCF5NwmS8vHAbZt7oa9JUpofgRWVd5piHgnR4QomUZdUdlFkuhB3KoMnx IOpHpaacqufWneksEPalxFLeecmhmo8I1vdfKwVfJjb5iWe/i30p8Y60HDTNHihijqLf iqncnRVFqfnILlOZdtxEEKHNI8ig3eKKgsQk4Ce83iX/kw7AMxK336kVTumggmstm1zh Gat7ma7yzRg1TvrNS9nlV5emcYlEMAKSsknkX/0URb3uaxf6/VrBBNX5ZDedzjplJAfX 6ESQ== X-Gm-Message-State: APzg51BSBLV67LqWjseNlBsAzJuV5FW3Y9nOZPz2KaBNpTIjxVKXMGTD IMPYXh5PHMi+L6te2gLcpCg= X-Google-Smtp-Source: ANB0VdaXmeMHxe3oPC9cQQ1PkuG6Vx0KSkPTMiEohO9oyToHAY1UbdU26TZFwMTxJwPnRhmhL17ZNQ== X-Received: by 2002:a63:ca09:: with SMTP id n9-v6mr8046738pgi.287.1535274182681; Sun, 26 Aug 2018 02:03:02 -0700 (PDT) Received: from ct7host.localdomain ([38.106.11.25]) by smtp.gmail.com with ESMTPSA id g7-v6sm14895093pfi.175.2018.08.26.02.02.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Aug 2018 02:03:01 -0700 (PDT) From: Jia He X-Google-Original-From: Jia He To: Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH] irqchip/gic-v3-its: add allocation max order limitation for lpi_id_bits Date: Sun, 26 Aug 2018 17:00:51 +0800 Message-Id: <1535274051-2418-1-git-send-email-jia.he@hxt-semitech.com> X-Mailer: git-send-email 1.8.3.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180826_020313_853756_EE6506A3 X-CRM114-Status: GOOD ( 13.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jia He , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP There is a WARN_ON when my QDF2400 server boots up (pagesize is 4k) ============begin=============== [ 0.000000] GICv3: GIC: Using split EOI/Deactivate mode [ 0.000000] GICv3: Distributor has no Range Selector support [ 0.000000] GICv3: VLPI support, no direct LPI support [ 0.000000] ACPI: SRAT not present [ 0.000000] ITS [mem 0xff7efe0000-0xff7effffff] [ 0.000000] ITS@0x000000ff7efe0000: Using ITS number 0 [ 0.000000] GIC: enabling workaround for ITS: QDF2400 erratum 0065 [ 0.000000] ITS@0x000000ff7efe0000: allocated 524288 Devices @179f000000 (indirect, esz 8, psz 64K, shr 1) [ 0.000000] ITS@0x000000ff7efe0000: allocated 8192 Interrupt Collections @179f930000 (flat, esz 8, psz 64K, shr 1) [ 0.000000] ITS@0x000000ff7efe0000: allocated 65536 Virtual CPUs @179f980000 (flat, esz 8, psz 64K, shr 1) [ 0.000000] WARNING: CPU: 0 PID: 0 at mm/page_alloc.c:4066 __alloc_pages_nodemask+0x2d8/0x1188 [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.18.0+ #66 [ 0.000000] pstate: 20000085 (nzCv daIf -PAN -UAO) [ 0.000000] pc : __alloc_pages_nodemask+0x2d8/0x1188 [ 0.000000] lr : __alloc_pages_nodemask+0x134/0x1188 [ 0.000000] sp : ffff0000091b3a30 [ 0.000000] x29: ffff0000091b3a30 x28: 0000000000000000 [ 0.000000] x27: ffff00000a045000 x26: 0000000000000000 [ 0.000000] x25: 0000000000000000 x24: ffff0000091c1000 [ 0.000000] x23: ffff0000091b3b98 x22: 000000000000000c [ 0.000000] x21: ffff0000082dc130 x20: 0000000000000001 [ 0.000000] x19: 0000000000000000 x18: 000000000000003f [ 0.000000] x17: 0000000000000000 x16: 0000000000000000 [ 0.000000] x15: ffffffffffffffff x14: 202c74616c662820 [ 0.000000] x13: ffff000009c5f9e0 x12: 0000000000000077 [ 0.000000] x11: 0000000000000078 x10: 0000000097110f47 [ 0.000000] x9 : 0000000000000000 x8 : 00000000009fff3f [ 0.000000] x7 : 000000000000002b x6 : 000000000000000c [ 0.000000] x5 : 0000000000000001 x4 : 0000000000000000 [ 0.000000] x3 : ffff000008fd1000 x2 : ffff000008fd1000 [ 0.000000] x1 : ffff0000091c1000 x0 : 0000000000000000 [ 0.000000] Call trace: [ 0.000000] __alloc_pages_nodemask+0x2d8/0x1188 [ 0.000000] alloc_pages_current+0x8c/0xd8 [ 0.000000] its_allocate_prop_table+0x5c/0xb8 [ 0.000000] its_init+0x220/0x3c0 [ 0.000000] gic_init_bases+0x250/0x380 [ 0.000000] gic_acpi_init+0x16c/0x2a4 [ 0.000000] acpi_match_madt+0x50/0x88 [ 0.000000] acpi_table_parse_entries_array+0x180/0x204 [ 0.000000] acpi_table_parse_entries+0x60/0x84 [ 0.000000] acpi_table_parse_madt+0x40/0x4c [ 0.000000] __acpi_probe_device_table+0x94/0xe8 [ 0.000000] irqchip_init+0x38/0x40 [ 0.000000] init_IRQ+0x70/0x9c [ 0.000000] start_kernel+0x310/0x4c0 [ 0.000000] irq event stamp: 0 [ 0.000000] hardirqs last enabled at (0): [<0000000000000000>] (null) [ 0.000000] hardirqs last disabled at (0): [<0000000000000000>] (null) [ 0.000000] softirqs last enabled at (0): [<0000000000000000>] (null) [ 0.000000] softirqs last disabled at (0): [<0000000000000000>] (null) [ 0.000000] ---[ end trace 943781056d97862b ]--- ============end============ In its_alloc_lpi_tables, lpi_id_bits is 24, without this patch, its_allocate_prop_table will try to allocate 16M(order 12 if pagesize=4k). Thus it causes the WARN_ON. This patch fixes it by limiting the lpi_id_bits. Signed-off-by: Jia He --- drivers/irqchip/irq-gic-v3-its.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 316a575..79e6993 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1624,8 +1624,11 @@ static void its_free_prop_table(struct page *prop_page) static int __init its_alloc_lpi_tables(void) { phys_addr_t paddr; + u32 max_bits; /*max order limitation in alloc_page*/ - lpi_id_bits = GICD_TYPER_ID_BITS(gic_rdists->gicd_typer); + max_bits = PAGE_SHIFT + MAX_ORDER - 1; + lpi_id_bits = min_t(u32, max_bits, + GICD_TYPER_ID_BITS(gic_rdists->gicd_typer)); gic_rdists->prop_page = its_allocate_prop_table(GFP_NOWAIT); if (!gic_rdists->prop_page) { pr_err("Failed to allocate PROPBASE\n");