From patchwork Tue Jun 29 15:27:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498401 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=c42bJMGn; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpKJ6bmYz9sW8 for ; Wed, 30 Jun 2021 01:28:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234830AbhF2PbB (ORCPT ); Tue, 29 Jun 2021 11:31:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58749 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234810AbhF2Pa4 (ORCPT ); Tue, 29 Jun 2021 11:30:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v4yUPdtpOJEcweWgkTfPnmAZIWcrOmFAWUYkxKtZ/fo=; b=c42bJMGnmIVqVr/O8sl/nEc+0LVhE6SMl7qfhKL5ZGo/GdIltZt6n+I15sVjfnjBX/gMf6 eQekNJj5zEqV4XrDjAzn/EbLwljmTSZAAA2VVqSaMhrESCEZ163r5v7rVu2g2FcV7S0Cxc Gjwi+Y913uo73XiARCEFCmTjKJHigQg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-424-XIzoBdyXP4GXO5ynXFATzA-1; Tue, 29 Jun 2021 11:28:26 -0400 X-MC-Unique: XIzoBdyXP4GXO5ynXFATzA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0761100CCCA; Tue, 29 Jun 2021 15:28:21 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA9CC69CB7; Tue, 29 Jun 2021 15:28:09 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 01/14] genirq: Provide new interfaces for affinity hints Date: Tue, 29 Jun 2021 11:27:33 -0400 Message-Id: <20210629152746.2953364-2-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Thomas Gleixner The discussion about removing the side effect of irq_set_affinity_hint() of actually applying the cpumask (if not NULL) as affinity to the interrupt, unearthed a few unpleasantries: 1) The modular perf drivers rely on the current behaviour for the very wrong reasons. 2) While none of the other drivers prevents user space from changing the affinity, a cursorily inspection shows that there are at least expectations in some drivers. #1 needs to be cleaned up anyway, so that's not a problem #2 might result in subtle regressions especially when irqbalanced (which nowadays ignores the affinity hint) is disabled. Provide new interfaces: irq_update_affinity_hint() - Only sets the affinity hint pointer irq_set_affinity_and_hint() - Set the pointer and apply the affinity to the interrupt Make irq_set_affinity_hint() a wrapper around irq_apply_affinity_hint() and document it to be phased out. Signed-off-by: Thomas Gleixner Signed-off-by: Nitesh Narayan Lal Link: https://lore.kernel.org/r/20210501021832.743094-1-jesse.brandeburg@intel.com --- include/linux/interrupt.h | 53 ++++++++++++++++++++++++++++++++++++++- kernel/irq/manage.c | 8 +++--- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 2ed65b01c961..bd25ba029c68 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -328,7 +328,46 @@ extern int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask); extern int irq_can_set_affinity(unsigned int irq); extern int irq_select_affinity(unsigned int irq); -extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); +extern int __irq_apply_affinity_hint(unsigned int irq, const struct cpumask *m, + bool setaffinity); + +/** + * irq_update_affinity_hint - Update the affinity hint + * @irq: Interrupt to update + * @cpumask: cpumask pointer (NULL to clear the hint) + * + * Updates the affinity hint, but does not change the affinity of the interrupt. + */ +static inline int +irq_update_affinity_hint(unsigned int irq, const struct cpumask *m) +{ + return __irq_apply_affinity_hint(irq, m, false); +} + +/** + * irq_set_affinity_and_hint - Update the affinity hint and apply the provided + * cpumask to the interrupt + * @irq: Interrupt to update + * @cpumask: cpumask pointer (NULL to clear the hint) + * + * Updates the affinity hint and if @cpumask is not NULL it applies it as + * the affinity of that interrupt. + */ +static inline int +irq_set_affinity_and_hint(unsigned int irq, const struct cpumask *m) +{ + return __irq_apply_affinity_hint(irq, m, true); +} + +/* + * Deprecated. Use irq_update_affinity_hint() or irq_set_affinity_and_hint() + * instead. + */ +static inline int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) +{ + return irq_set_affinity_and_hint(irq, m); +} + extern int irq_update_affinity_desc(unsigned int irq, struct irq_affinity_desc *affinity); @@ -360,6 +399,18 @@ static inline int irq_can_set_affinity(unsigned int irq) static inline int irq_select_affinity(unsigned int irq) { return 0; } +static inline int irq_update_affinity_hint(unsigned int irq, + const struct cpumask *m) +{ + return -EINVAL; +} + +static inline int irq_set_affinity_and_hint(unsigned int irq, + const struct cpumask *m) +{ + return -EINVAL; +} + static inline int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) { diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index ef30b4762947..837b63e63111 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -487,7 +487,8 @@ int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) } EXPORT_SYMBOL_GPL(irq_force_affinity); -int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) +int __irq_apply_affinity_hint(unsigned int irq, const struct cpumask *m, + bool setaffinity) { unsigned long flags; struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL); @@ -496,12 +497,11 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m) return -EINVAL; desc->affinity_hint = m; irq_put_desc_unlock(desc, flags); - /* set the initial affinity to prevent every interrupt being on CPU0 */ - if (m) + if (m && setaffinity) __irq_set_affinity(irq, m, false); return 0; } -EXPORT_SYMBOL_GPL(irq_set_affinity_hint); +EXPORT_SYMBOL_GPL(__irq_apply_affinity_hint); static void irq_affinity_notify(struct work_struct *work) { From patchwork Tue Jun 29 15:27:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498402 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b5ocsrOp; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpKl17LZz9sWM for ; Wed, 30 Jun 2021 01:28:59 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234719AbhF2PbX (ORCPT ); Tue, 29 Jun 2021 11:31:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59275 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234750AbhF2PbU (ORCPT ); Tue, 29 Jun 2021 11:31:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yYHuenJYgR7jtuCWCYvc0qdRH5XTlfnj11MyvxR9Vw0=; b=b5ocsrOp0S/5yos3oRpvIOSGO9YMPjvTV5099vXUb0RvyvWGZLJtqVSLK46ZgCPXW5tEK/ QYv7c32oPeidJghPLlXufCw7lVq6TrfDj3EmEavI/x40CrK9CtN5TG5uNmwCV8znYvNKne bOvx8+KJwHxMHoNSVM/LDwPtyU1N5U8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-R6wXnvmjPYyWP4jz-QcAuQ-1; Tue, 29 Jun 2021 11:28:50 -0400 X-MC-Unique: R6wXnvmjPYyWP4jz-QcAuQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 85B6980430A; Tue, 29 Jun 2021 15:28:45 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA40C604CC; Tue, 29 Jun 2021 15:28:21 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 02/14] iavf: Use irq_update_affinity_hint Date: Tue, 29 Jun 2021 11:27:34 -0400 Message-Id: <20210629152746.2953364-3-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() for two purposes: - To set the affinity_hint which is consumed by the userspace for distributing the interrupts - To apply an affinity that it provides for the iavf interrupts The latter is done to ensure that all the interrupts are evenly spread across all available CPUs. However, since commit a0c9259dc4e1 ("irq/matrix: Spread interrupts on allocation") the spreading of interrupts is dynamically performed at the time of allocation. Hence, there is no need for the drivers to enforce their own affinity for the spreading of interrupts. Also, irq_set_affinity_hint() applying the provided cpumask as an affinity for the interrupt is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only sets the pointer for the affinity_hint. Signed-off-by: Nitesh Narayan Lal --- drivers/net/ethernet/intel/iavf/iavf_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index e612c24fa384..f2e8fab53cb9 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -449,10 +449,10 @@ iavf_request_traffic_irqs(struct iavf_adapter *adapter, char *basename) irq_set_affinity_notifier(irq_num, &q_vector->affinity_notify); /* Spread the IRQ affinity hints across online CPUs. Note that * get_cpu_mask returns a mask with a permanent lifetime so - * it's safe to use as a hint for irq_set_affinity_hint. + * it's safe to use as a hint for irq_update_affinity_hint. */ cpu = cpumask_local_spread(q_vector->v_idx, -1); - irq_set_affinity_hint(irq_num, get_cpu_mask(cpu)); + irq_update_affinity_hint(irq_num, get_cpu_mask(cpu)); } return 0; @@ -462,7 +462,7 @@ iavf_request_traffic_irqs(struct iavf_adapter *adapter, char *basename) vector--; irq_num = adapter->msix_entries[vector + NONQ_VECS].vector; irq_set_affinity_notifier(irq_num, NULL); - irq_set_affinity_hint(irq_num, NULL); + irq_update_affinity_hint(irq_num, NULL); free_irq(irq_num, &adapter->q_vectors[vector]); } return err; @@ -514,7 +514,7 @@ static void iavf_free_traffic_irqs(struct iavf_adapter *adapter) for (vector = 0; vector < q_vectors; vector++) { irq_num = adapter->msix_entries[vector + NONQ_VECS].vector; irq_set_affinity_notifier(irq_num, NULL); - irq_set_affinity_hint(irq_num, NULL); + irq_update_affinity_hint(irq_num, NULL); free_irq(irq_num, &adapter->q_vectors[vector]); } } From patchwork Tue Jun 29 15:27:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498403 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ogw5FEFL; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpKw4QkNz9sWK for ; Wed, 30 Jun 2021 01:29:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234875AbhF2Pbe (ORCPT ); Tue, 29 Jun 2021 11:31:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45557 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234871AbhF2Pbc (ORCPT ); Tue, 29 Jun 2021 11:31:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HcJDOfelbZC8RiTErIOKA5ou31ptZ6zGFr/HrtCKX+4=; b=Ogw5FEFLHYrhOFWrnl0H4qEKZ9DngbM7/XeyL5XTaGd5GMUm6i93SHP0W3ybT91HvcrKdv NNqVFsb0sbtU0xVH/ILGauoY5THLg4fDE9owOhhxHBb6SnB+lH4QNQAswDzwwbWAwcPNQZ vbPcAM8zo/sZWIFlQEa+7SnRLd/ZQD4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-600-NYqxpDiqNGy5d84O_BCdBg-1; Tue, 29 Jun 2021 11:29:03 -0400 X-MC-Unique: NYqxpDiqNGy5d84O_BCdBg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4023B91270; Tue, 29 Jun 2021 15:28:58 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F5C869CB6; Tue, 29 Jun 2021 15:28:45 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 03/14] i40e: Use irq_update_affinity_hint Date: Tue, 29 Jun 2021 11:27:35 -0400 Message-Id: <20210629152746.2953364-4-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() for two purposes: - To set the affinity_hint which is consumed by the userspace for distributing the interrupts - To apply an affinity that it provides for the i40e interrupts The latter is done to ensure that all the interrupts are evenly spread across all available CPUs. However, since commit a0c9259dc4e1 ("irq/matrix: Spread interrupts on allocation") the spreading of interrupts is dynamically performed at the time of allocation. Hence, there is no need for the drivers to enforce their own affinity for the spreading of interrupts. Also, irq_set_affinity_hint() applying the provided cpumask as an affinity for the interrupt is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only sets the pointer for the affinity_hint. Signed-off-by: Nitesh Narayan Lal --- drivers/net/ethernet/intel/i40e/i40e_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 704e474879c5..a4439a86aeb8 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -3873,10 +3873,10 @@ static int i40e_vsi_request_irq_msix(struct i40e_vsi *vsi, char *basename) * * get_cpu_mask returns a static constant mask with * a permanent lifetime so it's ok to pass to - * irq_set_affinity_hint without making a copy. + * irq_update_affinity_hint without making a copy. */ cpu = cpumask_local_spread(q_vector->v_idx, -1); - irq_set_affinity_hint(irq_num, get_cpu_mask(cpu)); + irq_update_affinity_hint(irq_num, get_cpu_mask(cpu)); } vsi->irqs_ready = true; @@ -3887,7 +3887,7 @@ static int i40e_vsi_request_irq_msix(struct i40e_vsi *vsi, char *basename) vector--; irq_num = pf->msix_entries[base + vector].vector; irq_set_affinity_notifier(irq_num, NULL); - irq_set_affinity_hint(irq_num, NULL); + irq_update_affinity_hint(irq_num, NULL); free_irq(irq_num, &vsi->q_vectors[vector]); } return err; @@ -4695,7 +4695,7 @@ static void i40e_vsi_free_irq(struct i40e_vsi *vsi) /* clear the affinity notifier in the IRQ descriptor */ irq_set_affinity_notifier(irq_num, NULL); /* remove our suggested affinity mask for this IRQ */ - irq_set_affinity_hint(irq_num, NULL); + irq_update_affinity_hint(irq_num, NULL); synchronize_irq(irq_num); free_irq(irq_num, vsi->q_vectors[i]); From patchwork Tue Jun 29 15:27:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498404 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZQgx1J8E; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpL640jXz9sW8 for ; Wed, 30 Jun 2021 01:29:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234910AbhF2Pbm (ORCPT ); Tue, 29 Jun 2021 11:31:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51028 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234890AbhF2Pbi (ORCPT ); Tue, 29 Jun 2021 11:31:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tMJGLbOPQkBBjpyqO4GycXxqoo139IXpm2o/vzlxKk0=; b=ZQgx1J8EQZx0gD2r4loLSLueX4iSAEQ0h0kydNVV2p3AUKMBh4wQ85la06IMy40NJBLZ6k 5I8QqlLXNW+BB+sEIiQ8MbTZbafXCygjWQiGOpCeuCx74o1zJz6hPgtzMiX93w0681ZnxQ iOvVg+tRhdAu+YhQLC+du78Wen56WO8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-436-4saXpwAnM32n1JwKi0jEAw-1; Tue, 29 Jun 2021 11:29:07 -0400 X-MC-Unique: 4saXpwAnM32n1JwKi0jEAw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 11E0F100CCCA; Tue, 29 Jun 2021 15:29:02 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58AC2604CC; Tue, 29 Jun 2021 15:28:58 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 04/14] scsi: megaraid_sas: Use irq_set_affinity_and_hint Date: Tue, 29 Jun 2021 11:27:36 -0400 Message-Id: <20210629152746.2953364-5-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() specifically for the high IOPS queue interrupts for two purposes: - To set the affinity_hint which is consumed by the userspace for   distributing the interrupts - To apply an affinity that it provides The driver enforces its own affinity to bind the high IOPS queue interrupts to the local NUMA node. However, irq_set_affinity_hint() applying the provided cpumask as an affinity for the interrupt is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_set_affinity_and_hint() that clearly indicates the purpose of the usage and is meant to apply the affinity and set the affinity_hint pointer. Also, replace irq_set_affinity_hint() with irq_update_affinity_hint() when only affinity_hint needs to be updated. Change the megasas_set_high_iops_queue_affinity_hint function name to megasas_set_high_iops_queue_affinity_and_hint to clearly indicate that the function is setting both affinity and affinity_hint. Signed-off-by: Nitesh Narayan Lal --- drivers/scsi/megaraid/megaraid_sas_base.c | 27 +++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 4d4e9dbe5193..f59b99925830 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5666,7 +5666,7 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) "Failed to register IRQ for vector %d.\n", i); for (j = 0; j < i; j++) { if (j < instance->low_latency_index_start) - irq_set_affinity_hint( + irq_update_affinity_hint( pci_irq_vector(pdev, j), NULL); free_irq(pci_irq_vector(pdev, j), &instance->irq_context[j]); @@ -5709,7 +5709,7 @@ megasas_destroy_irqs(struct megasas_instance *instance) { if (instance->msix_vectors) for (i = 0; i < instance->msix_vectors; i++) { if (i < instance->low_latency_index_start) - irq_set_affinity_hint( + irq_update_affinity_hint( pci_irq_vector(instance->pdev, i), NULL); free_irq(pci_irq_vector(instance->pdev, i), &instance->irq_context[i]); @@ -5840,22 +5840,25 @@ int megasas_get_device_list(struct megasas_instance *instance) } /** - * megasas_set_high_iops_queue_affinity_hint - Set affinity hint for high IOPS queues - * @instance: Adapter soft state - * return: void + * megasas_set_high_iops_queue_affinity_and_hint - Set affinity and hint + * for high IOPS queues + * @instance: Adapter soft state + * return: void */ static inline void -megasas_set_high_iops_queue_affinity_hint(struct megasas_instance *instance) +megasas_set_high_iops_queue_affinity_and_hint(struct megasas_instance *instance) { int i; - int local_numa_node; + unsigned int irq; + const struct cpumask *mask; if (instance->perf_mode == MR_BALANCED_PERF_MODE) { - local_numa_node = dev_to_node(&instance->pdev->dev); + mask = cpumask_of_node(dev_to_node(&instance->pdev->dev)); - for (i = 0; i < instance->low_latency_index_start; i++) - irq_set_affinity_hint(pci_irq_vector(instance->pdev, i), - cpumask_of_node(local_numa_node)); + for (i = 0; i < instance->low_latency_index_start; i++) { + irq = pci_irq_vector(instance->pdev, i); + irq_set_affinity_and_hint(irq, mask); + } } } @@ -5944,7 +5947,7 @@ megasas_alloc_irq_vectors(struct megasas_instance *instance) instance->msix_vectors = 0; if (instance->smp_affinity_enable) - megasas_set_high_iops_queue_affinity_hint(instance); + megasas_set_high_iops_queue_affinity_and_hint(instance); } /** From patchwork Tue Jun 29 15:27:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498405 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FfbD/Lzc; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpL81JbNz9sW8 for ; Wed, 30 Jun 2021 01:29:20 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234894AbhF2Pbq (ORCPT ); Tue, 29 Jun 2021 11:31:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27477 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234929AbhF2Pbl (ORCPT ); Tue, 29 Jun 2021 11:31:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HnDUmDAq6SxtJ6nL+n3280p1oa+jGUXBlVW3jKOFy/A=; b=FfbD/LzcVsghQ0QVOI14siM/xI/n/uI5yunQ3bNby++BAk3FXY5XO8YRt/I5AkvIrdWpkx wQP3jdZ4Y21Sc+AS4GdFOLG33t48vP5Af6dgnpCo01BC/Hk9yCDEuGsmtfU/cr6+xBkvfi 6l8BgNndyaJ7JTP68EFZXjoS1RGGAcA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-347-_g83pNe0OhmlJd-TVuP27g-1; Tue, 29 Jun 2021 11:29:11 -0400 X-MC-Unique: _g83pNe0OhmlJd-TVuP27g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC69B80414C; Tue, 29 Jun 2021 15:29:05 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2976118A77; Tue, 29 Jun 2021 15:29:02 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 05/14] scsi: mpt3sas: Use irq_set_affinity_and_hint Date: Tue, 29 Jun 2021 11:27:37 -0400 Message-Id: <20210629152746.2953364-6-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() specifically for the high IOPS queue interrupts for two purposes: - To set the affinity_hint which is consumed by the userspace for distributing the interrupts - To apply an affinity that it provides The driver enforces its own affinity to bind the high IOPS queue interrupts to the local NUMA node. However, irq_set_affinity_hint() applying the provided cpumask as an affinity (if not NULL) for the interrupt is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_set_affinity_and_hint() that clearly indicates the purpose of the usage and is meant to apply the affinity and set the affinity_hint pointer. Also, replace irq_set_affinity_hint() with irq_update_affinity_hint() when only affinity_hint needs to be updated. Signed-off-by: Nitesh Narayan Lal --- drivers/scsi/mpt3sas/mpt3sas_base.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 5779f313f6f8..d07cf66ecf09 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -2990,6 +2990,7 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) static void _base_free_irq(struct MPT3SAS_ADAPTER *ioc) { + unsigned int irq; struct adapter_reply_queue *reply_q, *next; if (list_empty(&ioc->reply_queue_list)) @@ -2997,9 +2998,10 @@ _base_free_irq(struct MPT3SAS_ADAPTER *ioc) list_for_each_entry_safe(reply_q, next, &ioc->reply_queue_list, list) { list_del(&reply_q->list); - if (ioc->smp_affinity_enable) - irq_set_affinity_hint(pci_irq_vector(ioc->pdev, - reply_q->msix_index), NULL); + if (ioc->smp_affinity_enable) { + irq = pci_irq_vector(ioc->pdev, reply_q->msix_index); + irq_update_affinity_hint(irq, NULL); + } free_irq(pci_irq_vector(ioc->pdev, reply_q->msix_index), reply_q); kfree(reply_q); @@ -3055,16 +3057,13 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index) * @ioc: per adapter object * * The enduser would need to set the affinity via /proc/irq/#/smp_affinity - * - * It would nice if we could call irq_set_affinity, however it is not - * an exported symbol */ static void _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc) { - unsigned int cpu, nr_cpus, nr_msix, index = 0; + unsigned int cpu, nr_cpus, nr_msix, index = 0, irq; struct adapter_reply_queue *reply_q; - int local_numa_node; + const struct cpumask *mask; if (!_base_is_controller_msix_enabled(ioc)) return; @@ -3087,11 +3086,11 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc) * corresponding to high iops queues. */ if (ioc->high_iops_queues) { - local_numa_node = dev_to_node(&ioc->pdev->dev); + mask = cpumask_of_node(dev_to_node(&ioc->pdev->dev)); for (index = 0; index < ioc->high_iops_queues; index++) { - irq_set_affinity_hint(pci_irq_vector(ioc->pdev, - index), cpumask_of_node(local_numa_node)); + irq = pci_irq_vector(ioc->pdev, index); + irq_set_affinity_and_hint(irq, mask); } } From patchwork Tue Jun 29 15:27:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498412 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=M3cPwY7E; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpLj3fVtz9sW8 for ; Wed, 30 Jun 2021 01:29:49 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234830AbhF2PcN (ORCPT ); Tue, 29 Jun 2021 11:32:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26468 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234990AbhF2PcF (ORCPT ); Tue, 29 Jun 2021 11:32:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980573; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yGtGwjM0HqOorIAs5Vljr+3B7rxAzLOFx0Bg3o4IjhM=; b=M3cPwY7EhOgEWjuDsrn4jUEK2Xu4S6yaV060Vn6JMzTvhAr5irQ+VgA/+pc/iCIQ8Px1b3 lZNVANEaid02+KVLSFae+TW1h+u1FuxH6oqk0p4AVwXI550UMaFdZ6jG7sQuF1jgEGXJHi Oh6/v/yBq862vRNsN/DpjeWMkROeSqM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-108-pmGy0XCqMaGfW_ngqZhDyA-1; Tue, 29 Jun 2021 11:29:30 -0400 X-MC-Unique: pmGy0XCqMaGfW_ngqZhDyA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 343931084F63; Tue, 29 Jun 2021 15:29:25 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 014A260583; Tue, 29 Jun 2021 15:29:05 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 06/14] RDMA/i40iw: Use irq_update_affinity_hint Date: Tue, 29 Jun 2021 11:27:38 -0400 Message-Id: <20210629152746.2953364-7-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() to update the affinity_hint mask that is consumed by the userspace to distribute the interrupts. However, under the hood irq_set_affinity_hint() also applies the provided cpumask (if not NULL) as the affinity for the given interrupt which is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only updates the affinity_hint pointer. Signed-off-by: Nitesh Narayan Lal --- drivers/infiniband/hw/i40iw/i40iw_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c index b496f30ce066..433d91c30cae 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_main.c +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c @@ -266,7 +266,7 @@ static void i40iw_disable_irq(struct i40iw_sc_dev *dev, i40iw_wr32(dev->hw, I40E_PFINT_DYN_CTLN(msix_vec->idx - 1), 0); else i40iw_wr32(dev->hw, I40E_VFINT_DYN_CTLN1(msix_vec->idx - 1), 0); - irq_set_affinity_hint(msix_vec->irq, NULL); + irq_update_affinity_hint(msix_vec->irq, NULL); free_irq(msix_vec->irq, dev_id); } @@ -696,7 +696,7 @@ static enum i40iw_status_code i40iw_configure_ceq_vector(struct i40iw_device *iw cpumask_clear(&msix_vec->mask); cpumask_set_cpu(msix_vec->cpu_affinity, &msix_vec->mask); - irq_set_affinity_hint(msix_vec->irq, &msix_vec->mask); + irq_update_affinity_hint(msix_vec->irq, &msix_vec->mask); if (status) { i40iw_pr_err("ceq irq config fail\n"); From patchwork Tue Jun 29 15:27:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498414 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SHYkAaQi; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpMC3fbtz9sW8 for ; Wed, 30 Jun 2021 01:30:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234969AbhF2Pcj (ORCPT ); Tue, 29 Jun 2021 11:32:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58203 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234840AbhF2Pcf (ORCPT ); Tue, 29 Jun 2021 11:32:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O5KXq/z7dZ/+GfJwFgmvdOMFBPu0TxASq5EsvM935Ms=; b=SHYkAaQiaCSKGWfHWq9zjzoUXaAGUodmbgwK1Glwx0N6wO597KjYP/jmdrX3itfSb/WOgH SFKV7PQ+DWNcKpN43ItPS6zyBuJJ0hoYl4gyYeoqmppbPaYivxmOwopWsnUEK9qnxzuTXK VlqhEmhdOxVzpCFjCtXPMR4jzCBVPnA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-2BsbQXkzOM-hse0A5-wakw-1; Tue, 29 Jun 2021 11:30:06 -0400 X-MC-Unique: 2BsbQXkzOM-hse0A5-wakw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C7B01B18BCF; Tue, 29 Jun 2021 15:30:01 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 402BB19CBA; Tue, 29 Jun 2021 15:29:25 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 07/14] enic: Use irq_update_affinity_hint Date: Tue, 29 Jun 2021 11:27:39 -0400 Message-Id: <20210629152746.2953364-8-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() to update the affinity_hint mask that is consumed by the userspace to distribute the interrupts. However, under the hood irq_set_affinity_hint() also applies the provided cpumask (if not NULL) as the affinity for the given interrupt which is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only updates the affinity_hint pointer. Signed-off-by: Nitesh Narayan Lal --- drivers/net/ethernet/cisco/enic/enic_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index d0a8f7106958..97eb5bd62855 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -150,10 +150,10 @@ static void enic_set_affinity_hint(struct enic *enic) !cpumask_available(enic->msix[i].affinity_mask) || cpumask_empty(enic->msix[i].affinity_mask)) continue; - err = irq_set_affinity_hint(enic->msix_entry[i].vector, - enic->msix[i].affinity_mask); + err = irq_update_affinity_hint(enic->msix_entry[i].vector, + enic->msix[i].affinity_mask); if (err) - netdev_warn(enic->netdev, "irq_set_affinity_hint failed, err %d\n", + netdev_warn(enic->netdev, "irq_update_affinity_hint failed, err %d\n", err); } @@ -173,7 +173,7 @@ static void enic_unset_affinity_hint(struct enic *enic) int i; for (i = 0; i < enic->intr_count; i++) - irq_set_affinity_hint(enic->msix_entry[i].vector, NULL); + irq_update_affinity_hint(enic->msix_entry[i].vector, NULL); } static int enic_udp_tunnel_set_port(struct net_device *netdev, From patchwork Tue Jun 29 15:27:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498415 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ap1D3WYx; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpMM0jyJz9sW8 for ; Wed, 30 Jun 2021 01:30:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234952AbhF2Pcs (ORCPT ); Tue, 29 Jun 2021 11:32:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40671 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234987AbhF2Pco (ORCPT ); Tue, 29 Jun 2021 11:32:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JE7Kuq7Nb9jg85fmCIleEaH75sWYHkI/j6GaTCzguyQ=; b=Ap1D3WYxkOqmpMAMG/YWkDjSBJ0Zru0KJeL2Dmushqj9Iv34EiBfEsVR9udFYO0OJr6Yf9 /hPUo/y6tsxovckQVDSmRgWuRwCAgzC6H/fp/k5Wl6/Xlo/OEaie2XmiQCbey3qPKmQ9ux jTSA6JYLXjXAASwg8bCRtqGAKel8+p4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-248-p5gLeRczNFGoM_uKUMw1Ng-1; Tue, 29 Jun 2021 11:30:15 -0400 X-MC-Unique: p5gLeRczNFGoM_uKUMw1Ng-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F2641084F54; Tue, 29 Jun 2021 15:30:10 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65444604CC; Tue, 29 Jun 2021 15:30:01 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 08/14] be2net: Use irq_update_affinity_hint Date: Tue, 29 Jun 2021 11:27:40 -0400 Message-Id: <20210629152746.2953364-9-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() to update the affinity_hint mask that is consumed by the userspace to distribute the interrupts. However, under the hood irq_set_affinity_hint() also applies the provided cpumask (if not NULL) as the affinity for the given interrupt which is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only updates the affinity_hint pointer. Signed-off-by: Nitesh Narayan Lal --- drivers/net/ethernet/emulex/benet/be_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 7968568bbe21..72fef9d882e2 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -3491,7 +3491,7 @@ static int be_msix_register(struct be_adapter *adapter) if (status) goto err_msix; - irq_set_affinity_hint(vec, eqo->affinity_mask); + irq_update_affinity_hint(vec, eqo->affinity_mask); } return 0; @@ -3552,7 +3552,7 @@ static void be_irq_unregister(struct be_adapter *adapter) /* MSIx */ for_all_evt_queues(adapter, eqo, i) { vec = be_msix_vec_get(adapter, eqo); - irq_set_affinity_hint(vec, NULL); + irq_update_affinity_hint(vec, NULL); free_irq(vec, eqo); } From patchwork Tue Jun 29 15:27:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498416 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gJ3vk2e9; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpMV1QHcz9sWM for ; Wed, 30 Jun 2021 01:30:30 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235034AbhF2Pcz (ORCPT ); Tue, 29 Jun 2021 11:32:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20688 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234987AbhF2Pct (ORCPT ); Tue, 29 Jun 2021 11:32:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980621; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Bdy57BG4UHg3zoWEBm83afaWYyEJP4JrPq4b5ijfZcs=; b=gJ3vk2e96pEUMNPxLTNuU1X5Tq9zlZAYZ+H3LvDRbCCGbZaE067mkeHdi8MZI555d5gBDx L1h6NJ215tZwHIF0s6fH4IpoNEFS7KXOCLqnMn+BfEHS4GIfsNpcvZmSBstVfIRgVoWjLe y6HEVQlQ08JwOFjv6PNTwtMyXg1hOsE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-165-37qbf2LDNSy1dbgOq_hOhg-1; Tue, 29 Jun 2021 11:30:19 -0400 X-MC-Unique: 37qbf2LDNSy1dbgOq_hOhg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CDE1B1084F55; Tue, 29 Jun 2021 15:30:13 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38BB569CB6; Tue, 29 Jun 2021 15:30:10 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 09/14] ixgbe: Use irq_update_affinity_hint Date: Tue, 29 Jun 2021 11:27:41 -0400 Message-Id: <20210629152746.2953364-10-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() to update the affinity_hint mask that is consumed by the userspace to distribute the interrupts. However, under the hood irq_set_affinity_hint() also applies the provided cpumask (if not NULL) as the affinity for the given interrupt which is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only updates the affinity_hint pointer. Signed-off-by: Nitesh Narayan Lal --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 2ac5b82676f3..be8e4af6c283 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -3243,8 +3243,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter) /* If Flow Director is enabled, set interrupt affinity */ if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { /* assign the mask for this irq */ - irq_set_affinity_hint(entry->vector, - &q_vector->affinity_mask); + irq_update_affinity_hint(entry->vector, + &q_vector->affinity_mask); } } @@ -3260,8 +3260,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter) free_queue_irqs: while (vector) { vector--; - irq_set_affinity_hint(adapter->msix_entries[vector].vector, - NULL); + irq_update_affinity_hint(adapter->msix_entries[vector].vector, + NULL); free_irq(adapter->msix_entries[vector].vector, adapter->q_vector[vector]); } @@ -3394,7 +3394,7 @@ static void ixgbe_free_irq(struct ixgbe_adapter *adapter) continue; /* clear the affinity_mask in the IRQ descriptor */ - irq_set_affinity_hint(entry->vector, NULL); + irq_update_affinity_hint(entry->vector, NULL); free_irq(entry->vector, q_vector); } From patchwork Tue Jun 29 15:27:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498417 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=J8IMIOHs; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpMb4Bh6z9sW8 for ; Wed, 30 Jun 2021 01:30:35 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235060AbhF2PdA (ORCPT ); Tue, 29 Jun 2021 11:33:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36823 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234903AbhF2Pcw (ORCPT ); Tue, 29 Jun 2021 11:32:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zkGoMadKmvDhmhMXSbPLlXhKPKbYIBPf7+Kg/PZ+k4c=; b=J8IMIOHseIdtQz+r1fhh85FeIzR+VcNNv731pwjTvn42cf0dmUd/iRyoOt+K9ZO9QLWGRG /TQBlE5t/BmY6TN4bite6XXXVFaMa7oUVxgCgKeto+3NhWIDKbjRCnI1CW44NOg/ZF7iTz 7vi+55mEP2KiaIg2bopMURANaiAwOKk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-7vj8OJ2uPKOCC1E97tkr1w-1; Tue, 29 Jun 2021 11:30:23 -0400 X-MC-Unique: 7vj8OJ2uPKOCC1E97tkr1w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C42D100C619; Tue, 29 Jun 2021 15:30:17 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id E663069CB6; Tue, 29 Jun 2021 15:30:13 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 10/14] mailbox: Use irq_update_affinity_hint Date: Tue, 29 Jun 2021 11:27:42 -0400 Message-Id: <20210629152746.2953364-11-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() to: - Set the affinity_hint which is consumed by the userspace for distributing the interrupts - Enforce affinity As per commit 6ac17fe8c14a ("mailbox: bcm-flexrm-mailbox: Set IRQ affinity hint for FlexRM ring IRQs") the latter is done to ensure that the FlexRM ring interrupts are evenly spread across all available CPUs. However, since commit a0c9259dc4e1 ("irq/matrix: Spread interrupts on allocation") the spreading of interrupts is dynamically performed at the time of allocation. Hence, there is no need for the drivers to enforce their own affinity for the spreading of interrupts. Also, irq_set_affinity_hint() applying the provided cpumask as an affinity for the interrupt is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only sets the affinity_hint pointer. Signed-off-by: Nitesh Narayan Lal --- drivers/mailbox/bcm-flexrm-mailbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index b4f33dc399a0..abdd06d1986a 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -1298,7 +1298,7 @@ static int flexrm_startup(struct mbox_chan *chan) val = (num_online_cpus() < val) ? val / num_online_cpus() : 1; cpumask_set_cpu((ring->num / val) % num_online_cpus(), &ring->irq_aff_hint); - ret = irq_set_affinity_hint(ring->irq, &ring->irq_aff_hint); + ret = irq_update_affinity_hint(ring->irq, &ring->irq_aff_hint); if (ret) { dev_err(ring->mbox->dev, "failed to set IRQ affinity hint for ring%d\n", @@ -1425,7 +1425,7 @@ static void flexrm_shutdown(struct mbox_chan *chan) /* Release IRQ */ if (ring->irq_requested) { - irq_set_affinity_hint(ring->irq, NULL); + irq_update_affinity_hint(ring->irq, NULL); free_irq(ring->irq, ring); ring->irq_requested = false; } From patchwork Tue Jun 29 15:27:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498419 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=F9ZCQ2sZ; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpMg6xDjz9sW8 for ; Wed, 30 Jun 2021 01:30:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235038AbhF2PdE (ORCPT ); Tue, 29 Jun 2021 11:33:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45349 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234980AbhF2Pc7 (ORCPT ); Tue, 29 Jun 2021 11:32:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OKZ79TMn7nNOmPGpyBhp062PBF7LikzSjmo8J8Xk8IM=; b=F9ZCQ2sZdIf0mmzEeX7IcQrJlJCvk6NOs4PDT7qOwgp+HK7esATNULOFUCoPAdocTRODYC 0lQRcFVERQNMq+3nVWGfDiGYBTn2O+6jLWCuVMPD8sHXFxvuHkgBVjOCv78wQ76JzfaeO9 mwMXRCnPh6KDW1tTG1zLHlJ2ZhEQXXE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-k7lpgtwQPCyEp1Dhn8Weug-1; Tue, 29 Jun 2021 11:30:29 -0400 X-MC-Unique: k7lpgtwQPCyEp1Dhn8Weug-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 717109128C; Tue, 29 Jun 2021 15:30:24 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4488604CC; Tue, 29 Jun 2021 15:30:17 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 11/14] scsi: lpfc: Use irq_set_affinity Date: Tue, 29 Jun 2021 11:27:43 -0400 Message-Id: <20210629152746.2953364-12-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint to set the affinity for the lpfc interrupts to a mask corresponding to the local NUMA node to avoid performance overhead on AMD architectures. However, irq_set_affinity_hint() setting the affinity is an undocumented side effect that this function also sets the affinity under the hood. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Also, as per the commit dcaa21367938 ("scsi: lpfc: Change default IRQ model on AMD architectures"): "On AMD architecture, revert the irq allocation to the normal style (non-managed) and then use irq_set_affinity_hint() to set the cpu affinity and disable user-space rebalancing." we don't really need to set the affinity_hint as user-space rebalancing for the lpfc interrupts is not desired. Hence, replace the irq_set_affinity_hint() with irq_set_affinity() which only applies the affinity for the interrupts. Signed-off-by: Nitesh Narayan Lal --- drivers/scsi/lpfc/lpfc_init.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 5f018d02bf56..d6e48414018d 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -11360,7 +11360,7 @@ lpfc_irq_set_aff(struct lpfc_hba_eq_hdl *eqhdl, unsigned int cpu) cpumask_clear(&eqhdl->aff_mask); cpumask_set_cpu(cpu, &eqhdl->aff_mask); irq_set_status_flags(eqhdl->irq, IRQ_NO_BALANCING); - irq_set_affinity_hint(eqhdl->irq, &eqhdl->aff_mask); + irq_set_affinity(eqhdl->irq, &eqhdl->aff_mask); } /** @@ -11649,7 +11649,6 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) for (--index; index >= 0; index--) { eqhdl = lpfc_get_eq_hdl(index); lpfc_irq_clear_aff(eqhdl); - irq_set_affinity_hint(eqhdl->irq, NULL); free_irq(eqhdl->irq, eqhdl); } @@ -11810,7 +11809,6 @@ lpfc_sli4_disable_intr(struct lpfc_hba *phba) for (index = 0; index < phba->cfg_irq_chann; index++) { eqhdl = lpfc_get_eq_hdl(index); lpfc_irq_clear_aff(eqhdl); - irq_set_affinity_hint(eqhdl->irq, NULL); free_irq(eqhdl->irq, eqhdl); } } else { From patchwork Tue Jun 29 15:27:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498424 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=a2PMfzWV; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpN01Dlqz9sW8 for ; Wed, 30 Jun 2021 01:30:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235084AbhF2PdV (ORCPT ); Tue, 29 Jun 2021 11:33:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24113 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234867AbhF2PdG (ORCPT ); Tue, 29 Jun 2021 11:33:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q9/J94iiTV9NCKHY6OY11mBTH01W1s+CKGEQ51TJjE8=; b=a2PMfzWV4jiLrFeph/Dr4oTU0j0J696NWTRFz/LUAvX5uvPGuvyNaugy3OfDWlNER5ZkIS CxLwutswxi1U/bQrNFMQDXlyYj+qriQ9h35SPsFbE1gDlawXRao9W721/jYGfs98lPUi0s ebx8ZOm6imydfsr3qDFoGPjbYN0ooNE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-12-buLnwqYCNFiJ-UpkcugP3g-1; Tue, 29 Jun 2021 11:30:36 -0400 X-MC-Unique: buLnwqYCNFiJ-UpkcugP3g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 873B9100C61B; Tue, 29 Jun 2021 15:30:31 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B00C69CB6; Tue, 29 Jun 2021 15:30:24 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 12/14] hinic: Use irq_set_affinity_and_hint Date: Tue, 29 Jun 2021 11:27:44 -0400 Message-Id: <20210629152746.2953364-13-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() to: - Set the affinity_hint which is consumed by the userspace for distributing the interrupts - Enforce affinity As per commit 352f58b0d9f2 ("net-next/hinic: Set Rxq irq to specific cpu for NUMA"), the hinic driver enforces its own affinity to bind IRQs to the local NUMA node. However, irq_set_affinity_hint() applying the provided cpumask as an affinity for the interrupt is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_set_affinity_and_hint() that applies the affinity and updates the affinity_hint pointer. Also, use irq_update_affinity() when only affinity_hint needs to be updated. Signed-off-by: Nitesh Narayan Lal --- drivers/net/ethernet/huawei/hinic/hinic_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/ethernet/huawei/hinic/hinic_rx.c index cce08647b9b2..c6cac4bbdb49 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c @@ -547,7 +547,7 @@ static int rx_request_irq(struct hinic_rxq *rxq) goto err_req_irq; cpumask_set_cpu(qp->q_id % num_online_cpus(), &rq->affinity_mask); - err = irq_set_affinity_hint(rq->irq, &rq->affinity_mask); + err = irq_set_affinity_and_hint(rq->irq, &rq->affinity_mask); if (err) goto err_irq_affinity; @@ -564,7 +564,7 @@ static void rx_free_irq(struct hinic_rxq *rxq) { struct hinic_rq *rq = rxq->rq; - irq_set_affinity_hint(rq->irq, NULL); + irq_update_affinity_hint(rq->irq, NULL); free_irq(rq->irq, rxq); rx_del_napi(rxq); } From patchwork Tue Jun 29 15:27:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498428 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UYdO7rfQ; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpNB2kqcz9sW8 for ; Wed, 30 Jun 2021 01:31:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235169AbhF2Pdb (ORCPT ); Tue, 29 Jun 2021 11:33:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53275 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235128AbhF2PdL (ORCPT ); Tue, 29 Jun 2021 11:33:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e5hTg1Q/xXLKrkoT71WaE5GWdRVD1c/vjjK2SiKdshc=; b=UYdO7rfQDtbk3/BmMsV+vaBYyPp5oUwheaqe7keyHrRwH/0dzEYcj2sq+0XupftQwvcmi4 6dFjjvhLhG1Jrofa7DmOi83cWJYQVmQECjDfhIEXBFB2y6oTsGTqUWcE59rT6ShN3S2Ki8 cQ6OkY892RIFY724ZGdzNQnR5bJXo6U= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-478-7pFQ2xHxNuycWqoldtqxqA-1; Tue, 29 Jun 2021 11:30:40 -0400 X-MC-Unique: 7pFQ2xHxNuycWqoldtqxqA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A46B100C609; Tue, 29 Jun 2021 15:30:35 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0300604CC; Tue, 29 Jun 2021 15:30:31 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 13/14] net/mlx5: Use irq_update_affinity_hint Date: Tue, 29 Jun 2021 11:27:45 -0400 Message-Id: <20210629152746.2953364-14-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() to update the affinity_hint mask that is consumed by the userspace to distribute the interrupts. However, under the hood irq_set_affinity_hint() also applies the provided cpumask (if not NULL) as the affinity for the given interrupt which is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only updates the affinity_hint pointer. Signed-off-by: Nitesh Narayan Lal Reviewed-by: Leon Romanovsky --- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c index c3373fb1cd7f..a1b9434f4e25 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c @@ -276,8 +276,8 @@ static int set_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i) cpumask_set_cpu(cpumask_local_spread(i, mdev->priv.numa_node), irq->mask); if (IS_ENABLED(CONFIG_SMP) && - irq_set_affinity_hint(irqn, irq->mask)) - mlx5_core_warn(mdev, "irq_set_affinity_hint failed, irq 0x%.4x", + irq_update_affinity_hint(irqn, irq->mask)) + mlx5_core_warn(mdev, "irq_update_affinity_hint failed, irq 0x%.4x", irqn); return 0; @@ -291,7 +291,7 @@ static void clear_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i) irq = mlx5_irq_get(mdev, vecidx); irqn = pci_irq_vector(mdev->pdev, vecidx); - irq_set_affinity_hint(irqn, NULL); + irq_update_affinity_hint(irqn, NULL); free_cpumask_var(irq->mask); } From patchwork Tue Jun 29 15:27:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitesh Narayan Lal X-Patchwork-Id: 1498429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EobHfkf3; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GDpNS0LxPz9sW8 for ; Wed, 30 Jun 2021 01:31:20 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234905AbhF2Pdp (ORCPT ); Tue, 29 Jun 2021 11:33:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58543 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235051AbhF2PdT (ORCPT ); Tue, 29 Jun 2021 11:33:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624980651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Th3vaV2j817/WDzJbZssbF/Balmf7wt+58Irkccy28s=; b=EobHfkf3xW9bbcD2rzr3+kS81yGtr6ANuzdMIgH8StPwaDYehznHVFM/Vgz/Rc6KWeaio2 iD1oEmmXwzEqR1kZ3Ra32PLnejbUWVND5uqZwX0D93VY5MkaacEDzDuOeZvyGFyB3ZKAcn g/0Udw8LvGdkPOKx6e0Akf+eQURMpNk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-282-pJLjhAeOOoyzK9YxMKT_sA-1; Tue, 29 Jun 2021 11:30:49 -0400 X-MC-Unique: pJLjhAeOOoyzK9YxMKT_sA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 662EF804140; Tue, 29 Jun 2021 15:30:44 +0000 (UTC) Received: from virtlab719.virt.lab.eng.bos.redhat.com (virtlab719.virt.lab.eng.bos.redhat.com [10.19.153.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52421604CC; Tue, 29 Jun 2021 15:30:35 +0000 (UTC) From: Nitesh Narayan Lal To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, jesse.brandeburg@intel.com, robin.murphy@arm.com, mtosatti@redhat.com, mingo@kernel.org, jbrandeb@kernel.org, frederic@kernel.org, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, rostedt@goodmis.org, peterz@infradead.org, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, chris.friesen@windriver.com, maz@kernel.org, nhorman@tuxdriver.com, pjwaskiewicz@gmail.com, sassmann@redhat.com, thenzl@redhat.com, kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, jkc@redhat.com, faisal.latif@intel.com, shiraz.saleem@intel.com, tariqt@nvidia.com, ahleihel@redhat.com, kheib@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, benve@cisco.com, govind@gmx.com, jassisinghbrar@gmail.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, nilal@redhat.com, tatyana.e.nikolova@intel.com, mustafa.ismail@intel.com, ahs3@redhat.com, leonro@nvidia.com Subject: [PATCH v2 14/14] net/mlx4: Use irq_update_affinity_hint Date: Tue, 29 Jun 2021 11:27:46 -0400 Message-Id: <20210629152746.2953364-15-nitesh@redhat.com> In-Reply-To: <20210629152746.2953364-1-nitesh@redhat.com> References: <20210629152746.2953364-1-nitesh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The driver uses irq_set_affinity_hint() to update the affinity_hint mask that is consumed by the userspace to distribute the interrupts. However, under the hood irq_set_affinity_hint() also applies the provided cpumask (if not NULL) as the affinity for the given interrupt which is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only updates the affinity_hint pointer. Signed-off-by: Nitesh Narayan Lal Reviewed-by: Leon Romanovsky --- drivers/net/ethernet/mellanox/mlx4/eq.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index 9e48509ed3b2..414e390e6b48 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c @@ -244,9 +244,9 @@ static void mlx4_set_eq_affinity_hint(struct mlx4_priv *priv, int vec) cpumask_empty(eq->affinity_mask)) return; - hint_err = irq_set_affinity_hint(eq->irq, eq->affinity_mask); + hint_err = irq_update_affinity_hint(eq->irq, eq->affinity_mask); if (hint_err) - mlx4_warn(dev, "irq_set_affinity_hint failed, err %d\n", hint_err); + mlx4_warn(dev, "irq_update_affinity_hint failed, err %d\n", hint_err); } #endif @@ -1123,9 +1123,7 @@ static void mlx4_free_irqs(struct mlx4_dev *dev) for (i = 0; i < dev->caps.num_comp_vectors + 1; ++i) if (eq_table->eq[i].have_irq) { free_cpumask_var(eq_table->eq[i].affinity_mask); -#if defined(CONFIG_SMP) - irq_set_affinity_hint(eq_table->eq[i].irq, NULL); -#endif + irq_update_affinity_hint(eq_table->eq[i].irq, NULL); free_irq(eq_table->eq[i].irq, eq_table->eq + i); eq_table->eq[i].have_irq = 0; }