From patchwork Fri Dec 9 14:01:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 31754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp794498wrr; Fri, 9 Dec 2022 06:06:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf6JULuu6VAT2DtrTEEHWEZRru9EYEayFmoh0s2J9PtQ3Xr7uAy4UbJby/tj+/COPUWvQxAQ X-Received: by 2002:a17:90b:4fc2:b0:219:f9d9:c82e with SMTP id qa2-20020a17090b4fc200b00219f9d9c82emr5983492pjb.42.1670594796389; Fri, 09 Dec 2022 06:06:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670594796; cv=none; d=google.com; s=arc-20160816; b=EwZSVdQRNCJww0aeSs95XS3bUZ+mLVzu8EdC/IjP/3mf2joahdJbtBMCmuSheKDLad VWuIRPX5t2iwJA2rrb1CFBeJRBFpwFr0IdzBih4dwxznM6DNeBHxwID2E6OIfB5cQCi9 RsS+zWoOXgfpA9JzLGlKn3sqXrWjCy7AQ+obPHX3Hm2CdXM9NopQcgox2oQc5LykyI1l YIzdZ3ZmppKt0svXrIBpXLsFgQ3CBwp5ZXGj5WunVAjxNlS0txKFko1IHAhSPOePoc9c ODsJxicqxv/Qtg+oFQFTQAJ9XtDhXjen5h3leLgY2Z1ErTGNwkWpR8tXg001P7+bzodI cEoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ftcIPpS9dnwX3FOCuGr8qp7lSyWNA2Hj6+qZ6hUSo6g=; b=g5K6Id3KF6Glbbd6oIycnusSDnFkVFvKCsoaXH88QwU5yrZWQKB9muQJ1ad81nbNIp pFacwSDg0f+amaLUYpH6pYLbo7VR7Q9sNlBGnjVUnNNChuGPAo37kjyFyKWWKJ4FWAOE IG4/l1kJASWWsArEBQ+hlENavgj7Jvh5XE9sDefKEaLiI8iOf7vVy2eCBeLGoMQuskLH O4Uwv4hLXl0RWvvVNeNRms2dRJNV9SXNzMRUQfXdGaBzcOsqAqNlhF1BIzNNUloq1Hd3 UzIZ9llQhZlXE6CxyNNdbxTvG9rOxW5esCVswLu3EVgC9mumfB02JZyZoNUniZE5Fk07 bdlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mjFT4DQ8; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15-20020a17090a74cf00b002193068fe94si2169778pjl.37.2022.12.09.06.06.10; Fri, 09 Dec 2022 06:06:36 -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=@kernel.org header.s=k20201202 header.b=mjFT4DQ8; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbiLIOF2 (ORCPT + 99 others); Fri, 9 Dec 2022 09:05:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiLIOFR (ORCPT ); Fri, 9 Dec 2022 09:05:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10A6E77229; Fri, 9 Dec 2022 06:05:15 -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 95C3962269; Fri, 9 Dec 2022 14:05:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CBE8C433AA; Fri, 9 Dec 2022 14:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670594713; bh=25WzgH8MXrRT4j0vWI1/G7WvfbKjDj7LuhqI1OtgHDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjFT4DQ8z9ZlKuB/SCMNZRZ/RzrAZgiOOrJ0PfRUJaVRThztlaUcCpQPOu4kqduKI gyxKZjq/e81Mu8CIHXWLq5xUKKGKb6JyuIJBw/BylQS0Rpr25Rl3TOUYd2YtZajdd5 /WC7iKD80xZ7YxL4zrOzLMKnC9D7Ht+/pt5o/OBx4dZavApxI8yvOky/JU4yNe2Zhx Bj6cCE12Jif+aEbiNW9BRmMocaSxG2Dfyfe3YM4tV/JdJouLMRwajSrkkIQrqvPIpo iDinKaUbIMvf9pkyu2PeDD5xjNlU9HxV06/rZ2hAcYBptCO30KGgY3pOYVwhez79pw kvPrnTrp/85Lw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1p3e0I-0000Rc-Kt; Fri, 09 Dec 2022 15:05:30 +0100 From: Johan Hovold To: Marc Zyngier Cc: Thomas Gleixner , 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 Subject: [PATCH v3 06/19] irqdomain: Drop revmap mutex Date: Fri, 9 Dec 2022 15:01:37 +0100 Message-Id: <20221209140150.1453-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221209140150.1453-1-johan+linaro@kernel.org> References: <20221209140150.1453-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751745608962295134?= X-GMAIL-MSGID: =?utf-8?q?1751745608962295134?= 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. 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 a372086750ca..16399de00b48 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); } /**