Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3504198imm; Fri, 19 Oct 2018 11:42:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Ukd4rKRgPV0FfOcx+dESmgM2YOy6FM9/d0sbME6VJb8koV2Lo14iP9zFjJkv6KzevLgR+ X-Received: by 2002:a63:8f09:: with SMTP id n9-v6mr33116934pgd.222.1539974540855; Fri, 19 Oct 2018 11:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539974540; cv=none; d=google.com; s=arc-20160816; b=kh2T+j4qW5ZGyT4p2nF7VOtT9tWP65jvO6sqdNvgLh/0TWWjLeWy6QpVf8QXYNU+na ByLP4s9Bsa2A9ySWILsv0Rip4d0xFddZI2E2lXWH6fay278w2Cwe2aCulps8ulsr0NkV CStOOVD78M3IzqQHoW14cMhR/bRhPHYkcAyAf1Meglk6oUrbhMHNhT2uuiXFIFjDicTa TUFR790ywp/m3LpeYWqnh81WxcTSzwBlg+XiwtWysCStSHNBPN3yqID4eiljnlLD5wE5 uJMqSBWlGqkPlr2EDDRss155fWqiGIL41BbsGyYUtfExx+o3SvA35MV2a/w/Wt5FE5Wl sJww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=tGcALt8CXrtXo1L+DmJnVU32nbPqje92PcsvqPRZIjs=; b=DEPpfuzh8co/uCz4Xf4OE/mWZM2xSnGFM+B8LZb1qhj+tNkhLLm0FCLuHYVFVicM9B OHZ6v2eVGqR6Sox0916Afh17uLqNWiUdue+IENnHWc7KrRZ5aTYZyA8lw6L4FQQJjnSN xWig4Jgm8ml/o9cYYFutq/5bXr6cVNOwdCz06+TSWA4t7WCbcm4Z9GjPdScFKvZyiRbU MwGJLvlbGgG6JvkeQz/Vwknkmh/NYt7+5ahBEvmWo1IdR+ljHu8QgiYQBC1L3BgO6HUh Z+8gNJLqWvPdKBjKXiRCRs7NWc0WwyMwHQ+pdsSsxjPOpTD9kb5NQYYK8sjHP5ohGccZ C6xA== 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 74-v6si26568596pga.231.2018.10.19.11.42.05; Fri, 19 Oct 2018 11:42:20 -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 S1727772AbeJTCsz (ORCPT + 99 others); Fri, 19 Oct 2018 22:48:55 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:40024 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727329AbeJTCsz (ORCPT ); Fri, 19 Oct 2018 22:48:55 -0400 Received: from p5492fe24.dip0.t-ipconnect.de ([84.146.254.36] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gDZiF-0004XZ-0Q; Fri, 19 Oct 2018 20:41:31 +0200 Date: Fri, 19 Oct 2018 20:41:30 +0200 (CEST) From: Thomas Gleixner To: David Laight cc: "casey.fitzpatrick@timesys.com" , "lukas@wunner.de" , "mingo@kernel.org" , "m.duckeck@kunbus.de" , "hpa@zytor.com" , "akshay.bhat@timesys.com" , "linux-kernel@vger.kernel.org" , "linux-tip-commits@vger.kernel.org" Subject: RE: [tip:irq/core] genirq: Fix race on spurious interrupt detection In-Reply-To: <2bbbe6ba27424b3b83d7f22bafea13ad@AcuMS.aculab.com> Message-ID: References: <1dfd8bbd16163940648045495e3e9698e63b50ad.1539867047.git.lukas@wunner.de> <2bbbe6ba27424b3b83d7f22bafea13ad@AcuMS.aculab.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David, On Fri, 19 Oct 2018, David Laight wrote: > From: Lukas Wunner > > Sent: 19 October 2018 16:34 > > > > genirq: Fix race on spurious interrupt detection > > > > Commit 1e77d0a1ed74 ("genirq: Sanitize spurious interrupt detection of > > threaded irqs") made detection of spurious interrupts work for threaded > > handlers by: > > > > a) incrementing a counter every time the thread returns IRQ_HANDLED, and > > b) checking whether that counter has increased every time the thread is > > woken. > > That seems horribly broken. > What is it trying to achieve? > > There are (at least) two common cases where IRQ_HANDLED doesn't get returned. > (Unless the driver always returns it to avoid the message.) > > 1) The IOW that causes the hardware to drop a level sensitive IRQ is posted > on the bus (etc) and happens late enough that the IRQ line is still > asserted when the iret executes. > If this happens all the time you need to flush the IOW, but if only > occasionally it doesn't matter and you don't want a message. > > 2) Typically an ethernet driver ISR has to enable the interrupt and then > check the ring for work before returning from the interrupt. > If a packet arrives at this time it might be processed by the 'old' > ISR invocation but still generate another interrupt. > If no more packets arrive the second ISR invocation will find no work. > Again this is normal behaviour. > (Deferring everything with NAPI might make this not happen - but other > interrupts end up working the same way.) > > If you are really trying to detect 'stuck' interrupts then you probably > want to count un-handled ones and zero the count on handled ones. > I'm also pretty sure you don't need an atomic counter. Care to look at the logic which handles all of this including the interaction with threaded interrupt handlers? Thanks, tglx