qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Nico Boehr <nrb@linux.ibm.com>
Cc: "Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Nina Schoetterl-Glausch" <nsg@linux.ibm.com>,
	qemu-devel@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
	qemu-s390x@nongnu.org,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"David Hildenbrand" <david@redhat.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Michael Mueller" <mimu@linux.ibm.com>
Subject: Re: [PATCH for-9.2 00/10] s390: Convert virtio-ccw, cpu to three-phase reset, and followup cleanup
Date: Fri, 30 Aug 2024 13:04:54 +0100	[thread overview]
Message-ID: <CAFEAcA-FG0V0=MNf6sszGW-_Z8PdNv5DWZbLyiF3CCyTt8NUxQ@mail.gmail.com> (raw)
In-Reply-To: <172501900133.6066.3071687086903215470@t14-nrb.local>

On Fri, 30 Aug 2024 at 12:56, Nico Boehr <nrb@linux.ibm.com> wrote:
>
> Quoting Peter Maydell (2024-08-30 12:01:47)
> > I ran overnight with none of the patchset applied, and it never
> > failed (as expected). Running with just the first virtio-ccw
> > patch does fall over fairly quickly. So something's up with
> > that patch, which is curious because that's the one I thought
> > was a straightforward conversion without any complications :-)
> >
> > I'll investigate further today, I have the beginnings of a
> > theory about what might be happening...
>
> Thanks for taking the time, Peter! Let me know when you have insights.

I think I've found the problem, I'm just testing it to see if it
does properly fix the intermittent. The issue is that before we
can convert a class to three-phase reset we need to have
already converted all its parent classes. TYPE_VIRTIO_CCW_DEVICE
is a subclass of TYPE_CCW_DEVICE, but I forgot to convert
TYPE_CCW_DEVICE to three-phase reset. The result is that the
reset in the parent class was not happening at all (presumably
leaving the TYPE_CCW_DEVICE in an invalid/unexpected state on
reboot). The fix is to add an extra patch at the start of the
series. Once I've tested this I'll send out a v2 of the series,
maybe also adding the cleanup RTH suggested in one of the later
patches. (Ironically, if we do that cleanup then the bug would
also go away, because old-style DeviceClass:reset methods will
get called in exactly the same way as if they were registered
as phases.hold methods, rather than being specially handled...)


commit ff9bc4c8910f636f20e9b6e91d63dd003408ce10
Author: Peter Maydell <peter.maydell@linaro.org>
Date:   Fri Aug 30 12:50:03 2024 +0100

    hw/s390/ccw-device: Convert to three-phase reset

    Convert the TYPE_CCW_DEVICE to three-phase reset. This is a
    device class which is subclassed, so it needs to be three-phase
    before we can convert the subclass.

    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c
index a7d682e5af9..14c24e38904 100644
--- a/hw/s390x/ccw-device.c
+++ b/hw/s390x/ccw-device.c
@@ -44,9 +44,9 @@ static Property ccw_device_properties[] = {
     DEFINE_PROP_END_OF_LIST(),
 };

-static void ccw_device_reset(DeviceState *d)
+static void ccw_device_reset_hold(Object *obj, ResetType type)
 {
-    CcwDevice *ccw_dev = CCW_DEVICE(d);
+    CcwDevice *ccw_dev = CCW_DEVICE(obj);

     css_reset_sch(ccw_dev->sch);
 }
@@ -55,11 +55,12 @@ static void ccw_device_class_init(ObjectClass
*klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     CCWDeviceClass *k = CCW_DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);

     k->realize = ccw_device_realize;
     k->refill_ids = ccw_device_refill_ids;
     device_class_set_props(dc, ccw_device_properties);
-    dc->reset = ccw_device_reset;
+    rc->phases.hold = ccw_device_reset_hold;
     dc->bus_type = TYPE_VIRTUAL_CSS_BUS;
 }

