Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6724180ybn; Mon, 30 Sep 2019 02:44:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXYJormMJ0p/pV/hZpOymEF+hykMZawDx/xrgA3R/m4vzTEZgXn0a1605bRXTXFDnGWdjT X-Received: by 2002:aa7:dd8e:: with SMTP id g14mr18373746edv.233.1569836649283; Mon, 30 Sep 2019 02:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569836649; cv=none; d=google.com; s=arc-20160816; b=L+FKnZk/onB2TlmN+MiDIsvZ8DvgIoa4EXugilri3Yy7V09S0xIonY3SjHuaz3u+oq 0HK3DV3HauyMBerufF7I2RRKf90r+mLOAl0jclRUeyUliVaSUfqbbAJK0fknWkG2o7qx avkhearvGr4F0tBN4lZM0zYxCd3D8retFomkpQzBovh21bLxXYN/lIpmDaV+joBWxcyT PePp/kbHY0UX7rrGd2gXnsfeAJlsnDkjwRvMt1yQazZW+qo89Pc/Ekh5JMlPtQu5bSMz xKfE+YZu6lPR0ouZKJF7Mx7wFACtnAcDnr+y5/1RLWW3qbFnU7KnaOTBooxb/o8hxRJ1 lfaA== 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=rjdVBPng//XQKkpxpZlnCug5fhvgJnS9vz0XEZaATZk=; b=KEKa7jBP6/qfp+SQpD2yDOt7b8WMnFyqnJ/9R5EWWgviZtP8bTdzV441cPcavvc0zj tvGL4vKu9I7jT5MJVsvwk8te7W6MvB+2gEsJP6yJO/m7XKiPBatPzo3IrCqqlL8w2WDe AbyR8qiQmwp2r/z0CJ9/zYV/9zwnNU8tkRnxKntkI3XVekDH8K284cDHjYfzv7lNwQPb jp3vtSpLJ8GXgPa+gSgsUTY70vtA7wlsej4t8feHtjPmKcuRB2yfCFilaSRzwlZS3P9J c7PvObWOlSvWzMxFfXU1SvJMfZWOppWT3ufuTmQTAn/0LqH8Bxk8DxivI8Vr7RVXp+Yf R0Iw== 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 d22si6677302ede.131.2019.09.30.02.43.44; Mon, 30 Sep 2019 02:44:09 -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 S1730348AbfI3Jl2 (ORCPT + 99 others); Mon, 30 Sep 2019 05:41:28 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3234 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727547AbfI3Jl2 (ORCPT ); Mon, 30 Sep 2019 05:41:28 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E97985D9C003C37EE7BD; Mon, 30 Sep 2019 17:41:23 +0800 (CST) Received: from [127.0.0.1] (10.184.12.158) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Mon, 30 Sep 2019 17:41:16 +0800 Subject: Re: [PATCH 20/35] irqchip/gic-v4.1: Allow direct invalidation of VLPIs To: Marc Zyngier CC: , , "Lorenzo Pieralisi" , Jason Cooper , Thomas Gleixner References: <20190923182606.32100-1-maz@kernel.org> <20190923182606.32100-21-maz@kernel.org> <1c96d38da22a97b1fda94a940b60e345@www.loen.fr> From: Zenghui Yu Message-ID: <4ac7dddc-1ba8-52bf-e66e-bee9b3b79744@huawei.com> Date: Mon, 30 Sep 2019 17:40:17 +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: <1c96d38da22a97b1fda94a940b60e345@www.loen.fr> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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/30 17:20, Marc Zyngier wrote: > On 2019-09-28 03:02, Zenghui Yu wrote: >> On 2019/9/24 2:25, Marc Zyngier wrote: >>> Just like for INVALL, GICv4.1 has grown a VPE-aware INVLPI register. >>> Let's plumb it in and make use of the DirectLPI code in that case. >>> Signed-off-by: Marc Zyngier >>> --- >>>   drivers/irqchip/irq-gic-v3-its.c   | 19 +++++++++++++++++-- >>>   include/linux/irqchip/arm-gic-v3.h |  1 + >>>   2 files changed, 18 insertions(+), 2 deletions(-) >>> diff --git a/drivers/irqchip/irq-gic-v3-its.c >>> b/drivers/irqchip/irq-gic-v3-its.c >>> index b791c9beddf2..34595a7fcccb 100644 >>> --- a/drivers/irqchip/irq-gic-v3-its.c >>> +++ b/drivers/irqchip/irq-gic-v3-its.c >>> @@ -1200,13 +1200,27 @@ static void wait_for_syncr(void __iomem *rdbase) >>>   static void direct_lpi_inv(struct irq_data *d) >>>   { >>> +    struct its_vlpi_map *map = get_vlpi_map(d); >>>       struct its_collection *col; >>>       void __iomem *rdbase; >>> +    u64 val; >>> + >>> +    if (map) { >>> +        struct its_device *its_dev = irq_data_get_irq_chip_data(d); >>> + >>> +        WARN_ON(!is_v4_1(its_dev->its)); >>> + >>> +        val  = GICR_INVLPIR_V; >>> +        val |= FIELD_PREP(GICR_INVLPIR_VPEID, map->vpe->vpe_id); >>> +        val |= FIELD_PREP(GICR_INVLPIR_INTID, map->vintid); >>> +    } else { >>> +        val = d->hwirq; >>> +    } >>> >>>       /* Target the redistributor this LPI is currently routed to */ >>>       col = irq_to_col(d); >> >> I think irq_to_col() may not work when GICv4.1 VLPIs are involved in. >> >> irq_to_col() gives us col_map[event] as the target redistributor, >> but the correct one for VLPIs should be vlpi_maps[event]->vpe->col_idx. >> These two are not always pointing to the same physical RD. >> For example, if guest issues a MOVI against a VLPI, we will update the >> corresponding vlpi_map->vpe and issue a VMOVI on ITS... but leave the >> col_map[event] unchanged. >> >> col_map[event] usually describes the physical LPI's CPU affinity, but >> when this physical LPI serves as something which the VLPI is backed by, >> we take really little care of it.  Did I miss something here? > > You didn't miss anything, and this is indeed another pretty bad bug. > The collection mapping is completely unused when the LPI becomes a > VLPI, and it is only the vpe->col_id that matters (which gets updated > on VMOVP). > > This shows that irq_to_col() is the wrong abstraction, and what we're > interested is something that is more like 'irq to cpuid', allowing us > to directly point to the right distributor. > > Please see the patch I just pushed[1], which does that. > > Thanks, > >         M. > > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=irq/gic-v4.1-devel&id=aff363113eb26b6840136b69c2c7db2ea691db20 Yes, I think this makes sense. Thanks, zenghui