From patchwork Sun Aug 19 06:27:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 144524 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2617918ljj; Sat, 18 Aug 2018 23:39:57 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzxCU7NBz+Et94pVR2+7ihMYNhNmctKTznjWTcmLzB3V6NwIOs15erANHIvHsWdU8/dy6px X-Received: by 2002:a63:5fc8:: with SMTP id t191-v6mr11837088pgb.183.1534660797455; Sat, 18 Aug 2018 23:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534660797; cv=none; d=google.com; s=arc-20160816; b=wpZqKNf5cIVSSXV/PAJHgoBmI3RwDlkKsvxrpz5dr84OrNErYdQMBi/wDTZKgkPzkS WrTXK1U6AcibwbV+akTfxMI3TrzxjptNNQWt8ALvvmoRGo4zg+s0UOO2lIsN9h2WyrsY tvA027DsX8tDDJ2P8bvghJ8ViE4dMKpe4s2za64dmm34f6ls1cybGHM8wlUEJZ4nJ4oK II7sK1zirK6za0LW7o8PAPSlcvTbIdcF10A5wr4h5l3c9nEWfldTCP04HkbrR/tZ+ror XEmr7/aVyHm6pMJvqaPN6qjF96wpgphyF+SrdXgMDoGxPu3Vjw0k85tWfA5x4Tgvp05T nUlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=eS8VPyermjtGfLznKhyQ/y6yvcKtcubgnH07om+s2lw=; b=ek3d+y7K7Oiv5uyRq6kAk+XLWcZsEkzrbZD9a69YiFMHM+06ee3DDFnMOk+sm9c/X7 MjRYANWxM6HrNBmpbWiyU8EBh2ESMXNmfNLdvKLdsOjEbWSMRT65bS6FRXebBeX3bAow SgLKdnNwt+YITViLnvVzIh3iUU/YT5acQcXc6Kt9RbWmVdlozvvePJm9HPoELAl0IJ60 v9ta2wgylqqixG6vp9jS7iUfwPDcHezv9M2KAdjzm+adbot/VmRAherki2n3QKRuX+L9 3ZUETML1Kbcrnse37/0hX1erLcUn8mxfMDFtVn+O6zdsZeuiuuaI5qjB2bBPn4N9kDnA T/bA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 33-v6si6765450plu.283.2018.08.18.23.39.57; Sat, 18 Aug 2018 23:39:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725929AbeHSJuW (ORCPT + 13 others); Sun, 19 Aug 2018 05:50:22 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:45534 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725953AbeHSJuV (ORCPT ); Sun, 19 Aug 2018 05:50:21 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id AF5F235315411; Sun, 19 Aug 2018 14:39:51 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.399.0; Sun, 19 Aug 2018 14:39:42 +0800 From: Hanjun Guo To: Greg KH , CC: , Sudeep Holla , Marc Zyngier , Thomas Gleixner , Hanjun Guo Subject: [PATCH 4.4 1/6] genirq: Delay incrementing interrupt count if it's disabled/pending Date: Sun, 19 Aug 2018 14:27:36 +0800 Message-ID: <1534660061-51980-2-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1534660061-51980-1-git-send-email-guohanjun@huawei.com> References: <1534660061-51980-1-git-send-email-guohanjun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sudeep Holla commit a946e8c717f9355d1abd5408ed0adc0002d1aed1 upstream. In case of a wakeup interrupt, irq_pm_check_wakeup disables the interrupt and marks it pending and suspended, disables it and notifies the pm core about the wake event. The interrupt gets handled later once the system is resumed. However the irq stats is updated twice: once when it's disabled waiting for the system to resume and later when it's handled, resulting in wrong counting of the wakeup interrupt when waking up the system. This patch updates the interrupt count so that it's updated only when the interrupt gets handled. It's already handled correctly in handle_edge_irq and handle_edge_eoi_irq. Reported-by: Manoil Claudiu Signed-off-by: Sudeep Holla Cc: Marc Zyngier Link: http://lkml.kernel.org/r/1446661957-1019-1-git-send-email-sudeep.holla@arm.com Signed-off-by: Thomas Gleixner Signed-off-by: Hanjun Guo --- kernel/irq/chip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 1.7.12.4 diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index e4453d9..3c74e13 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -338,7 +338,6 @@ void handle_nested_irq(unsigned int irq) raw_spin_lock_irq(&desc->lock); desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); - kstat_incr_irqs_this_cpu(desc); action = desc->action; if (unlikely(!action || irqd_irq_disabled(&desc->irq_data))) { @@ -346,6 +345,7 @@ void handle_nested_irq(unsigned int irq) goto out_unlock; } + kstat_incr_irqs_this_cpu(desc); irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS); raw_spin_unlock_irq(&desc->lock); @@ -412,13 +412,13 @@ void handle_simple_irq(struct irq_desc *desc) goto out_unlock; desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); - kstat_incr_irqs_this_cpu(desc); if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) { desc->istate |= IRQS_PENDING; goto out_unlock; } + kstat_incr_irqs_this_cpu(desc); handle_irq_event(desc); out_unlock: @@ -462,7 +462,6 @@ void handle_level_irq(struct irq_desc *desc) goto out_unlock; desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); - kstat_incr_irqs_this_cpu(desc); /* * If its disabled or no action available @@ -473,6 +472,7 @@ void handle_level_irq(struct irq_desc *desc) goto out_unlock; } + kstat_incr_irqs_this_cpu(desc); handle_irq_event(desc); cond_unmask_irq(desc); @@ -532,7 +532,6 @@ void handle_fasteoi_irq(struct irq_desc *desc) goto out; desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); - kstat_incr_irqs_this_cpu(desc); /* * If its disabled or no action available @@ -544,6 +543,7 @@ void handle_fasteoi_irq(struct irq_desc *desc) goto out; } + kstat_incr_irqs_this_cpu(desc); if (desc->istate & IRQS_ONESHOT) mask_irq(desc);