qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Jianjun Duan <duanj@linux.vnet.ibm.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: veroniabahaa@gmail.com, peter.maydell@linaro.org,
	mdroth@linux.vnet.ibm.com, mst@redhat.com, quintela@redhat.com,
	mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org,
	mreitz@redhat.com, blauwirbel@gmail.com, amit.shah@redhat.com,
	qemu-ppc@nongnu.org, kraxel@redhat.com, kwolf@redhat.com,
	dmitry@daynix.com, rth@twiddle.net, leon.alrae@imgtec.com,
	aurelien@aurel32.net, david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [QEMU PATCH v9 2/3] migration: migrate QTAILQ
Date: Tue, 1 Nov 2016 16:47:11 +0100	[thread overview]
Message-ID: <4beb0f71-514e-f7a8-5bd9-de1ede47f2bf@linux.vnet.ibm.com> (raw)
In-Reply-To: <56fd391c-0723-6bfa-e0fa-ac68af8119c9@redhat.com>



On 11/01/2016 04:02 PM, Paolo Bonzini wrote:
> 
> 
> On 31/10/2016 14:10, Halil Pasic wrote:
>> I think this got overly complicated.
> 
> I agree. :)
> 
>> Here is a little patch on
>> top of your stuff which gets rid of 15 lines and IMHO simplifies
>> things quite a bit.  What do you think? 
>>
>> It is based on/inspired by Dave's proposal with the dummy stuff. 
>>
>> Did not address the typos though.
> 
> I still prefer my field_at_offset proposal, but I'm obviously biased.

:) have searched it

   *field_at_offset(void **, elm, (entry) + QTAILQ_NEXT_OFFSET) = NULL;
   *field_at_offset(void ***, elm, (entry) + QTAILQ_PREV_OFFSET) =
       *field_at_offset(void ***, head, QTAILQ_LAST_OFFSET);
   **field_at_offset(void ***, head, QTAILQ_LAST_OFFSET) = (elm);
   *field_at_offset(void ***, head, QTAILQ_LAST_OFFSET) =
        field_at_offset(void **, elm, (entry) + QTAILQ_NEXT_OFFSET);

That was for the insert of course.

A lot of * for my taste and we still have the QTAILQ_NEXT_OFFSET
and QTAILQ_PREV_OFFSET macros which are supposed to capture
what QTAILQRawEntry does (namely where is the next and the
prev pointer within the entry -- not the element). 

Obviously I'm biased too ;)

> Squashing your changes on top of 2/3 is fine too.  But this change makes
> little sense:
> 
>>   */
>>  #define QTAILQ_RAW_NEXT(elm, entry)                                            \
>> -        (*field_at_offset(elm, entry + QTAILQ_NEXT_OFFSET, void **))
>> +        ((field_at_offset(elm, entry, QTAILQRawEntry *)->tqe_next))
>>  #define QTAILQ_RAW_PREV(elm, entry)                                            \
>> -        (*field_at_offset(elm, entry + QTAILQ_PREV_OFFSET, void ***))
>> +        (field_at_offset(elm, entry, QTAILQRawEntry *)->tqe_prev)
>> +
> 
> field_at_offset seems to be out of place.

Me scratching head. This is the place where we pinpoint the qtailq 
entry which is at offset entry within the element and reinterpret
the pointer as a pointer to QTAILQRawEntry. In the end we end up
with a void pointer to the next or prev element.

I think
#define QTAILQ_RAW_NEXT(elm, entry_offset)                                         \
        ((field_at_offset(elm, entry_offset, QTAILQRawEntry *)->tqe_next)
would be more readable though.

Could you explain whats wrong with that?

Thank you very much for commenting!

Halil

> 
> Paolo
> 

  reply	other threads:[~2016-11-01 15:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 22:28 [Qemu-devel] [QEMU PATCH v9 0/3] migration: migrate QTAILQ Jianjun Duan
2016-10-27 22:28 ` [Qemu-devel] [QEMU PATCH v9 1/3] migration: extend VMStateInfo Jianjun Duan
2016-10-27 22:28 ` [Qemu-devel] [QEMU PATCH v9 2/3] migration: migrate QTAILQ Jianjun Duan
2016-10-28 19:06   ` Dr. David Alan Gilbert
2016-10-28 19:46     ` Jianjun Duan
2016-10-31 13:10       ` Halil Pasic
2016-10-31 17:10         ` [Qemu-devel] [Qemu-ppc] " Jianjun Duan
2016-10-31 17:21           ` Halil Pasic
2016-10-31 17:32             ` Jianjun Duan
2016-10-31 18:01               ` Halil Pasic
2016-10-31 18:25                 ` Jianjun Duan
2016-10-31 19:02                   ` Halil Pasic
2016-11-01 15:02         ` [Qemu-devel] " Paolo Bonzini
2016-11-01 15:47           ` Halil Pasic [this message]
2016-10-27 22:28 ` [Qemu-devel] [QEMU PATCH v9 3/3] tests/migration: Add test for QTAILQ migration Jianjun Duan
2016-10-28 13:57 ` [Qemu-devel] [QEMU PATCH v9 0/3] migration: migrate QTAILQ no-reply

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=4beb0f71-514e-f7a8-5bd9-de1ede47f2bf@linux.vnet.ibm.com \
    --to=pasic@linux.vnet.ibm.com \
    --cc=amit.shah@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=blauwirbel@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgilbert@redhat.com \
    --cc=dmitry@daynix.com \
    --cc=duanj@linux.vnet.ibm.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leon.alrae@imgtec.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    --cc=veroniabahaa@gmail.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).