From patchwork Fri May 23 09:41:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 351788 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9459D14009A for ; Fri, 23 May 2014 19:42:21 +1000 (EST) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id 7BE841A0665 for ; Fri, 23 May 2014 19:42:21 +1000 (EST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id F2BF21A007D for ; Fri, 23 May 2014 19:41:17 +1000 (EST) Received: by ozlabs.org (Postfix) id DB82A14009A; Fri, 23 May 2014 19:41:17 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4553014007B for ; Fri, 23 May 2014 19:41:16 +1000 (EST) Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id s4N9f797012384; Fri, 23 May 2014 04:41:08 -0500 Message-ID: <1400838066.29150.69.camel@pasglop> Subject: [PATCH] tty/hvc/hvc_console: Fix wakeup of HVC thread on hvc_kick() From: Benjamin Herrenschmidt To: Greg Kroah-Hartman Date: Fri, 23 May 2014 19:41:06 +1000 X-Mailer: Evolution 3.12.2 Mime-Version: 1.0 Cc: linuxppc-dev list , Jiri Slaby , Linux Kernel list X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Some backends call hvc_kick() to wakeup the HVC thread from its slumber upon incoming characters. This however doesn't work properly because it uses msleep_interruptible() which is mostly immune to wake_up_process(). It will basically go back to sleep until the timeout is expired (only signals can really wake it). Replace it with a simple shedule_timeout_interruptible() instead, which may wakeup earlier every now and then but we really don't care in this case. Signed-off-by: Benjamin Herrenschmidt --- drivers/tty/hvc/hvc_console.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 94f9e3a..1094265 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -760,10 +760,17 @@ static int khvcd(void *unused) if (poll_mask == 0) schedule(); else { + unsigned long j_timeout; + if (timeout < MAX_TIMEOUT) timeout += (timeout >> 6) + 1; - msleep_interruptible(timeout); + /* + * We don't use msleep_interruptible otherwise + * "kick" will fail to wake us up + */ + j_timeout = msecs_to_jiffies(timeout) + 1; + schedule_timeout_interruptible(j_timeout); } } __set_current_state(TASK_RUNNING);