Received: by 10.223.176.5 with SMTP id f5csp2727169wra; Mon, 5 Feb 2018 08:53:05 -0800 (PST) X-Google-Smtp-Source: AH8x225sus3+6koeXh25IXA/8zcB4RjKG093SDHxQWZIwT2G7fSiBwFGm/1F5JW9+TZh1DXbfwxy X-Received: by 10.99.38.67 with SMTP id m64mr31306152pgm.2.1517849585307; Mon, 05 Feb 2018 08:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517849585; cv=none; d=google.com; s=arc-20160816; b=0VWE+ahIuLJ7Lqf8RXsjZCGZpHyXcwIE8y7jDo8HEy7ZhPZ/cqiZliE5fG3i6fjxV+ avON8ul+W9mxRt17ZjqKuE9noiM+I7AJ6E7CogBKEyPiRu2JhWLE+cRMzPyWCGXIOfhN WKVvcxdGxc8puFm3Pgxw3tDpYUyS/igsaYFMAHTAfgJh1z9S4ux21yMlCjj7nX2p0QeR KsMiycwLzv2JRUzzvHhpXd43oQwfCcL3tG9ASAUpeyRBkjyPk/H/oYQXJCsLVIrsyC2h M67VwKlXpadEh5Xza++lalQc/G1zPyO6DxuoWhP/ftA90itF+UDQGfQeP9oAIouETPc5 ZOKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=QTtNgLcgpwd+1W5W7DX5hXmesH/eyFQVG5gsuIGVlm0=; b=nGv3r0Ue07i588vWKYvQd1hUQCWT4acQoot/S5BdR690vhfb0fqMpMIEfLzjNHHLcp R3+OWl45lfCwVgmNt8VV+vflhLBRO6Hl5yhGH25tkTyLnUKPVWewR58AXpLTzjkQyEBZ znuiWqRhkaQ7QYzsYtYEOE16wDcv+21sTygJAmPLPTv+DRYDVEennTRshb+Y0vUO9TB8 DBks0b6A+GN4Fd9UF7/rfbn/st57cre/kzWN2fESyyeS0MCI/WNx4ATF12SWH8EZJgC2 H+jbbcDMZSg2DR4LhDAxaAl5pNr8Fiv1E3kUrud2VkAWDB55gyPtjeP+4/1MPppwAqYL RJaA== 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 88-v6si2952592ple.76.2018.02.05.08.52.50; Mon, 05 Feb 2018 08:53:05 -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 S1753178AbeBEQvc (ORCPT + 99 others); Mon, 5 Feb 2018 11:51:32 -0500 Received: from 9pmail.ess.barracuda.com ([64.235.154.210]:35371 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752582AbeBEQv0 (ORCPT ); Mon, 5 Feb 2018 11:51:26 -0500 Received: from MIPSMAIL01.mipstec.com (mailrelay.mips.com [12.201.5.28]) by mx1402.ess.rzc.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Mon, 05 Feb 2018 16:50:08 +0000 Received: from mredfearn-linux.mipstec.com (10.150.130.83) by MIPSMAIL01.mipstec.com (10.20.43.31) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 5 Feb 2018 08:45:44 -0800 From: Matt Redfearn To: Thomas Gleixner , Marc Zyngier CC: , Ralf Baechle , Matt Redfearn , Jason Cooper , Subject: [PATCH] irqchip: mips-gic: Avoid spuriously handling masked interrupts Date: Mon, 5 Feb 2018 16:45:36 +0000 Message-ID: <1517849136-29508-1-git-send-email-matt.redfearn@mips.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.150.130.83] X-BESS-ID: 1517849406-321458-23044-1056-2 X-BESS-VER: 2018.1-r1801290438 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.189699 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 7778c4b27cbe ("irqchip: mips-gic: Use pcpu_masks to avoid reading GIC_SH_MASK*") removed the read of the hardware mask register when handling shared interrupts, instead using the driver's shadow pcpu_masks entry as the effective mask. Unfortunately this did not take account of the write to pcpu_masks during gic_shared_irq_domain_map, which effectively unmasks the interrupt early. If an interrupt is asserted, gic_handle_shared_int decodes and processes the interrupt even though it has not yet been unmasked via gic_unmask_irq, which also sets the appropriate bit in pcpu_masks. On the MIPS Boston board, when a console command line of "console=ttyS0,115200n8r" is passed, the modem status IRQ is enabled in the UART, which is immediately raised to the GIC. The interrupt has been mapped, but no handler has yet been registered, nor is it expected to be unmasked. However, the write to pcpu_masks in gic_shared_irq_domain_map has effectively unmasked it, resulting in endless reports of: [ 5.058454] irq 13, desc: ffffffff80a7ad80, depth: 1, count: 0, unhandled: 0 [ 5.062057] ->handle_irq(): ffffffff801b1838, [ 5.062175] handle_bad_irq+0x0/0x2c0 Where IRQ 13 is the UART interrupt. To fix this, just remove the write to pcpu_masks in gic_shared_irq_domain_map. The existing write in gic_unmask_irq is the correct place for what is now the effective unmasking. Fixes: 7778c4b27cbe ("irqchip: mips-gic: Use pcpu_masks to avoid reading GIC_SH_MASK*") Signed-off-by: Matt Redfearn Reviewed-by: Paul Burton --- drivers/irqchip/irq-mips-gic.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index b2cfc6d66d74..2c3684ba46e5 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -429,8 +429,6 @@ static int gic_shared_irq_domain_map(struct irq_domain *d, unsigned int virq, spin_lock_irqsave(&gic_lock, flags); write_gic_map_pin(intr, GIC_MAP_PIN_MAP_TO_PIN | shared_cpu_pin); write_gic_map_vp(intr, BIT(mips_cm_vp_id(cpu))); - gic_clear_pcpu_masks(intr); - set_bit(intr, per_cpu_ptr(pcpu_masks, cpu)); irq_data_update_effective_affinity(data, cpumask_of(cpu)); spin_unlock_irqrestore(&gic_lock, flags); -- 2.7.4