Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3477126rwj; Mon, 19 Dec 2022 19:44:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf6T01J1y91IEAvkEtJvBSTIta3Hgkwb+bjA/C0m8E50Ol0WBgCuvG57AYI0ReeC0b+en5Ir X-Received: by 2002:a17:90a:b38b:b0:219:8e19:6ebf with SMTP id e11-20020a17090ab38b00b002198e196ebfmr47233898pjr.0.1671507889629; Mon, 19 Dec 2022 19:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671507889; cv=none; d=google.com; s=arc-20160816; b=y0Yb02E9GpfMTKIGq4uUrfhbZRH2DSABCElJyWVyr8avzzq4N64RNuu9yfNhpcirxr D3+2GTi9CwlUn0cf7CwLRUHdaeG6fhIFK7SsHoaEArlfIk1wQHM9ZVWBn9lbnUPeUD6I ozYpZP3zt4PTiPduzYUIxua2nxhyxsfZDfeyXfY/LabLCZWORQL8t5ThBIH0okp07NEO kO0iEyiwlSFB2LwE7K8Yv2rASWgQVLxcn+8qFLgdpAjdfGwyWbzWkWypVlvIqkUBqxh5 JHIZ4g1THpK/mWn0enSeQoxvifaiAfvl9urk7mer9IVvD/redZpSHuGy4P4Hazqip192 9MHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=T+zbj0FiGEVmFNF2y0DWDBR6s5YDkdyhMts5oqZTM20=; b=Cyw0y6r6LUkdb/HSaDT5lIxVqDmAiG28Lig4DaZ0Yl5ho7kabgCOThX2tg+9tNsywY V3pefxdTKn5LDcAw84E5aRcgio68gAwTQ7DwFfzbjlz8T+JjRLblIry6Ilr8CfV/zzv8 qY8gJr51D8WFenUFOFct5JqbZ+0+g/9a0VSeCwecM7iq/GsjJWLw721xKjcdwOAJgMzo vjOLjXhFN5FkoFfDH8j7uTYHo7KszFqDuV6t5I9AGKMHBMU6bPab6d4sJ7IQTBG8SA6L MueiETLWYfzMYPbK9n7fp2zHdEkZvo/ZFc8Aoa8DhPlTg3aZMy8dAlqP6h3rDZ6ZaPTI olVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mJVOPZD2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oe15-20020a17090b394f00b0020087bc6415si17999329pjb.16.2022.12.19.19.44.40; Mon, 19 Dec 2022 19:44:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mJVOPZD2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232859AbiLTDaz (ORCPT + 70 others); Mon, 19 Dec 2022 22:30:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232444AbiLTDay (ORCPT ); Mon, 19 Dec 2022 22:30:54 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A2731154; Mon, 19 Dec 2022 19:30:47 -0800 (PST) X-UUID: 75e0fbb66a1a4df2badb6ea42cae5b38-20221220 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:06a7866e-cb6c-4d30-8c6a-3da2e83986b9,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:92b265f3-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: 75e0fbb66a1a4df2badb6ea42cae5b38-20221220 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1128956095; Tue, 20 Dec 2022 11:30:43 +0800 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 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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/