Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5152376imm; Sun, 26 Aug 2018 12:02:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaZEgWri+Sdip6KxkKVzCNMURXdyk8cv2QjTHqLB9qRy/vHZsx7dxpkHPxk0MCI1OasVykC X-Received: by 2002:a63:28c7:: with SMTP id o190-v6mr9547970pgo.84.1535310167463; Sun, 26 Aug 2018 12:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535310167; cv=none; d=google.com; s=arc-20160816; b=esfo3UaQWFs0Ca+0U12Iu/80zlBAlEnh7SoLiBRwoOSOS0oIpxHO5dP41qK84BccU1 xQbXy8SmN4GcXPO27x9EXAClBoIU3GHy0Xfw7kkqcZIxzvWxQpWrlvt9AykkcSp6sjjt cG+RVxWLKS9T6If4qd3wX+wnr+qz6/kWKUlfPk/sk0RE4L7C3AYH+tjjTokatWrqJqz/ RZ0R3WS5DNernxilkYtRL3FCQIc2XsMsOPCPelgSQR7M2v7SCmXDjnxs49WJVxzVnLuS gmPSCugn3qq+jBv/WIJyRfTlh0GdHD9GxIyd/Pb4L43ipggXZRER+RsgoVBBJGDevsr/ V6Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:user-agent :references:in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=QC2LnADYpi1GAvelIpfCrs63Cxe2xppiaugrh1YGNsU=; b=SBt29WvJX4wm3lPp5TVOn0UKvDN/7l68OnCApE5G3Sjl9uMkrGvuhWpzThdSQuYrrz 1PdGQoZBsLKAy6VNOKqoQzQmiX+Zq/vxKetuAqGX8kl1RaCkh/zMLdF9xJ+3N2pLNtAn lIBnrQuRqKkYr32xBT0F2wpGDGUK28cGBAHyhDJP8nxqomN0WgXslWtMsnNJG8uPdf3B vyHqeoWVcYqGuH5yJrHpiceMxwjOPWQF4XJJVvygCDYbUJlfOFC/EUSyG2rqefH3q7zx pJ5K1elVGNV82FFOw9B2M+Pr07u2rCAsybGM/0RKU5vaFlIvcpZ1XqWvu+oPPsThqGSL R5YA== 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 z89-v6si12761873pfd.357.2018.08.26.12.02.32; Sun, 26 Aug 2018 12:02:47 -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 S1726873AbeHZWou (ORCPT + 99 others); Sun, 26 Aug 2018 18:44:50 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44812 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726772AbeHZWou (ORCPT ); Sun, 26 Aug 2018 18:44:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2CE627A9; Sun, 26 Aug 2018 12:01:27 -0700 (PDT) Received: from big-swifty.misterjones.org (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 25E503F5BD; Sun, 26 Aug 2018 12:01:24 -0700 (PDT) Date: Sun, 26 Aug 2018 20:01:19 +0100 Message-ID: <868t4tx88w.wl-marc.zyngier@arm.com> From: Marc Zyngier To: Jia He Cc: Thomas Gleixner , Jason Cooper , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jia He Subject: Re: [PATCH] irqchip/gic-v3-its: add allocation max order limitation for lpi_id_bits In-Reply-To: <1535274051-2418-1-git-send-email-jia.he@hxt-semitech.com> References: <1535274051-2418-1-git-send-email-jia.he@hxt-semitech.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: ARM Ltd MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [I'm travelling, so expect some major delays in responding to email] Hi Jia, On Sun, 26 Aug 2018 10:00:51 +0100, Jia He wrote: > > There is a WARN_ON when my QDF2400 server boots up (pagesize is 4k) [snip] > 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. Gah! QDF and its 24bit INTIDs... Making life hell for everyone ;-) Sorry for breaking it. > > 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"); > -- > 1.8.3.1 > I find it rather odd that we end-up with different interrupt ranges depending on the CPU page size. Also, allocating that much memory for LPIs is rather pointless, as we actually have a pretty low limit of interrupts the system can deal with (see IRQ_BITMAP_BITS, which is slightly more than 8k). I've so far seen *one* request to push it up, but I doubt that it is a real use case. 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. Thanks, M. -- Jazz is not dead, it just smell funny.