From c2bd2e8bf5fd47b49242a6b1c03effcc2acf0a03 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 4 Jun 2011 17:50:19 +0000 Subject: [PATCH] ib_srpt: Remove "thread" kernel module parameter and keep thread=1 behavior - the other two modes could cause soft lockup complaints git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3535 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/README | 16 -------- srpt/src/ib_srpt.c | 92 +++++----------------------------------------- 2 files changed, 10 insertions(+), 98 deletions(-) diff --git a/srpt/README b/srpt/README index f3adf3a44..b5d6af7a5 100644 --- a/srpt/README +++ b/srpt/README @@ -87,22 +87,6 @@ The ib_srpt kernel module supports the following parameters: for a credit limit of 128. Changing this parameter to a smaller value may cause RDMA requests to be retried and hence may slow down data transfer severely. -* thread (0, 1 or 2, default 1) - Defines the context on which SRP requests are processed: - * thread=0: do as much processing in IRQ context as possible. Results in - lower latency than the other two modes but may trigger soft lockup - complaints when multiple initiators are simultaneously processing - workloads with large I/O depths. Scalability of this mode is limited - - it exploits only a fraction of the power available on multiprocessor - systems. - * thread=1: dedicates one kernel thread per initiator. Scales well on - multiprocessor systems. This is the recommended mode when multiple - initiator systems are accessing the same target system simultaneously. - * thread=2: makes one CPU process all IB completions and defer further - processing to kernel thread context. Scales better than mode thread=0 but - not as good as mode thread=1. May trigger soft lockup complaints when - multiple initiators are simultaneously processing workloads with large I/O - depths. * trace_flag (unsigned integer, only available in debug builds) The individual bits of the trace_flag parameter define which categories of trace messages should be sent to the kernel log and which ones not. diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 3efdc54f3..52885999e 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -75,17 +75,6 @@ MODULE_DESCRIPTION("InfiniBand SCSI RDMA Protocol target " "v" DRV_VERSION " (" DRV_RELDATE ")"); MODULE_LICENSE("Dual BSD/GPL"); -/* - * Local data types. - */ - -enum threading_mode { - MODE_ALL_IN_SIRQ = 0, - MODE_IB_COMPLETION_IN_THREAD = 1, - MODE_IB_COMPLETION_IN_SIRQ = 2, -}; - - /* * Global Variables */ @@ -99,15 +88,6 @@ module_param(trace_flag, long, 0644); MODULE_PARM_DESC(trace_flag, "SCST trace flags."); #endif -static int thread = 1; -module_param(thread, int, 0444); -MODULE_PARM_DESC(thread, - "IB completion and SCSI command processing context. Defaults" - " to one, i.e. process IB completions and SCSI commands in" - " kernel thread context. 0 means soft IRQ whenever possible" - " and 2 means process IB completions in soft IRQ context and" - " SCSI commands in kernel thread context."); - static unsigned srp_max_rdma_size = DEFAULT_MAX_RDMA_SIZE; module_param(srp_max_rdma_size, int, 0744); MODULE_PARM_DESC(srp_max_rdma_size, @@ -1892,33 +1872,12 @@ static void srpt_process_completion(struct ib_cq *cq, /** * srpt_completion() - IB completion queue callback function. - * - * Notes: - * - It is guaranteed that a completion handler will never be invoked - * concurrently on two different CPUs for the same completion queue. See also - * Documentation/infiniband/core_locking.txt and the implementation of - * handle_edge_irq() in kernel/irq/chip.c. - * - When threaded IRQs are enabled, completion handlers are invoked in thread - * context instead of interrupt context. */ static void srpt_completion(struct ib_cq *cq, void *ctx) { struct srpt_rdma_ch *ch = ctx; - BUG_ON(!ch); - switch (thread) { - case MODE_IB_COMPLETION_IN_THREAD: - wake_up_process(ch->thread); - break; - case MODE_IB_COMPLETION_IN_SIRQ: - srpt_process_completion(cq, ch, SCST_CONTEXT_THREAD, - SCST_CONTEXT_THREAD); - break; - case MODE_ALL_IN_SIRQ: - srpt_process_completion(cq, ch, SCST_CONTEXT_TASKLET, - SCST_CONTEXT_TASKLET); - break; - } + wake_up_process(ch->thread); } static int srpt_compl_thread(void *arg) @@ -1999,20 +1958,16 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) if (ret) goto err_destroy_qp; - if (thread == MODE_IB_COMPLETION_IN_THREAD) { - TRACE_DBG("creating IB completion thread for session %s", - ch->sess_name); + TRACE_DBG("creating IB completion thread for session %s", + ch->sess_name); - ch->thread = kthread_run(srpt_compl_thread, ch, - "ib_srpt_compl"); - if (IS_ERR(ch->thread)) { - PRINT_ERROR("failed to create kernel thread %ld", - PTR_ERR(ch->thread)); - ch->thread = NULL; - goto err_destroy_qp; - } - } else - ib_req_notify_cq(ch->cq, IB_CQ_NEXT_COMP); + ch->thread = kthread_run(srpt_compl_thread, ch, "ib_srpt_compl"); + if (IS_ERR(ch->thread)) { + PRINT_ERROR("failed to create kernel thread %ld", + PTR_ERR(ch->thread)); + ch->thread = NULL; + goto err_destroy_qp; + } out: kfree(qp_init); @@ -3972,33 +3927,6 @@ static int __init srpt_init_module(void) } #endif - switch (thread) { - case MODE_ALL_IN_SIRQ: - /* - * Process both IB completions and SCST commands in SIRQ - * context. May lead to soft lockups and other scary behavior - * under sufficient load. - */ - srpt_template.rdy_to_xfer_atomic = true; - break; - case MODE_IB_COMPLETION_IN_THREAD: - /* - * Process IB completions in the kernel thread associated with - * the RDMA channel, and process SCST commands in the kernel - * threads created by the SCST core. - */ - srpt_template.rdy_to_xfer_atomic = false; - break; - case MODE_IB_COMPLETION_IN_SIRQ: - default: - /* - * Process IB completions in SIRQ context and SCST commands in - * the kernel threads created by the SCST core. - */ - srpt_template.rdy_to_xfer_atomic = false; - break; - } - ret = scst_register_target_template(&srpt_template); if (ret < 0) { PRINT_ERROR("%s", "couldn't register with scst");