All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Shkolnyy <kshk@linux.ibm.com>
To: Farhan Ali <alifm@linux.ibm.com>, mjrosato@linux.ibm.com
Cc: farman@linux.ibm.com, richard.henderson@linaro.org,
	iii@linux.ibm.com, david@kernel.org, cohuck@redhat.com,
	pasic@linux.ibm.com, borntraeger@linux.ibm.com,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v11 15/16] s390x/pci: Implement migration for emulated devices
Date: Mon, 5 Oct 2026 17:31:26 -0500	[thread overview]
Message-ID: <356bb71f-30a3-4bfd-b559-069dc377f415@linux.ibm.com> (raw)
In-Reply-To: <16c455c2-6f42-4041-9580-eb7292647759@linux.ibm.com>

On 261005 17:20, Farhan Ali wrote:
> <..snip..>
> 
> On 9/30/2026 7:52 AM, Konstantin Shkolnyy wrote:
>> +/*
>> + * When pending_sei load is executed, pending_sei can already contain 
>> SEIs
>> + * generated here in the target QEMU, for example, by state loads of 
>> zpci
>> + * devices. A dumb load here would place the older SEIs from the 
>> source QEMU
>> + * after the new SEIs. To fix this, we have pre_load() stash the new 
>> SEIs from
>> + * pending_sei and post_load() unstash them after the old ones.
>> + */
>> +static void s390_pci_move_sei_list(SeiContainerList *dst, 
>> SeiContainerList *src)
>> +{
>> +    SeiContainer *sei_cont;
>> +
>> +    while ((sei_cont = QTAILQ_FIRST(src))) {
>> +        QTAILQ_REMOVE(src, sei_cont, link);
>> +        QTAILQ_INSERT_TAIL(dst, sei_cont, link);
>> +    }
>> +}
>> +
>> +static int s390_pcihost_pending_sei_vmstate_pre_load(void *opaque)
>> +{
>> +    S390pciState *s = S390_PCI_HOST_BRIDGE(opaque);
>> +
>> +    QTAILQ_INIT(&s->pending_sei_stash);
>> +    s390_pci_move_sei_list(&s->pending_sei_stash, &s->pending_sei);
>> +    return 0;
>> +}
> 
> Does this mean we can append SEIs to the list while we are still 
> migrating? In that case do we need any form of synchronization here when 
> accessing the pending_sei list?

SEIs can be generated the migration process itself - by 
s390_pci_ioat_replay() called from s390_pci_device_post_load_errp().
That happens before the migration process comes here to load 
s390_pcihost state (with old SEIs).

Since the migration process is single-threaded I don't think we need to 
synchronize between its stages.

> 
> Thanks
> 
> Farhan
> 
>> +
>> +static int s390_pcihost_pending_sei_vmstate_post_load(void *opaque,
>> +                                                      int version_id)
>> +{
>> +    S390pciState *s = S390_PCI_HOST_BRIDGE(opaque);
>> +
>> +    s390_pci_move_sei_list(&s->pending_sei, &s->pending_sei_stash);
>> +    return 0;
>> +}
>> +
>> +static const VMStateDescription s390_pcihost_pending_sei_vmstate = {
>> +    .name = TYPE_S390_PCI_HOST_BRIDGE "/pending-sei",
>> +    .version_id = 1,
>> +    .minimum_version_id = 1,
>> +    .needed = s390_pcihost_pending_sei_vmstate_needed,
>> +    .pre_load = s390_pcihost_pending_sei_vmstate_pre_load,
>> +    .post_load = s390_pcihost_pending_sei_vmstate_post_load,
>> +    .fields = (const VMStateField[]) {
>> +        VMSTATE_QTAILQ_V(pending_sei, S390pciState, 1,
>> +                         vmstate_sei_container, SeiContainer, link),
>> +        VMSTATE_END_OF_LIST()
>> +    }
>> +};
>> +



  reply	other threads:[~2026-10-05 22:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 14:52 [PATCH v11 00/16] s390x/pci: Implement migration for emulated devices Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 01/16] s390x/pci: implement IOMMU replay Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 02/16] s390x/pci: Create function to contain translation status check Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 03/16] s390x/pci: Move iommu_mr from S390PCIIOMMU to S390PCIBusDevice Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 04/16] s390x/pci: Move dm_mr " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 05/16] s390x/pci: Move iotlb " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 06/16] s390x/pci: Remove a ptr to S390PCIBusDevice from S390PCIIOMMU Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 07/16] s390x/pci: Move/rename enabled from S390PCIIOMMU to S390PCIBusDevice Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 08/16] s390x/pci: Move dma_limit " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 09/16] s390x/pci: Move g_iota " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 10/16] s390x/pci: Move pba " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 11/16] s390x/pci: Move pal " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 12/16] s390x/pci: Move max_dma_limit " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 13/16] s390x/pci: Add a comment explaining S390PCIIOMMU purpose Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 14/16] s390x/pci: Factor ioat sanity checks into a separate function Konstantin Shkolnyy
2026-10-02 18:28   ` Matthew Rosato
2026-10-03  0:43     ` Konstantin Shkolnyy
2026-10-05 13:23       ` Konstantin Shkolnyy
2026-10-05 13:46         ` Matthew Rosato
2026-10-05 16:20           ` Konstantin Shkolnyy
2026-10-05 13:30       ` Matthew Rosato
2026-09-30 14:52 ` [PATCH v11 15/16] s390x/pci: Implement migration for emulated devices Konstantin Shkolnyy
2026-10-05 19:39   ` Matthew Rosato
2026-10-05 22:20   ` Farhan Ali
2026-10-05 22:31     ` Konstantin Shkolnyy [this message]
2026-09-30 14:52 ` [PATCH v11 16/16] 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=356bb71f-30a3-4bfd-b559-069dc377f415@linux.ibm.com \
    --to=kshk@linux.ibm.com \
    --cc=alifm@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@kernel.org \
    --cc=farman@linux.ibm.com \
    --cc=iii@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 \
    /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.