From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F97AC4332F for ; Tue, 20 Dec 2022 03:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CLDgeRbBZSJlYoUw6iAhW+stlGExHUqwwY8BE115pTs=; b=tCLtAx5a/xObBT 5mOV1YGp4Q7NkueEo17HRLlUqNx1TyHFaV4Ye/ZMzgs7AwFvFXvAovRpSZh+zoAy4C+LdRcjcAKwR wkIslIs0i6u0cSJhzzeB+cUtVs7mIgxFsl/kPNziLlVV+sKKF1wPb3mtAtW2q/quO8BmHhc+C7yob LFa9dzQ2OxMD4kj01yFODhc2+EEMza5l8lFzC/5WC1pWQy95s6hqlPWGdezSTXpOHNU0KSWEIbdYg zc4dYs2c1OSNwE8WjTieXCGeRm6E4BnJEIE/TwawHMJHs7L8giYepGrbJqm6JELVUkrwxpSRupcAo FuytScHN/5PMeDB6YytA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7TaJ-008j1s-7q; Tue, 20 Dec 2022 03:46:31 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7TVT-008fln-Ak for linux-arm-kernel@lists.infradead.org; Tue, 20 Dec 2022 03:41:34 +0000 X-UUID: 531c88ad01fa4ef9946b86646a17c262-20221219 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=T+zbj0FiGEVmFNF2y0DWDBR6s5YDkdyhMts5oqZTM20=; b=mJVOPZD21Jlvpph1p1C8n1xsH2sLQLDvcQ9zhMten8jeNIgZ1WA7+8G7kJpSrv3k2ml8xl8o+tyDN/QHCnDey3dEWqVBKJj/YMF1UdQzLQeb7gjl7Vz03CdYYxOSKuJ02kQ8qNqiINWoKNkPUnSvusbOcaQhBvrRZaxmZjn/KEI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:e3f14bcd-3d29-404c-893a-3a1dc8583ad0,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:dcaaed0,CLOUDID:bc0566f3-ff42-4fb0-b929-626456a83c14,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 531c88ad01fa4ef9946b86646a17c262-20221219 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 843598758; Mon, 19 Dec 2022 20:41:16 -0700 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Tue, 20 Dec 2022 11:30:42 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 20 Dec 2022 11:30:42 +0800 From: Mark-PK Tsai To: CC: , , , , , , , , , Subject: [PATCH v3 0/19] irqdomain: fix mapping race and clean up locking Date: Tue, 20 Dec 2022 11:30:42 +0800 Message-ID: <20221220033042.27724-1-mark-pk.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20221209140150.1453-1-johan+linaro@kernel.org> References: <20221209140150.1453-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221219_194131_489579_B56EF4E4 X-CRM114-Status: GOOD ( 15.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > Parallel probing (e.g. due to asynchronous probing) of devices that > share interrupts can currently result in two mappings for the same > hardware interrupt to be created. > > This series fixes this mapping race and clean up the irqdomain locking > so that in the end the global irq_domain_mutex is only used for managing > the likewise global irq_domain_list, while domain operations (e.g. > IRQ allocations) use per-domain (hierarchy) locking. > > Johan > > > Changes in v2 > - split out redundant-lookup cleanup (1/4) > - use a per-domain mutex to address mapping race (2/4) > - move kernel-doc to exported function (2/4) > - fix association race (3/4, new) > - use per-domain mutex for associations (4/4, new) > > Changes in v3 > - drop dead and bogus code (1--3/19, new) > - fix racy mapcount accesses (5/19, new) > - drop revmap mutex (6/19, new) > - use irq_domain_mutex to address mapping race (9/19) > - clean up irq_domain_push/pop_irq() (10/19, new) > - use irq_domain_create_hierarchy() to construct hierarchies > (11--18/19, new) > - switch to per-domain locking (19/19, new) > > > Johan Hovold (19): > irqdomain: Drop bogus fwspec-mapping error handling > irqdomain: Drop dead domain-name assignment > irqdomain: Drop leftover brackets > irqdomain: Fix association race > irqdomain: Fix disassociation race > irqdomain: Drop revmap mutex > irqdomain: Look for existing mapping only once > irqdomain: Refactor __irq_domain_alloc_irqs() > irqdomain: Fix mapping-creation race > irqdomain: Clean up irq_domain_push/pop_irq() > x86/ioapic: Use irq_domain_create_hierarchy() > x86/apic: Use irq_domain_create_hierarchy() > irqchip/alpine-msi: Use irq_domain_add_hierarchy() > irqchip/gic-v2m: Use irq_domain_create_hierarchy() > irqchip/gic-v3-its: Use irq_domain_create_hierarchy() > irqchip/gic-v3-mbi: Use irq_domain_create_hierarchy() > irqchip/loongson-pch-msi: Use irq_domain_create_hierarchy() > irqchip/mvebu-odmi: Use irq_domain_create_hierarchy() > irqdomain: Switch to per-domain locking > > arch/x86/kernel/apic/io_apic.c | 8 +- > arch/x86/platform/uv/uv_irq.c | 7 +- > drivers/irqchip/irq-alpine-msi.c | 8 +- > drivers/irqchip/irq-gic-v2m.c | 5 +- > drivers/irqchip/irq-gic-v3-its.c | 13 +- > drivers/irqchip/irq-gic-v3-mbi.c | 5 +- > drivers/irqchip/irq-loongson-pch-msi.c | 9 +- > drivers/irqchip/irq-mvebu-odmi.c | 13 +- > include/linux/irqdomain.h | 6 +- > kernel/irq/irqdomain.c | 328 ++++++++++++++----------- > 10 files changed, 220 insertions(+), 182 deletions(-) > > -- > 2.37.4 Tested-by: Mark-PK Tsai We have the same issue and this patch series fix that. Thanks! Link: https://lore.kernel.org/lkml/20221219130620.21092-1-mark-pk.tsai@mediatek.com/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel