From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id C21241EFD84; Mon, 3 Jul 2017 05:52:37 -0400 (EDT) Received: from mail0205.smtp25.com (mail0205.smtp25.com [174.37.170.205]) by befuddled.reisers.ca (Postfix) with ESMTPS id 903781EFD68 for ; Mon, 3 Jul 2017 05:52:35 -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 v639qO0n011631 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 3 Jul 2017 05:52:24 -0400 Received: (from covici@localhost) by ccs.covici.com (8.14.9/8.13.7/Submit) id v639qJ6i011548; Mon, 3 Jul 2017 05:52:19 -0400 Date: Mon, 03 Jul 2017 05:52:19 -0400 Message-ID: From: John Covici To: Okash Khawaja Cc: speakup@linux-speakup.org, Samuel Thibault Subject: Re: speakup-r empty line lockup In-Reply-To: <20170624090645.GA8813@sanghar> References: <20170624090645.GA8813@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: s-out-001.smtp25.com-v639qP7j020579 X-SpamH-OriginatingIP: 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: Mon, 03 Jul 2017 09:52:37 -0000 I just tested the empty line lockup is gone, but now speakup-r does not work, actually in the file I had, after reading a number of lines when I hit control, the cursor was actually at the end of the file. Thanks for working on this one. On Sat, 24 Jun 2017 05:06:45 -0400, Okash Khawaja wrote: > > Hi, > > The lockup when running speakup-r at start of an empty line occurs > because simulated key press is generated (using speakup_fake_down_arrow) > from context of keyboard_notifier_call callback which is called in > interrupt context. The simulated keypress leads to > keybaord_notifier_call to be trigerred again from the same context > leading to the lockup. The exact cause could be priority inversion where > simulated keypress cannot be processed because there is a real keyboard > interrupt already being processed (the one from which simulated keypress > was triggered), hence causing a deadlock. Please share your thoughts on > this. Here is the call chain. > > (speakup-r) --> keyboard_notifier_call --> speakup_key --> do_spkup --> > read_all_doc --> get_sentence_buf [which returns -1 because of empty > line] --> kbd_fakekey2(RA_DOWN_ARROW) --> speakup_fake_down_arrow > > The following patch resolves this by not simulating the keypress inside > keyboard notifier callback but instead delegating it to cursor_timer. In > the above chain, when get_sentence_buf returns -1, this patch starts > 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. I've tested > this succesfully. > > It's the first time I've worked on this side of the code so please > review carefully :) > > Finally, I have updated the test repo on github so you can test from > there. > > Thanks, > Okash > > --- > drivers/staging/speakup/main.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > --- a/drivers/staging/speakup/main.c > +++ b/drivers/staging/speakup/main.c > @@ -1408,7 +1408,8 @@ 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); > + start_read_all_timer(vc, RA_DOWN_ARROW); > } else { > say_sentence_num(0, 0); > synth_insert_next_index(0); -- 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