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 B33932D5944 for ; Tue, 13 Jan 2026 20:14:58 +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=1768335298; cv=none; b=cQG7qZpIUt16GFQBbGfkTv09rLSL0GXsk8eribGEVK0eP1rFWQ/pVl5zHki8Jr2t4bd5DMgmlwDBu1L8fulrd+7g/+U+Td9Rii9ZFLSitPjaw+Za+nqAJJ+l5vCxab8PcM9bjGROE8+IVhWtowtzTgOYhTBNaYMqxhFZZ29D+fQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768335298; c=relaxed/simple; bh=OSCRlP5Gyg8EXK8qp4tBivTlyAGc6gMsJtsXzLHMR7Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=d21Y2l8nFPhrG0PePAlRiGJtWldILWT3YFmjYa9clO+0ey/z+bJWWsImrTPsSPKTIycWIj5lXluIdnlEJJFYdJTqAmdwaFVq8eQcZQD4p6Og6HJW4GFl2TL0gugBqvLiSh4VG54iHtPkFPb6a1M6DKdU/W581HW4IidHg3rY5pE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IKYvMG5E; 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="IKYvMG5E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4793C116C6; Tue, 13 Jan 2026 20:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768335298; bh=OSCRlP5Gyg8EXK8qp4tBivTlyAGc6gMsJtsXzLHMR7Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=IKYvMG5EFKOKVHiK4mH0iAk7KIywLD/KUnagy3CGjFLk0FgDy4lk/85fRLdsstlRK 1WnWJauCGSRFBnh/HPWGxDzwRdyYHFd5SiijdeJCcybXunCyhOY7R4J7YpmXLrnrjM 63lrGBHf3Al4s4JVMfZBaDvTFwpiVClWB36Hj5umNrUNbNgIkYF6JOoWs4HZBq6s2L x39n+pT2oTouLbuKRH2ZKWu8f4DHedHg+vatNfBJs7mZFD/n6N6Yvw7Ez0rCQHFrC2 ee9AJL69Wfrgcvhl0AG5KlMpFWe8fJq2IanuSJMaNHatD8XtAAVB1DcFEUB6A89U7a /i/uKNSe/PCyg== From: Thomas Gleixner To: Imran Khan Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] genirq/cpuhotplug: notify about irq affinity change for offlined cpus. In-Reply-To: <20260113143727.1041265-1-imran.f.khan@oracle.com> References: <20260113143727.1041265-1-imran.f.khan@oracle.com> Date: Tue, 13 Jan 2026 21:14:54 +0100 Message-ID: <87sec9i81t.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Tue, Jan 13 2026 at 22:37, Imran Khan wrote: > During cpu offlining the irqs affined to that cpu are moved Please use proper words, i.e. interrupts, in change logs. There is no character limit. > to other cpu, but this affinity change is not accounted for by > irq_desc::affinity_notify (if available). > This can leave users, of irq_set_affinity_notifier, with old > affinity information. That's not really correct. _All_ device interrupts (except managed interrupts which are shut down) are moved away from the outgoing CPU, but the affinity change notification is only required when the outgoing CPU was the last online CPU in the affinity mask. > Avoid this by allowing to schedule affinity change notification Allowing? This is not what the patch does. It schedules it, no? > work for irqs that were affined to the cpu being offlined. > > Also since irq_set_affinity_locked uses the same logic to As documented in Documentation/process/.... functions should be denoted with function_name(). > @@ -383,6 +383,7 @@ irq_create_affinity_masks(unsigned int nvec, struct irq_affinity *affd); > unsigned int irq_calc_affinity_vectors(unsigned int minvec, unsigned int maxvec, > const struct irq_affinity *affd); > > +extern void schedule_affinity_notify_work(struct irq_desc *desc); > #else /* CONFIG_SMP */ > > static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) > @@ -445,6 +446,7 @@ irq_calc_affinity_vectors(unsigned int minvec, unsigned int maxvec, > return maxvec; > } > > +static inline void schedule_affinity_notify_work(struct irq_desc *desc) { } There is neither a reason for this to be in the global header nor there is a reason for the !SMP stub. Both call sites are only compiled when CONFIG_SMP=y. > +/** > + * schedule_affinity_notify_work - Schedule work to notify > + * about irq affinity change. > + * @desc: irq descriptor whose affinity changed > + * > + * Caller needs to hold desc->lock > + */ > +void schedule_affinity_notify_work(struct irq_desc *desc) > +{ > + kref_get(&desc->affinity_notify->kref); > + if (!schedule_work(&desc->affinity_notify->work)) > + /* Work was already scheduled, drop our extra ref */ > + kref_put(&desc->affinity_notify->kref, > + desc->affinity_notify->release); Lacks brackets around the if() (see Documentation) and the line break is pointless. > +} > +EXPORT_SYMBOL_GPL(schedule_affinity_notify_work); Zero reason to export this. It's an internal function of the built-in interrupt core code and nothing outside of it has any business with it. No need to resend. I fixed it up on the fly. Please study and verify the changes I made both in code and change log once the merge notification hits your inbox. Thanks, tglx