From: Halil Pasic <pasic@linux.vnet.ibm.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>,
qemu-devel@nongnu.org, amit.shah@redhat.com, quintela@redhat.com,
duanj@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [very-WIP 3/4] slirp: VMStatify sbuf
Date: Tue, 18 Oct 2016 12:40:03 +0200 [thread overview]
Message-ID: <17da19a6-ff84-3996-d73f-c0c28785639a@linux.vnet.ibm.com> (raw)
In-Reply-To: <20161017190600.GF12934@work-vm>
On 10/17/2016 09:06 PM, Dr. David Alan Gilbert wrote:
>> OK, memory was allocated at #2
>> > It is a bit confusing though (for a novice like me) that we have a non ALLOC VBUFFER
>> > whose pointer is NULL after post_load.
> I don't think this pointer can be NULL; the sbreserve at #2 causes it to be
> allocated.
> But yes, it's a shame I can't use VMS_ALLOC here, but the sbreserve is not
> a trivial allocation function.
Sorry my fault, wanted to say pre_load and not post_load. The assumption
that backing memory is allocated either during device realization or in the
pre_load of the parent or in vmstate_base_addr seemed a reasonable one
(prior to the extra possibilities introduced by the patches of Jianjun).
>
>> > Now if I imagine the original stream were written in the following sequence:
>> > vbuffer_length (sb_datalen), vbuffer_data (sb_data), offsets (sb_wptr, sb_rptr)
>> > which seems completely valid to me then the context would not be sufficient
>> > to compute sb_wptr and sb_rptr because the lifetime of vbuffer_data and
>> > the tmp do not overlap.
> If that was the case you could still do it pretty easily.
> You'd have to add the sb_datalen and sb_data fields to the temporary
> and then move the VMSTATE_VBUFFER_UINT32 into the tmp so it would operate
> on the copied fields.
>
That basically means you expand the area affected by the tmp handling
so that you have all the info you need to do the computation/transformation
before the temporary is freed, right? Then the worst it can get is that you need to
transform the first field and for that you need the last field.
>> > I aware it's a trade-off between how long the temporary data lives and
>> > how complicated the dependencies get. Or am I getting something wrong?
> No, I think that's right. The other option I thought of was a macro
> to allocate a temporary and then another to free it and then someway
> to tell macros in between that they should operate on the temporary
> rather than the main pointer; but then you'd have to be VERY careful
> to not allow yourself to access a temporary that's been freed.
> This structure means you can't make that mistake.
>
I have a couple of crazy half ideas of myself, I just do not feel
very comfortable sharing them, because right now I do not have the
capacity to explore them properly. Besides I don't know the code-base
well enough to say if this reasoning has some practical relevance
or is it 'rather academic'. Nevertheless I did not want to keep
the opinion to myself that this thing with the dependencies can
get rather convoluted under circumstances.
Cheers,
Halil
> Dave
>
>> >
>> > Cheers,
>> > Halil
>> >
>>>> > >> + VMSTATE_END_OF_LIST()
>>>> > >> + }
>>>> > >> +};
>> > [..]
>> >
next prev parent reply other threads:[~2016-10-18 10:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-11 17:18 [Qemu-devel] [very-WIP 0/4] Migration: VMSTATE_WITH_TMP Dr. David Alan Gilbert (git)
2016-10-11 17:18 ` [Qemu-devel] [very-WIP 1/7] migration: Add VMSTATE_WITH_TMP Dr. David Alan Gilbert (git)
2016-10-17 3:31 ` David Gibson
2016-10-17 18:49 ` Jianjun Duan
2016-10-17 18:52 ` Dr. David Alan Gilbert
2016-10-17 19:02 ` Jianjun Duan
2016-10-17 19:16 ` Dr. David Alan Gilbert
2016-10-17 19:30 ` Jianjun Duan
2016-10-18 8:06 ` Dr. David Alan Gilbert
2016-10-11 17:18 ` [Qemu-devel] [very-WIP 2/7] tests/migration: Add test for VMSTATE_WITH_TMP Dr. David Alan Gilbert (git)
2016-10-17 3:34 ` David Gibson
2016-10-11 17:18 ` [Qemu-devel] [very-WIP 3/4] slirp: VMStatify sbuf Dr. David Alan Gilbert (git)
2016-10-17 3:36 ` David Gibson
2016-10-17 17:54 ` Halil Pasic
2016-10-17 19:06 ` Dr. David Alan Gilbert
2016-10-18 10:40 ` Halil Pasic [this message]
2016-10-11 17:18 ` [Qemu-devel] [very-WIP 4/4] virtio/migration: Migrate virtio-net to VMState Dr. David Alan Gilbert (git)
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=17da19a6-ff84-3996-d73f-c0c28785639a@linux.vnet.ibm.com \
--to=pasic@linux.vnet.ibm.com \
--cc=amit.shah@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=dgilbert@redhat.com \
--cc=duanj@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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).