Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp657945img; Thu, 21 Mar 2019 06:22:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpC3CAsR+rJCinD7/mKXwukJcKENRUWNhjl85ZIQyZKKs2CVteNNlkotXBXsHCQAZtzw8P X-Received: by 2002:a63:b902:: with SMTP id z2mr3385712pge.428.1553174573051; Thu, 21 Mar 2019 06:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553174573; cv=none; d=google.com; s=arc-20160816; b=fe8G8rgIJ4q7vnEXzYBZcjF3is/4G+z70JZzLIHVqHfY9UOCG4glmJviFvTCzPPQVV o6l2oFg39Wm30DukPiD33aa2G3IkeJpqKApiEgFwEsBL02WNBxFwgAuZpkRPwHI/O83t ltlOeAmLLCTJg0cwhwKpeyt7owpVPk3h4/4EWoVLwrC5V2MZcB7jr6nzhrznBmtThKlg zNwHwHxhkCOICktow11/VTHX0hFGHf0j2yDR2lM5fPnZMq9eXPB1r1nqSyiEWbY1WTfB XHv1rdVqD56h1yJdUnycOv09sI1yuDz4z5rC2HTZC4y0d96H+l/1MeCoFsRPGXB91W7r X8Gg== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=qNw0VvC0r029zwKzMpqV997lqwGCbBjkdA61rs/v1BQ=; b=gQOOmH0JnXwb5gKCU+gy3bscCdOfIKca2CZCGKOIjPt1pkkgNJo+Z77QuLF+pyocas KNGRdUk4TtsBEZuRsYx26dhrv98OUIFA8O3dx/mxPm5SsQ82hfbj6bYkTxoYBJAxegzx 2kXqT9esHiuoIjZu2V4vbZyPCkapz4/13uwv8FSSXZlCXoERQpBJAxc6oGLEgG2OgRcG WMJZy8eNMGdoH4PL4oIDLfXrUro8rwC4UScWufhmVMv7LuibaxvX7otz0U5iHM6lloOX YP6eqnzKUPP66W58Ouxplp36rxWuHy7eCYhOXI/MRUjwLUPZIsLcD8+kWmQzLcZ1BYGP qlew== 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 p11si4139406pgl.526.2019.03.21.06.22.37; Thu, 21 Mar 2019 06:22:53 -0700 (PDT) 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 S1728298AbfCUNVw (ORCPT + 99 others); Thu, 21 Mar 2019 09:21:52 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5169 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728049AbfCUNVw (ORCPT ); Thu, 21 Mar 2019 09:21:52 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 516952E2750DC0DBCDD2; Thu, 21 Mar 2019 21:21:49 +0800 (CST) Received: from [127.0.0.1] (10.74.177.192) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.408.0; Thu, 21 Mar 2019 21:21:41 +0800 Subject: Re: [PATCH] mbigen: don't clear eventid when free_irq To: Marc Zyngier References: <20190321091135.5574b496@why.wild-wind.fr.eu.org> CC: Thomas Gleixner , Jason Cooper , "linux-kernel@vger.kernel.org" , "Liyou (leeyou, RTOS)" , "Joey Yan(Bo)" , "Xiaowei (C)" , "zhanghan (Q)" , Yangyingliang , yaohongbo , Linuxarm From: Chen Jianguo Message-ID: Date: Thu, 21 Mar 2019 21:21:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20190321091135.5574b496@why.wild-wind.fr.eu.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.177.192] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc On 2019/3/21 17:11, Marc Zyngier wrote: > On Sat, 16 Mar 2019 11:15:03 +0000 > chenjianguo wrote: > >> From: Jianguo Chen >> >> mbigen_write_msg clears eventid bits of a mbigen register >> when free a interrupt, because msi_domain_deactivate memset >> struct msg to zero. Then multiple mbigen pins with zero eventid >> will report the same interrupt number. >> >> The eventid clear call trace: >> free_irq >> __free_irq >> irq_shutdown >> irq_domain_deactivate_irq >> __irq_domain_deactivate_irq >> __irq_domain_deactivate_irq >> msi_domain_deactivate >> platform_msi_write_msg >> mbigen_write_msg >> >> Signed-off-by: Jianguo Chen >> --- >> drivers/irqchip/irq-mbigen.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c >> index 567b29c..fad7291 100644 >> --- a/drivers/irqchip/irq-mbigen.c >> +++ b/drivers/irqchip/irq-mbigen.c >> @@ -161,6 +161,9 @@ static void mbigen_write_msg(struct msi_desc *desc, >> struct msi_msg *msg) >> void __iomem *base = d->chip_data; >> u32 val; >> >> + if (!msg->address_lo && !msg->address_hi) >> + return; >> + >> base += get_mbigen_vec_reg(d->hwirq); >> val = readl_relaxed(base); >> > > For whatever reason, I couldn't apply this patch (even when fishing a > copy of this email from the archives). It seems to be corrupted is > various ways, so I had to write the patch from scratch, which is not the > most reliable way to work. Good thing this was something trivial, I > wouldn't do it for something more complicated. > > In the future, please make sure to use 'git send-email' to send your > patches, as it is known to work correctly. > > Thanks, > > M. > Mbigen vector register and pin structure shows as below: event id 0 1 2 127 vector register reg0 reg1 reg2 reg127 | | | | MBIGEN pin0 pin1 pin2 ... pin127 |-----|-----|-----|-----| | | | | | device interrupt num0 num1 num2 num127 Suppose a device driver requested irq num0 and num1 at the beginning, and for some reason it freed irq num1, mbigen_write_msg will write reg1 with event id 0. Then the pin1 probably mistakenly report interrupt num0 to device driver if there is a signal on the pin. event id 0 0 2 127 vector register reg0 reg1 reg2 reg127 | | | | MBIGEN pin0 pin1 pin2 ... pin127 |-----|-----|-----|-----| | | | | | device interrup num0 num1 num2 num127 Thanks, Jianguo Chen