mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 04:34:11 +08:00
mpt2sas: Rework the MSI-X grouping code
On systems with a non power-of-two CPU count the existing MSI-X grouping code failed to distribute interrupts correctly. Rework the code to handle arbitrary processor counts. Also remove the hardcoded upper limit on the number of processors so we can boot on large systems. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Sreekanth Reddy <Sreekanth.reddy@avagotech.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
9f21316fc2
commit
cbbb7b31ad
@ -1332,53 +1332,35 @@ _base_request_irq(struct MPT2SAS_ADAPTER *ioc, u8 index, u32 vector)
|
|||||||
static void
|
static void
|
||||||
_base_assign_reply_queues(struct MPT2SAS_ADAPTER *ioc)
|
_base_assign_reply_queues(struct MPT2SAS_ADAPTER *ioc)
|
||||||
{
|
{
|
||||||
struct adapter_reply_queue *reply_q;
|
unsigned int cpu, nr_cpus, nr_msix, index = 0;
|
||||||
int cpu_id;
|
|
||||||
int cpu_grouping, loop, grouping, grouping_mod;
|
|
||||||
|
|
||||||
if (!_base_is_controller_msix_enabled(ioc))
|
if (!_base_is_controller_msix_enabled(ioc))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(ioc->cpu_msix_table, 0, ioc->cpu_msix_table_sz);
|
memset(ioc->cpu_msix_table, 0, ioc->cpu_msix_table_sz);
|
||||||
/* when there are more cpus than available msix vectors,
|
|
||||||
* then group cpus togeather on same irq
|
|
||||||
*/
|
|
||||||
if (ioc->cpu_count > ioc->msix_vector_count) {
|
|
||||||
grouping = ioc->cpu_count / ioc->msix_vector_count;
|
|
||||||
grouping_mod = ioc->cpu_count % ioc->msix_vector_count;
|
|
||||||
if (grouping < 2 || (grouping == 2 && !grouping_mod))
|
|
||||||
cpu_grouping = 2;
|
|
||||||
else if (grouping < 4 || (grouping == 4 && !grouping_mod))
|
|
||||||
cpu_grouping = 4;
|
|
||||||
else if (grouping < 8 || (grouping == 8 && !grouping_mod))
|
|
||||||
cpu_grouping = 8;
|
|
||||||
else
|
|
||||||
cpu_grouping = 16;
|
|
||||||
} else
|
|
||||||
cpu_grouping = 0;
|
|
||||||
|
|
||||||
loop = 0;
|
nr_cpus = num_online_cpus();
|
||||||
reply_q = list_entry(ioc->reply_queue_list.next,
|
nr_msix = ioc->reply_queue_count = min(ioc->reply_queue_count,
|
||||||
struct adapter_reply_queue, list);
|
ioc->facts.MaxMSIxVectors);
|
||||||
for_each_online_cpu(cpu_id) {
|
if (!nr_msix)
|
||||||
if (!cpu_grouping) {
|
return;
|
||||||
ioc->cpu_msix_table[cpu_id] = reply_q->msix_index;
|
|
||||||
reply_q = list_entry(reply_q->list.next,
|
cpu = cpumask_first(cpu_online_mask);
|
||||||
struct adapter_reply_queue, list);
|
|
||||||
} else {
|
do {
|
||||||
if (loop < cpu_grouping) {
|
unsigned int i, group = nr_cpus / nr_msix;
|
||||||
ioc->cpu_msix_table[cpu_id] =
|
|
||||||
reply_q->msix_index;
|
if (index < nr_cpus % nr_msix)
|
||||||
loop++;
|
group++;
|
||||||
} else {
|
|
||||||
reply_q = list_entry(reply_q->list.next,
|
for (i = 0 ; i < group ; i++) {
|
||||||
struct adapter_reply_queue, list);
|
ioc->cpu_msix_table[cpu] = index;
|
||||||
ioc->cpu_msix_table[cpu_id] =
|
cpu = cpumask_next(cpu, cpu_online_mask);
|
||||||
reply_q->msix_index;
|
|
||||||
loop = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
index++;
|
||||||
|
|
||||||
|
} while (cpu < nr_cpus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user