From patchwork Fri Mar 17 10:51:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sodagudi Prasad X-Patchwork-Id: 740243 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vl2GB2x0tz9ryZ for ; Fri, 17 Mar 2017 21:51:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ffTxVN7r"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="L9DVyYkW"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="L9DVyYkW"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-ID: References:In-Reply-To:Subject:To:From:Date:Content-Type:MIME-Version: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=y32X+8NcJLGj4fZnn9Jgc8w/XmBEG3poYGvl/hsMOpA=; b=ffTxVN7r9nsAmMM5zd7UPLLS0 WHpK5pJyRkp9W+6d1+L1nhzKk1XnlpK/Xt0NRQHlTOLHZ+7M67cU/wMlHSsFq5W+zm+HI7KQgxhBv 7gGxYK+ED75i5VH/ANIrx5bCgakr62YUof4gZbE/GEP4gttLRTnU7smND4BH1Hkx32RYIPkKmpQ8I +8mN/Dd30sJihK9m9SzzjTDYEMpkcarA5bnJrSJjb1p/wpPKn6U951AxT+VEAjw1MEtM99tFuu1+0 2lxLKvvQC5aiQbOTIgk/9yr9k3bQm8EXJ7iQ59gIq5gzCIkMbhbPGgJqRDHFK9NocFtkenZ7WVzBR F90OQlOMw==; 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 1copU0-0001pL-SE; Fri, 17 Mar 2017 10:51:44 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1copTx-0001nS-27 for linux-arm-kernel@lists.infradead.org; Fri, 17 Mar 2017 10:51:42 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B4CC360798; Fri, 17 Mar 2017 10:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1489747880; bh=iG8J9v+uTtEcD5rF/zRNp9i9Ot/SxpivoYL0vRgoC1g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=L9DVyYkWH+nuC3sYcpz4+c1peMOPBbMnWneOf1zdPCJxTHFuoyHCrwim0lscScrJg jBqFBYLhy4HyKeMTIXknJEu5/ViJnOn9e36eA5b94P2Jk3NNVpGiSzLJ7VJqa0PMAX Blc94mLU6lHCfZPudGaC3wNciR/vDxzgpn7kV/o0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id EBB9060276; Fri, 17 Mar 2017 10:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1489747880; bh=iG8J9v+uTtEcD5rF/zRNp9i9Ot/SxpivoYL0vRgoC1g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=L9DVyYkWH+nuC3sYcpz4+c1peMOPBbMnWneOf1zdPCJxTHFuoyHCrwim0lscScrJg jBqFBYLhy4HyKeMTIXknJEu5/ViJnOn9e36eA5b94P2Jk3NNVpGiSzLJ7VJqa0PMAX Blc94mLU6lHCfZPudGaC3wNciR/vDxzgpn7kV/o0= MIME-Version: 1.0 Date: Fri, 17 Mar 2017 03:51:19 -0700 From: Sodagudi Prasad To: Thomas Gleixner Subject: Re: Schedule affinity_notify work while migrating IRQs during hot plug In-Reply-To: References: <05102c455476941d37904f8c6f387452@codeaurora.org> <36fe90bcca0a9c6283c4012412ed2924@codeaurora.org> Message-ID: <559ce4c1fef10c45eab12f65c4e0f0d9@codeaurora.org> 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-20170317_035141_152796_AC60B4BE X-CRM114-Status: GOOD ( 21.78 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.145.29.96 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list 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+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org On 2017-03-13 13:19, Thomas Gleixner wrote: > On Mon, 13 Mar 2017, Sodagudi Prasad wrote: >> On 2017-02-27 09:21, Thomas Gleixner wrote: >> > On Mon, 27 Feb 2017, Sodagudi Prasad wrote: >> > > So I am thinking that, adding following sched_work() would notify clients. >> > >> > And break the world and some more. >> > >> > > 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; >> > >> > You cannot do that unconditionally and just slap that schedule_work() call >> > into the code. Aside of that schedule_work() would be invoked twice for all >> > calls which come via irq_set_affinity_locked() .... >> Hi Tglx, >> >> Yes. I agree with you, schedule_work() gets invoked twice with >> previous >> change. >> >> How about calling irq_set_notify_locked() instead of >> irq_do_set_notify()? > > Is this a quiz? > > Can you actually see the difference between these functions? There is a > damned good reason WHY this calls irq_do_set_affinity(). Other option is that, adding an argument to irq_do_set_affinity() and queue work to notify when that new parameter set. I have attached patch for the same. I tested this change on arm64 bit platform and observed that clients drivers are getting notified during cpu hot plug. > Thanks, > > tglx From 54b8d5164126fbdf14d1a9586342b972a6eb5537 Mon Sep 17 00:00:00 2001 From: Prasad Sodagudi Date: Thu, 16 Mar 2017 23:44:44 -0700 Subject: [PATCH] genirq: Notify clients whenever there is change in affinity During the cpu hotplug, irq are getting migrated from hotplugging core but not getting notitfied to client drivers. So add parameter to irq_do_set_affinity(), to check and notify client drivers during the cpu hotplug. Signed-off-by: Prasad Sodagudi --- kernel/irq/cpuhotplug.c | 2 +- kernel/irq/internals.h | 2 +- kernel/irq/manage.c | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c index 011f8c4..e293d9b 100644 --- a/kernel/irq/cpuhotplug.c +++ b/kernel/irq/cpuhotplug.c @@ -38,7 +38,7 @@ static bool migrate_one_irq(struct irq_desc *desc) if (!c->irq_set_affinity) { pr_debug("IRQ%u: unable to set affinity\n", d->irq); } else { - int r = irq_do_set_affinity(d, affinity, false); + int r = irq_do_set_affinity(d, affinity, false, true); if (r) pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", d->irq, r); diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index bc226e7..6abde48 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -114,7 +114,7 @@ static inline void unregister_handler_proc(unsigned int irq, extern void irq_set_thread_affinity(struct irq_desc *desc); extern int irq_do_set_affinity(struct irq_data *data, - const struct cpumask *dest, bool force); + const struct cpumask *dest, bool force, bool notify); /* Inline functions for support of irq chips on slow busses */ static inline void chip_bus_lock(struct irq_desc *desc) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index a4afe5c..aef8a96 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -197,7 +197,7 @@ static inline bool irq_move_pending(struct irq_data *data) #endif int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, - bool force) + bool force, bool notify) { struct irq_desc *desc = irq_data_to_desc(data); struct irq_chip *chip = irq_data_get_irq_chip(data); @@ -209,6 +209,9 @@ 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: + if (notify) + schedule_work(&desc->affinity_notify->work); + irq_set_thread_affinity(desc); ret = 0; } @@ -227,7 +230,7 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, return -EINVAL; if (irq_can_move_pcntxt(data)) { - ret = irq_do_set_affinity(data, mask, force); + ret = irq_do_set_affinity(data, mask, force, false); } else { irqd_set_move_pending(data); irq_copy_pending(desc, mask); @@ -375,7 +378,7 @@ static int setup_affinity(struct irq_desc *desc, struct cpumask *mask) if (cpumask_intersects(mask, nodemask)) cpumask_and(mask, mask, nodemask); } - irq_do_set_affinity(&desc->irq_data, mask, false); + irq_do_set_affinity(&desc->irq_data, mask, false, true); return 0; } #else -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project