From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id B63A71EFAF6; Sun, 27 Aug 2017 00:47:04 -0400 (EDT) Received: from a2-out-001.smtp25.com (a2-out-001.smtp25.com [50.201.66.168]) by befuddled.reisers.ca (Postfix) with ESMTPS id 4D88B1EFA5D for ; Sun, 27 Aug 2017 00:47:01 -0400 (EDT) Received: from ccs.covici.com (localhost [127.0.0.1]) by ccs.covici.com (8.14.9/8.14.8) with ESMTP id v7R4ko6M013024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 27 Aug 2017 00:46:51 -0400 Received: (from covici@localhost) by ccs.covici.com (8.14.9/8.13.7/Submit) id v7R4koCo012953; Sun, 27 Aug 2017 00:46:50 -0400 Date: Sun, 27 Aug 2017 00:46:50 -0400 Message-ID: From: John Covici To: Okash Khawaja Cc: Samuel Thibault , Christopher Brannon , "Speakup is a screen review system for Linux." Subject: Re: [patch] staging: speakup: fix speakup-r empty line lockup In-Reply-To: <20170826171513.GA644@sanghar> References: <20170826171513.GA644@sanghar> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Reply-To: covici@ccs.covici.com Organization: Covici Computer Systems MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SpamH-Filter: a2-out-001.smtp25.com-v7R4kptA029934 X-SpamH-OriginatingIP: 70.109.53.110 X-MIMEDefang-Relay-ca7e395729062400c36e9cbcb508575aec105509: 70.109.53.110 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 X-BeenThere: speakup@linux-speakup.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Aug 2017 04:47:05 -0000 hmmm, new patch is the same as the old one and so will not work any better. On Sat, 26 Aug 2017 13:15:13 -0400, Okash Khawaja wrote: > > When cursor is at beginning of an empty or whitespace-only line and > speakup-r typed, kernel locks up. This happens because deadlock of in > input_event function over dev->event_lock, as demonstrated by lockdep > logs. The reason for that is speakup simulates a down arrow - because > cursor is at an empty line - while inside key press notifier handler > which is ultimately triggered from input_event function. The simulated > key press leads to input_event being called again, this time under its > own context. So the spinlock is dev->event_lock is acquired while still > being held. > > This patch ensures that key press is not simulated from inside key press > notifier handler. Instead it delegates to cursor_timer. It starts the > timer and passes RA_DOWN_ARROW as argument. When timer handler runs and > sees RA_DOWN_ARROW, it will then call kbd_fakekey2(RA_DOWN_ARROW) which > will correctly simulate the keypress inside timer context. > > When not inside key press notifier callback, the behaviour will remain > the same as before this patch. > > Signed-off-by: Okash Khawaja > > --- > drivers/staging/speakup/main.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > --- a/drivers/staging/speakup/main.c > +++ b/drivers/staging/speakup/main.c > @@ -1376,6 +1376,8 @@ static void reset_highlight_buffers(stru > > static int read_all_key; > > +static volatile int in_keyboard_notifier = 0; > + > static void start_read_all_timer(struct vc_data *vc, int command); > > enum { > @@ -1408,7 +1410,10 @@ static void read_all_doc(struct vc_data > cursor_track = read_all_mode; > spk_reset_index_count(0); > if (get_sentence_buf(vc, 0) == -1) { > - kbd_fakekey2(vc, RA_DOWN_ARROW); > + del_timer(&cursor_timer); > + if (!in_keyboard_notifier) > + speakup_fake_down_arrow(); > + start_read_all_timer(vc, RA_DOWN_ARROW); > } else { > say_sentence_num(0, 0); > synth_insert_next_index(0); > @@ -2212,8 +2217,10 @@ static int keyboard_notifier_call(struct > int ret = NOTIFY_OK; > static int keycode; /* to hold the current keycode */ > > + in_keyboard_notifier = 1; > + > if (vc->vc_mode == KD_GRAPHICS) > - return ret; > + goto out; > > /* > * First, determine whether we are handling a fake keypress on > @@ -2225,7 +2232,7 @@ static int keyboard_notifier_call(struct > */ > > if (speakup_fake_key_pressed()) > - return ret; > + goto out; > > switch (code) { > case KBD_KEYCODE: > @@ -2266,6 +2273,8 @@ static int keyboard_notifier_call(struct > break; > } > } > +out: > + in_keyboard_notifier = 0; > return ret; > } > -- Your life is like a penny. You're going to lose it. The question is: How do you spend it? John Covici covici@ccs.covici.com