Received: by 10.223.185.116 with SMTP id b49csp4173738wrg; Mon, 26 Feb 2018 12:32:41 -0800 (PST) X-Google-Smtp-Source: AH8x224XVN7FKudfyoW6b+BEXTDyU0rzOtVHw9/T/CKxxdwVCq27O3KHgOkDFKto7+zBLaliWwv7 X-Received: by 2002:a17:902:8d81:: with SMTP id v1-v6mr11734363plo.430.1519677161318; Mon, 26 Feb 2018 12:32:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519677161; cv=none; d=google.com; s=arc-20160816; b=FqKegVic34cdShboOJNJpfVq43i1u3RrgOQFtQATfIWrzS0IJr45m8EHMq6vFFgr7A Cgbf8WMZApnHaErOlmD0VJIXzNgGYO9C74E3Q07l7xLBhBVq7xXqWwPa+MvtARkY7/r6 ABLl4RsuB9lpaAOTkJbntUMC9huNxQxUB4CkkkLn8sltl8UlBBuOkEysJv3hK3MwvPSa vIR9OfK0d4hRRLT9KYDGw9B4uPVoSyNJ004cgR74Qa+m/P8MUvUeCFSEkAULlSfzsSD2 l3TxWK1vFXY8EwcBslLCysT9DuOFxomPUm1wjd55iucNN3p5i/20X66KGxMELIWGNd+z Q7pA== 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 :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kYvuiOrEF6EEj3qJfhf4TOqsUuwzyN4qY5QtHQ8uoTw=; b=TOCIaVcOzmjH+yKh9aHgeX0k32/wzPX5rHbpkujYzjbNjYrIrOKmSorrrxIwZJ/5Qf JGRTRo9VGm6WNp6qflQxbzmnkoVmTkR7QBG6up9hLkTqJA5t9AsoCPp7BQLm1IEYUaKN MpwyWW5S53O7OrYUrLW2SSe99wDesGv2u+xvAr0eRLkWq3GwEFT8SLZv4bIcr4AlLPVE YkFeS4DHkoWtauocRh7wQ9waQpdUNSyEJrgnigB+3OXDoXVMAcacfsdR+wR6N6jUB5nc 6ngM0hn/B2IkLxUALRThcP1tnPrBlAMpyxzClcbMAQIG6xwCWySUbew5ebcSPDfrb6kB NSyA== 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 b8-v6si7234923ple.246.2018.02.26.12.32.25; Mon, 26 Feb 2018 12:32:41 -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 S1754024AbeBZU3D (ORCPT + 99 others); Mon, 26 Feb 2018 15:29:03 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37410 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754011AbeBZU3B (ORCPT ); Mon, 26 Feb 2018 15:29:01 -0500 Received: from localhost (clnet-b04-243.ikbnet.co.at [83.175.124.243]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 493EFED8; Mon, 26 Feb 2018 20:29:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matt Redfearn , Paul Burton , Marc Zyngier Subject: [PATCH 4.15 33/64] irqchip/mips-gic: Avoid spuriously handling masked interrupts Date: Mon, 26 Feb 2018 21:22:10 +0100 Message-Id: <20180226202154.875616039@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180226202153.453363333@linuxfoundation.org> References: <20180226202153.453363333@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matt Redfearn commit 285cb4f62319737e6538252cf1a67ce9da5cf3d5 upstream. 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. Cc: stable@vger.kernel.org Fixes: 7778c4b27cbe ("irqchip: mips-gic: Use pcpu_masks to avoid reading GIC_SH_MASK*") Signed-off-by: Matt Redfearn Reviewed-by: Paul Burton Signed-off-by: Marc Zyngier Signed-off-by: Greg Kroah-Hartman --- drivers/irqchip/irq-mips-gic.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -424,8 +424,6 @@ static int gic_shared_irq_domain_map(str spin_lock_irqsave(&gic_lock, flags); write_gic_map_pin(intr, GIC_MAP_PIN_MAP_TO_PIN | gic_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);