Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3195258lqo; Wed, 15 May 2024 02:35:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWbG9u/5quOuQzCxTKByFZZEjY8is+oNE5eyEjD1j2W+Nd0yyn/M6mrVUVA/pxolmVYXGkomF7n0iXFtgjw4yab7Gc9peRheFTVA3rY5A== X-Google-Smtp-Source: AGHT+IFOPYQvhkyBmFq8YnRxuzKYKqzjw/BUjCqMJtKr/z1gzv4YQWQ3ou1BHWjNxTvp5BPBwCKi X-Received: by 2002:a05:6a20:914f:b0:1a8:2cd1:e493 with SMTP id adf61e73a8af0-1afde1c576amr23081375637.29.1715765704345; Wed, 15 May 2024 02:35:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715765704; cv=pass; d=google.com; s=arc-20160816; b=PpiomfpjP4lmgBU/vRu8urr9yh/RFA4DIyCMIGxXMu+adCuTpFJ2N5p1jLKTkFmuC4 fCwcFSM1Dvg1F48AbUSbEdvkvZTNwIV8Pnd/Ns7KlLipM5u66BTt4fPdKohtCNgC7GDb SF56dKbdisQuYzMmQ8pfux2ks7rrnWxmenNfU3e0U9gfeN2kAK7qXZbUSYrSqpUZOeIY D28K2gc31MSFpL+3CQHv/rwpt4YI4jYrPBCLgMclM45NBYnWz+kXCkLnRP2iembuAH+b 8jotjOPZOLyH1c7wx5PYc7j6UpPUoV8h1mUsPOc1LGjpgHIWT2q855GkLG3pW9NKKVHi NbrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=OzUDX/GeZgsASLJpYjz+mGVW6rQ64izLSp7/G/1oUdE=; fh=dH4jTj7b1WNA6A5G+I4xuLRfttfFRua05yiITnnN5NI=; b=U4cisE3iXH7mnMPCHqtaj5w6jUg+y4TiuGaarMyI/uHxq/HHs6ARqR1ijMzowjcjQI JSgaTu19zyc9rgFu7cIOO31sq75j0LsJqP+kDuXma7Gxoqd58R4u2qOZgU/UxUCyq+OY KL5nzIntViM2jfwyYp8XxSIfqQUn8MkKYN/V46t96+/t3Ix2APVX0+EVqRH3gPeRhINe Lc8GF7t49Imx+ggofz2oholLtelmeSZOZYGHR+XGYVrS+/DY2QqM502sr81anR7vf3TS MZCylc92IAVnwy/+688HlNR/oV4HIHlpiVJOlAz3/yjkErLJJFtxJMN4ldqOTc4NUetM c2QA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DCC9ZrZK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179709-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179709-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2a726e7si11968726b3a.35.2024.05.15.02.35.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 02:35:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179709-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DCC9ZrZK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179709-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179709-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C28B7281CBD for ; Wed, 15 May 2024 09:34:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 862685914D; Wed, 15 May 2024 09:34:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DCC9ZrZK" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A444B58AA5 for ; Wed, 15 May 2024 09:34:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715765689; cv=none; b=TdFKhlaDqU+dmAFhhwZCJd9UGtEXMa3VNyDGar5IlS0xZQl3rtzI0r23ygwASYLKIX8mlLaRTxelzNQGhACOZbv57zGrXfLo21kTuboSNWb+ZJE0EZuqhOC+qh9HYASkBhhk1Ua86QVnkpm5/WYIF9Jh09nHXYCXCgLYP/9y1II= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715765689; c=relaxed/simple; bh=iV4NuC8nZ4r/lSpibzwon8OU9TtP6uytv5bsFJ9FtjM=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=ed9EEDbY1ADWebjEDH4ee5AoIP+k9bo3IYd+r+5vDOmTYTNeco13ahoORlHWH3gR5+xk6Q3KPmbHztwVa+9V4ter/UYANnkEvMthEy2oNKZQQHFc956NCowsFsa2PYJrxV8ltirxWiQCxDQEQy863WmUAaV229HnFxcZ+CZHWGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DCC9ZrZK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AC15C116B1; Wed, 15 May 2024 09:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715765689; bh=iV4NuC8nZ4r/lSpibzwon8OU9TtP6uytv5bsFJ9FtjM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DCC9ZrZKJhjrHUGxSfUVC2SuZ/tmBB59hL5/Wh8NqddWcYautGz3WQ69a5e8pLkGn nMZ7E8pOcxh1xFVnUvjzA60346MoR8A0GHaJisGGaeOxpy7dL/7LWaQN/EgeAizqS1 MK8PUVYS0P29ElLaicDr/h33+k/GLH8RU9LavbY2+yOEPkq/ZxuU6T6YdA4rHvN3FB q6c8e6Rp1mOxj7clTnGfTRYUhSLEWY8j4UuT8vaWVDyKq+hMdLmp5pW4GKMyje73U2 JvRBemGIJKvhaUm3J42+RRGYbki0P/cvzN82S10m76a0N7ijK5BqXwWXAYP/5YyAZu ZtMJJ949/OUKg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1s7B26-00DLRm-L5; Wed, 15 May 2024 10:34:46 +0100 Date: Wed, 15 May 2024 10:34:46 +0100 Message-ID: <86v83fmn9l.wl-maz@kernel.org> From: Marc Zyngier To: Tangnianyao Cc: , , , , , jiangkunkun Subject: Re: [PATCH] irqchip/gic-v4.1:Check whether indirect table is supported in allocate_vpe_l1_table In-Reply-To: References: <20240122160607.1078960-1-tangnianyao@huawei.com> <86sf2p91zt.wl-maz@kernel.org> <5de3da53-9c0d-2a2d-876b-2181e540fa2f@huawei.com> <86r0i98o0a.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: tangnianyao@huawei.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, guoyang2@huawei.com, wangwudi@hisilicon.com, jiangkunkun@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Wed, 15 May 2024 09:56:10 +0100, Tangnianyao wrote: > > > > On 1/22/2024 22:02, Marc Zyngier wrote: > > On Mon, 22 Jan 2024 13:13:09 +0000, > > Tangnianyao wrote: > >> On 1/22/2024 17:00, Marc Zyngier wrote: > >>> [Fixing the LKML address, which has bits of Stephan's address embedded > >>> in it...] > >>> > >>> On Mon, 22 Jan 2024 16:06:07 +0000, > >>> Nianyao Tang wrote: > >>>> In allocate_vpe_l1_table, when we fail to inherit VPE table from other > >>>> redistributors or ITSs, and we allocate a new vpe table for current common > >>>> affinity field without checking whether indirect table is supported. > >>>> Let's fix it. > >>> Is there an actual implementation that doesn't support the indirect > >>> property for the VPE table? I know this is allowed for consistency > >>> with the original revision of the architecture, but I never expected > >>> an actual GICv4.1 implementation to be *that* bad. > >>> > >>> If that's the case, I'm a bit puzzled/worried. > >> I met this problem in a developing implementation and find it's allowed by GIC spec. > >> In such environment, in a common affinity field with only redistributors and without > >> any ITS in it, forcing its_vpe_id_alloc to allocate a large vpeid(like 65000), and there > >> comes an error message "VPE IRQ allocation failure". It originally comes from > >> allocate_vpe_l2_table, reading GICR_VPROPBASER with GICR_VPROPBASER_4_1_SIZE=1 > >> and GICR_VPROPBASER_4_1_INDIRECT=0. > > Really, you should get your HW engineers to fix their GIC > > implementation. I'm OK with working around this issue for > > completeness, but shipping such an implementation would be a mistake. > > > > [...] > > > >> I have another question here. The max number of pages for GITS_BASER > >> and GICR_VPROPBASER is different here, while GITS_BASER.Size is > >> bit[7:0] with max 256, and GICR_4_1_VPROPBASER.Size is bit[6:0] with max 128. > >> Kernel usually probe ITS basers first and then probe GICR_4_1_VPROPBASER in > >> a common affinity group. Maybe we need to check this in "inherit_vpe_l1_table_from_its" ? > > This is because GITS_BASER[] is generic (also works for devices and > > collections), while GICR_VPROPBASER is tailored to the VPE table which > > is usually smaller. > > > > I would expect that GICD_TYPER2.VID reports something that cannot > > result in something going wrong (in this case, the L1 allocation > > cannot be more than 128 pages). > > > > Overall, the kernel isn't a validation suite for the HW, and we expect > > it to have some level of sanity. So if none of this is in shipping HW > > but only in some model with crazy parameters, I don't think we should > > go out of our way to support it. > > > > Thanks, > > > > M. > > > > Hi Marc, > Friendly ping. Do we have plan to fix this problem on kernel, or any other plan ? Hi Nianyao, My earlier question still stand: is this something that affects a shipping implementation? If not, then I don't think we should support this upstream, as this doesn't seem like a realistic configuration. If your employer has actually built this (which I still consider as a mistake), then we can add the workaround I suggested. Thanks, M. -- Without deviation from the norm, progress is not possible.