Skip to content

Commit

Permalink
IB/hfi1: Allocate cpu mask on the heap to silence warning
Browse files Browse the repository at this point in the history
If CONFIG_FRAME_WARN is small (1K) and CONFIG_NR_CPUS big
then a frame size warning is triggered during build.
Allocate the cpu mask dynamically to silence the warning.

Reviewed-by: Sebastian Sanchez <[email protected]>
Signed-off-by: Tadeusz Struk <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
  • Loading branch information
tstruk authored and dledford committed Aug 22, 2016
1 parent 5412352 commit 8303f68
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions drivers/infiniband/hw/hfi1/affinity.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf,
size_t count)
{
struct hfi1_affinity_node *entry;
struct cpumask mask;
cpumask_var_t mask;
int ret, i;

spin_lock(&node_affinity.lock);
Expand All @@ -692,19 +692,24 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf,
if (!entry)
return -EINVAL;

ret = cpulist_parse(buf, &mask);
ret = zalloc_cpumask_var(&mask, GFP_KERNEL);
if (!ret)
return -ENOMEM;

ret = cpulist_parse(buf, mask);
if (ret)
return ret;
goto out;

if (!cpumask_subset(&mask, cpu_online_mask) || cpumask_empty(&mask)) {
if (!cpumask_subset(mask, cpu_online_mask) || cpumask_empty(mask)) {
dd_dev_warn(dd, "Invalid CPU mask\n");
return -EINVAL;
ret = -EINVAL;
goto out;
}

mutex_lock(&sdma_affinity_mutex);
/* reset the SDMA interrupt affinity details */
init_cpu_mask_set(&entry->def_intr);
cpumask_copy(&entry->def_intr.mask, &mask);
cpumask_copy(&entry->def_intr.mask, mask);
/*
* Reassign the affinity for each SDMA interrupt.
*/
Expand All @@ -720,8 +725,9 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf,
if (ret)
break;
}

mutex_unlock(&sdma_affinity_mutex);
out:
free_cpumask_var(mask);
return ret ? ret : strnlen(buf, PAGE_SIZE);
}

Expand Down

0 comments on commit 8303f68

Please sign in to comment.