* [Qemu-devel] [RFH PATCH] vhost-user-test: fix g_cond_wait_until compat implementation
@ 2016-06-28 17:22 Paolo Bonzini
2016-06-29 11:48 ` Marc-André Lureau
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2016-06-28 17:22 UTC (permalink / raw)
To: qemu-devel; +Cc: marcandre.lureau
This fixes compilation with glib versions up to 2.30, such
as the one in CentOS 6.
Even with this patch the test fails though:
ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:165:wait_for_fds: assertion failed: (s->fds_num)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/vhost-user-test.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 8b2164b..4de64df 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -127,21 +127,24 @@ typedef struct TestServer {
int fds_num;
int fds[VHOST_MEMORY_MAX_NREGIONS];
VhostUserMemory memory;
- GMutex data_mutex;
- GCond data_cond;
+ CompatGMutex data_mutex;
+ CompatGCond data_cond;
int log_fd;
uint64_t rings;
} TestServer;
#if !GLIB_CHECK_VERSION(2, 32, 0)
-static gboolean g_cond_wait_until(CompatGCond cond, CompatGMutex mutex,
+static gboolean g_cond_wait_until(CompatGCond *cond, CompatGMutex *mutex,
gint64 end_time)
{
gboolean ret = FALSE;
end_time -= g_get_monotonic_time();
GTimeVal time = { end_time / G_TIME_SPAN_SECOND,
end_time % G_TIME_SPAN_SECOND };
- ret = g_cond_timed_wait(cond, mutex, &time);
+ g_assert(mutex->once.status != G_ONCE_STATUS_PROGRESS);
+ g_once(&cond->once, do_g_cond_new, NULL);
+ ret = g_cond_timed_wait((GCond *) cond->once.retval,
+ (GMutex *) mutex->once.retval, &time);
return ret;
}
#endif
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [RFH PATCH] vhost-user-test: fix g_cond_wait_until compat implementation
2016-06-28 17:22 [Qemu-devel] [RFH PATCH] vhost-user-test: fix g_cond_wait_until compat implementation Paolo Bonzini
@ 2016-06-29 11:48 ` Marc-André Lureau
2016-06-29 12:01 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Marc-André Lureau @ 2016-06-29 11:48 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: QEMU
Hi
On Tue, Jun 28, 2016 at 7:22 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> This fixes compilation with glib versions up to 2.30, such
> as the one in CentOS 6.
>
What's RFH in title? :) (not sure this applies here:
http://www.urbandictionary.com/define.php?term=rfh)
> Even with this patch the test fails though:
>
> ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:165:wait_for_fds: assertion failed: (s->fds_num)
>
That's a regression from Cornelia's series "virtio-bus: have callers
tolerate new host notifier api".
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> tests/vhost-user-test.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
> index 8b2164b..4de64df 100644
> --- a/tests/vhost-user-test.c
> +++ b/tests/vhost-user-test.c
> @@ -127,21 +127,24 @@ typedef struct TestServer {
> int fds_num;
> int fds[VHOST_MEMORY_MAX_NREGIONS];
> VhostUserMemory memory;
> - GMutex data_mutex;
> - GCond data_cond;
> + CompatGMutex data_mutex;
> + CompatGCond data_cond;
> int log_fd;
> uint64_t rings;
> } TestServer;
>
> #if !GLIB_CHECK_VERSION(2, 32, 0)
> -static gboolean g_cond_wait_until(CompatGCond cond, CompatGMutex mutex,
> +static gboolean g_cond_wait_until(CompatGCond *cond, CompatGMutex *mutex,
> gint64 end_time)
> {
> gboolean ret = FALSE;
> end_time -= g_get_monotonic_time();
> GTimeVal time = { end_time / G_TIME_SPAN_SECOND,
> end_time % G_TIME_SPAN_SECOND };
> - ret = g_cond_timed_wait(cond, mutex, &time);
> + g_assert(mutex->once.status != G_ONCE_STATUS_PROGRESS);
> + g_once(&cond->once, do_g_cond_new, NULL);
> + ret = g_cond_timed_wait((GCond *) cond->once.retval,
> + (GMutex *) mutex->once.retval, &time);
> return ret;
> }
> #endif
> --
> 2.7.4
>
>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [RFH PATCH] vhost-user-test: fix g_cond_wait_until compat implementation
2016-06-29 11:48 ` Marc-André Lureau
@ 2016-06-29 12:01 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2016-06-29 12:01 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: QEMU
On 29/06/2016 13:48, Marc-André Lureau wrote:
> Hi
>
> On Tue, Jun 28, 2016 at 7:22 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> This fixes compilation with glib versions up to 2.30, such
>> as the one in CentOS 6.
>>
>
> What's RFH in title? :) (not sure this applies here:
> http://www.urbandictionary.com/define.php?term=rfh)
Request for help with the other bug. :)
Paolo
>> Even with this patch the test fails though:
>>
>> ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:165:wait_for_fds: assertion failed: (s->fds_num)
>>
>
> That's a regression from Cornelia's series "virtio-bus: have callers
> tolerate new host notifier api".
>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> tests/vhost-user-test.c | 11 +++++++----
>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
>> index 8b2164b..4de64df 100644
>> --- a/tests/vhost-user-test.c
>> +++ b/tests/vhost-user-test.c
>> @@ -127,21 +127,24 @@ typedef struct TestServer {
>> int fds_num;
>> int fds[VHOST_MEMORY_MAX_NREGIONS];
>> VhostUserMemory memory;
>> - GMutex data_mutex;
>> - GCond data_cond;
>> + CompatGMutex data_mutex;
>> + CompatGCond data_cond;
>> int log_fd;
>> uint64_t rings;
>> } TestServer;
>>
>> #if !GLIB_CHECK_VERSION(2, 32, 0)
>> -static gboolean g_cond_wait_until(CompatGCond cond, CompatGMutex mutex,
>> +static gboolean g_cond_wait_until(CompatGCond *cond, CompatGMutex *mutex,
>> gint64 end_time)
>> {
>> gboolean ret = FALSE;
>> end_time -= g_get_monotonic_time();
>> GTimeVal time = { end_time / G_TIME_SPAN_SECOND,
>> end_time % G_TIME_SPAN_SECOND };
>> - ret = g_cond_timed_wait(cond, mutex, &time);
>> + g_assert(mutex->once.status != G_ONCE_STATUS_PROGRESS);
>> + g_once(&cond->once, do_g_cond_new, NULL);
>> + ret = g_cond_timed_wait((GCond *) cond->once.retval,
>> + (GMutex *) mutex->once.retval, &time);
>> return ret;
>> }
>> #endif
>> --
>> 2.7.4
>>
>>
>
>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-29 12:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28 17:22 [Qemu-devel] [RFH PATCH] vhost-user-test: fix g_cond_wait_until compat implementation Paolo Bonzini
2016-06-29 11:48 ` Marc-André Lureau
2016-06-29 12:01 ` Paolo Bonzini
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).