From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C21C30C153 for ; Sun, 17 May 2026 20:02:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779048163; cv=none; b=kogZ8OLLwUiz/U0BMSBElZtOEBLRQTnEBs+ch8FuBbNwhXGgwXZbCXqpdvJMeYAn5CphjrH5wbQOtackBzeQxAgx9LMPCgLz+lIRtiU4REa2Eeyot5pLUmTx0CDVSpnxHrs+YCoYEewmAu5B5aoVPah9o9DFdmswzOn+m6wMqek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779048163; c=relaxed/simple; bh=zugC1PHDdf91Isj/Q3qSOG7VilNslrUFW1yD6V8Kot0=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=b9DRYhGf38tLGINBtLk7aawCHE5t9mVQhpNSOINZF1/mW+HsGp67+Q9YZwMgPmMUPNweT7WZjnzjaNgyLOteRxzyKMhn8k2CabDb/6OYj/odp2FP8S+OdEE4N7L/IYcW9tYn9FQUYIE8bAY+F+GgfzlbuU1z9QwsuY4UZ3IKto0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ospG+hzg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ospG+hzg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 355C3C2BCB0; Sun, 17 May 2026 20:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779048162; bh=zugC1PHDdf91Isj/Q3qSOG7VilNslrUFW1yD6V8Kot0=; h=Date:From:To:Cc:Subject:References:From; b=ospG+hzglH8jQYE9cfWZarWFQfT3qwMDxlEFStfhyD2rGgno7ySCM9FI+jZmx2r/g fn6sR7aD0bdu2mIYGF5qI3t62uLQPUn3m2CwMIPK0O4QJ/YKiNmhRQNC1d6ZUDPBx+ vzwk+iXCAqHPPN8Ss/SriJNwG6hwEjyGwgmFD+KJtBI1gVb+4/jwwR1FPoP53V6DO7 cMf/siXyBJtvy8w08t3A/eumbCEUzngD6VSVsb98NjIPoSHFPbOWO2LPAWR6BRAl/G y1RuYoYyTmVJMF7iy9EK//9zgdwdRmatJGCt5y/Q74h0JSEv2BFPQJm4bQ30ZYgRq5 zCTlpQWHNlFgw== Date: Sun, 17 May 2026 22:02:39 +0200 Message-ID: <20260517194932.005787611@kernel.org> User-Agent: quilt/0.68 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Michael Kelley , Dmitry Ilvokhin , Radu Rendec , Jan Kiszka , Kieran Bingham , Florian Fainelli , Marc Zyngier Subject: [patch V6 14/16] genirq: Expose irq_find_desc_at_or_after() in core code References: <20260517194421.705253664@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: Thomas Gleixner ... in preparation for a smarter iterator for /proc/interrupts. Signed-off-by: Thomas Gleixner Tested-by: Michael Kelley Reviewed-by: Dmitry Ilvokhin --- V3: Add missing RCU guard and a lockdep assert - Dmitry --- kernel/irq/internals.h | 2 ++ kernel/irq/irqdesc.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -155,6 +155,8 @@ void irq_proc_calc_prec(void); static inline void irq_proc_calc_prec(void) { } #endif +struct irq_desc *irq_find_desc_at_or_after(unsigned int offset); + extern bool irq_can_set_affinity_usr(unsigned int irq); extern int irq_do_set_affinity(struct irq_data *data, --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -181,15 +181,12 @@ static int irq_find_free_area(unsigned i return mas.index; } -static unsigned int irq_find_at_or_after(unsigned int offset) +struct irq_desc *irq_find_desc_at_or_after(unsigned int offset) { unsigned long index = offset; - struct irq_desc *desc; - - guard(rcu)(); - desc = mt_find(&sparse_irqs, &index, total_nr_irqs); - return desc ? irq_desc_get_irq(desc) : total_nr_irqs; + lockdep_assert_in_rcu_read_lock(); + return mt_find(&sparse_irqs, &index, total_nr_irqs); } static void irq_insert_desc(unsigned int irq, struct irq_desc *desc) @@ -934,7 +931,11 @@ EXPORT_SYMBOL_GPL(__irq_alloc_descs); */ unsigned int irq_get_next_irq(unsigned int offset) { - return irq_find_at_or_after(offset); + struct irq_desc *desc; + + guard(rcu)(); + desc = irq_find_desc_at_or_after(offset); + return desc ? irq_desc_get_irq(desc) : total_nr_irqs; } struct irq_desc *__irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus,