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 DD5C5C38147 for ; Wed, 18 Jan 2023 13:36:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbjARNge (ORCPT ); Wed, 18 Jan 2023 08:36:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbjARNgL (ORCPT ); Wed, 18 Jan 2023 08:36:11 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D59B35AA4D; Wed, 18 Jan 2023 05:05:30 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1674047129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aZaIjrzhvVg9jpiqi2HTixsDbSaXaIdATroe2BmK7u8=; b=Eq700/picnYdhBtQy1p726vv/TLVIwnpnWNT+krWpkyrEoJ0lMc1UxOB7mAX5X2tLjShtu of4UG5nvdBZG30dD2CtrWRfc8jggFE5RJk0Pfe/FmY7ALaN03fzKkv6nAmb6RiI8Z2Lxo3 ewAbdlN/HpLQrekdqqDde3n7j504IFfGJzMj/x25nMNE+qTG997KUtEKcKcWxyt078VBRT 6u3Uhm/bTDrIE4j38avwZCLOm6968BZ6+hsAN00vtN08pMimx8SbAqT25rk4sZN0pjxD85 OLGFaW46nNwFnCZzjKzdsQ+NiQwhWpGYCMOmEXAHUefTRH3hC1ifZYwm+C3nrw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1674047129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aZaIjrzhvVg9jpiqi2HTixsDbSaXaIdATroe2BmK7u8=; b=v0dQgim9ekA7YGFRhrRSgwJtx1R+dmhRXTihTnGp0SDMuGAWpQOy6mtYyQ9PfV/h2SZmyE eLReQIWvKXg1LCDw== To: Johan Hovold Cc: Johan Hovold , Marc Zyngier , 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, Hsin-Yi Wang , Mark-PK Tsai Subject: Re: [PATCH v4 06/19] irqdomain: Drop revmap mutex In-Reply-To: References: <20230116135044.14998-1-johan+linaro@kernel.org> <20230116135044.14998-7-johan+linaro@kernel.org> <871qnslut3.ffs@tglx> Date: Wed, 18 Jan 2023 14:05:29 +0100 Message-ID: <87r0vshu1y.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On Wed, Jan 18 2023 at 10:22, Johan Hovold wrote: > On Tue, Jan 17, 2023 at 10:23:20PM +0100, Thomas Gleixner wrote: >> On Mon, Jan 16 2023 at 14:50, Johan Hovold wrote: >> > 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. >> >> This can also go after the 3rd race fix, but ... >> >> > static void irq_domain_clear_mapping(struct irq_domain *domain, >> > irq_hw_number_t hwirq) >> > { >> > + lockdep_assert_held(&irq_domain_mutex); >> >> these lockdep asserts want to be part of the [dis]association race >> fixes. They are completely unrelated to the removal of the revmap_mutex. > > No, they are very much related to the removal of the revmap_mutex. These > functions deal with the revmap structures which before this patch were > clearly only modified with the revmap_mutex held. > > The lockdep assert is here to guarantee that my claim that all current > (and future) paths that end up modifying these structures do so under > the irq_domain_mutex instead. > >> Your race fixes change the locking and you want to ensure that all >> callers comply right there, no? > > I want to make sure that all callers of these function comply, yes. > That's why the asserts belong in this patch. You can do this in a two step approach. 1) Add the new locking and ensure that the lock is held when the functions are called 2) Safely remove the revmap_mutex because you already established that revmap is protected by some other means Thanks, tglx 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 9F589C32793 for ; Wed, 18 Jan 2023 13:06:40 +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:Message-ID:Date:References :In-Reply-To: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=Rsl0SAa2NkVzLwWFxkpbyQQCh9HXKmtkHngkkKOLXWA=; b=xGDolsXXi2lx0u j+4TOTHCb+4FnpzX4yHh2kauY+7TdnU/ip66KyrcAEL4iXo3eo401x02ljdGEQzqugtQS4wjgMSQ4 ab2BvFD6F4odzhRg+q0+zUQac66rhTVJjUC0TeE8Ch3Lap8r8WhBzfdGVaAt68ih6JNWwpxOvfK8s dozNfurEjCVDngaFZCxAUbvsDMT7KDOpZ3HvP4cFaIhYKKrPnk/0IFJYCQLBaYQyfKLusiPqVkGKd 5nAcx4XvNEO2dXbz1D7lS8W9CfiCmmxu4ldPjGUMm/RF52dIokketkxzRgV/lbbZqaUTD7xaD0mdA vQH3jvpYhveiQWTCEqMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI88G-0013Eu-5T; Wed, 18 Jan 2023 13:05:36 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI88A-0013Cu-VG for linux-arm-kernel@lists.infradead.org; Wed, 18 Jan 2023 13:05:34 +0000 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1674047129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aZaIjrzhvVg9jpiqi2HTixsDbSaXaIdATroe2BmK7u8=; b=Eq700/picnYdhBtQy1p726vv/TLVIwnpnWNT+krWpkyrEoJ0lMc1UxOB7mAX5X2tLjShtu of4UG5nvdBZG30dD2CtrWRfc8jggFE5RJk0Pfe/FmY7ALaN03fzKkv6nAmb6RiI8Z2Lxo3 ewAbdlN/HpLQrekdqqDde3n7j504IFfGJzMj/x25nMNE+qTG997KUtEKcKcWxyt078VBRT 6u3Uhm/bTDrIE4j38avwZCLOm6968BZ6+hsAN00vtN08pMimx8SbAqT25rk4sZN0pjxD85 OLGFaW46nNwFnCZzjKzdsQ+NiQwhWpGYCMOmEXAHUefTRH3hC1ifZYwm+C3nrw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1674047129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aZaIjrzhvVg9jpiqi2HTixsDbSaXaIdATroe2BmK7u8=; b=v0dQgim9ekA7YGFRhrRSgwJtx1R+dmhRXTihTnGp0SDMuGAWpQOy6mtYyQ9PfV/h2SZmyE eLReQIWvKXg1LCDw== To: Johan Hovold Cc: Johan Hovold , Marc Zyngier , 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, Hsin-Yi Wang , Mark-PK Tsai Subject: Re: [PATCH v4 06/19] irqdomain: Drop revmap mutex In-Reply-To: References: <20230116135044.14998-1-johan+linaro@kernel.org> <20230116135044.14998-7-johan+linaro@kernel.org> <871qnslut3.ffs@tglx> Date: Wed, 18 Jan 2023 14:05:29 +0100 Message-ID: <87r0vshu1y.ffs@tglx> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230118_050531_170617_06DF35CD X-CRM114-Status: GOOD ( 17.98 ) 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 On Wed, Jan 18 2023 at 10:22, Johan Hovold wrote: > On Tue, Jan 17, 2023 at 10:23:20PM +0100, Thomas Gleixner wrote: >> On Mon, Jan 16 2023 at 14:50, Johan Hovold wrote: >> > 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. >> >> This can also go after the 3rd race fix, but ... >> >> > static void irq_domain_clear_mapping(struct irq_domain *domain, >> > irq_hw_number_t hwirq) >> > { >> > + lockdep_assert_held(&irq_domain_mutex); >> >> these lockdep asserts want to be part of the [dis]association race >> fixes. They are completely unrelated to the removal of the revmap_mutex. > > No, they are very much related to the removal of the revmap_mutex. These > functions deal with the revmap structures which before this patch were > clearly only modified with the revmap_mutex held. > > The lockdep assert is here to guarantee that my claim that all current > (and future) paths that end up modifying these structures do so under > the irq_domain_mutex instead. > >> Your race fixes change the locking and you want to ensure that all >> callers comply right there, no? > > I want to make sure that all callers of these function comply, yes. > That's why the asserts belong in this patch. You can do this in a two step approach. 1) Add the new locking and ensure that the lock is held when the functions are called 2) Safely remove the revmap_mutex because you already established that revmap is protected by some other means Thanks, tglx _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel