Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: megaraid_sas: Use irq_set_affinity_and_hint()

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()
where the provided mask needs to be applied as the affinity and
affinity_hint pointer needs to be set and replace with
irq_update_affinity_hint() where 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 <nitesh@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Link: https://lore.kernel.org/r/20210903152430.244937-5-nitesh@redhat.com

authored by

Nitesh Narayan Lal and committed by
Thomas Gleixner
8049da6f d34c54d1

+15 -12
+15 -12
drivers/scsi/megaraid/megaraid_sas_base.c
··· 5720 5720 "Failed to register IRQ for vector %d.\n", i); 5721 5721 for (j = 0; j < i; j++) { 5722 5722 if (j < instance->low_latency_index_start) 5723 - irq_set_affinity_hint( 5723 + irq_update_affinity_hint( 5724 5724 pci_irq_vector(pdev, j), NULL); 5725 5725 free_irq(pci_irq_vector(pdev, j), 5726 5726 &instance->irq_context[j]); ··· 5763 5763 if (instance->msix_vectors) 5764 5764 for (i = 0; i < instance->msix_vectors; i++) { 5765 5765 if (i < instance->low_latency_index_start) 5766 - irq_set_affinity_hint( 5766 + irq_update_affinity_hint( 5767 5767 pci_irq_vector(instance->pdev, i), NULL); 5768 5768 free_irq(pci_irq_vector(instance->pdev, i), 5769 5769 &instance->irq_context[i]); ··· 5894 5894 } 5895 5895 5896 5896 /** 5897 - * megasas_set_high_iops_queue_affinity_hint - Set affinity hint for high IOPS queues 5898 - * @instance: Adapter soft state 5899 - * return: void 5897 + * megasas_set_high_iops_queue_affinity_and_hint - Set affinity and hint 5898 + * for high IOPS queues 5899 + * @instance: Adapter soft state 5900 + * return: void 5900 5901 */ 5901 5902 static inline void 5902 - megasas_set_high_iops_queue_affinity_hint(struct megasas_instance *instance) 5903 + megasas_set_high_iops_queue_affinity_and_hint(struct megasas_instance *instance) 5903 5904 { 5904 5905 int i; 5905 - int local_numa_node; 5906 + unsigned int irq; 5907 + const struct cpumask *mask; 5906 5908 5907 5909 if (instance->perf_mode == MR_BALANCED_PERF_MODE) { 5908 - local_numa_node = dev_to_node(&instance->pdev->dev); 5910 + mask = cpumask_of_node(dev_to_node(&instance->pdev->dev)); 5909 5911 5910 - for (i = 0; i < instance->low_latency_index_start; i++) 5911 - irq_set_affinity_hint(pci_irq_vector(instance->pdev, i), 5912 - cpumask_of_node(local_numa_node)); 5912 + for (i = 0; i < instance->low_latency_index_start; i++) { 5913 + irq = pci_irq_vector(instance->pdev, i); 5914 + irq_set_affinity_and_hint(irq, mask); 5915 + } 5913 5916 } 5914 5917 } 5915 5918 ··· 6001 5998 instance->msix_vectors = 0; 6002 5999 6003 6000 if (instance->smp_affinity_enable) 6004 - megasas_set_high_iops_queue_affinity_hint(instance); 6001 + megasas_set_high_iops_queue_affinity_and_hint(instance); 6005 6002 } 6006 6003 6007 6004 /**