Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp942080pxu; Wed, 16 Dec 2020 20:22:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHbDuub01JCxWABKM5IxWKWOqFkb2oSmwE8VksvI1wBvbzF7l2M153PiFt4zuy7Ve4Ywfh X-Received: by 2002:a17:906:f894:: with SMTP id lg20mr33352035ejb.348.1608178946090; Wed, 16 Dec 2020 20:22:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608178946; cv=none; d=google.com; s=arc-20160816; b=um18C+3vqgus+lerxCWz5nj9g/BIG2btFV5h8NceSMJ7lFB8FUCOQ2fB2LsKFGluq0 5ASMFpDXgIa1L4CZuzOBi+85N/puxVLUvKH+KCn0AKjseP8NJfHSpggTBStngs73bO1r lPLydbCoGUIX/Xx3lnB3HoiaPstDksIxADXE7OgZLXWgXxB1ip8XdNJMvUHv0/PZWesQ 7At3x9Ny04aOic9B8eZZhUijyJKmzI6ZGJPAPo0wv5gdJT/uKN8o8RLT5+OJhxxGtFDl 4BsFFGgd7mWUweVmL8jaqrLO7oibYhu/Ywi3Uv6s6I1SzgL3xNNfRVCvmCTrarh85UZk MV4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=xodYu4dsHpq7bC+ibWXZxo8S+TrNOHbV0dnQYuxXNEM=; b=nVmruiia3rl88haIz+oAz726jQaZInjPrax0ghrkE9m96D9GF/ZL6GWTODL+E4B46P AtKkUIpt0DxPBN+opfAW1z5mXsLI3FjoFvS9FOa4mA0ZHL/jgBShDckpfbN5qc4ujHpA sPEr/ySd64MMq/Dp66K38T+ktAppGtsnr5/MdbAAJKTOg72ZLg90W/vhb0fDuj62vWgO GoPO5k/DTrKO4dSlli8qA/lkCaEVOirdV0ZOpRfJcTNtPWkEeu45yvFzAcOfy01vsngx a79Ux91Hj0wnks/RgAlHKB0Ih6SjreFfZ+9jcv4PC+OaYSOD0AsfCxjr0A21Wrkjpre8 Jr0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p1si1978585ejw.42.2020.12.16.20.22.01; Wed, 16 Dec 2020 20:22:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726575AbgLQEUb (ORCPT + 99 others); Wed, 16 Dec 2020 23:20:31 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9221 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbgLQEUb (ORCPT ); Wed, 16 Dec 2020 23:20:31 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CxJf46wsZzkr0L; Thu, 17 Dec 2020 12:18:52 +0800 (CST) Received: from [10.174.187.231] (10.174.187.231) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Thu, 17 Dec 2020 12:19:35 +0800 Subject: Re: [RFC PATCH v1 3/4] KVM: arm64: GICv4.1: Restore VLPI's pending state to physical side To: Auger Eric , Marc Zyngier CC: James Morse , Julien Thierry , Suzuki K Poulose , , , , , Christoffer Dall , Alex Williamson , Kirti Wankhede , Cornelia Huck , "Neo Jia" , , References: <20201123065410.1915-1-lushenming@huawei.com> <20201123065410.1915-4-lushenming@huawei.com> <5c724bb83730cdd5dcf7add9a812fa92@kernel.org> <2d2bcae4f871d239a1af50362f5c11a4@kernel.org> <49610291-cf57-ff78-d0ac-063af24efbb4@huawei.com> <48c10467-30f3-9b5c-bbcb-533a51516dc5@huawei.com> <2ad38077300bdcaedd2e3b073cd36743@kernel.org> <9b80d460-e149-20c8-e9b3-e695310b4ed1@huawei.com> <274dafb2e21f49326a64bb575e668793@kernel.org> <59ec07e5-c017-8644-b96f-e87fe600c490@huawei.com> From: Shenming Lu Message-ID: <5732e2a2-7b78-dcbe-bd7d-77541c7bcf16@huawei.com> Date: Thu, 17 Dec 2020 12:19:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.187.231] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/12/16 18:35, Auger Eric wrote: > Hi Shenming, > > On 12/1/20 1:15 PM, Shenming Lu wrote: >> On 2020/12/1 19:50, Marc Zyngier wrote: >>> On 2020-12-01 11:40, Shenming Lu wrote: >>>> On 2020/12/1 18:55, Marc Zyngier wrote: >>>>> On 2020-11-30 07:23, Shenming Lu wrote: >>>>> >>>>> Hi Shenming, >>>>> >>>>>> We are pondering over this problem these days, but still don't get a >>>>>> good solution... >>>>>> Could you give us some advice on this? >>>>>> >>>>>> Or could we move the restoring of the pending states (include the sync >>>>>> from guest RAM and the transfer to HW) to the GIC VM state change handler, >>>>>> which is completely corresponding to save_pending_tables (more symmetric?) >>>>>> and don't expose GICv4... >>>>> >>>>> What is "the GIC VM state change handler"? Is that a QEMU thing? >>>> >>>> Yeah, it is a a QEMU thing... >>>> >>>>> We don't really have that concept in KVM, so I'd appreciate if you could >>>>> be a bit more explicit on this. >>>> >>>> My thought is to add a new interface (to QEMU) for the restoring of >>>> the pending states, which is completely corresponding to >>>> KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES... >>>> And it is called from the GIC VM state change handler in QEMU, which >>>> is happening after the restoring (call kvm_vgic_v4_set_forwarding()) >>>> but before the starting (running) of the VFIO device. >>> >>> Right, that makes sense. I still wonder how much the GIC save/restore >>> stuff differs from other architectures that implement similar features, >>> such as x86 with VT-D. >> >> I am not familiar with it... >> >>> >>> It is obviously too late to change the userspace interface, but I wonder >>> whether we missed something at the time. >> >> The interface seems to be really asymmetrical?... > > in qemu d5aa0c229a ("hw/intc/arm_gicv3_kvm: Implement pending table > save") commit message, it is traced: > > "There is no explicit restore as the tables are implicitly sync'ed > on ITS table restore and on LPI enable at redistributor level." > > At that time there was no real justification behind adding the RESTORE > fellow attr. > > Maybe a stupid question but isn't it possible to unset the forwarding > when saving and rely on VFIO to automatically restore it when resuming > on destination? It seems that the unset_forwarding would not be called when saving, it would be called after migration completion... As for the resuming/set_forwarding, I still wonder: is it really improper to transfer the pending states from vgic to VPT in set_forwarding (not only in migration)?... -_- Thanks, Shenming > > Thanks > > Eric > > >> >> Or is there a possibility that we could know which irq is hw before the VFIO >> device calls kvm_vgic_v4_set_forwarding()? >> >> Thanks, >> Shenming >> >>> >>> Thanks, >>> >>>         M. >> > > . >