From patchwork Fri Apr 27 14:00:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Lei" X-Patchwork-Id: 10368625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B5E17601BE for ; Fri, 27 Apr 2018 14:01:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5D8B2941B for ; Fri, 27 Apr 2018 14:01:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A40629428; Fri, 27 Apr 2018 14:01:15 +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_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 27F992941B for ; Fri, 27 Apr 2018 14:01:15 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=j9xF/3D0Wwa7AU5/P6X85262R8rl5xtPdRemQdMsr7w=; b=mixiD1p5v/joYP JMsZPxO1xeCcAPODDP93HrLOrEVicBR/lxX/klUyPvCplWRiaA4LuiQkY/40hj8kgmq6Bn7GYtkDE Skt7QHIpJlOB/T9+ndfxspY55HQh1diYkjW7dCV/4Eof+yDSDOvzFZEnZ4h+02/OTJ4EMlpyaLZiY gTT4lFCxtPkLSc2GnJw+/EPSPR+XwKOBPvtvfJVcQr+g6ZJ5wzD8G9XAeiNZSk1BsH6rUFZKOEiGg kR7uFGPMiRZy6oT1DMhwBJ6ahPLJOFu11iVnh/eGnZ/ie4vsEZh3iih1Z/auwe72+Q0+M/BD2swUi CKeg1emB78SmUtaV+4FQ==; 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 1fC3vu-00027o-Qk; Fri, 27 Apr 2018 14:01:06 +0000 Received: from mgwkm02.jp.fujitsu.com ([202.219.69.169]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fC3vq-00025y-6n for linux-arm-kernel@lists.infradead.org; Fri, 27 Apr 2018 14:01:03 +0000 Received: from kw-mxoi1.gw.nic.fujitsu.com (unknown [192.168.231.131]) by mgwkm02.jp.fujitsu.com with smtp id 612d_7f6e_cbe60194_e837_467c_88cf_613b47546768; Fri, 27 Apr 2018 23:00:46 +0900 Received: from g01jpfmpwkw03.exch.g01.fujitsu.local (g01jpfmpwkw03.exch.g01.fujitsu.local [10.0.193.57]) by kw-mxoi1.gw.nic.fujitsu.com (Postfix) with ESMTP id 2472DAC044D for ; Fri, 27 Apr 2018 23:00:46 +0900 (JST) Received: from G01JPEXCHKW13.g01.fujitsu.local (G01JPEXCHKW13.g01.fujitsu.local [10.0.194.52]) by g01jpfmpwkw03.exch.g01.fujitsu.local (Postfix) with ESMTP id 7365FBD6863; Fri, 27 Apr 2018 23:00:45 +0900 (JST) Received: from G01JPEXMBKW03.g01.fujitsu.local ([10.0.194.67]) by g01jpexchkw13 ([10.0.194.52]) with mapi id 14.03.0352.000; Fri, 27 Apr 2018 23:00:45 +0900 From: "Zhang, Lei" To: "'linux-arm-kernel@lists.infradead.org'" Subject: [PATCH]irqchip/irq-gic-v3:Avoid a waste of LPI resource Thread-Topic: [PATCH]irqchip/irq-gic-v3:Avoid a waste of LPI resource Thread-Index: AdPeMB5DUwmD7soMRXWifhlL41oMAA== Date: Fri, 27 Apr 2018 14:00:44 +0000 Message-ID: <8898674D84E3B24BA3A2D289B872026A69EED0B0@G01JPEXMBKW03> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-securitypolicycheck: OK by SHieldMailChecker v2.2.3 x-shieldmailcheckerpolicyversion: FJ-ISEC-20140219 x-originating-ip: [10.18.70.198] MIME-Version: 1.0 X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180427_070102_493075_27E0D726 X-CRM114-Status: UNSURE ( 7.05 ) X-CRM114-Notice: Please train this message. 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: "'marc.zyngier@arm.com'" , "Zhang, Lei" 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 I want to talk about the implementation of GIC-ITS driver. The current implementation of irq-gic-v3-its driver allocates at least 32 LPIs (interrupt numbers) for each Device ID even if the number of requested LPIs is only one. I think it is a waste for LPI resource. And if we use many devices over ITS, this implementation may cause a shortage of LPI . I have a patch to avoid this problem by reducing the number of LPIs from 32 to 2 per chunk. The points of this patch are as follows. Point1:Each Device ID can still allocate enough LPIs by increasing chunk number. Point2:The size of memory for the bitmap (lpi_bitmap) to manage the free chunks becomes larger(256B -> 4KiB).But I think it is not a problem, because the max size of lpi_bitmap is 4KiB. Signed-off-by: Lei Zhang The follow is my patch. the patch is based on kernel 4.16.5 ------------------------------------- Regards, Lei Zhang --- e-mail: zhang.lei@jp.fujitsu.com --- drivers/irqchip/irq-gic-v3-its.c 2018-01-29 06:20:33.000000000 +0900 +++ drivers/irqchip/irq-gic-v3-its.c 2018-04-25 15:05:26.078956980 +0900 @@ -1406,12 +1406,12 @@ * * The GIC has id_bits bits for interrupt identifiers. From there, we * must subtract 8192 which are reserved for SGIs/PPIs/SPIs. Then, as - * we allocate LPIs by chunks of 32, we can shift the whole thing by 5 + * we allocate LPIs by chunks of 2, we can shift the whole thing by 1 * bits to the right. * * This gives us (((1UL << id_bits) - 8192) >> 5) possible allocations. */ -#define IRQS_PER_CHUNK_SHIFT 5 +#define IRQS_PER_CHUNK_SHIFT 1 #define IRQS_PER_CHUNK (1 << IRQS_PER_CHUNK_SHIFT) #define ITS_MAX_LPI_NRBITS 16 /* 64K LPIs */