Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6980126rwb; Mon, 12 Dec 2022 08:36:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf4L9gpdzn959vVRRnTBVJTIQN/E/DRij2qTt+ARiHVy/fowK+p5PyrRQ2O2CGDKpWXuHvgO X-Received: by 2002:a05:6a21:2d8a:b0:a5:cc8f:cd14 with SMTP id ty10-20020a056a212d8a00b000a5cc8fcd14mr21389995pzb.35.1670862986217; Mon, 12 Dec 2022 08:36:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670862986; cv=none; d=google.com; s=arc-20160816; b=0F7R3awm4IPw8m0ZgPzRffc47ZwKocssUM1qwSLQfZdyRzZLN/Tnb4e9uStrumiBVC q6VGWU2Fg3k3RrEP7BDZ0ZTNb2Jl+YhpDKov5hzJr86KgtFoFPWsfyPI9+v7EQPy9ObT XOANPdlkhaRZI+N5rQAp+IR5zpL1qBw4KWVoB421ZlqduZKFut5MFrJKd5nqfiX4LOqO wwWoEyeWjN5Sa9DdZSSbnWPod4bIl8CfbwN2y5zjsW53ApZk/gxkcp+JyK+A50+pvCeb uTBBmLBMsq1UZS8TaC0oWZOg0zJmoM9IUhzf8i9+RugQKAyC6Y8YQTaHVtshDkYO0mf5 irkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=xj018pjLW2UkgQnmqILBUEjAhXT9K6CF9xEj+xIiOFE=; b=vE4jr/1CPP2f7ZyJbhySwRtmy1z5+fFiK8wBM6VrxD6bkDJxbhzIA7mjsM1kiJ8DiY 7cBhjr1MYQ3/zMPrwUhHrvfNrnvxCz6txcBbIhKMQlOlN6wN5QFTyTL6oIw2rz5uJNuK oIZgLsxrlV5zKf09MKMrKw7OnRv+PqVSLFDd3SRMaDQ+UHsfF5DeHFo8W1Ie045Vx4EI iCTFP9ft5y02UPnhH0iXc3obl78wXtgwD/fg3GNRjVxVvhNPz82PZFv7fSxEZEhKTuD6 Gn12JK23g++gtSVO8WMPWCVIv3dPedfKGXZGZn4/8sB1C78bHnl4g0Rs32RpD1XcfsEM 5bRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dKy70Zi3; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g2-20020a170902740200b001755f43df36si9268769pll.479.2022.12.12.08.36.15; Mon, 12 Dec 2022 08:36:26 -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=@linutronix.de header.s=2020 header.b=dKy70Zi3; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232708AbiLLQSU (ORCPT + 75 others); Mon, 12 Dec 2022 11:18:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232672AbiLLQSQ (ORCPT ); Mon, 12 Dec 2022 11:18:16 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F79B13E28; Mon, 12 Dec 2022 08:18:14 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670861892; 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=xj018pjLW2UkgQnmqILBUEjAhXT9K6CF9xEj+xIiOFE=; b=dKy70Zi3FiVNICZwR1ZmCUEpDQ3v/TY50J/4hvfbOePjz8inPzy3fENnG8eMjkELCHMY8U 38zyt11Ffk1cmTWmB6ToWEZTugFnAY0I7ngiTNgllZaM+/f27zmb/uveKuqeVZZtLLbUow LstYVR6VpXbY5gzJ6o+xdFVwAJ7GacdIDVFJjzkpdqszoQeGW9ekwsbN1D4np6IJBnA+xT pjKnMILuN78kgX48D5Bulitb2TWj3LZFduti5L8HN3wQ0lBZZnak79HXBCp0UMxtM7ypeL Q7GZi2E0KgDgV3rqQzfI+t1XG7SPNTWwb6uP+Tgd3EH0S9TO5mmr8mO4QLsFOA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670861892; 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=xj018pjLW2UkgQnmqILBUEjAhXT9K6CF9xEj+xIiOFE=; b=wyzDgR0jttlml3luJKS9Im9oim6JOrsphSFktX57nGApgGMBCUL4+A9pqaB+oEGsO9mRnw m6hOMh+W+d1iIFBw== 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 Subject: Re: [PATCH v3 19/19] irqdomain: Switch to per-domain locking In-Reply-To: References: <20221209140150.1453-1-johan+linaro@kernel.org> <20221209140150.1453-20-johan+linaro@kernel.org> <87mt7sbtf9.ffs@tglx> Date: Mon, 12 Dec 2022 17:18:11 +0100 Message-ID: <878rjcbnp8.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 15:29, Johan Hovold wrote: > 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. Hmm. Indeed that should do the trick. Some comments would be appreciated as the rules around domain->root are far from obvious. Thanks, tglx