From: "Andreas Färber" <afaerber@suse.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
aliguori@us.ibm.com, quintela@redhat.com,
Jan Kiszka <jan.kiszka@siemens.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>,
qemu-devel@nongnu.org, owasserm@redhat.com,
Stefan Hajnoczi <stefanha@gmail.com>,
akong@redhat.com, yamahata@valinux.co.jp
Subject: Re: [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor
Date: Mon, 11 Jun 2012 11:02:57 +0200 [thread overview]
Message-ID: <4FD5B441.7060401@suse.de> (raw)
In-Reply-To: <4FD5A55C.9070800@redhat.com>
Am 11.06.2012 09:59, schrieb Paolo Bonzini:
> Il 11/06/2012 09:56, Andreas Färber ha scritto:
>>>> I thought that was just a convenience choice, not a necessity. The
>>>> children objects could just as well be heap-allocated.
>> In that case we'd need to change the instance_init signature. As far as
>> I've understood from our discussions with Anthony, realize must not
>> allocate new objects because that may collide with the recursive realize
>> model, and instance_init is not supposed to fail.
>
> But qemu_malloc is also not supposed to fail. It will exit QEMU if it
> fails.
(s/qemu_malloc/g_malloc/g)
...which is not always desired.
void *objp = g_try_malloc(sizeof(MyState)); /* may fail without abort */
if (objp != NULL) {
object_initialize(objp, TYPE_MY); /* may not fail */
} else {
/* report error to caller */
}
This becomes more important the more objects we allocate at runtime in
response to users' QMP commands.
When we talk about QEMU startup then we are in violent agreement that it
can abort. When influenced by user-tunable options like -m then it
starts to become less clear, there seemed agreement that it shouldn't
abort but fail with a nice error message (seems not followed up with a
patch though?).
But as I've seen in v0.15.x bug reports and reported last fall for
v1.0-rcX, allocations can fail while the guest is running (even without
active user interaction: network? block? memory usage varied HIGHly
according to simpletrace analyzed) and also being far from the hard
physical limit depending on ulimit settings (e.g., 41G'ish on a 64 GB
RAM system with default soft virtual limit of 80%).
Examples I have in mind where user interaction shouldn't crash the guest
is hotplugging an x86 CPU with its APIC or hotplugging a ppc CPU with
its large'ish opcode table. About a 5-char g_strdup() I'm not as worried. ;)
So from my view, the solution is to have basic versions such as
qdev_create() abort and to also provide advanced versions like
qdev_try_create() to handle more sophisticated enterprise use cases. QOM
does not provide a double API in the same way qdev did, but the above
snippet shows that if proper QOM modelling is used - the topic of this
thread - it can be compensated with GLib. Either way it requires
knowledge about struct sizes so they need to be exposed somehow.
What I started playing with a few weeks ago is reporting OOM via Error;
that's a bit trickier since allocating a new object might fail as well,
so it needs to be preallocated and there was some reference-counting
iirc that didn't play nicely with a never-to-be-freed object. Use cases
might include adding properties - which is and must be done in
instance_init - and retrieving string properties.
Not the highest priority for me at the moment, but something we
shouldn't make impossible by Bad Design.
I have deriving a public BNC# for this on my TODO list, to preserve my
graphs and analysis tools...
Regards,
Andreas
--
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:[~2012-06-11 9:03 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-05 1:00 [Qemu-devel] [RFC] Use QEMU IDL for device serialization/vmstate Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 01/17] qidl: add QEMU IDL processor Michael Roth
2012-06-05 1:57 ` Anthony Liguori
2012-06-05 9:25 ` Kevin Wolf
2012-06-05 9:47 ` Anthony Liguori
2012-06-05 10:11 ` Kevin Wolf
2012-06-05 16:21 ` Michael Roth
2012-06-05 19:56 ` Paolo Bonzini
2012-06-05 23:40 ` Anthony Liguori
2012-06-06 5:12 ` Paolo Bonzini
2012-06-06 5:43 ` Anthony Liguori
2012-06-06 7:30 ` Kevin Wolf
2012-06-05 10:00 ` Peter Maydell
2012-06-05 10:10 ` Anthony Liguori
2012-06-11 7:13 ` Andreas Färber
2012-06-11 7:20 ` Paolo Bonzini
2012-06-11 7:56 ` Andreas Färber
2012-06-11 7:59 ` Paolo Bonzini
2012-06-11 9:02 ` Andreas Färber [this message]
2012-06-11 8:04 ` Andreas Färber
2012-06-11 13:12 ` Anthony Liguori
2012-06-11 13:37 ` Peter Maydell
2012-06-11 13:09 ` Peter Maydell
2012-06-05 10:06 ` Avi Kivity
2012-06-05 12:19 ` Gerd Hoffmann
2012-06-05 23:41 ` Anthony Liguori
2012-06-06 7:19 ` Avi Kivity
2012-06-05 21:11 ` Michael Roth
2012-06-06 7:31 ` Avi Kivity
2012-06-06 21:36 ` Michael Roth
2012-06-07 7:08 ` Avi Kivity
2012-06-05 23:51 ` Anthony Liguori
2012-06-06 1:25 ` Peter Maydell
2012-06-06 7:45 ` Avi Kivity
2012-06-06 8:27 ` Anthony Liguori
2012-06-06 8:37 ` Avi Kivity
2012-06-06 8:45 ` Anthony Liguori
2012-06-06 8:59 ` Avi Kivity
2012-06-06 9:17 ` Anthony Liguori
2012-06-06 9:58 ` Avi Kivity
2012-06-06 11:12 ` Anthony Liguori
2012-06-06 11:25 ` Avi Kivity
2012-06-06 23:20 ` Anthony Liguori
2012-06-05 1:00 ` [Qemu-devel] [PATCH 02/17] qidl: add qc definitions Michael Roth
2012-06-05 9:25 ` Kevin Wolf
2012-06-05 10:35 ` Jan Kiszka
2012-06-05 11:12 ` Anthony Liguori
2012-06-05 11:26 ` Jan Kiszka
2012-06-05 11:42 ` Kevin Wolf
2012-06-05 14:08 ` Paolo Bonzini
2012-06-05 21:44 ` Michael Roth
2012-06-05 23:35 ` Anthony Liguori
2012-06-05 1:00 ` [Qemu-devel] [PATCH 03/17] qapi: add visitor interfaces for arrays Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 04/17] qapi: QmpOutputVisitor, implement array handling Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 05/17] qapi: qapi-visit.py, support arrays and complex qapi definitions Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 06/17] qapi: qapi-visit.py, add gen support for existing types Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 07/17] qapi: add open-coded visitors for QEMUTimer/struct tm types Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 08/17] rtc: move RTCState declaration to header Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 09/17] rtc: add qc annotations Michael Roth
2012-06-05 10:25 ` Avi Kivity
2012-06-05 10:40 ` Jan Kiszka
2012-06-05 12:42 ` Avi Kivity
2012-06-05 22:07 ` Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 10/17] Makefile: add infrastructure to incorporate qidl-generated files Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 11/17] qapi: add qidl-generated qapi schema for rtc Michael Roth
2012-06-05 9:29 ` Kevin Wolf
2012-06-05 16:03 ` Michael Roth
2012-06-06 7:38 ` Kevin Wolf
2012-06-06 22:40 ` Michael Roth
2012-06-05 10:11 ` Avi Kivity
2012-06-05 1:00 ` [Qemu-devel] [PATCH 12/17] rtc: add a QOM property for accessing device state Michael Roth
2012-06-05 14:14 ` Paolo Bonzini
2012-06-05 17:54 ` Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 13/17] rtc: add _version() qidl annotations Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 14/17] qidl: add qidl-based generation of vmstate field bindings Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 15/17] Makefile: add qidl-generation of vmstate field descriptions Michael Roth
2012-06-05 1:00 ` [Qemu-devel] [PATCH 16/17] qidl: add qidl-generated vmstate fields for rtc Michael Roth
2012-06-05 10:26 ` Avi Kivity
2012-06-05 23:38 ` Anthony Liguori
2012-06-06 7:47 ` Avi Kivity
2012-06-05 1:00 ` [Qemu-devel] [PATCH 17/17] rtc: use qidl-generated vmstate bindings Michael Roth
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=4FD5B441.7060401@suse.de \
--to=afaerber@suse.de \
--cc=akong@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=jan.kiszka@siemens.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=owasserm@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@gmail.com \
--cc=yamahata@valinux.co.jp \
/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).