All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Matthew Rosato <mjrosato@linux.ibm.com>,
	Thomas Huth <thuth@redhat.com>,
	Konstantin Shkolnyy <kshk@linux.ibm.com>
Cc: alifm@linux.ibm.com, richard.henderson@linaro.org,
	iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com,
	borntraeger@linux.ibm.com, qemu-s390x@nongnu.org,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 14/15] s390x/pci: Implement migration for emulated devices
Date: Wed, 08 Apr 2026 14:41:35 +0200	[thread overview]
Message-ID: <87eckpd3pc.fsf@redhat.com> (raw)
In-Reply-To: <e4e1ea36-29c7-47df-86d1-d108106a006a@linux.ibm.com>

On Wed, Apr 08 2026, Matthew Rosato <mjrosato@linux.ibm.com> wrote:

> On 4/8/26 6:01 AM, Thomas Huth wrote:
>> On 02/04/2026 04.29, Konstantin Shkolnyy wrote:
>>> Implement zPCI device state migration, consequently enabling migration
>>> of VMs that have emulated PCI devices, whether virtio or not.
>>> Migration is allowed for devices whose function handle has the
>>> FH_SHM_EMUL bit set. For these devices QEMU will save and restore the
>>> state of its zPCI emulator.
>>>
>>> Passthrough devices will continue to block migration.
>>>
>>> Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
>>> ---
>>>   hw/s390x/s390-pci-bus.c         | 112 ++++++++++++++++++++++++++++++--
>>>   hw/s390x/s390-pci-inst.c        |   2 +-
>>>   include/hw/s390x/s390-pci-bus.h |   2 +
>>>   3 files changed, 110 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
>>> index f339a0fd94..b3037b9a8a 100644
>>> --- a/hw/s390x/s390-pci-bus.c
>>> +++ b/hw/s390x/s390-pci-bus.c
>>> ...
>>> +static const VMStateDescription s390_pci_device_vmstate = {
>>> +    .name = TYPE_S390_PCI_DEVICE,
>>> +    .version_id = 1,
>>> +    .minimum_version_id = 1,
>>> +    .post_load = s390_pci_device_post_load,
>>> +    .fields = (const VMStateField[]) {
>>> +        VMSTATE_UINT32(state, S390PCIBusDevice),
>>> +        VMSTATE_UINT16(uid, S390PCIBusDevice),
>>> +        VMSTATE_UINT32(idx, S390PCIBusDevice),
>>> +        VMSTATE_UINT32(fh, S390PCIBusDevice),
>>> +        VMSTATE_UINT32(fid, S390PCIBusDevice),
>>> +        VMSTATE_BOOL(fid_defined, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(fmb_addr, S390PCIBusDevice),
>>> +        VMSTATE_UINT32(fmb.format, S390PCIBusDevice),
>>> +        VMSTATE_UINT32(fmb.sample, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(fmb.last_update, S390PCIBusDevice),
>>> +        VMSTATE_UINT64_ARRAY(fmb.counter, S390PCIBusDevice,
>>> +                ARRAY_SIZE(((S390PCIBusDevice *)0)->fmb.counter)),
>>> +        VMSTATE_UINT64(fmb.fmt0.dma_rbytes, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(fmb.fmt0.dma_wbytes, S390PCIBusDevice),
>>> +        VMSTATE_UINT8(isc, S390PCIBusDevice),
>>> +        VMSTATE_UINT16(noi, S390PCIBusDevice),
>>> +        VMSTATE_UINT8(sum, S390PCIBusDevice),
>>> +        VMSTATE_UINT8(pft, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(routes.adapter.ind_addr, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(routes.adapter.summary_addr, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(routes.adapter.ind_offset, S390PCIBusDevice),
>>> +        VMSTATE_UINT32(routes.adapter.summary_offset, S390PCIBusDevice),
>>> +        VMSTATE_UINT32(routes.adapter.adapter_id, S390PCIBusDevice),
>>> +        VMSTATE_BOOL(iommu_enabled, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(g_iota, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(pba, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(pal, S390PCIBusDevice),
>>> +        VMSTATE_UINT64(max_dma_limit, S390PCIBusDevice),
>>> +        VMSTATE_PTR_TO_IND_ADDR(summary_ind, S390PCIBusDevice),
>>> +        VMSTATE_PTR_TO_IND_ADDR(indicator, S390PCIBusDevice),
>>> +        VMSTATE_BOOL(pci_unplug_request_processed, S390PCIBusDevice),
>>> +        VMSTATE_BOOL(unplug_requested, S390PCIBusDevice),
>>> +        VMSTATE_BOOL(interp, S390PCIBusDevice),
>>> +        VMSTATE_BOOL(forwarding_assist, S390PCIBusDevice),
>>> +        VMSTATE_BOOL(aif, S390PCIBusDevice),
>>> +        VMSTATE_BOOL(rtr_avail, S390PCIBusDevice),
>>> +        VMSTATE_END_OF_LIST()
>>> +    }
>>>   };
>>  Hi!
>> 
>> I assume this will likely break backward migration with old machine types?
>> 
>> Could you please try whether migrating a s390-ccw-virtio-10.2 machine
>> from an old version of QEMU to a version of QEMU that includes your
>> patches, and back from the new version to the old version works as
>> expected?
>> 
>> If not, you might need to add a ".needed = ..." line to the
>> s390_pci_device_vmstate, with a function that checks a variable from the
>> machine state whether the PCI state is allowed or not. And then enable
>> that variable only on the newest -11.1 machine type once it is available.
>
> +1, I was having the same thought but hadn't gotten around to trying it yet.
>
> We do already have a few examples for zPCI where we did this even though
> migration was not even supported yet to kind of lay the groundwork for
> backward migration ahead of time.
>
> But honestly, looking at just this series in isolation, my concern is
> things like an older machine type would not have the IOMMU replay
> functionality added in patch 1.
>
> So yes, please test to see what happens but make sure to include IOMMU
> activity in that testing.
>
> Tying this to a machine type is probably the safest bet, and given that
> virtio-pci is not the default virtio transport on s390x I don't think it
> would cause much hardship.
> 11.1 machine isn't available yet but I imagine will be soon after QEMU
> 11.0 release -- you can use Connie's series as a base:
> https://lore.kernel.org/qemu-devel/20260331140347.653404-1-cohuck@redhat.com/

I agree, that needs to be tied to the machine type.

I'll pick up the 11.1 machine types patch as soon as I prepare the first
s390 pull req for 11.1, so there should be a good base around soon.



  reply	other threads:[~2026-04-08 19:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02  2:29 [PATCH 00/15] s390x/pci: Implement migration for emulated devices Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 01/15] s390x/pci: implement IOMMU replay Konstantin Shkolnyy
2026-04-08 12:43   ` Cornelia Huck
2026-04-02  2:29 ` [PATCH 02/15] s390x/pci: Create function to contain translation status check Konstantin Shkolnyy
2026-04-02 12:03   ` Christian Borntraeger
2026-04-02  2:29 ` [PATCH 03/15] s390x/pci: Move iommu_mr from S390PCIIOMMU to S390PCIBusDevice Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 04/15] s390x/pci: Move dm_mr " Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 05/15] s390x/pci: Move iotlb " Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 06/15] s390x/pci: Remove a ptr to S390PCIBusDevice from S390PCIIOMMU Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 07/15] s390x/pci: Move/rename enabled from S390PCIIOMMU to S390PCIBusDevice Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 08/15] s390x/pci: Move dma_limit " Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 09/15] s390x/pci: Move g_iota " Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 10/15] s390x/pci: Move pba " Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 11/15] s390x/pci: Move pal " Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 12/15] s390x/pci: Move max_dma_limit " Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 13/15] s390x/pci: Add a comment explaining S390PCIIOMMU purpose Konstantin Shkolnyy
2026-04-02  2:29 ` [PATCH 14/15] s390x/pci: Implement migration for emulated devices Konstantin Shkolnyy
2026-04-08 10:01   ` Thomas Huth
2026-04-08 12:28     ` Matthew Rosato
2026-04-08 12:41       ` Cornelia Huck [this message]
2026-04-02  2:29 ` [PATCH 15/15] s390x/pci: Create function to contain fmb_timer start Konstantin Shkolnyy

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=87eckpd3pc.fsf@redhat.com \
    --to=cohuck@redhat.com \
    --cc=alifm@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=iii@linux.ibm.com \
    --cc=kshk@linux.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.