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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A6C1C678DE for ; Mon, 16 Jan 2023 13:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbjAPNvJ (ORCPT ); Mon, 16 Jan 2023 08:51:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231436AbjAPNun (ORCPT ); Mon, 16 Jan 2023 08:50:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20C2421945; Mon, 16 Jan 2023 05:50:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B28DE60FC6; Mon, 16 Jan 2023 13:50:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9767DC43392; Mon, 16 Jan 2023 13:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673877040; bh=Sc/MXrEwZaxI4omzYCVHgWpM1c0Ozs8INEgkW+Kkfxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZdwS8bAvdzWN/C6v/U15xmHvbQMQMJusVQTi9CqJfflW/jPFbn3aYdXTST2GS1hv ChWtwzHM9Mo6bKs2CLsEmdTjFdL/zEumhE3mzEhXtRCRsHvoeixjPySaA7MX0P6B55 Vhw9Kbo3g3EM6g0/QTjGYHErVQuIgXI6FpFpnntNtkCY56NtR4870LolZ9+RXwI0eW KjvIpJ5o/R9jTF1Dlw9S97JdX8yEZqI9ZaszR6vU9qk3jNFuBgQn5xOBl18KH7oGFb x0ft+UcfE6D4hkXHV3EOcU2UDR0XlFd/EaW6NVQItAnk0l2yIvJmHlMp8mS8jkV/Ya 5tidaNTVroP+Q== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pHPt5-0003ux-Vi; Mon, 16 Jan 2023 14:51:00 +0100 From: Johan Hovold To: Marc Zyngier , Thomas Gleixner Cc: x86@kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , Hsin-Yi Wang , Mark-PK Tsai Subject: [PATCH v4 06/19] irqdomain: Drop revmap mutex Date: Mon, 16 Jan 2023 14:50:31 +0100 Message-Id: <20230116135044.14998-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.38.2 In-Reply-To: <20230116135044.14998-1-johan+linaro@kernel.org> References: <20230116135044.14998-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The global irq_domain_mutex is now held in all paths that update the revmap structures so there is no longer any need for the revmap mutex. Tested-by: Hsin-Yi Wang Tested-by: Mark-PK Tsai Signed-off-by: Johan Hovold --- include/linux/irqdomain.h | 2 -- kernel/irq/irqdomain.c | 13 ++++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 5b2718e1c6de..7fd3939328c2 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -143,7 +143,6 @@ struct irq_domain_chip_generic; * Revmap data, used internally by the irq domain code: * @revmap_size: Size of the linear map table @revmap[] * @revmap_tree: Radix map tree for hwirqs that don't fit in the linear map - * @revmap_mutex: Lock for the revmap * @revmap: Linear table of irq_data pointers */ struct irq_domain { @@ -171,7 +170,6 @@ struct irq_domain { irq_hw_number_t hwirq_max; unsigned int revmap_size; struct radix_tree_root revmap_tree; - struct mutex revmap_mutex; struct irq_data __rcu *revmap[]; }; diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 23f5919e58b7..248e6acfafbe 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -214,7 +214,6 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int s /* Fill structure */ INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL); - mutex_init(&domain->revmap_mutex); domain->ops = ops; domain->host_data = host_data; domain->hwirq_max = hwirq_max; @@ -501,30 +500,30 @@ static bool irq_domain_is_nomap(struct irq_domain *domain) static void irq_domain_clear_mapping(struct irq_domain *domain, irq_hw_number_t hwirq) { + lockdep_assert_held(&irq_domain_mutex); + if (irq_domain_is_nomap(domain)) return; - mutex_lock(&domain->revmap_mutex); if (hwirq < domain->revmap_size) rcu_assign_pointer(domain->revmap[hwirq], NULL); else radix_tree_delete(&domain->revmap_tree, hwirq); - mutex_unlock(&domain->revmap_mutex); } static void irq_domain_set_mapping(struct irq_domain *domain, irq_hw_number_t hwirq, struct irq_data *irq_data) { + lockdep_assert_held(&irq_domain_mutex); + if (irq_domain_is_nomap(domain)) return; - mutex_lock(&domain->revmap_mutex); if (hwirq < domain->revmap_size) rcu_assign_pointer(domain->revmap[hwirq], irq_data); else radix_tree_insert(&domain->revmap_tree, hwirq, irq_data); - mutex_unlock(&domain->revmap_mutex); } static void irq_domain_disassociate(struct irq_domain *domain, unsigned int irq) @@ -1511,11 +1510,12 @@ static void irq_domain_fix_revmap(struct irq_data *d) { void __rcu **slot; + lockdep_assert_held(&irq_domain_mutex); + if (irq_domain_is_nomap(d->domain)) return; /* Fix up the revmap. */ - mutex_lock(&d->domain->revmap_mutex); if (d->hwirq < d->domain->revmap_size) { /* Not using radix tree */ rcu_assign_pointer(d->domain->revmap[d->hwirq], d); @@ -1524,7 +1524,6 @@ static void irq_domain_fix_revmap(struct irq_data *d) if (slot) radix_tree_replace_slot(&d->domain->revmap_tree, slot, d); } - mutex_unlock(&d->domain->revmap_mutex); } /** -- 2.38.2 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 465A4C46467 for ; Mon, 16 Jan 2023 13:57:57 +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=VTOUw1n1jCH/w/zr1Tu8GzUYRI1DSiacGFZJJ7voaNg=; b=1/ur/VvYhBd/KH xQtStdcMC9LVyXAUKC1eckSCScsDksvKTSZJ0W1tN5l1aRPwhQpIaAoZt03SlImMn0NdLEvbnLWlF mwwUddHMudBXxr5Ue7hZseBMBiI9xJpbmo+hfYPHENcWiwE77y5b/+l58qy9cozhukrNdaQYXAJRP h3IE/wRs6ItNfmN/AIXJFVi+U2xN8cUEpFoa9IQdv2yCxLQxBEM0ulodhx1ddrq80JMQDVn5pweHb 7uJYSBqDACo+c5yL8M76Oe0q5DMX69JWoTYFHm0LWep7xi7s2frNmqnwc3K2BZpKpqT6tKhBr2By3 72/dslsCDxsuovezMLQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHPym-00Ae5l-6A; Mon, 16 Jan 2023 13:56:53 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHPt1-00AbBk-IW for linux-arm-kernel@bombadil.infradead.org; Mon, 16 Jan 2023 13:50:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=rOQcjiJysgkAnLhPnpeszLDm///LM3zPVgI/U0Cn9hE=; b=KpzCZ7D8F0KIBR/aalW2GvMWK9 HHyBv65YmQkinDeG4CofpekdHeHBVpZ+qhM2Za3v7pLOzpU3Lf183doMzNZ/c6N4WYS9EtISRP0BW LO6Sm/ng/nziq/xn7nDr1kxhYWKiCHsIj9a0YIibZYMnGI+AL+m4/xhsuveG4dMwTDPfDPkdhGFID Pzid9Hm8PA0diEg0qbYe9bi291yrAH02xIvieyNAUKcliW6XJOvIIWaJu0wcAsSK4PNTkG21xn2ds sA2nWnfwuqYbGzK7AGd4xbunrio43QLWLd6QJAtspnbASGmCYNbZRQtdK19qQ5M0vJx94lWSl7wBd UsCN5LJQ==; Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pHPsk-005c9h-2u for linux-arm-kernel@lists.infradead.org; Mon, 16 Jan 2023 13:50:43 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5E4E960FE5; Mon, 16 Jan 2023 13:50:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9767DC43392; Mon, 16 Jan 2023 13:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673877040; bh=Sc/MXrEwZaxI4omzYCVHgWpM1c0Ozs8INEgkW+Kkfxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZdwS8bAvdzWN/C6v/U15xmHvbQMQMJusVQTi9CqJfflW/jPFbn3aYdXTST2GS1hv ChWtwzHM9Mo6bKs2CLsEmdTjFdL/zEumhE3mzEhXtRCRsHvoeixjPySaA7MX0P6B55 Vhw9Kbo3g3EM6g0/QTjGYHErVQuIgXI6FpFpnntNtkCY56NtR4870LolZ9+RXwI0eW KjvIpJ5o/R9jTF1Dlw9S97JdX8yEZqI9ZaszR6vU9qk3jNFuBgQn5xOBl18KH7oGFb x0ft+UcfE6D4hkXHV3EOcU2UDR0XlFd/EaW6NVQItAnk0l2yIvJmHlMp8mS8jkV/Ya 5tidaNTVroP+Q== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pHPt5-0003ux-Vi; Mon, 16 Jan 2023 14:51:00 +0100 From: Johan Hovold To: Marc Zyngier , Thomas Gleixner Cc: x86@kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , Hsin-Yi Wang , Mark-PK Tsai Subject: [PATCH v4 06/19] irqdomain: Drop revmap mutex Date: Mon, 16 Jan 2023 14:50:31 +0100 Message-Id: <20230116135044.14998-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.38.2 In-Reply-To: <20230116135044.14998-1-johan+linaro@kernel.org> References: <20230116135044.14998-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230116_135039_653256_8DCD8A7A X-CRM114-Status: GOOD ( 14.94 ) 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 The global irq_domain_mutex is now held in all paths that update the revmap structures so there is no longer any need for the revmap mutex. Tested-by: Hsin-Yi Wang Tested-by: Mark-PK Tsai Signed-off-by: Johan Hovold --- include/linux/irqdomain.h | 2 -- kernel/irq/irqdomain.c | 13 ++++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 5b2718e1c6de..7fd3939328c2 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -143,7 +143,6 @@ struct irq_domain_chip_generic; * Revmap data, used internally by the irq domain code: * @revmap_size: Size of the linear map table @revmap[] * @revmap_tree: Radix map tree for hwirqs that don't fit in the linear map - * @revmap_mutex: Lock for the revmap * @revmap: Linear table of irq_data pointers */ struct irq_domain { @@ -171,7 +170,6 @@ struct irq_domain { irq_hw_number_t hwirq_max; unsigned int revmap_size; struct radix_tree_root revmap_tree; - struct mutex revmap_mutex; struct irq_data __rcu *revmap[]; }; diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 23f5919e58b7..248e6acfafbe 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -214,7 +214,6 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int s /* Fill structure */ INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL); - mutex_init(&domain->revmap_mutex); domain->ops = ops; domain->host_data = host_data; domain->hwirq_max = hwirq_max; @@ -501,30 +500,30 @@ static bool irq_domain_is_nomap(struct irq_domain *domain) static void irq_domain_clear_mapping(struct irq_domain *domain, irq_hw_number_t hwirq) { + lockdep_assert_held(&irq_domain_mutex); + if (irq_domain_is_nomap(domain)) return; - mutex_lock(&domain->revmap_mutex); if (hwirq < domain->revmap_size) rcu_assign_pointer(domain->revmap[hwirq], NULL); else radix_tree_delete(&domain->revmap_tree, hwirq); - mutex_unlock(&domain->revmap_mutex); } static void irq_domain_set_mapping(struct irq_domain *domain, irq_hw_number_t hwirq, struct irq_data *irq_data) { + lockdep_assert_held(&irq_domain_mutex); + if (irq_domain_is_nomap(domain)) return; - mutex_lock(&domain->revmap_mutex); if (hwirq < domain->revmap_size) rcu_assign_pointer(domain->revmap[hwirq], irq_data); else radix_tree_insert(&domain->revmap_tree, hwirq, irq_data); - mutex_unlock(&domain->revmap_mutex); } static void irq_domain_disassociate(struct irq_domain *domain, unsigned int irq) @@ -1511,11 +1510,12 @@ static void irq_domain_fix_revmap(struct irq_data *d) { void __rcu **slot; + lockdep_assert_held(&irq_domain_mutex); + if (irq_domain_is_nomap(d->domain)) return; /* Fix up the revmap. */ - mutex_lock(&d->domain->revmap_mutex); if (d->hwirq < d->domain->revmap_size) { /* Not using radix tree */ rcu_assign_pointer(d->domain->revmap[d->hwirq], d); @@ -1524,7 +1524,6 @@ static void irq_domain_fix_revmap(struct irq_data *d) if (slot) radix_tree_replace_slot(&d->domain->revmap_tree, slot, d); } - mutex_unlock(&d->domain->revmap_mutex); } /** -- 2.38.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel