Commit 4cb205c0 authored by Jia He's avatar Jia He Committed by Thomas Gleixner

irqchip/gic-v3-its: Cap lpi_id_bits to reduce memory footprint

Commit fe8e9350 ("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: fe8e9350 ("irqchip/gic-v3-its: Use full range of LPIs")
Suggested-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarJia He <jia.he@hxt-semitech.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Tested-by: default avatarOlof Johansson <olof@lixom.net>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lkml.kernel.org/r/1535432006-2304-1-git-send-email-jia.he@hxt-semitech.com
parent db44bf4b
...@@ -1439,6 +1439,7 @@ static struct irq_chip its_irq_chip = { ...@@ -1439,6 +1439,7 @@ static struct irq_chip its_irq_chip = {
* The consequence of the above is that allocation is cost is low, but * The consequence of the above is that allocation is cost is low, but
* freeing is expensive. We assumes that freeing rarely occurs. * freeing is expensive. We assumes that freeing rarely occurs.
*/ */
#define ITS_MAX_LPI_NRBITS 16 /* 64K LPIs */
static DEFINE_MUTEX(lpi_range_lock); static DEFINE_MUTEX(lpi_range_lock);
static LIST_HEAD(lpi_range_list); static LIST_HEAD(lpi_range_list);
...@@ -1625,7 +1626,8 @@ static int __init its_alloc_lpi_tables(void) ...@@ -1625,7 +1626,8 @@ static int __init its_alloc_lpi_tables(void)
{ {
phys_addr_t paddr; 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); gic_rdists->prop_page = its_allocate_prop_table(GFP_NOWAIT);
if (!gic_rdists->prop_page) { if (!gic_rdists->prop_page) {
pr_err("Failed to allocate PROPBASE\n"); pr_err("Failed to allocate PROPBASE\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment