Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1033178imm; Thu, 6 Sep 2018 14:13:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZvlD9PAwZwIIoScxwiUsDZ9+sTj4JF7DUqTvSCZt66jdz4fzDzTy0KBhQc2+9RJRLnDUqf X-Received: by 2002:a62:a65a:: with SMTP id t87-v6mr4958890pfe.225.1536268436842; Thu, 06 Sep 2018 14:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536268436; cv=none; d=google.com; s=arc-20160816; b=QOv8H3ZNU+RKxhWkHgYJhq6SclKRox0cG48yXL9+m/+sltpzE58i36XNkDRj0iKC4n 6NrMl39No3hhf2OKD1w4m6dJ1HJ3ZVPrktWtv6hPRo5UsJ5VMZEUBDGe0rR5gZHdWGW2 ugrqTOb/V5/IB5bNpztP/CRTNxzQsJMvh8BL5XvY7YSuIXvIu9bVlt5NAgxNgijoHeTS vboN5/LikBf6Ux4rhSmKtuI4dqOTYgeWflgumlVp1VfuX01yG+AKu5IiWhxVydHBQJfa EAVf7GAn2bUfTrylekeFdWKv2H9cUAPcBZogp42LIk7DZ7rda8BFOQyvRHRYjRCOt7gy thGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=MlemAppCcv/KvskruT+sqTeX6ad242VV29xp8E5B8dU=; b=KN9kqY7iL7IBKFfdQXaT8XOeR5NNH9YPZ/+R3XD/4eWFBfbuI42pgvkfD6uhBejGUF wJpFhuhHNNE9iVO0/mJO4VHr/n2sHxQUuaBC72EDAfPAO0kMyt2MoxtrFyQ2YhfnccwL FhBYW7AiGEuZCW/y84go8fngS+glXqHdmVK3hhxS4AdlFGAzdpwvbCyr7dcjkxuI4gdn 2swKuRasPNNH5fuRcMfy+8YIrdPnKWEqLnbrJKBs+7HrbM/fvfFbyDM6jhIowf7v62NI m6Oek9dpFOPA1N5MrZmF7CwQd/DFPIhyK0tFbKjGgF9ov4tXyCB4/8Y94sWAZpD7BVTf 5nlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2-v6si6229778pgj.391.2018.09.06.14.13.41; Thu, 06 Sep 2018 14:13:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728921AbeIFXO0 (ORCPT + 99 others); Thu, 6 Sep 2018 19:14:26 -0400 Received: from terminus.zytor.com ([198.137.202.136]:48629 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728366AbeIFXO0 (ORCPT ); Thu, 6 Sep 2018 19:14:26 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w86IarES396734 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 6 Sep 2018 11:36:53 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w86IaqtZ396731; Thu, 6 Sep 2018 11:36:52 -0700 Date: Thu, 6 Sep 2018 11:36:52 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Jia He Message-ID: Cc: jia.he@hxt-semitech.com, mingo@kernel.org, marc.zyngier@arm.com, jason@lakedaemon.net, tglx@linutronix.de, olof@lixom.net, linux-kernel@vger.kernel.org, hpa@zytor.com Reply-To: jason@lakedaemon.net, marc.zyngier@arm.com, jia.he@hxt-semitech.com, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, olof@lixom.net, tglx@linutronix.de In-Reply-To: <1535432006-2304-1-git-send-email-jia.he@hxt-semitech.com> References: <1535432006-2304-1-git-send-email-jia.he@hxt-semitech.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/urgent] irqchip/gic-v3-its: Cap lpi_id_bits to reduce memory footprint Git-Commit-ID: 4cb205c0c50f613e2de91f0eb19d5247ed003e89 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 4cb205c0c50f613e2de91f0eb19d5247ed003e89 Gitweb: https://git.kernel.org/tip/4cb205c0c50f613e2de91f0eb19d5247ed003e89 Author: Jia He AuthorDate: Tue, 28 Aug 2018 12:53:26 +0800 Committer: Thomas Gleixner CommitDate: Thu, 6 Sep 2018 20:31:59 +0200 irqchip/gic-v3-its: Cap lpi_id_bits to reduce memory footprint Commit fe8e93504ce8 ("irqchip/gic-v3-its: Use full range of LPIs"), removes the cap for lpi_id_bits, which causes the following warning to trigger on a QDF2400 server: WARNING: CPU: 0 PID: 0 at mm/page_alloc.c:4066 __alloc_pages_nodemask ... Call trace: __alloc_pages_nodemask+0x2d8/0x1188 alloc_pages_current+0x8c/0xd8 its_allocate_prop_table+0x5c/0xb8 its_init+0x220/0x3c0 gic_init_bases+0x250/0x380 gic_acpi_init+0x16c/0x2a4 In its_alloc_lpi_tables(), lpi_id_bits is 24 in QDF2400. The allocation in allocate_prop_table() tries therefore to allocate 16M (order 12 if pagesize=4k), which triggers the warning. As said by MarcL Capping lpi_id_bits at 16 (which is what we had before) is plenty, will save a some memory, and gives some margin before we need to push it up again. Bring the upper limit of lpi_id_bits back to prevent Fixes: fe8e93504ce8 ("irqchip/gic-v3-its: Use full range of LPIs") Suggested-by: Marc Zyngier Signed-off-by: Jia He Signed-off-by: Thomas Gleixner Acked-by: Marc Zyngier Tested-by: Olof Johansson Cc: Jason Cooper Cc: linux-arm-kernel@lists.infradead.org Link: https://lkml.kernel.org/r/1535432006-2304-1-git-send-email-jia.he@hxt-semitech.com --- drivers/irqchip/irq-gic-v3-its.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 316a57530f6d..c2df341ff6fa 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1439,6 +1439,7 @@ static struct irq_chip its_irq_chip = { * The consequence of the above is that allocation is cost is low, but * freeing is expensive. We assumes that freeing rarely occurs. */ +#define ITS_MAX_LPI_NRBITS 16 /* 64K LPIs */ static DEFINE_MUTEX(lpi_range_lock); static LIST_HEAD(lpi_range_list); @@ -1625,7 +1626,8 @@ static int __init its_alloc_lpi_tables(void) { phys_addr_t paddr; - lpi_id_bits = GICD_TYPER_ID_BITS(gic_rdists->gicd_typer); + lpi_id_bits = min_t(u32, GICD_TYPER_ID_BITS(gic_rdists->gicd_typer), + ITS_MAX_LPI_NRBITS); gic_rdists->prop_page = its_allocate_prop_table(GFP_NOWAIT); if (!gic_rdists->prop_page) { pr_err("Failed to allocate PROPBASE\n");