Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3646859ybl; Tue, 21 Jan 2020 04:44:36 -0800 (PST) X-Google-Smtp-Source: APXvYqyu6QoPiwV9cc860BgJs5WE8tJ2Yf5EFl2a2egqBCGKTYnDo9zVhAH6zVFxOd6QofTIcEwn X-Received: by 2002:a54:4396:: with SMTP id u22mr2853715oiv.128.1579610676823; Tue, 21 Jan 2020 04:44:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579610676; cv=none; d=google.com; s=arc-20160816; b=e4AI6H1N0M1MyMROhSI4ZZKYKwCyQcH5My2zXUlFmNLdWYb9TAbaB/yi6j1MPOLyv+ EZzXbcLnpG8pHRd+ewnOQwq4OlVvXk9e3D7Bn0MWQX0WWp7eWVHzl2aoL7bHlmh3uGRX tqtDy9KL60osGXcne717PacGTZUOSFMjWLsOepqaezeHYq4i0ekr/1wmhvxaEQ+Orcvh cF7EXpkf3OHUZCp41yqsPQI9aRhdZB18zV1WppzYXYyu9Dlf7nbwA1YrH5l2J6pMqMOy tR8SDSwXaO7HSBV7JC2DXKZ3guRAF0NKrxprgfClxhenjmju+AQX3mYroPU/6VoLP5zZ 8u0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=QCog9CIJzd2wVzDd+fYFc0Dx+tgy8sXOibTFmlE6KBU=; b=AnRWgFGxXM+JkO9ILHl37N0YIxdkvUa/CQXXymcNF/b1YwtokcfKzIciOBrOzDalQ1 m9mhGK0s6iEyY/wsGgeHpL/lOGlFRP7YnGoyX+Npw2wPq5TmKkrHQm7crqUkfMzQ/e+M +GZ3UPPqgRv5K2oYD5LkgMLU6W4EZczTrADZN5LmxjW4CvTfqqoess8+p73Z5sMKRBm7 O3OF6GPsqQa6F/7t1V1nUHeOa8OQCNJiT2O+XfK81mg34WY2GgDnbZU7uP5xZ6YH2vVQ fi6+uvluSfWVDxi3jmrWyzFJj3bPEfuaj2EPrOvWJnmjcyFKfJ0XotLf8ep9swABELUf VZpg== 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 u8si21072556otq.262.2020.01.21.04.44.24; Tue, 21 Jan 2020 04:44:36 -0800 (PST) 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 S1729770AbgAUMmz (ORCPT + 99 others); Tue, 21 Jan 2020 07:42:55 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:50626 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728898AbgAUMmx (ORCPT ); Tue, 21 Jan 2020 07:42:53 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 8B9C710EB62758289330 for ; Tue, 21 Jan 2020 20:42:45 +0800 (CST) Received: from huawei.com (10.175.104.245) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Tue, 21 Jan 2020 20:42:33 +0800 From: l00520965 To: CC: , , LiuChao , Subject: [RFC] irq: Skip printing irq when desc->action is null even if any_count is not zero Date: Tue, 21 Jan 2020 21:09:59 +0800 Message-ID: <20200121130959.22589-1-liuchao173@huawei.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.245] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: LiuChao When desc->action is empty, there is no need to print out the irq and its' count in each cpu. The desc is not alloced in request_irq or freed in free_irq. So some PCI devices, such as rtl8139, uses request_irq and free_irq, which only modify the action of desc. So /proc/interrupts could be like this: CPU0 CPU1 2: 69397 69267 GICv3 27 Level arch_timer 4: 0 0 GICv3 33 Level uart-pl011 38: 46 0 GICv3 36 Level ehci_hcd:usb1 39: 66 0 GICv3 37 Level 40: 0 0 GICv3 38 Level virtio1 42: 0 0 GICv3 23 Level arm-pmu 43: 0 0 ARMH0061:00 3 Edge ACPI:Event 44: 1 0 ITS-MSI 32768 Edge PCIe PME, pciehp 45: 0 0 ITS-MSI 32769 Edge aerdrv Irqbalance gets the list of interrupts according to /proc/interrupts. In this case, irqbalance does not remove the interrupt from the balance list, and the last string in this line,which is Level, is used as irq_name. Or we can clear desc->kstat_irqs in each cpu in free_irq when desc->action is null? Signed-off-by: LiuChao Reviewed-by: Thomas Gleixner Cc: linux-kernel@vger.kernel.org --- kernel/irq/proc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index cfc4f088a0e7..b27169e587f4 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c @@ -439,7 +439,7 @@ int show_interrupts(struct seq_file *p, void *v) { static int prec; - unsigned long flags, any_count = 0; + unsigned long flags; int i = *(loff_t *) v, j; struct irqaction *action; struct irq_desc *desc; @@ -466,11 +466,7 @@ int show_interrupts(struct seq_file *p, void *v) if (!desc) goto outsparse; - if (desc->kstat_irqs) - for_each_online_cpu(j) - any_count |= *per_cpu_ptr(desc->kstat_irqs, j); - - if ((!desc->action || irq_desc_is_chained(desc)) && !any_count) + if (!desc->action || irq_desc_is_chained(desc)) goto outsparse; seq_printf(p, "%*d: ", prec, i); -- 2.19.1