From: Christoffer Dall <cdall@linaro.org>
To: Auger Eric <eric.auger@redhat.com>
Cc: marc.zyngier@arm.com, kvmarm@lists.cs.columbia.edu,
wu.wubin@huawei.com, andre.przywara@arm.com
Subject: Re: [RFC PATCH 2/3] kvm: arm/arm64: vgic-vits: free its resource when vm reboot/reset
Date: Wed, 13 Sep 2017 22:34:06 -0700 [thread overview]
Message-ID: <20170914053406.GN1631@lvm> (raw)
In-Reply-To: <cfab5e9e-c60b-9f41-988a-e3b31d8edcd3@redhat.com>
On Wed, Sep 13, 2017 at 11:13:55PM +0200, Auger Eric wrote:
> Hi Christoffer,
>
> On 13/09/2017 21:34, Christoffer Dall wrote:
> > Hi Wanghaibin,
> >
> > On Wed, Sep 06, 2017 at 09:05:09PM +0800, wanghaibin wrote:
> >> This patch fix the migrate save tables failure.
> >>
> >> When the virtual machine is in booting and the devices haven't initialized,
> >> the all virtual dte/ite may be invalid. If migrate at this moment, the save
> >> tables interface traversal device list, and check the dte is valid or not.
> >> if not, it will return the -EINVAL.
> >>
> >> This patch try to free the its list resource when vm reboot or reset to avoid this.
> >
> > I think the problem should be described the following way (feel free to
> > use this in a commit message).
> >
> > When rebooting a VM, we currently don't have a way to reset the ITS.
> > This results in the booting a VM with a pre-programmed ITS with existing
> > cached state. This can lead to all sorts of interesting problems.
> >
> > One such problem is that if trying to migrate the VM after rebooting the
> > VM, we try to traverse the device tables in guest memory. When using
> > indirect tables, and the guest has re-initialized the ITS device table
> > base register pointing to cleared memory, this results in trying to
> > access address 0 in the guest physical address space, which in turn
> > causes the ITS saving code to return an error to user space.
> >
> > The correct fix is to introduce a reset function as a device attribute
> > for the ITS.
> ... or reset the list when the userspace writes GITS_BASERn with a valid
> bit set to 0.
But I can't tell if that in any way matches something mandated by the
architecture. Would the ITS invalidate its caches because
BASERn is written with valid==0 ?
To me, it feels like the BASERn trick is trying to guess that we have
done a reset and we should probably do something, where what we really
want is the system (userspace) to tell us when to reset to a clean
state.
>
> For GICv3 we don't have a specific IOCTL for reset. In QEMU there is a
> reset callback called whenever the guest is rebooted or reset and in the
> GICv3 callback we perform user space write access for all the relevant
> registers. I missed that when doing the ITS QEMU integration.
Oh, we let userspace drive reset of the redistributors via setting the
mmio registers currently. I sort of think we should perhaps provide a
separate attribute for reset as well, but if what we have currently
works, why not.
>
> Shall we use the same trick as for GICv3 or add another KVM device
> group/attribute?
I think we need a separate attribute, because I don't see that the
architecture provides a meaningful way to reset the internal ITS state
simply by writing some registers, so we would have to come up with
something specific for the user space mmio accessors anyway, and we
might as well expose a virtual reset pin to userspace.
Thanks,
-Christoffer
next prev parent reply other threads:[~2017-09-14 5:31 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 13:05 [RFC PATCH 0/3] fix migrate failed when vm is in booting wanghaibin
2017-09-06 13:05 ` [RFC PATCH 1/3] kvm: arm/arm64: vgic-vits: separate vgic_its_free_list() function wanghaibin
2017-09-12 8:50 ` wanghaibin
2017-09-12 10:08 ` Auger Eric
2017-09-13 19:13 ` Christoffer Dall
2017-09-13 19:14 ` Christoffer Dall
2017-09-16 1:59 ` wanghaibin
2017-09-16 22:17 ` Christoffer Dall
2017-09-06 13:05 ` [RFC PATCH 2/3] kvm: arm/arm64: vgic-vits: free its resource when vm reboot/reset wanghaibin
2017-09-06 16:20 ` Auger Eric
2017-09-07 1:32 ` wanghaibin
2017-09-07 11:28 ` Auger Eric
2017-09-10 18:46 ` Auger Eric
2017-09-12 11:15 ` wanghaibin
2017-09-13 8:49 ` Auger Eric
2017-09-13 19:34 ` Christoffer Dall
2017-09-13 21:13 ` Auger Eric
2017-09-14 5:34 ` Christoffer Dall [this message]
2017-09-06 13:05 ` [RFC PATCH 3/3] kvm: arm/arm64: vgic-its: fix return value for restore wanghaibin
2017-09-06 15:18 ` Auger Eric
2017-09-13 20:02 ` Christoffer Dall
2017-09-13 21:25 ` Auger Eric
2017-09-14 5:35 ` Christoffer Dall
2017-09-13 20:04 ` Christoffer Dall
2017-09-14 8:30 ` Auger Eric
2017-09-16 2:02 ` wanghaibin
2017-09-20 1:57 ` [RFC PATCH 0/3] fix migrate failed when vm is in booting wanghaibin
2017-09-20 7:16 ` Auger Eric
2017-09-21 12:17 ` wanghaibin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170914053406.GN1631@lvm \
--to=cdall@linaro.org \
--cc=andre.przywara@arm.com \
--cc=eric.auger@redhat.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=marc.zyngier@arm.com \
--cc=wu.wubin@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox