From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id 855021EFDB9; Sat, 24 Jun 2017 06:31:00 -0400 (EDT) Received: from mail-wr0-x22e.google.com (mail-wr0-x22e.google.com [IPv6:2a00:1450:400c:c0c::22e]) by befuddled.reisers.ca (Postfix) with ESMTPS id 801FE1EFDB2 for ; Sat, 24 Jun 2017 06:30:58 -0400 (EDT) Received: by mail-wr0-x22e.google.com with SMTP id r103so94813582wrb.0 for ; Sat, 24 Jun 2017 03:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DGN4Gf5bjs7AVbpICHH1WLocuVOYvelk+kNq6VW4Rzk=; b=WTb5Fu28OLp4w//S2/yAkN5U+Ppw5B5bQ1KlPXcsCcxzk6uj7Yuqsi0736dzIrxJkb sHYXAkbo9I1/Pve3i5RITjT5ss7cE1e1MxT2hg2h/OKV1Nha3e5SxqP675f0lXj366h1 qaS+b+uyPxOg037jPqfbyTFxuQRZdAal7RiLxG4bC0jAq8gPzv5CH7f8DGNSRZibJcSW jjMSSirf0MzNaCear7Dc62J0wwZ0o/BaG604zbuD9ef4hora1n6VtukuVS1hWCSB2l+X KudmfK6NvjQF7qr+9YPHVGITAi2O7wiHmNJhPFfkPYb3XoZ7OsscTC6ADV2nkCRU0/Da ZBdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DGN4Gf5bjs7AVbpICHH1WLocuVOYvelk+kNq6VW4Rzk=; b=aQKrQnuPVw3AsoftcKQ8cYxpL20hj2uUvq+XcdvTyJRPb+W2k7O3BVJj+SDPC4NAdI LMx/AHtD9i0sEDx5XUew9M1UoVHJhvxVfYfjzYyW0xjxlKPfnTKj2rPIPmnPlKbkcoYX bamgwedO3DqOtwIvlRA6riaihlU8wi8/Mw5MahmkEdbTL62vX5TzqxZggQebY/aCUhp9 Zl4rV8RjtEGfML3+Z/mTIuqk8d7gyws9YhyCLvcBrNlFhfpkvEhstFY8rzDZWpLInNXr XxmKYqYmsyGFvsQJhvUFGdTU6vIhMNi8nCKSKSRnmiuwaN9TIZZIkJ9+FywuLBQU65o8 VcyQ== X-Gm-Message-State: AKS2vOyurT4TZdSsKO5zuwXA2kalmFQZ/6Z54ItRNrZbq5jkGmi4jUzn CQDi8zX/1eOxhVVh X-Received: by 10.80.154.129 with SMTP id p1mr9297279edb.131.1498300252735; Sat, 24 Jun 2017 03:30:52 -0700 (PDT) Received: from ?IPv6:2a00:23c4:7320:5900:20f2:df69:a681:8f3e? ([2a00:23c4:7320:5900:20f2:df69:a681:8f3e]) by smtp.gmail.com with ESMTPSA id b4sm1183217eda.34.2017.06.24.03.30.51 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Jun 2017 03:30:52 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: speakup-r empty line lockup From: Okash Khawaja X-Mailer: iPhone Mail (11A501) In-Reply-To: Date: Sat, 24 Jun 2017 11:30:53 +0100 Cc: "speakup@linux-speakup.org" , Samuel Thibault Content-Transfer-Encoding: quoted-printable Message-Id: <9195001A-A609-4FCF-80DE-E2AA6FC1A076@gmail.com> References: <20170624090645.GA8813@sanghar> To: "covici@ccs.covici.com" 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: Sat, 24 Jun 2017 10:31:00 -0000 Yes export-tty.patch on the repo has been updated. Let me know if you get an= y problems.=20 Cheers, Okash > On 24 Jun 2017, at 11:12, John Covici wrote: >=20 > Thanks a lot, I will definitely test this -- do I need a new > export.patch as well? >=20 > On Sat, 24 Jun 2017 05:06:45 -0400, > Okash Khawaja wrote: >>=20 >> Hi, >>=20 >> 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. >>=20 >> (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 >>=20 >> 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. >>=20 >> It's the first time I've worked on this side of the code so please >> review carefully :) >>=20 >> Finally, I have updated the test repo on github so you can test from >> there. >>=20 >> Thanks, >> Okash >>=20 >> --- >> drivers/staging/speakup/main.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >>=20 >> --- 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 =3D read_all_mode; >> spk_reset_index_count(0); >> if (get_sentence_buf(vc, 0) =3D=3D -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); >=20 > --=20 > Your life is like a penny. You're going to lose it. The question is: > How do > you spend it? >=20 > John Covici > covici@ccs.covici.com