Received: by 10.223.176.5 with SMTP id f5csp438680wra; Wed, 7 Feb 2018 01:43:54 -0800 (PST) X-Google-Smtp-Source: AH8x224SNso+njQQ6a4OK16hDz2EoEq772LinjZfMoL52/BWcf5Ym7fObjB6j64ZGMFa87lbzHnM X-Received: by 10.99.145.66 with SMTP id l63mr4287581pge.397.1517996634220; Wed, 07 Feb 2018 01:43:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517996634; cv=none; d=google.com; s=arc-20160816; b=S5BV5R+taITGXKHfDDsDvpRLS83lLAW27J5IVuefAhGGpqn823mFTV7J2Xx014Dd/M o6AHCrpozIjWp/7o2MTNqmHnDsOcxo+eBXVVd2EII+pyNOM2MdjxTetdE4pOnPtw0YNZ +z1MC4I5rcDZymHXcuN6ir4MSaNl+Q8eyamk+YfboMvViH50/uCpduZEj5XuJy7oiUZr YQxlZwXMQVGAQZHEVFh7rwJUYQie4t82NKbqFotanL4LpZlWuzGohYXjhJQETkl4XBNU oVYAUrLb8eIXnJTiY+QeLodzdTaskFxEUnIS5qP8h56jMfc+J5T5/TaoEKmZBHvMgnqN 6LiQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=KW8YCHGaH1hRtYRr8NYh8KLubxAovkuZrr+RdjzbaTM=; b=hVifE+la8taJJCKlp3q48fI4wDYB/05gmIvBvAwpjn04hL/jrfvicHSCJEgcoXpmeH iMdwIFHaBmF+Gue/ngxfJaw97dZU+5TEwmnGFVGeUCCrxgABhpcIqiJ2UK2xj5m5/GCm TdMdet+42n5BodKeJq3wfPqnZQZidmObkS7PKUU/R2MQLu7kSN/KoqIn8R86du0JG2S6 D2JIil3SWp0c9VRFkJLfSEvVRMJl62mfUCGJuV3lb62S6KpOK56deQLhxiY9x/1yi2o8 aTFaMhN545xU8TCLVXoavzzgdn2BcFt4R8fZiCOkWelgnvcGG6vmJ3g3vpnFHZ08PmCr FdWQ== 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 c3-v6si837498pld.174.2018.02.07.01.43.40; Wed, 07 Feb 2018 01:43:54 -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 S1753607AbeBGJlJ (ORCPT + 99 others); Wed, 7 Feb 2018 04:41:09 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47622 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753454AbeBGJlH (ORCPT ); Wed, 7 Feb 2018 04:41:07 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 334051435; Wed, 7 Feb 2018 01:41:07 -0800 (PST) Received: from [10.1.207.62] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1CA263F24D; Wed, 7 Feb 2018 01:41:05 -0800 (PST) Subject: Re: [PATCH] irqchip: mips-gic: Avoid spuriously handling masked interrupts To: Matt Redfearn , Thomas Gleixner Cc: linux-mips@linux-mips.org, Ralf Baechle , Jason Cooper , linux-kernel@vger.kernel.org References: <1517849136-29508-1-git-send-email-matt.redfearn@mips.com> From: Marc Zyngier Organization: ARM Ltd Message-ID: Date: Wed, 7 Feb 2018 09:41:04 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1517849136-29508-1-git-send-email-matt.redfearn@mips.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/02/18 16:45, Matt Redfearn wrote: > 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); > > Does this need to be Cc to stable (since it fixes something that was merged in 4.14)? Thanks, M. -- Jazz is not dead. It just smells funny...