From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753534AbdFVQ7h (ORCPT ); Thu, 22 Jun 2017 12:59:37 -0400 Received: from terminus.zytor.com ([65.50.211.136]:38141 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751283AbdFVQ7f (ORCPT ); Thu, 22 Jun 2017 12:59:35 -0400 Date: Thu, 22 Jun 2017 09:54:53 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: hpa@zytor.com, peterz@infradead.org, hch@lst.de, mingo@kernel.org, axboe@kernel.dk, keith.busch@intel.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, mpe@ellerman.id.au, marc.zyngier@arm.com Reply-To: hch@lst.de, hpa@zytor.com, peterz@infradead.org, mingo@kernel.org, axboe@kernel.dk, keith.busch@intel.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, marc.zyngier@arm.com, mpe@ellerman.id.au In-Reply-To: <20170619235445.354181630@linutronix.de> References: <20170619235445.354181630@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] genirq/cpuhotplug: Reorder check logic Git-Commit-ID: e8a7035039306c90bcc99129ffc18e0be052bbb9 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e8a7035039306c90bcc99129ffc18e0be052bbb9 Gitweb: http://git.kernel.org/tip/e8a7035039306c90bcc99129ffc18e0be052bbb9 Author: Thomas Gleixner AuthorDate: Tue, 20 Jun 2017 01:37:27 +0200 Committer: Thomas Gleixner CommitDate: Thu, 22 Jun 2017 18:21:16 +0200 genirq/cpuhotplug: Reorder check logic Move the checks for a valid irq chip and the irq_set_affinity() callback right in front of the whole migration logic. No point in doing a gazillion of other things when the interrupt cannot be migrated at all. Signed-off-by: Thomas Gleixner Cc: Jens Axboe Cc: Marc Zyngier Cc: Michael Ellerman Cc: Keith Busch Cc: Peter Zijlstra Cc: Christoph Hellwig Link: http://lkml.kernel.org/r/20170619235445.354181630@linutronix.de --- kernel/irq/cpuhotplug.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c index 9c5521b..41fe1e0 100644 --- a/kernel/irq/cpuhotplug.c +++ b/kernel/irq/cpuhotplug.c @@ -17,9 +17,20 @@ static bool migrate_one_irq(struct irq_desc *desc) { struct irq_data *d = irq_desc_get_irq_data(desc); + struct irq_chip *chip = irq_data_get_irq_chip(d); const struct cpumask *affinity = d->common->affinity; - struct irq_chip *c; - bool ret = false; + bool brokeaff = false; + int err; + + /* + * IRQ chip might be already torn down, but the irq descriptor is + * still in the radix tree. Also if the chip has no affinity setter, + * nothing can be done here. + */ + if (!chip || !chip->irq_set_affinity) { + pr_debug("IRQ %u: Unable to migrate away\n", d->irq); + return false; + } /* * If this is a per-CPU interrupt, or the affinity does not @@ -31,23 +42,16 @@ static bool migrate_one_irq(struct irq_desc *desc) if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { affinity = cpu_online_mask; - ret = true; + brokeaff = true; } - c = irq_data_get_irq_chip(d); - if (!c->irq_set_affinity) { - pr_debug("IRQ%u: unable to set affinity\n", d->irq); - ret = false; - } else { - int r = irq_do_set_affinity(d, affinity, false); - if (r) { - pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", - d->irq, r); - ret = false; - } + err = irq_do_set_affinity(d, affinity, false); + if (err) { + pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", + d->irq, err); + return false; } - - return ret; + return brokeaff; } /**