Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6829538rwb; Mon, 12 Dec 2022 06:59:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf7iqOGY5kDdDJZKoteMVKMiT+XyVZkA03Jx4htaaC8hCq6ipiXCUW/d4jCaZYegmuVaoivX X-Received: by 2002:a05:6a00:1c91:b0:574:91bc:13e6 with SMTP id y17-20020a056a001c9100b0057491bc13e6mr17107942pfw.20.1670857188977; Mon, 12 Dec 2022 06:59:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670857188; cv=none; d=google.com; s=arc-20160816; b=EXIQAFxflwUB0n/RnfpAQeSSqEf5DOkAMeS7w13gDVuqB5Id/6NEKqN7V4l+vDmo3l CMtuBfjW3wDtUTglm1mVTwL0Rq1QLsovdJkh8x3NlAUo0EmwEgD5rC9hKli5wLRL9nhP Ic7/95iFvbduxxJ60807VMT/U0SL2OtUEa07Tkz7/rfy0Er/rSRxN184yiPSPGqXxwAF bSjvwxTYCSs+fkhaJXmV+ub9u5czH/FUc3N6b9yt0vzGgq+Bo1VN8wAaMHcV1VuygMqz zfPebALr95070jaT846gSLn8X3LRfep8I+7RcADUlPf8RSh23gS1gH7g1XgeZhosuqrT CYhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3Tx10fgoMwyJ/mZGBqMskTmCyjG2OnX1iEAk1qAP6t4=; b=OnLG5MXorelcgfLeC/L+cFrc11bSRUFEUs2XoD019OvU3/TMN/hr33XG/g5TYlm3vX Hyfs5m+V6wnQzNY1rc7bArLXCm06HHwBnASfaOjRdgGoN5r5hCSfrMZBVOfMfPal/Jxn 6nobNAfWbygqVpQHZSqUp6O/tR0Hye3rpVn1SGVjjKS3nuT1SMNrHiZrHL8C2/o0JUOP Le/KNp5HMi5dQaO3czkArtcD8UCuN9Kz5Rdhjxe+Z2pLYjz9sI59okLVner7hz/8EX06 odqfLNBxEgQaC+v9Q/XnJtkpaQzJrAy+H0OiB9I1fzopE4s0orgr5KHBOZ8K+TRzV4rS /Upw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PAmAzWWk; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a056a0015c100b00577c17000dasi10298388pfu.166.2022.12.12.06.59.38; Mon, 12 Dec 2022 06:59:48 -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=PAmAzWWk; 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 S232432AbiLLO3X (ORCPT + 75 others); Mon, 12 Dec 2022 09:29:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232081AbiLLO3R (ORCPT ); Mon, 12 Dec 2022 09:29:17 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 921DC12D06; Mon, 12 Dec 2022 06:29: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 ams.source.kernel.org (Postfix) with ESMTPS id 2AA6EB80D8B; Mon, 12 Dec 2022 14:29:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9C71C433D2; Mon, 12 Dec 2022 14:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670855352; bh=Rus4CdOiiPn7zFAosG9gmqEHn/vU+rdHuj+PuYGnEXg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PAmAzWWkhYpob2WNGn5P3l87YkLVt2J+gDnA5q/PAfUReD/3Y5Vfjmc1YYMg6jC9P 5XtNdReR5EbdW6ySCZZALPLA1rfxWksQNIIcp6tLuWJXyuK205G5KrEtlT6nN8WRmL JdoDFb8bS1qXi/eVjlTIjt0TnPGii1Zmrn9bH053ZbO4EGWlr7XlUKZOmb3zHQHht8 gxZr0BfBNHuYM5dQw82FJTt+qXG47m1khF+auqnwwvKOYdM3gOGN1BZ1aohHFWsLc0 0x2BdSUFsBoekH48ZIviTY0edLXP/AUtlUgaYTOFA+KQ93wsoNIyEoo/84u2kkIeRX fPWG7s6x4m6JQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1p4joF-0007Mc-B7; Mon, 12 Dec 2022 15:29:36 +0100 Date: Mon, 12 Dec 2022 15:29:35 +0100 From: Johan Hovold To: Thomas Gleixner 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 Subject: Re: [PATCH v3 19/19] irqdomain: Switch to per-domain locking Message-ID: References: <20221209140150.1453-1-johan+linaro@kernel.org> <20221209140150.1453-20-johan+linaro@kernel.org> <87mt7sbtf9.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87mt7sbtf9.ffs@tglx> 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 On Mon, Dec 12, 2022 at 03:14:34PM +0100, Thomas Gleixner wrote: > On Fri, Dec 09 2022 at 15:01, Johan Hovold wrote: > > The IRQ domain structures are currently protected by the global > > irq_domain_mutex. Switch to using more fine-grained per-domain locking, > > which may potentially speed up parallel probing somewhat. > > > > Note that the domain lock of the root domain (innermost domain) must be > > used for hierarchical domains. For non-hierarchical domain (as for root > > domains), the new root pointer is set to the domain itself so that > > domain->root->mutex can be used in shared code paths. > > > > Also note that hierarchical domains should be constructed using > > irq_domain_create_hierarchy() (or irq_domain_add_hierarchy()) to avoid > > poking at irqdomain internals. > > While I agree in principle, this change really makes me nervous. > > Any fail in setting up domain->root correctly, e.g. by not using > irq_domain_create_hierarchy(), cannot be detected and creates nasty to > debug race conditions. > > So we need some debug mechanism which allows to validate that > domain->root is set up correctly when domain->parent != NULL. Lockdep will catch that due to the lockdep_assert_held(&domain->root->mutex); I added to irq_domain_set_mapping() and which is is called for each (inner) domain in a hierarchy when allocating an IRQ. Johan