Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp653410ybv; Thu, 13 Feb 2020 07:14:00 -0800 (PST) X-Google-Smtp-Source: APXvYqzW0Y0S491gYs+FqA8ttIZ0DbkbrmE1gpW0Y1qV+j2L5QrqnzmIIqldTbiKU3zm3BhPQSVu X-Received: by 2002:a9d:6a53:: with SMTP id h19mr6418471otn.120.1581606840639; Thu, 13 Feb 2020 07:14:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581606840; cv=none; d=google.com; s=arc-20160816; b=Mq+5YzPwdob9VN0DAHz5MU5L5mm7dTv/Np93gKyRBN2H/bJPoAeln8O5U8wfj6DgdK d/3iie3ecATaQvf4UT5O01fVF0dKI6Vz8Mydq2Qu8vZP3dN2g/x4nhUIz9vF4QdfTPHV uU2V5d9a5RGY1MVQEQplE0bKdRfmFG0omNFwgvClJ00u1MROi6OBnaIW8FFmdWaoWXJZ YUqCJJxs9EasN3b315ces2dvvwtTih5CzHlRPt3tjGFfJPkcztnE+4spLtSVWdr5OeM3 RzxtsrYIR7+yGtfR+QkCj1H6jlBUHGGhgp7EWU+fRuQgBj0kfF8XJ4oN76/YYg+U/9k9 i3LQ== 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=fGcpn0sBTpQ6PlKLJ9Y6lODfkq/53g5v8QxYWOp6bO8=; b=isZWgEIfreMoUjZj+PZ/o+NI446e+cyIXJi76py7XEDzCr63IUY2D70I/N8Fs6wCW1 F5v50fEHW8O/o+Qz4NjNHKXmmwwq4fBSsD+c04E9NDRv8z4kuk6T89JUl9DsyJQI7Rmi FEgBKtkJmdbKB53DJFbDP84+c67Co4NyTw8tZT8uIBbIpU9agavWaQfLfmn+50PVWcY9 6XQ+JTKW4uEoDx3pOdRIBV9jzM8yMXkPC176YEFpDJl+3Wwhj0sIifxZ+5B9qpYtaYpn 1uE2AxNnMbQaYKYQe9w02ic9gv1VcpF6f0zN1HzLu8I7m9Rjha2AmFpEHed0w0YIFvy5 q7uw== 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 w12si1240461otk.77.2020.02.13.07.13.48; Thu, 13 Feb 2020 07:14:00 -0800 (PST) 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 S1727635AbgBMPMD (ORCPT + 99 others); Thu, 13 Feb 2020 10:12:03 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:46708 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726937AbgBMPMC (ORCPT ); Thu, 13 Feb 2020 10:12:02 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 87457483DF8DF9ECD8F4; Thu, 13 Feb 2020 23:11:59 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Thu, 13 Feb 2020 23:11:52 +0800 Subject: Re: [PATCH v2 3/6] irqchip/gic-v4.1: Ensure L2 vPE table is allocated at RD level To: Marc Zyngier CC: , , , , , References: <20200206075711.1275-1-yuzenghui@huawei.com> <20200206075711.1275-4-yuzenghui@huawei.com> <2f6a27ac57aef9b948952c210c9a5882@kernel.org> From: Zenghui Yu Message-ID: Date: Thu, 13 Feb 2020 23:11:51 +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: <2f6a27ac57aef9b948952c210c9a5882@kernel.org> 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/2/13 22:22, Marc Zyngier wrote: > Hi Zenghui, > > On 2020-02-06 07:57, Zenghui Yu wrote: >> In GICv4, we will ensure that level2 vPE table memory is allocated >> for the specified vpe_id on all v4 ITS, in its_alloc_vpe_table(). >> This still works well for the typical GICv4.1 implementation, where >> the new vPE table is shared between the ITSs and the RDs. >> >> To make it explicit, let us introduce allocate_vpe_l2_table() to >> make sure that the L2 tables are allocated on all v4.1 RDs. We're >> likely not need to allocate memory in it because the vPE table is >> shared and (L2 table is) already allocated at ITS level, except >> for the case where the ITS doesn't share anything (say SVPET == 0, >> practically unlikely but architecturally allowed). >> >> The implementation of allocate_vpe_l2_table() is mostly copied from >> its_alloc_table_entry(). >> >> Signed-off-by: Zenghui Yu >> --- >>  drivers/irqchip/irq-gic-v3-its.c | 80 ++++++++++++++++++++++++++++++++ >>  1 file changed, 80 insertions(+) >> >> diff --git a/drivers/irqchip/irq-gic-v3-its.c >> b/drivers/irqchip/irq-gic-v3-its.c >> index 0f1fe56ce0af..ae4e7b355b46 100644 >> --- a/drivers/irqchip/irq-gic-v3-its.c >> +++ b/drivers/irqchip/irq-gic-v3-its.c >> @@ -2443,6 +2443,72 @@ static u64 >> inherit_vpe_l1_table_from_rd(cpumask_t **mask) >>      return 0; >>  } >> >> +static bool allocate_vpe_l2_table(int cpu, u32 id) >> +{ >> +    void __iomem *base = gic_data_rdist_cpu(cpu)->rd_base; >> +    u64 val, gpsz, npg; >> +    unsigned int psz, esz, idx; >> +    struct page *page; >> +    __le64 *table; >> + >> +    if (!gic_rdists->has_rvpeid) >> +        return true; >> + >> +    val  = gits_read_vpropbaser(base + SZ_128K + GICR_VPROPBASER); > > Having rebased the rest of the GICv4.1 series on top of -rc1, I've hit a > small > issue right here. I run a FVP model that only spawns 4 CPUs, while the > DT has > 8 of them. This means that online_cpus = 4, and possible_cpus = 8. > > So in my case, half of the RDs have base == NULL, and things stop quickly. Ah, so this may also be why we check '!base' for each possible CPU in inherit_vpe_l1_table_from_rd(). I didn't think about it at that time. > > I plan to queue the following: > > diff --git a/drivers/irqchip/irq-gic-v3-its.c > b/drivers/irqchip/irq-gic-v3-its.c > index d85dc8dcb0ad..7656b353a95f 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -2526,6 +2526,10 @@ static bool allocate_vpe_l2_table(int cpu, u32 id) >      if (!gic_rdists->has_rvpeid) >          return true; > > +    /* Skip non-present CPUs */ > +    if (!base) > +        return true; > + >      val  = gicr_read_vpropbaser(base + SZ_128K + GICR_VPROPBASER); > >      esz  = FIELD_GET(GICR_VPROPBASER_4_1_ENTRY_SIZE, val) + 1; Thanks for fixing the second bug for this patch :-) Zenghui