From: mdroth <mdroth@linux.vnet.ibm.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: blauwirbel@gmail.com, pingfank@linux.vnet.ibm.com,
gleb@redhat.com, stefanha@gmail.com, jbaron@redhat.com,
seabios@seabios.org, qemu-devel@nongnu.org,
Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>,
kevin@koconnor.net, kraxel@redhat.com,
Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [RFC PATCH v4 06/30] qapi: make visit_type_size fallback to type_int
Date: Wed, 9 Jan 2013 10:00:25 -0600 [thread overview]
Message-ID: <20130109160025.GB1543@vm> (raw)
In-Reply-To: <50ECB73C.9090605@suse.de>
On Wed, Jan 09, 2013 at 01:18:04AM +0100, Andreas Färber wrote:
> Am 18.12.2012 13:41, schrieb Vasilis Liaskovitis:
> > Currently visit_type_size checks if the visitor's type_size function pointer is
> > NULL. If not, it calls it, otherwise it calls v->type_uint64(). But neither of
> > these pointers are ever set. Fallback to calling v->type_int() in this third
> > (default) case.
> >
> > Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
>
> Is this patch still needed? I thought size -> int fallback was fixed
> differently for the deallocation visitor...
It was only fixed for the dealloc visitor since that was the only path
hit in 1.3. If we add a non-OptsVisitor user of visit_type_size() then
we'll trigger the bug this patch fixes.
I do have some comments on this patch though (below)
>
> Anyway, someone (Anthony?) recently suggested to drop the size visitor
> completely in favor of string type (cf. frequency visitor discussion).
Hmm, in terms of generalizing size/freq visitors without adding code for
theoretical use cases (which I think was the deadlock) it seems to serve
that purpose. And it does make sense to handle special suffixes at the
end-points (qemu options and option users) rather than bake them into the
visitor interfaces (which get too numerous if we add them on a
case-by-case, and unwieldly if we try to generalize too much)
Though for qapi-generated visitors (as opposed to the open-coded ones like
the freq visitor) it does have the downside of requiring us to deserialize
into a string field before parsing/using it later, so we add some
unecessary fields. But I don't think that's a major downside.
At least, I would consider implementing the frequency visitor as a
string visitor should we decide to leave visit_type_size() as is.
>
> Regards,
> Andreas
>
> > ---
> > qapi/qapi-visit-core.c | 11 ++++++++++-
> > 1 files changed, 10 insertions(+), 1 deletions(-)
> >
> > diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
> > index 7a82b63..497e693 100644
> > --- a/qapi/qapi-visit-core.c
> > +++ b/qapi/qapi-visit-core.c
> > @@ -236,8 +236,17 @@ void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp)
> >
> > void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp)
> > {
> > + int64_t value;
> > if (!error_is_set(errp)) {
> > - (v->type_size ? v->type_size : v->type_uint64)(v, obj, name, errp);
> > + if (v->type_size) {
> > + v->type_size(v, obj, name, errp);
> > + } else if (v->type_uint64) {
> > + v->type_uint64(v, obj, name, errp);
> > + } else {
> > + value = *obj;
> > + v->type_int(v, &value, name, errp);
> > + *obj = value;
> > + }
I'd recommend just doing:
if (v->type_size) {
v->type_size(v, obj, name, errp);
} else {
visit_type_uint64(v, obj, name, errp);
}
visit_type_uint64() already handles the fallback to visit_type_int() so no
need to duplicate.
> > }
> > }
> >
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
>
next prev parent reply other threads:[~2013-01-09 16:05 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 12:41 [Qemu-devel] [RFC PATCH v4 00/30] ACPI memory hotplug Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 01/30] [SeaBIOS] Add ACPI_EXTRACT_DEVICE* macros Vasilis Liaskovitis
2013-03-20 3:28 ` li guang
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 02/30] [SeaBIOS] Add SSDT memory device support Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 03/30] [SeaBIOS] acpi-dsdt: Implement functions for memory hotplug Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 04/30] [SeaBIOS] acpi: generate hotplug memory devices Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 05/30] [SeaBIOS] q35: Add memory hotplug handler Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 06/30] qapi: make visit_type_size fallback to type_int Vasilis Liaskovitis
2013-01-09 0:18 ` Andreas Färber
2013-01-09 16:00 ` mdroth [this message]
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 07/30] Add SIZE type to qdev properties Vasilis Liaskovitis
2013-03-20 6:06 ` li guang
2013-03-20 14:24 ` Eric Blake
2013-03-21 0:39 ` li guang
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 08/30] qemu-option: export parse_option_number Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 09/30] Implement dimm device abstraction Vasilis Liaskovitis
2013-03-26 3:51 ` li guang
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 10/30] vl: handle "-device dimm" Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 11/30] acpi_piix4 : Implement memory device hotplug registers Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 12/30] acpi_ich9 " Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 13/30] piix_pci and pc_piix: refactor Vasilis Liaskovitis
2013-01-16 7:20 ` Hu Tao
2013-01-16 9:36 ` Vasilis Liaskovitis
2013-01-16 11:17 ` Andreas Färber
2013-01-16 17:10 ` Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 14/30] piix_pci: Add i440fx dram controller initialization Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 15/30] q35: " Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 16/30] pc: Add dimm paravirt SRAT info Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 17/30] [SeaBIOS] pci: Use paravirt interface for pcimem_start and pcimem64_start Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 18/30] Introduce paravirt interface QEMU_CFG_PCI_WINDOW Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 19/30] Implement "info memory-total" and "query-memory-total" Vasilis Liaskovitis
2012-12-19 19:47 ` Blue Swirl
2013-01-04 16:21 ` Eric Blake
2013-01-10 17:42 ` Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 20/30] balloon: update with hotplugged memory Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 21/30] Implement dimm-info Vasilis Liaskovitis
2013-01-08 23:20 ` Eric Blake
2013-01-10 17:45 ` Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 22/30] [SeaBIOS] acpi: add _EJ0 operation and eject port for memory devices Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 23/30] dimm: add hot-remove capability Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 24/30] acpi_piix4: " Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 25/30] acpi_ich9: " Vasilis Liaskovitis
2012-12-19 19:48 ` Blue Swirl
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 26/30] Implement qmp and hmp commands for notification lists Vasilis Liaskovitis
2013-01-09 0:23 ` Eric Blake
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 27/30] [SeaBIOS] Add _OST dimm method Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 28/30] Add _OST dimm support Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 29/30] [SeaBIOS] Implement _PS3 method for memory device Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 30/30] Implement _PS3 for dimm Vasilis Liaskovitis
2012-12-18 16:45 ` [Qemu-devel] [RFC PATCH v4 00/30] ACPI memory hotplug Zhi Yong Wu
2012-12-19 11:40 ` Vasilis Liaskovitis
2012-12-19 7:27 ` Gerd Hoffmann
2012-12-19 11:35 ` Vasilis Liaskovitis
2012-12-19 13:56 ` Gerd Hoffmann
2013-01-10 18:57 ` Vasilis Liaskovitis
2013-03-19 6:30 ` li guang
2013-03-26 16:58 ` Vasilis Liaskovitis
2013-03-27 2:42 ` li guang
2013-04-02 9:15 ` liu ping fan
2013-01-09 0:08 ` Andreas Färber
2013-01-10 17:36 ` Vasilis Liaskovitis
2013-01-10 17:55 ` Andreas Färber
2013-03-20 6:18 ` li guang
2013-03-26 14:20 ` Eduardo Habkost
2013-03-27 7:39 ` li guang
[not found] ` <CAF+CadtnTcOnUt7jp1bARJgioxR5KzLG0QSQuDbiqhiKxiCqFA@mail.gmail.com>
[not found] ` <20130228101819.GA4370@dhcp-192-168-178-175.profitbricks.localdomain>
2013-03-19 7:28 ` li guang
2013-03-26 16:43 ` Vasilis Liaskovitis
2013-03-27 2:54 ` li guang
2013-03-28 9:29 ` Vasilis Liaskovitis
2013-03-28 9:49 ` liu ping fan
2013-03-26 14:47 ` Luiz Capitulino
2013-03-26 16:59 ` Vasilis Liaskovitis
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=20130109160025.GB1543@vm \
--to=mdroth@linux.vnet.ibm.com \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=blauwirbel@gmail.com \
--cc=gleb@redhat.com \
--cc=jbaron@redhat.com \
--cc=kevin@koconnor.net \
--cc=kraxel@redhat.com \
--cc=pingfank@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=seabios@seabios.org \
--cc=stefanha@gmail.com \
--cc=vasilis.liaskovitis@profitbricks.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.