Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp187169ybb; Thu, 19 Mar 2020 19:32:05 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvpfpN+RWcqfVGPMPSyZjtc5+Fv9NpKqurhSHI/tdEOMFGIIGEImVtxKtn9mlqDw657r+iS X-Received: by 2002:aca:4e47:: with SMTP id c68mr5008496oib.16.1584671525257; Thu, 19 Mar 2020 19:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584671525; cv=none; d=google.com; s=arc-20160816; b=rFaKpHVAUunYgdrw0N+s1JefyaZjEct12otYP6qcr5394auxrWbAKowyDPYhrm5khs dIWmjeXbWjsDaioz603RnUUDwQCO2EQTO6RRhDXFlTrd8AU+/lQE9Mj8yKE4kjiiPNQf PsFmUE5SdFUqFccKHubiD104ytfA6DXiKbnaw9/AoTZkIzFu0VA9+h43GcS2uY/mzcPI DhY5MPrNEea2B05godzGKd6kP6JQIcvG+UJbBfrIEFXUQuMLkX2IOTfBdvtsGIFLhC8e t7kQsoXWpjwVyb6MasROZPNXuuoHAb720H95O6TuqfI0++9/+IAxzsRNcxuyqujbuxzk JTZw== 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=Ff0uk5Bx0ZbQ0VyBjLMjR++TwE0UqQ9N+wQU/ZoR5hQ=; b=LPgWusZVn15DIgyJZfYEAQIFW7te8mh8JtyPOqJxZhmkVbfjDVQmYFjPARpP5/rkZ7 G1mIK+lGqZzpqo1ncUPWBvNSUPI94/7Cgv8UpRDoTyvZsjgxPFnuO1eANwB0FtTBFOa7 W0aqV/HqTPI0nxek62s+a/i/umryBx6X7B1gUxNsAAP2SMfTIfrjS39O4kSh90uCrSdB LcbXLcXkWtzwTCIvhkPpyoZMoQATWKGcyIVpsdn6iMtMSUsToT5b1tKhsw7EyvTMjQZV qdaJGB4DZ0wu7GomK+uvi6e3LR3bzgdTO0B1Xc1CWHL8f/vTFIM+3NcV7VJEYt5+sm5n c4Jw== 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 l63si2089224oif.161.2020.03.19.19.31.52; Thu, 19 Mar 2020 19:32:05 -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 S1726697AbgCTCbe (ORCPT + 99 others); Thu, 19 Mar 2020 22:31:34 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12166 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725856AbgCTCbe (ORCPT ); Thu, 19 Mar 2020 22:31:34 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 2AC509635A3A5CBCEBBC; Fri, 20 Mar 2020 10:31:31 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Fri, 20 Mar 2020 10:31:22 +0800 Subject: Re: [PATCH v5 16/23] irqchip/gic-v4.1: Eagerly vmap vPEs To: Marc Zyngier CC: , , , , Lorenzo Pieralisi , Jason Cooper , "Robert Richter" , Thomas Gleixner , "Eric Auger" , James Morse , "Julien Thierry" , Suzuki K Poulose References: <20200304203330.4967-1-maz@kernel.org> <20200304203330.4967-17-maz@kernel.org> <2817cb89-4cc2-549f-6e40-91d941aa8a5f@huawei.com> From: Zenghui Yu Message-ID: <2f667113-8241-dce6-0a5e-3acb5ef9cf7f@huawei.com> Date: Fri, 20 Mar 2020 10:31:20 +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: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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 Marc, On 2020/3/19 18:55, Marc Zyngier wrote: > On 2020-03-17 02:49, Zenghui Yu wrote: >> Hi Marc, >> >> On 2020/3/5 4:33, 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 >> >> Before GICv4.1, we use vlpi_count to evaluate whether the vPE has been >> mapped on the specified ITS, and use this refcount to only issue VMOVP >> to those involved ITSes. It's broken after this patch. >> >> We may need to re-evaluate "whether the vPE is mapped" now that we're at >> GICv4.1, otherwise *no* VMOVP will be issued on the v4.1 capable machine >> (I mean those without single VMOVP support). >> >> What I'm saying is something like below (only an idea, it even can't >> compile), any thoughts? >> >> >> diff --git a/drivers/irqchip/irq-gic-v3-its.c >> b/drivers/irqchip/irq-gic-v3-its.c >> index 2e12bc52e3a2..3450b5e847ca 100644 >> --- a/drivers/irqchip/irq-gic-v3-its.c >> +++ b/drivers/irqchip/irq-gic-v3-its.c >> @@ -198,7 +198,8 @@ static u16 get_its_list(struct its_vm *vm) >>          if (!is_v4(its)) >>              continue; >> >> -        if (vm->vlpi_count[its->list_nr]) >> +        if (vm->vlpi_count[its->list_nr] || >> +            gic_requires_eager_mapping()) >>              __set_bit(its->list_nr, &its_list); >>      } >> >> @@ -1295,7 +1296,8 @@ static void its_send_vmovp(struct its_vpe *vpe) >>          if (!is_v4(its)) >>              continue; >> >> -        if (!vpe->its_vm->vlpi_count[its->list_nr]) >> +        if (!vpe->its_vm->vlpi_count[its->list_nr] && >> +            !gic_requires_eager_mapping()) >>              continue; >> >>          desc.its_vmovp_cmd.col = &its->collections[col_id]; > > It took me a while to wrap my head around that one, but you're as usual > spot on. > > The use of gic_requires_eager_mapping() is a bit confusing here, as it > isn't > so much that the VPE is eagerly mapped, but the predicate on which we > evaluate > the need for a VMOVP. How about this: > > diff --git a/drivers/irqchip/irq-gic-v3-its.c > b/drivers/irqchip/irq-gic-v3-its.c > index cd6451e190c9..348f7a909a69 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -189,6 +189,15 @@ static DEFINE_IDA(its_vpeid_ida); >  #define gic_data_rdist_rd_base()    (gic_data_rdist()->rd_base) >  #define gic_data_rdist_vlpi_base()    (gic_data_rdist_rd_base() + > SZ_128K) > > +/* > + * Skip ITSs that have no vLPIs mapped, unless we're on GICv4.1, as we > + * always have vSGIs mapped. > + */ > +static bool require_its_list_vmovp(struct its_vm *vm, struct its_node > *its) > +{ > +    return (gic_rdists->has_rvpeid || vm->vlpi_count[its->list_nr]); > +} > + >  static u16 get_its_list(struct its_vm *vm) >  { >      struct its_node *its; > @@ -198,7 +207,7 @@ static u16 get_its_list(struct its_vm *vm) >          if (!is_v4(its)) >              continue; > > -        if (vm->vlpi_count[its->list_nr]) > +        if (require_its_list_vmovp(vm, its)) >              __set_bit(its->list_nr, &its_list); >      } > > @@ -1295,7 +1304,7 @@ static void its_send_vmovp(struct its_vpe *vpe) >          if (!is_v4(its)) >              continue; > > -        if (!vpe->its_vm->vlpi_count[its->list_nr]) > +        if (!require_its_list_vmovp(vpe->its_vm, its)) >              continue; > >          desc.its_vmovp_cmd.col = &its->collections[col_id]; Indeed this looks much clearer. We're actually evaluating the need for issuing VMOVP to a specified ITS, on system using its_list_map feature (though we evaluate it by checking whether the vPE is mapped on this ITS). Thanks, Zenghui