Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp218278ybm; Thu, 28 May 2020 21:12:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFFKjYJXpNYmoYRHFaOkdygNQ7tNA1jJANYerh8PgmrFoXB+hJcsuoefiyTB2G2LJIAXU0 X-Received: by 2002:a50:9d46:: with SMTP id j6mr6588719edk.362.1590725532489; Thu, 28 May 2020 21:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590725532; cv=none; d=google.com; s=arc-20160816; b=xAQkayGmUrZ9qiyGhDOv/bF/j/IjirJv4HK+upz7B+GT1Dh0aNsOeegQ8q3D8XHiLO dhrs9il/Dzm8u5rhMwCT9W64gBTfiE0so8PJMHEW7hBRbJM6mPMUo4NK4PGFoGVIe1OD n/PYblQLuGQ+qXTT/9WS5OUzECIOqBQXrpD17oa0zS4uv3lIUFZsc6m9bIsMK4DiSskG YwuCeqINL1mNSSasMY++QOrcSvmkIoZECTgq4AMVB+dFIUQd8DG1/n6rVUg7KKLORTi7 xGNK18IJsEnhlrdk6NC++Cs6YBJ1IHfRjZq+JROnjoAk3+T6NcZNQNP57Xhn9aqBt0Aa 9DrA== 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:from:references:cc:to:subject; bh=QNluj+AKcjeQhBB8bs7T5TSK/j/ByJxBCx/sWZP/CUk=; b=VwxeRzjzFt7i5UQhckBFSm3hlOK6pFufpIpYHyiOgpMbZYZrKMYj6EQD2tO74in14Z NvhfYvBAjrTMNkhtVB5Dbf46s1khnJ3h6XnNxcb25QR8EuGKGMoL7CsCJ0avL1tQefcn 13FIfkfaRD6+lhMfFPYu3L1fKxCGtof+VasQOWROYnrUO4HG9rD/eLNg3RaMeDzor/RG xfgxzEIaOY5YqInG2fvcw6nbIWs848GYsFi0Q6iwltpF4JzIPsKw91EfQ0zMCcmqjmeO rXcEO/SMxiZ4GY/9BYYP3ZItRmLdAhcAK4T2Mgayv4WVla1FmPgvC0Rxm65h+UeLRRFy kHiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j26si5167099ejk.3.2020.05.28.21.11.49; Thu, 28 May 2020 21:12:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725884AbgE2EHy (ORCPT + 99 others); Fri, 29 May 2020 00:07:54 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:39146 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727094AbgE2EHx (ORCPT ); Fri, 29 May 2020 00:07:53 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B1A4569FBB21838E7DBA; Fri, 29 May 2020 12:07:50 +0800 (CST) Received: from [10.173.222.27] (10.173.222.27) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Fri, 29 May 2020 12:07:42 +0800 Subject: Re: [PATCH] irqchip/gic-v3-its: Don't try to move a disabled irq To: Ali Saidi , Thomas Gleixner , Jason Cooper , Marc Zyngier , CC: , , , , References: <20200529015501.15771-1-alisaidi@amazon.com> From: Zenghui Yu Message-ID: Date: Fri, 29 May 2020 12:07:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20200529015501.15771-1-alisaidi@amazon.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.222.27] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2020/5/29 9:55, Ali Saidi wrote: > If an interrupt is disabled the ITS driver has sent a discard removing > the DeviceID and EventID from the ITT. After this occurs it can't be > moved to another collection with a MOVI and a command error occurs if > attempted. Before issuing the MOVI command make sure that the IRQ isn't > disabled and change the activate code to try and use the previous > affinity. > > Signed-off-by: Ali Saidi > --- > drivers/irqchip/irq-gic-v3-its.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index 124251b0ccba..1235dd9a2fb2 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -1540,7 +1540,11 @@ static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val, > /* don't set the affinity when the target cpu is same as current one */ > if (cpu != its_dev->event_map.col_map[id]) { > target_col = &its_dev->its->collections[cpu]; > - its_send_movi(its_dev, target_col, id); > + > + /* If the IRQ is disabled a discard was sent so don't move */ > + if (!irqd_irq_disabled(d)) > + its_send_movi(its_dev, target_col, id); It looks to me that if the IRQ is disabled, we mask the enable bit in the corresponding LPI configuration table entry, but not sending DISCARD to remove the DevID/EventID mapping. And moving a disabled LPI is actually allowed by the GIC architecture, right? > + > its_dev->event_map.col_map[id] = cpu; > irq_data_update_effective_affinity(d, cpumask_of(cpu)); > } > @@ -3439,8 +3443,16 @@ static int its_irq_domain_activate(struct irq_domain *domain, > if (its_dev->its->numa_node >= 0) > cpu_mask = cpumask_of_node(its_dev->its->numa_node); > > - /* Bind the LPI to the first possible CPU */ > - cpu = cpumask_first_and(cpu_mask, cpu_online_mask); > + /* If the cpu set to a different CPU that is still online use it */ > + cpu = its_dev->event_map.col_map[event]; > + > + cpumask_and(cpu_mask, cpu_mask, cpu_online_mask); > + > + if (!cpumask_test_cpu(cpu, cpu_mask)) { > + /* Bind the LPI to the first possible CPU */ > + cpu = cpumask_first(cpu_mask); > + } I'd like to know what actual problem you had seen and the way to reproduce it :-) Thanks, Zenghui