-- PMM


  reply	other threads:[~2024-08-30 12:06 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13 16:52 [PATCH for-9.2 00/10] s390: Convert virtio-ccw, cpu to three-phase reset, and followup cleanup Peter Maydell
2024-08-13 16:52 ` [PATCH for-9.2 01/10] hw/s390/virtio-ccw: Convert to three-phase reset Peter Maydell
2024-08-13 22:07   ` Richard Henderson
2024-08-14 10:43   ` Thomas Huth
2024-08-23 17:34   ` Nina Schoetterl-Glausch
2024-08-26 16:02   ` Philippe Mathieu-Daudé
2024-08-26 17:11     ` Peter Maydell
2024-08-13 16:52 ` [PATCH for-9.2 02/10] target/s390: Convert CPU to Resettable interface Peter Maydell
2024-08-13 23:03   ` Richard Henderson
2024-08-14 10:56     ` Thomas Huth
2024-08-23 17:44   ` Nina Schoetterl-Glausch
2024-08-23 20:32     ` Peter Maydell
2024-08-13 16:52 ` [PATCH for-9.2 03/10] hw: Remove device_class_set_parent_reset() Peter Maydell
2024-08-13 23:06   ` Richard Henderson
2024-08-26 16:03   ` Philippe Mathieu-Daudé
2024-08-13 16:52 ` [PATCH for-9.2 04/10] target/alpha, hppa: Remove unused parent_reset fields Peter Maydell
2024-08-13 23:08   ` Richard Henderson
2024-08-13 16:52 ` [PATCH for-9.2 05/10] hw/dma/xilinx_axidma: Use semicolon at end of statement, not comma Peter Maydell
2024-08-13 23:08   ` Richard Henderson
2024-08-14 10:55   ` Thomas Huth
2024-08-13 16:52 ` [PATCH for-9.2 06/10] hw/remote/message.c: Don't directly invoke DeviceClass:reset Peter Maydell
2024-08-13 23:10   ` Richard Henderson
2024-08-14 13:48   ` Philippe Mathieu-Daudé
2024-08-13 16:52 ` [PATCH for-9.2 07/10] hw: Define new device_class_set_legacy_reset() Peter Maydell
2024-08-13 23:12   ` Richard Henderson
2024-08-26 16:06   ` Philippe Mathieu-Daudé
2024-08-13 16:52 ` [PATCH for-9.2 08/10] hw: Use device_class_set_legacy_reset() instead of opencoding Peter Maydell
2024-08-13 23:14   ` Richard Henderson
2024-08-13 16:52 ` [PATCH for-9.2 09/10] hw: Rename DeviceClass::reset field to legacy_reset Peter Maydell
2024-08-13 23:15   ` Richard Henderson
2024-08-26 16:07   ` Philippe Mathieu-Daudé
2024-08-13 16:52 ` [PATCH for-9.2 10/10] hw: Remove device_phases_reset() Peter Maydell
2024-08-14  0:53   ` Richard Henderson
2024-08-14 13:20     ` Peter Maydell
2024-08-14 14:22 ` [PATCH for-9.2 00/10] s390: Convert virtio-ccw, cpu to three-phase reset, and followup cleanup Christian Borntraeger
2024-08-14 20:06   ` Peter Maydell
2024-08-22 10:34     ` Nina Schoetterl-Glausch
2024-08-26 12:08       ` Nico Boehr
2024-08-28  8:13         ` Nico Boehr
2024-08-28 15:46           ` Peter Maydell
2024-08-29 12:19             ` Nico Boehr
2024-08-29 13:09               ` Peter Maydell
2024-08-29 13:20                 ` Cédric Le Goater
2024-08-29 13:26                 ` Nico Boehr
2024-08-29 13:35                   ` Peter Maydell
2024-08-29 14:44                     ` Nico Boehr
2024-08-29 15:08                       ` Peter Maydell
2024-08-29 15:53           ` Peter Maydell
2024-08-30  5:48             ` Nico Boehr
2024-08-30 10:01               ` Peter Maydell
2024-08-30 11:56                 ` Nico Boehr
2024-08-30 12:04                   ` Peter Maydell [this message]
2024-08-30 12:17                     ` Peter Maydell
2024-08-30 12:21                       ` Thomas Huth

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='CAFEAcA-FG0V0=MNf6sszGW-_Z8PdNv5DWZbLyiF3CCyTt8NUxQ@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=mimu@linux.ibm.com \
    --cc=nrb@linux.ibm.com \
    --cc=nsg@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=philmd@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).