From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C21E0C4332F for ; Wed, 8 Nov 2023 09:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235157AbjKHJqd (ORCPT ); Wed, 8 Nov 2023 04:46:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbjKHJqb (ORCPT ); Wed, 8 Nov 2023 04:46:31 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C07C199 for ; Wed, 8 Nov 2023 01:46:29 -0800 (PST) Received: from kwepemm000007.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SQKqV1w8kzMmdW; Wed, 8 Nov 2023 17:41:58 +0800 (CST) Received: from [10.174.185.210] (10.174.185.210) by kwepemm000007.china.huawei.com (7.193.23.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 8 Nov 2023 17:45:52 +0800 Subject: Re: [RFC PATCH] KVM: arm/arm64: GICv4: Support shared VLPI To: Marc Zyngier , , , , , CC: Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Gavin Shan , Jean-Philippe Brucker , "open list:IRQCHIP DRIVERS" , , , References: <20231102143507.840-1-jiangkunkun@huawei.com> <87msvt6cc7.wl-maz@kernel.org> <1fb8353e-e9c4-2570-c2ca-ec537c18ac4d@huawei.com> <86edh228xx.wl-maz@kernel.org> From: Kunkun Jiang Message-ID: <952bd5dc-dd20-acc3-d77e-c9b14e5728d3@huawei.com> Date: Wed, 8 Nov 2023 17:45:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <86edh228xx.wl-maz@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.185.210] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm000007.china.huawei.com (7.193.23.189) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On 2023/11/6 23:33, Marc Zyngier wrote: > On Mon, 06 Nov 2023 14:59:01 +0000, > Kunkun Jiang wrote: >> The virtio-pci driver write entry1-6 >> massage.data in the msix-table and trap to QEMU for processing. The >> massage.data is as follow: >>> entry-0 0 >>> entry-1 1 >>> entry-2 1 >>> entry-3 1 >>> entry-4 1 >>> entry-5 1 >>> entry-6 1 > Urgh... is vp_modern_queue_vector() used in your configuration? This > is ... terrible. I encountered this problem using the 4.19 version kernel, but not the 5.10 version. This vp_modern_queue_vector() function does not exist in 4.19, but it uses 'vp_iowrite16(msix_vec, &cfg->queue_msix_vector)', the same as vp_modern_queue_vector(). In the past two days, I learned about the virtio driver and made some new discoveries. When 'num_queues' is greater than maxcpus, it will fall back into MSI-X with one shared for queues. The two patches[1], submitted by Dongli, limits the number of hw queues used by virtio-blk/virtio-scsi by 'nr_cpu_ids'. The two patches were merged in 5.1-rc2. And the patch related virtio-blk was merged into the 4.19 stable branch.The patch related virtio-scsi was not merged. [1] https://lore.kernel.org/all/1553682995-5682-1-git-send-email-dongli.zhang@oracle.com/ This is the earliest discussion. https://lore.kernel.org/all/e4afe4c5-0262-4500-aeec-60f30734b4fc@default/ I don't know if there are other circumstances that would cause it to fall back into MSI-X with one shared for queues. At least the hack method is possible. > I wonder if PCIe actually allows this sort of thing. Do you think the virtio driver should be modified? > In any case, this sort of behaviour breaks so many thing in KVM's > implementation that I'd recommend you disable GICv4 until we have a > good solution for that. There seems to be no restriction in the GIC specification that multiple host irqs cannot be mapped to the same vlpi. Or maybe I didn't notice. Do you think there are any risks? GICv3 does not have this issue, but is this configuration legal? Thanks, Kunkun Jiang