All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws,
	kvm@vger.kernel.org, quintela@redhat.com, chrisw@redhat.com
Subject: Re: [RFC PATCH 7/6] savevm: Create a new continue flag to avoid resending block name
Date: Wed, 09 Jun 2010 00:29:17 +0200	[thread overview]
Message-ID: <4C0EC43D.7050908@redhat.com> (raw)
In-Reply-To: <1276032766.3079.18.camel@x201>

On 06/08/2010 11:32 PM, Alex Williamson wrote:
> On Tue, 2010-06-08 at 15:11 -0600, Alex Williamson wrote:
>> Allows us to compress the protocol a bit.
> ...
>> @@ -284,6 +290,33 @@ int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
>>       return (stage == 2)&&  (expected_time<= migrate_max_downtime());
>>   }
>>
>> +static inline void *host_from_stream_offset(QEMUFile *f,
>> +                                            ram_addr_t offset,
>> +                                            int flags)
>
> This probably shouldn't be inline.  When sending, we'll continue from
> COMPRESS or PAGE.  We'd get out of sync on the recv if the compiler
> created separate static blocks.  Compiler folks correct me if this can't
> happen.

There is only one static variable even if the inlining happens in 
multiple places.  In fact, inlining is totally transparent.

Example:

$ cat > x.c <<\EOF
#ifndef force_inline
#define force_inline inline __attribute__((always_inline))
#endif

static force_inline int f()
{
	static int i;
	return i++;
}

int main()
{
	printf ("%d\n", f());
	printf ("%d\n", f());
	printf ("%d\n", f());
	printf ("%d\n", f());
}
EOF
$ gcc -o - -Dforce_inline= -S x.c | egrep -cw _?f
7
$ gcc -o - -S x.c | egrep -cw _?f
0
$ gcc x.c && ./a.out
0
1
2
3

Paolo

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: chrisw@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org,
	kvm@vger.kernel.org
Subject: [Qemu-devel] Re: [RFC PATCH 7/6] savevm: Create a new continue flag to avoid resending block name
Date: Wed, 09 Jun 2010 00:29:17 +0200	[thread overview]
Message-ID: <4C0EC43D.7050908@redhat.com> (raw)
In-Reply-To: <1276032766.3079.18.camel@x201>

On 06/08/2010 11:32 PM, Alex Williamson wrote:
> On Tue, 2010-06-08 at 15:11 -0600, Alex Williamson wrote:
>> Allows us to compress the protocol a bit.
> ...
>> @@ -284,6 +290,33 @@ int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
>>       return (stage == 2)&&  (expected_time<= migrate_max_downtime());
>>   }
>>
>> +static inline void *host_from_stream_offset(QEMUFile *f,
>> +                                            ram_addr_t offset,
>> +                                            int flags)
>
> This probably shouldn't be inline.  When sending, we'll continue from
> COMPRESS or PAGE.  We'd get out of sync on the recv if the compiler
> created separate static blocks.  Compiler folks correct me if this can't
> happen.

There is only one static variable even if the inlining happens in 
multiple places.  In fact, inlining is totally transparent.

Example:

$ cat > x.c <<\EOF
#ifndef force_inline
#define force_inline inline __attribute__((always_inline))
#endif

static force_inline int f()
{
	static int i;
	return i++;
}

int main()
{
	printf ("%d\n", f());
	printf ("%d\n", f());
	printf ("%d\n", f());
	printf ("%d\n", f());
}
EOF
$ gcc -o - -Dforce_inline= -S x.c | egrep -cw _?f
7
$ gcc -o - -S x.c | egrep -cw _?f
0
$ gcc x.c && ./a.out
0
1
2
3

Paolo

  reply	other threads:[~2010-06-08 22:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0100608191447.4451.47795.stgit@localhost.localdomain>
2010-06-08 21:11 ` [RFC PATCH 7/6] savevm: Create a new continue flag to avoid resending block name Alex Williamson
2010-06-08 21:11   ` [Qemu-devel] " Alex Williamson
2010-06-08 21:32   ` Alex Williamson
2010-06-08 21:32     ` [Qemu-devel] " Alex Williamson
2010-06-08 22:29     ` Paolo Bonzini [this message]
2010-06-08 22:29       ` Paolo Bonzini

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=4C0EC43D.7050908@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=chrisw@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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 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.