Skip to content

Commit 4fd3006

Browse files
Hoang-Nam NguyenRoland Dreier
authored andcommitted
IB/ehca: Allow en/disabling scaling code via module parameter
Allow users to en/disable scaling code when loading ib_ehca module, rather than requiring the module to be rebuilt to change the setting. Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
1 parent 8b16cef commit 4fd3006

File tree

4 files changed

+26
-34
lines changed

4 files changed

+26
-34
lines changed

drivers/infiniband/hw/ehca/Kconfig

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,3 @@ config INFINIBAND_EHCA
77
To compile the driver as a module, choose M here. The module
88
will be called ib_ehca.
99

10-
config INFINIBAND_EHCA_SCALING
11-
bool "Scaling support (EXPERIMENTAL)"
12-
depends on IBMEBUS && INFINIBAND_EHCA && HOTPLUG_CPU && EXPERIMENTAL
13-
default y
14-
---help---
15-
eHCA scaling support schedules the CQ callbacks to different CPUs.
16-
17-
To enable this feature choose Y here.

drivers/infiniband/hw/ehca/ehca_classes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ extern struct idr ehca_cq_idr;
277277
extern int ehca_static_rate;
278278
extern int ehca_port_act_time;
279279
extern int ehca_use_hp_mr;
280+
extern int ehca_scaling_code;
280281

281282
struct ipzu_queue_resp {
282283
u32 qe_size; /* queue entry size */

drivers/infiniband/hw/ehca/ehca_irq.c

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,11 @@
6363
#define ERROR_DATA_LENGTH EHCA_BMASK_IBM(52,63)
6464
#define ERROR_DATA_TYPE EHCA_BMASK_IBM(0,7)
6565

66-
#ifdef CONFIG_INFINIBAND_EHCA_SCALING
67-
6866
static void queue_comp_task(struct ehca_cq *__cq);
6967

7068
static struct ehca_comp_pool* pool;
7169
static struct notifier_block comp_pool_callback_nb;
7270

73-
#endif
74-
7571
static inline void comp_event_callback(struct ehca_cq *cq)
7672
{
7773
if (!cq->ib_cq.comp_handler)
@@ -423,13 +419,13 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe)
423419
return;
424420
}
425421
reset_eq_pending(cq);
426-
#ifdef CONFIG_INFINIBAND_EHCA_SCALING
427-
queue_comp_task(cq);
428-
spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
429-
#else
430-
spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
431-
comp_event_callback(cq);
432-
#endif
422+
if (ehca_scaling_code) {
423+
queue_comp_task(cq);
424+
spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
425+
} else {
426+
spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
427+
comp_event_callback(cq);
428+
}
433429
} else {
434430
ehca_dbg(&shca->ib_device,
435431
"Got non completion event");
@@ -508,13 +504,12 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq)
508504
/* call completion handler for cached eqes */
509505
for (i = 0; i < eqe_cnt; i++)
510506
if (eq->eqe_cache[i].cq) {
511-
#ifdef CONFIG_INFINIBAND_EHCA_SCALING
512-
spin_lock(&ehca_cq_idr_lock);
513-
queue_comp_task(eq->eqe_cache[i].cq);
514-
spin_unlock(&ehca_cq_idr_lock);
515-
#else
516-
comp_event_callback(eq->eqe_cache[i].cq);
517-
#endif
507+
if (ehca_scaling_code) {
508+
spin_lock(&ehca_cq_idr_lock);
509+
queue_comp_task(eq->eqe_cache[i].cq);
510+
spin_unlock(&ehca_cq_idr_lock);
511+
} else
512+
comp_event_callback(eq->eqe_cache[i].cq);
518513
} else {
519514
ehca_dbg(&shca->ib_device, "Got non completion event");
520515
parse_identifier(shca, eq->eqe_cache[i].eqe->entry);
@@ -540,8 +535,6 @@ void ehca_tasklet_eq(unsigned long data)
540535
ehca_process_eq((struct ehca_shca*)data, 1);
541536
}
542537

543-
#ifdef CONFIG_INFINIBAND_EHCA_SCALING
544-
545538
static inline int find_next_online_cpu(struct ehca_comp_pool* pool)
546539
{
547540
int cpu;
@@ -764,14 +757,14 @@ static int comp_pool_callback(struct notifier_block *nfb,
764757
return NOTIFY_OK;
765758
}
766759

767-
#endif
768-
769760
int ehca_create_comp_pool(void)
770761
{
771-
#ifdef CONFIG_INFINIBAND_EHCA_SCALING
772762
int cpu;
773763
struct task_struct *task;
774764

765+
if (!ehca_scaling_code)
766+
return 0;
767+
775768
pool = kzalloc(sizeof(struct ehca_comp_pool), GFP_KERNEL);
776769
if (pool == NULL)
777770
return -ENOMEM;
@@ -796,16 +789,19 @@ int ehca_create_comp_pool(void)
796789
comp_pool_callback_nb.notifier_call = comp_pool_callback;
797790
comp_pool_callback_nb.priority =0;
798791
register_cpu_notifier(&comp_pool_callback_nb);
799-
#endif
792+
793+
printk(KERN_INFO "eHCA scaling code enabled\n");
800794

801795
return 0;
802796
}
803797

804798
void ehca_destroy_comp_pool(void)
805799
{
806-
#ifdef CONFIG_INFINIBAND_EHCA_SCALING
807800
int i;
808801

802+
if (!ehca_scaling_code)
803+
return;
804+
809805
unregister_cpu_notifier(&comp_pool_callback_nb);
810806

811807
for (i = 0; i < NR_CPUS; i++) {
@@ -814,5 +810,4 @@ void ehca_destroy_comp_pool(void)
814810
}
815811
free_percpu(pool->cpu_comp_tasks);
816812
kfree(pool);
817-
#endif
818813
}

drivers/infiniband/hw/ehca/ehca_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ int ehca_use_hp_mr = 0;
6262
int ehca_port_act_time = 30;
6363
int ehca_poll_all_eqs = 1;
6464
int ehca_static_rate = -1;
65+
int ehca_scaling_code = 1;
6566

6667
module_param_named(open_aqp1, ehca_open_aqp1, int, 0);
6768
module_param_named(debug_level, ehca_debug_level, int, 0);
@@ -71,6 +72,7 @@ module_param_named(use_hp_mr, ehca_use_hp_mr, int, 0);
7172
module_param_named(port_act_time, ehca_port_act_time, int, 0);
7273
module_param_named(poll_all_eqs, ehca_poll_all_eqs, int, 0);
7374
module_param_named(static_rate, ehca_static_rate, int, 0);
75+
module_param_named(scaling_code, ehca_scaling_code, int, 0);
7476

7577
MODULE_PARM_DESC(open_aqp1,
7678
"AQP1 on startup (0: no (default), 1: yes)");
@@ -91,6 +93,8 @@ MODULE_PARM_DESC(poll_all_eqs,
9193
" (0: no, 1: yes (default))");
9294
MODULE_PARM_DESC(static_rate,
9395
"set permanent static rate (default: disabled)");
96+
MODULE_PARM_DESC(scaling_code,
97+
"set scaling code (0: disabled, 1: enabled/default)");
9498

9599
spinlock_t ehca_qp_idr_lock;
96100
spinlock_t ehca_cq_idr_lock;

0 commit comments

Comments
 (0)