Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp4268516ybn; Fri, 27 Sep 2019 20:14:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBaEUe1EQ++A5Am1bWeWTadBLGvXSTQLahbTI3idtZtE7bQtp2vBjpi90T7qKxyA84pGVP X-Received: by 2002:a17:906:eb86:: with SMTP id mh6mr10735801ejb.171.1569640492925; Fri, 27 Sep 2019 20:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569640492; cv=none; d=google.com; s=arc-20160816; b=be7PLXQAvF4yhMx3hEcPbqewSt8S4joKnALYtriSv1vSs9z2HuCWOUQ+y3ZdzWVBNH GSbYTKKRb/LQTPu7Btte8ZahW6318kQ6cVWh3rOZUTGCxF/G0A4KUHQY4nOLT13daaGn mNtfxtIul+OLLV3P5YY2i33xbbvmxshjakCEBmfIhZXa7OaFqxuoA9pk1Jfn41NlmJ5Y fSckJrttdMa7YxXaa5g2nsMORDZSrCKfCmmBiz7Dq0LFBGs9NrKIDsLFeJnpih8CkFN0 FTye8cPYmgv4YUtVdVqXTHToaZW9WJUgt0oy4e5BFIr8Zkx6dBN0g4hhZHT0327EC5Nh cHkg== 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=TaT9DvH6OXG+aev/jtQjiB27TNNj7wtm6FlFJnbFlNw=; b=y+6h7RMWb260Wwt7x5Nb8XS+BQiE/5Q44TbnFWRcSEkJ3nvE9qPjglVM6us2m5QOoR XVY3YW04CzvTu0B4gtmqzCkApg6YCdCftRp2g4rDOpOGUCzKpkeF9nedNwwEzh4223OJ 2TtBBeRmIk198jMOfObBc73zV0lKd24/UTPL4/KoaMgXHo9IjzrHskrO9yn7/8P0BXtn mX5ks0dpFEMHVl8vz0ClMgE2xzCayypYdYxI164C4gkIC3GDhXS4+NqklufPZXK8YXNG Y+n9eclWbCswyg0kd6oC2b0j1kDEKI8NwnDWJBkL6m7emkhaqKWTOMA+X601JfRb4Ae2 rtpA== 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 d23si2961471edb.55.2019.09.27.20.14.28; Fri, 27 Sep 2019 20:14:52 -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 S1728430AbfI1DNW (ORCPT + 99 others); Fri, 27 Sep 2019 23:13:22 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3167 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725990AbfI1DNV (ORCPT ); Fri, 27 Sep 2019 23:13:21 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 55649E13E901CAD785BF; Sat, 28 Sep 2019 11:13:19 +0800 (CST) Received: from [127.0.0.1] (10.184.12.158) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Sat, 28 Sep 2019 11:13:10 +0800 Subject: Re: [PATCH 31/35] irqchip/gic-v4.1: Eagerly vmap vPEs To: Marc Zyngier , , CC: Lorenzo Pieralisi , Jason Cooper , Thomas Gleixner References: <20190923182606.32100-1-maz@kernel.org> <20190923182606.32100-32-maz@kernel.org> From: Zenghui Yu Message-ID: <82576f6e-3736-8069-bbf2-7744fbea9ed2@huawei.com> Date: Sat, 28 Sep 2019 11:11:42 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Thunderbird/64.0 MIME-Version: 1.0 In-Reply-To: <20190923182606.32100-32-maz@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.184.12.158] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/9/24 2:26, Marc Zyngier wrote: > Now that we have HW-accelerated SGIs being delivered to VPEs, it > becomes required to map the VPEs on all ITSs instead of relying > on the lazy approach that we would use when using the ITS-list > mechanism. > > Signed-off-by: Marc Zyngier > --- > drivers/irqchip/irq-gic-v3-its.c | 39 +++++++++++++++++++++++++------- > 1 file changed, 31 insertions(+), 8 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index 4aae9582182b..a1e8c4c2598a 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -1417,12 +1417,31 @@ static int its_irq_set_irqchip_state(struct irq_data *d, > return 0; > } > > +/* > + * Two favourable cases: > + * > + * (a) Either we have a GICv4.1, and all vPEs have to be mapped at all times > + * for vSGI delivery > + * > + * (b) Or the ITSs do not use a list map, meaning that VMOVP is cheap enough > + * and we're better off mapping all VPEs always > + * > + * If neither (a) nor (b) is true, then we map VLPIs on demand. ^^^^^ vPEs > + * > + */ > +static bool gic_requires_eager_mapping(void) > +{ > + if (!its_list_map || gic_rdists->has_rvpeid) > + return true; > + > + return false; > +} > + > static void its_map_vm(struct its_node *its, struct its_vm *vm) > { > unsigned long flags; > > - /* Not using the ITS list? Everything is always mapped. */ > - if (!its_list_map) > + if (gic_requires_eager_mapping()) > return; > > raw_spin_lock_irqsave(&vmovp_lock, flags); > @@ -1456,7 +1475,7 @@ static void its_unmap_vm(struct its_node *its, struct its_vm *vm) > unsigned long flags; > > /* Not using the ITS list? Everything is always mapped. */ > - if (!its_list_map) > + if (gic_requires_eager_mapping()) > return; > > raw_spin_lock_irqsave(&vmovp_lock, flags); > @@ -3957,8 +3976,12 @@ static int its_vpe_irq_domain_activate(struct irq_domain *domain, > struct its_vpe *vpe = irq_data_get_irq_chip_data(d); > struct its_node *its; > > - /* If we use the list map, we issue VMAPP on demand... */ > - if (its_list_map) > + /* > + * If we use the list map, we issue VMAPP on demand... Unless > + * we're on a GICv4.1 and we eagerly map the VPE on all ITSs > + * so that VSGIs can work. > + */ > + if (!gic_requires_eager_mapping()) > return 0; > > /* Map the VPE to the first possible CPU */ > @@ -3984,10 +4007,10 @@ static void its_vpe_irq_domain_deactivate(struct irq_domain *domain, > struct its_node *its; > > /* > - * If we use the list map, we unmap the VPE once no VLPIs are > - * associated with the VM. > + * If we use the list map on GICv4.0, we unmap the VPE once no > + * VLPIs are associated with the VM. > */ > - if (its_list_map) > + if (!gic_requires_eager_mapping()) > return; > > list_for_each_entry(its, &its_nodes, entry) { > Thanks, zenghui