Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3245837imm; Fri, 19 Oct 2018 07:33:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV62WJAYXWOhvuf43SxJaloJSivzb8z+WNmWfHQ5Y0ncRvnBWIvO/TTINTMg5Z722iGFkZFHj X-Received: by 2002:a63:8f09:: with SMTP id n9-v6mr32327043pgd.222.1539959614890; Fri, 19 Oct 2018 07:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539959614; cv=none; d=google.com; s=arc-20160816; b=1HktCBXmBP3dcvgIZEh0LLoeeIfsl7lJxDhQ6YTuYr3zusFDtP7m7If2RnD5sPXlHD oMRAOk2LbpFQl83k9ukeeXRS0NlBdagcopTKID/qyg4jMaUP2tFePogpaBeq0TPViB0I gAeaW7HFfMsFpRVnvDHA3OaSp6484h4vCACD4iMuWzpyTy+vHd0O3j6x5JI7MxysJf/v MyXH9Bt/KFHXyv3ksSLwKZa1aXQxZ+fSyj7YnhNJiw7C5Fh0HoXKuVLw2Cohsc4QHR6I UCWYwa4ImdtGSWPT3pnlQDa7wvqf8gctu/YAKDqJbpMftvVemuUkOO/hzMPnJ7aAzMyF c7mg== 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=5icVNeafrMc+XwPRl7O+FUMPgXEJ1OGUl7suIDLSakQ=; b=mC8pc5Osm0BPTRDcvOy1iCeaEGUNE7qTy7POqJ4GSoxM7+jh5Nr6eD/ci3QqoyqYbv A55Nw/wa9lkzCJv1t1YU2N4TIXvWoSF53b48xUpMLHLgNBO9eaN9CxPiI8FI6soO44/S YYSZg9gfc/iVZpTAUek+Dn8LR6D5Z7qKsM6MLTt1ajNnqzfdTzT4L8UhDSuy/PI8VL50 k3IUD4iZpJyLlVflx2ARBgXTXkTAxVjE226fe1MEu5uf6+FC9Dw0vXsW0eIPIV07Yq+9 8YeKSYBQE9a2PnAM76c8Cs9NEtP+2P938vM1rkeQPuAsKg+BPvZLtWkiBa0E9G9mPIkl SCAg== 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 e13-v6si25346831pfb.174.2018.10.19.07.33.19; Fri, 19 Oct 2018 07:33:34 -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 S1727542AbeJSWhz (ORCPT + 99 others); Fri, 19 Oct 2018 18:37:55 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:39183 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbeJSWhz (ORCPT ); Fri, 19 Oct 2018 18:37:55 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gDVoI-0000jr-In; Fri, 19 Oct 2018 16:31:30 +0200 Date: Fri, 19 Oct 2018 16:31:30 +0200 (CEST) From: Thomas Gleixner To: Lukas Wunner cc: linux-kernel@vger.kernel.org, Mathias Duckeck , Akshay Bhat , Casey Fitzpatrick Subject: Re: [PATCH] genirq: Fix race on spurious interrupt detection In-Reply-To: <1dfd8bbd16163940648045495e3e9698e63b50ad.1539867047.git.lukas@wunner.de> Message-ID: References: <1dfd8bbd16163940648045495e3e9698e63b50ad.1539867047.git.lukas@wunner.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Oct 2018, Lukas Wunner wrote: > 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. > > However for oneshot interrupts, the commit unmasks the interrupt before > incrementing the counter. If another interrupt occurs right after > unmasking but before the counter is incremented, that interrupt is > incorrectly considered spurious: > > time > | irq_thread() > | irq_thread_fn() > | action->thread_fn() > | irq_finalize_oneshot() > | unmask_threaded_irq() /* interrupt is unmasked */ > | > | /* interrupt fires, incorrectly deemed spurious */ > | > | atomic_inc(&desc->threads_handled); /* counter is incremented */ > v > > I am seeing this with a hi3110 CAN controller receiving data at high > volume (from a separate machine sending with "cangen -g 0 -i -x"): > The controller signals a huge number of interrupts (hundreds of millions > per day) and every second there are about a dozen which are deemed > spurious. The issue is benign in this case, mostly just an irritation, > but I'm worrying that at high CPU load and in the presence of higher > priority tasks, the number of incorrectly detected spurious interrupts > might increase beyond the 99,900 threshold and cause disablement of the > IRQ. I doubt that this can happen in reality, so I'd rather reword that paragraph slightly: In theory high CPU load and in the presence of higher priority tasks, the number of incorrectly detected spurious interrupts might increase beyond the 99,900 threshold and cause disablement of the interrupt. In practice it just increments the spurious interrupt count. But that can cause people to waste time investigating it over and over. Hmm? Thanks, tglx