From 91d939119425ce0aed3f9f38c30f173c06bb34f6 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 7 Feb 2014 12:43:25 +0000 Subject: [PATCH] scst_user, rt: Wake command processing thread when needed In a fully-preemptible realtime kernel (CONFIG_PREEMPT_RT_FULL=y), SCSI commands from an initiator time out because the userland target application is never woken to process them. This is because in a fully-preemptible realtime kernel, soft-IRQ (tasklet) execution always occurs in a ksoftirqd thread and preempt_count is not manipulated on soft-IRQ processing entry/exit. This makes in_interrupt() useless for determining whether soft-IRQ processing is occurring; instead, in_serving_softirq() should be used for that purpose. Signed-off-by: Steven J. Magnani [bvanassche: Elaborated source code comment] git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5272 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_user.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 6c05b876c..0d89e6166 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -1129,7 +1129,12 @@ static void dev_user_add_to_ready(struct scst_user_cmd *ucmd) { struct scst_user_dev *dev = ucmd->dev; unsigned long flags; - int do_wake = in_interrupt(); + /* + * Note, a separate softIRQ check is required for real-time kernels + * (CONFIG_PREEMPT_RT_FULL=y) since on such kernels softIRQ's are + * served in thread context. See also http://lwn.net/Articles/302043/. + */ + int do_wake = in_interrupt() || in_serving_softirq(); TRACE_ENTRY();