Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1765562imm; Tue, 2 Oct 2018 13:39:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV60K5FJjQf5xIupRfIB3yIYW4LmkNDEKhV7VRxKAq6QZxFgNdpH8JdGqDQX00iPFQ+gBrkck X-Received: by 2002:a17:902:9045:: with SMTP id w5-v6mr18810375plz.10.1538512759396; Tue, 02 Oct 2018 13:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538512759; cv=none; d=google.com; s=arc-20160816; b=ub91/Z8RnaARKwRU0Zdumy1vpSOSk75esgmVFteDjgEnHN2YJDXe64zudsAmxE7f68 cYxNsJHNHgWmSNuPtdinrV6XUtXhRduWdFY6Hszc3PKrGqApvBUXCSPykTjCjeC7DR59 XRMbBnV3Iz9PXxYs3IpwPGAGOr82wn5sw9x4pHZri5hxIHvR8TPwBUv33o9GrYGB16nz W5b0f6P2a20WaIRd282cRTyDvFTm6Fa775FnP2GHD/eQqs+rp+pmZOf8O6ZcogaLenM6 bfcVOrn0wWxSGb2xDxep0AGKxRfEM6iYK+r7+ywJzF58k2QUH3tfXNw/XWPq5N/dbfwq oWLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=wp+OVZdFkUwPCYOrJdN0UJU6g9zM1gYr3om0GrB6M5M=; b=J9JNMkwBECF6KX/PWI4NFZYfvRxeZJWfHyYOdO00sEHQaHuTCh8uQYMak3bkwKbF8q fQrvuGL2r4D1Hh8rhWYoJBA3IuTdJYsNDj/Q5RKAHnzXUy35VDDxVsdPZMVGsLLL+hgL l4FCGgSGJse6cg5xJvdwDJS1pQ12a1+TCzO9v74YeMve1NnDjV14LhNtAVaJJ/lUNoiZ Vkh7WuLzbvnsZyADTeab+8GTeBz0UNlwn8sl1Hfw3fyUvx2rJKM+pvk85A17n9dv1nXu ZemwXOnmW3BQfwOVu6wLlHF99NVyH52ZTTFdTbcHfTrvpx9oQutUJVqbSJlNNSURUPVP fyuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4-v6si10881826plr.343.2018.10.02.13.39.03; Tue, 02 Oct 2018 13:39:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727956AbeJCDWF (ORCPT + 99 others); Tue, 2 Oct 2018 23:22:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48492 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726847AbeJCDWF (ORCPT ); Tue, 2 Oct 2018 23:22:05 -0400 Received: from localhost (unknown [64.124.202.226]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B88FA1293; Tue, 2 Oct 2018 20:36:54 +0000 (UTC) Date: Tue, 2 Oct 2018 13:36:53 -0700 From: Greg Kroah-Hartman To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Phil Elwell , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Graf , Stefan Wahren , Mian Yousaf Kaukab , Matthias Brugger , Michael Allwright , Jakub Kicinski , Xue Liu Subject: Re: [PATCH 1/2] sc16is7xx: Fix for multi-channel stall Message-ID: <20181002203653.GA2397@kroah.com> References: <1536762716-30673-1-git-send-email-phil@raspberrypi.org> <1536762716-30673-2-git-send-email-phil@raspberrypi.org> <6028e8e5-f8a6-fbe0-8d2a-b6bb3c91aa14@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6028e8e5-f8a6-fbe0-8d2a-b6bb3c91aa14@suse.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 29, 2018 at 04:04:48PM +0200, Andreas F?rber wrote: > Hi Phil and Greg, > > Am 12.09.18 um 16:31 schrieb Phil Elwell: > > The SC16IS752 is a dual-channel device. The two channels are largely > > independent, but the IRQ signals are wired together as an open-drain, > > active low signal which will be driven low while either of the > > channels requires attention, which can be for significant periods of > > time until operations complete and the interrupt can be acknowledged. > > In that respect it is should be treated as a true level-sensitive IRQ. > > > > The kernel, however, needs to be able to exit interrupt context in > > order to use I2C or SPI to access the device registers (which may > > involve sleeping). Therefore the interrupt needs to be masked out or > > paused in some way. > > > > The usual way to manage sleeping from within an interrupt handler > > is to use a threaded interrupt handler - a regular interrupt routine > > does the minimum amount of work needed to triage the interrupt before > > waking the interrupt service thread. If the threaded IRQ is marked as > > IRQF_ONESHOT the kernel will automatically mask out the interrupt > > until the thread runs to completion. The sc16is7xx driver used to > > use a threaded IRQ, but a patch switched to using a kthread_worker > > in order to set realtime priorities on the handler thread and for > > other optimisations. The end result is non-threaded IRQ that > > schedules some work then returns IRQ_HANDLED, making the kernel > > think that all IRQ processing has completed. > > > > The work-around to prevent a constant stream of interrupts is to > > mark the interrupt as edge-sensitive rather than level-sensitive, > > but interpreting an active-low source as a falling-edge source > > requires care to prevent a total cessation of interrupts. Whereas > > an edge-triggering source will generate a new edge for every interrupt > > condition a level-triggering source will keep the signal at the > > interrupting level until it no longer requires attention; in other > > words, the host won't see another edge until all interrupt conditions > > are cleared. It is therefore vital that the interrupt handler does not > > exit with an outstanding interrupt condition, otherwise the kernel > > will not receive another interrupt unless some other operation causes > > the interrupt state on the device to be cleared. > > > > The existing sc16is7xx driver has a very simple interrupt "thread" > > (kthread_work job) that processes interrupts on each channel in turn > > until there are no more. If both channels are active and the first > > channel starts interrupting while the handler for the second channel > > is running then it will not be detected and an IRQ stall ensues. This > > could be handled easily if there was a shared IRQ status register, or > > a convenient way to determine if the IRQ had been deasserted for any > > length of time, but both appear to be lacking. > > > > Avoid this problem (or at least make it much less likely to happen) > > by reducing the granularity of per-channel interrupt processing > > to one condition per iteration, only exiting the overall loop when > > both channels are no longer interrupting. > > > > Signed-off-by: Phil Elwell > > --- > > drivers/tty/serial/sc16is7xx.c | 19 +++++++++++++------ > > 1 file changed, 13 insertions(+), 6 deletions(-) > > These two patches seem to be applied in linux-next tree, but are lacking > a Fixes: header for backporting to affected stable trees. > > openSUSE Tumbleweed's 4.18 appears to be affected, and I didn't see it > in linux.git for upcoming 4.19 either. > > Can the commit message still be updated to get this fixed everywhere? I can't change the tree, sorry, I can not rebase. If you want these applied to the stable tree, please email stable@vger.kernel.org when they hit Linus's tree with the git commit ids and I will be glad to queue them up then. thanks, greg k-h