From patchwork Mon Feb 27 17:12:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Sodagudi X-Patchwork-Id: 9593621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F0E2604AB for ; Mon, 27 Feb 2017 17:12:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30E1F27FAE for ; Mon, 27 Feb 2017 17:12:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24DBB283F6; Mon, 27 Feb 2017 17:12:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 97B8527FAE for ; Mon, 27 Feb 2017 17:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OaQD/QCKfFH4+63M38kz+DipRorbCCA0G95/V7Q4SNQ=; b=Ldm6D4xZNB91TE7czFKzNfrt4 NP+7lwcKwNeRPW2ccl8mWts2bhNcYx1J+iGloVzc0tRsqm6XLP1fAuZbODkD2hZWwvpPFA/zcNfje bj0PnKAWSjJwmQ7F3JIQWmVYHXJ1UmRRHJYCUjCeVZgsSb3RkLZhQEh7PccQwiGUYj0LhCTa/HhpR cfdmNCP5IwZxrjge/P4dvvY+CehQlQDDHncX3ti8pBIKRb4yg2SICSoM943Kpsl7qxqtxpRV9n47m v3v+vS5pcQvxQjbrDXQzc3FZdyIqcIVHnb34r7uGRaMYRDsF/LLSj8J0yzPQGIUSNUucVtcnhbJIN ECYePzLsw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ciOqY-0005r7-AG; Mon, 27 Feb 2017 17:12:26 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ciOqU-0005o5-1d for linux-arm-kernel@lists.infradead.org; Mon, 27 Feb 2017 17:12:24 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 25B3060910; Mon, 27 Feb 2017 17:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1488215521; bh=+TxPTyO6upT2nynq6RlbB6bFrYEwGP1H09oXFE2AOR8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LcSkP/VAcVaJDa2/JAoGWWtVlLVIRb+Lu4USC2mNJhZqMKz1/TcRsYug464GK6Ast TkgpLMdJNm8gPoxENtzk+3xnM1Os7+ArhvDwqMKJkITcGVg/n76TjfmXYRyRZd7VEA Y3dD8H6lvWTu9c7EMwPlUujHCeJgKMbWXMb9jBLw= Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id BD7956074A; Mon, 27 Feb 2017 17:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1488215520; bh=+TxPTyO6upT2nynq6RlbB6bFrYEwGP1H09oXFE2AOR8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hsrSvW6xj3+SjfXFEK6Ei/qf2/GFxAId8h355jbBHJkSRMYNxXpiOL7i18utUHqNE uH8D+za9oQaNtxFK1oCieTjmpYRPy2BF4ves9OSF6onb/PYG8K31c2Vv4sn4LMseUq ph2iMuSE6i8sNh1mRucrLGdV9azxeB2h1C5sDcn0= MIME-Version: 1.0 Date: Mon, 27 Feb 2017 09:12:00 -0800 From: Sodagudi Prasad To: tglx@linutronix.de Subject: Re: Schedule affinity_notify work while migrating IRQs during hot plug In-Reply-To: <05102c455476941d37904f8c6f387452@codeaurora.org> References: <05102c455476941d37904f8c6f387452@codeaurora.org> Message-ID: X-Sender: psodagud@codeaurora.org User-Agent: Roundcube Webmail/1.2.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170227_091222_176967_7AE2FB92 X-CRM114-Status: GOOD ( 14.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: will.deacon@arm.com, james.morse@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On 2017-02-21 12:59, Sodagudi Prasad wrote: > Hi Thomas, > > Currently irq_set_affinity() is called to migrate irqs from > migrate_one_irq() > during cpu hot plug and clients which are interested to know the irq > affinity change > not getting notified > > take_cpu_down () --> __cpu_disable() --> > irq_migrate_all_off_this_cpu(); > > irq_set_affinity() is changing the IRQ affinity at chip level > but it is not notifying the affinity_notify work. > Hi Thomas and All, I could see that in the 3.10 kernel irq affinity notifiers are getting called when a core getting hot plugged. But in later kernel versions api used to change affinity was changed from irq_set_affinity_locked() to irq_do_set_affinity(), so irq notifiers are not getting called when a core hot plugged. https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/kernel/irq/manage.c?id=refs/tags/v3.10.105#n201 In latest kernel following path is executed to migrate IRQs. irq_migrate_all_off_this_cpu() --> migrate_one_irq() -> irq_do_set_affinity(). As I mentioned above, irq_set_affinity_locked() notifies all clients drivers, which are registered for IRQ affinity change but irq_do_set_affinity() API just changes the affinity at irq chip level but does not notify the clients drivers. I am not sure whether it is just a miss during IRQ framework refactor or intentionally done like this. Can you please check whether following code change make sense or not? So I am thinking that, adding following sched_work() would notify clients. } > How about below change, so that clients drivers gets notified about > irq affinity changes? > --- a/kernel/irq/manage.c > +++ b/kernel/irq/manage.c > @@ -207,6 +207,7 @@ int irq_do_set_affinity(struct irq_data *data, > const struct cpumask *mask, > case IRQ_SET_MASK_OK_DONE: > cpumask_copy(desc->irq_common_data.affinity, mask); > case IRQ_SET_MASK_OK_NOCOPY: > + schedule_work(&desc->affinity_notify->work); > irq_set_thread_affinity(desc); > ret = 0; > > With this change, notifications of IRQ affinity gets executed and > notified > to client drivers. -Thanks, Prasad diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 6b66959..5e4766b 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -207,6 +207,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, case IRQ_SET_MASK_OK_DONE: cpumask_copy(desc->irq_common_data.affinity, mask); case IRQ_SET_MASK_OK_NOCOPY: + schedule_work(&desc->affinity_notify->work); irq_set_thread_affinity(desc); ret = 0;