From: Cornelia Huck <cohuck@redhat.com>
To: David Hildenbrand <david@redhat.com>
Cc: borntraeger@de.ibm.com, Collin Walling <walling@linux.ibm.com>,
rth@twiddle.net, qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v6 2/2] s390: diagnose 318 info reset and migration support
Date: Mon, 27 Jan 2020 18:29:42 +0100 [thread overview]
Message-ID: <20200127182942.4071f54f.cohuck@redhat.com> (raw)
In-Reply-To: <899b67fb-a337-c30d-e250-42399276fe38@redhat.com>
On Mon, 27 Jan 2020 18:09:11 +0100
David Hildenbrand <david@redhat.com> wrote:
> >>> +static void s390_diag318_reset(DeviceState *dev)
> >>> +{
> >>> + if (kvm_enabled())
> >>> + kvm_s390_set_diag318_info(0);
> >>> +}
> >>> +
> >>> +static void s390_diag318_class_init(ObjectClass *klass, void *data)
> >>> +{
> >>> + DeviceClass *dc = DEVICE_CLASS(klass);
> >>> +
> >>> + dc->reset = s390_diag318_reset;
> >>> + dc->vmsd = &vmstate_diag318;
> >>> + dc->hotpluggable = false;
> >>> + /* Reason: Created automatically during machine instantiation */
> >>> + dc->user_creatable = false;
> >>> +}
> >>> +
> >>> +static const TypeInfo s390_diag318_info = {
> >>> + .class_init = s390_diag318_class_init,
> >>> + .parent = TYPE_DEVICE,
> >>> + .name = TYPE_S390_DIAG318,
> >>> + .instance_size = sizeof(DIAG318State),
> >>> +};
> >>> +
> >>> +static void s390_diag318_register_types(void)
> >>> +{
> >>> + type_register_static(&s390_diag318_info);
> >>> +}
> >>
> >> Do we really need a new device? Can't we simply glue that extended state
> >> to the machine state?
> >>
> >> -> target/s390x/machine.c
> >>
> >
> > Those VM States relate to the CPU state... does it make sense to store the
> > diag318 info in a CPU state? (It doesn't seem necessary to store / migrate
> > this info for each CPU).
>
> I'm sorry, I was looking at the wrong file ...
>
> >
> > Should we store this in the S390CcwMachineState? Or perhaps create a generic
> > S390MachineState for information that needs to be stored once and migrated
> > once?
>
> ... I actually thought we have something like this already. Personally,
> I think that would make sense. At least spapr seems to have something
> like this already (hw/ppc/spapr.c:spapr_machine_init().
>
> @Conny?
What are you referring to? I only see the one with the FIXME in front
of it...
>
> [...]
> >
> > How about we introduce a union in the ReadInfo struct. Something like:
> >
> > union {
> > uint8_t byte_134;
> > struct CPUEntry entries[0];
> > } x;
>
> Or drop the "entries" pointer completely and introduce
>
> static int cpu_entries_offset(void)
> {
> /*
> * When we have to indicate features in byte 134, we have to move
> * the start of the cpu entries.
> */
> if (s390_has_feat(S390_FEAT_DIAG318)) {
> return 144;
> }
> return 128;
> }
>
> struct CPUEntry *cpu_entries(ReadInfo *ri)
> {
> return (struct CPUEntry *)((void *)ri + cpu_entries_offset());
> }
>
> unsigned int cpu_entries)count(ReadInfo *ri)
> {
> return (SCCB_SIZE - cpu_entries_offset()) / sizeof(CPUEntry);
> }
>
> etc. (might take some tweaking to make it compile) and a comment for the
> struct. Not sure what's better. Having two struct CPUEntry entries[0] is
> also confusing.
I think that version may end up looking better.
next prev parent reply other threads:[~2020-01-27 17:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-24 22:14 [PATCH v6 0/2] Use DIAG318 to set Control Program Name & Version Codes Collin Walling
2020-01-24 22:14 ` [PATCH v6 1/2] s390/kvm: header sync for diag318 Collin Walling
2020-01-24 22:14 ` [PATCH v6 2/2] s390: diagnose 318 info reset and migration support Collin Walling
2020-01-27 11:20 ` David Hildenbrand
2020-01-27 15:57 ` Collin Walling
2020-01-27 17:09 ` David Hildenbrand
2020-01-27 17:29 ` Cornelia Huck [this message]
2020-01-27 17:55 ` David Hildenbrand
2020-01-27 18:21 ` Collin Walling
2020-01-27 18:52 ` Collin Walling
2020-01-28 11:19 ` Cornelia Huck
2020-01-27 11:36 ` Thomas Huth
2020-01-27 15:58 ` Collin Walling
2020-01-27 11:47 ` Cornelia Huck
2020-01-27 16:39 ` Collin Walling
2020-01-27 17:35 ` Cornelia Huck
2020-01-27 23:05 ` Collin Walling
2020-01-28 11:24 ` Cornelia Huck
2020-01-28 14:38 ` Collin Walling
2020-01-28 14:37 ` Collin Walling
2020-01-28 15:08 ` Cornelia Huck
2020-01-24 22:22 ` [PATCH v6 0/2] Use DIAG318 to set Control Program Name & Version Codes no-reply
2020-03-17 21:34 ` Collin Walling
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=20200127182942.4071f54f.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=walling@linux.ibm.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).