* [Qemu-devel] [PATCH] vhost-net: Move asserts to after check for end < start
@ 2011-12-16 20:33 Bruce Rogers
2012-03-31 2:21 ` Josh Durgin
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Rogers @ 2011-12-16 20:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Bruce Rogers, mst
When migrating a vm using vhost-net we hit the following assertion:
qemu-kvm: /usr/src/packages/BUILD/qemu-kvm-0.15.1/hw/vhost.c:30:
vhost_dev_sync_region: Assertion `start / (0x1000 * (8 *
sizeof(vhost_log_chunk_t))) < dev->log_size' failed.
The cases which the end < start check is intended to catch, such as
for vga video memory, will also likely trigger the assertion.
Reorder the code to handle this correctly.
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/vhost.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 0870cb7..7309f71 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -26,11 +26,11 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1;
uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK;
- assert(end / VHOST_LOG_CHUNK < dev->log_size);
- assert(start / VHOST_LOG_CHUNK < dev->log_size);
if (end < start) {
return;
}
+ assert(end / VHOST_LOG_CHUNK < dev->log_size);
+ assert(start / VHOST_LOG_CHUNK < dev->log_size);
for (;from < to; ++from) {
vhost_log_chunk_t log;
int bit;
--
1.7.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost-net: Move asserts to after check for end < start
2011-12-16 20:33 [Qemu-devel] [PATCH] vhost-net: Move asserts to after check for end < start Bruce Rogers
@ 2012-03-31 2:21 ` Josh Durgin
2012-04-01 8:54 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Josh Durgin @ 2012-03-31 2:21 UTC (permalink / raw)
To: Bruce Rogers; +Cc: qemu-devel, mst
On 12/16/2011 12:33 PM, Bruce Rogers wrote:
> When migrating a vm using vhost-net we hit the following assertion:
>
> qemu-kvm: /usr/src/packages/BUILD/qemu-kvm-0.15.1/hw/vhost.c:30:
> vhost_dev_sync_region: Assertion `start / (0x1000 * (8 *
> sizeof(vhost_log_chunk_t)))< dev->log_size' failed.
I consistently hit this assert while testing live migration with qemu
1.0.1 and the master branch. Applying this patch allowed live migration
to complete successfully. Maybe it could be reviewed and merged?
> The cases which the end< start check is intended to catch, such as
> for vga video memory, will also likely trigger the assertion.
> Reorder the code to handle this correctly.
>
> Signed-off-by: Bruce Rogers<brogers@suse.com>
> ---
> hw/vhost.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/vhost.c b/hw/vhost.c
> index 0870cb7..7309f71 100644
> --- a/hw/vhost.c
> +++ b/hw/vhost.c
> @@ -26,11 +26,11 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
> vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1;
> uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK;
>
> - assert(end / VHOST_LOG_CHUNK< dev->log_size);
> - assert(start / VHOST_LOG_CHUNK< dev->log_size);
> if (end< start) {
> return;
> }
> + assert(end / VHOST_LOG_CHUNK< dev->log_size);
> + assert(start / VHOST_LOG_CHUNK< dev->log_size);
> for (;from< to; ++from) {
> vhost_log_chunk_t log;
> int bit;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost-net: Move asserts to after check for end < start
2012-03-31 2:21 ` Josh Durgin
@ 2012-04-01 8:54 ` Michael S. Tsirkin
0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2012-04-01 8:54 UTC (permalink / raw)
To: Josh Durgin; +Cc: qemu-devel, Bruce Rogers
On Fri, Mar 30, 2012 at 07:21:22PM -0700, Josh Durgin wrote:
> On 12/16/2011 12:33 PM, Bruce Rogers wrote:
> >When migrating a vm using vhost-net we hit the following assertion:
> >
> >qemu-kvm: /usr/src/packages/BUILD/qemu-kvm-0.15.1/hw/vhost.c:30:
> >vhost_dev_sync_region: Assertion `start / (0x1000 * (8 *
> >sizeof(vhost_log_chunk_t)))< dev->log_size' failed.
>
> I consistently hit this assert while testing live migration with
> qemu 1.0.1 and the master branch. Applying this patch allowed live
> migration to complete successfully. Maybe it could be reviewed and
> merged?
Yes, thanks for the reminder. I've applied a patch by Alex Williamson that
addresses this and other crashes.
> >The cases which the end< start check is intended to catch, such as
> >for vga video memory, will also likely trigger the assertion.
> >Reorder the code to handle this correctly.
> >
> >Signed-off-by: Bruce Rogers<brogers@suse.com>
> >---
> > hw/vhost.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/hw/vhost.c b/hw/vhost.c
> >index 0870cb7..7309f71 100644
> >--- a/hw/vhost.c
> >+++ b/hw/vhost.c
> >@@ -26,11 +26,11 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
> > vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1;
> > uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK;
> >
> >- assert(end / VHOST_LOG_CHUNK< dev->log_size);
> >- assert(start / VHOST_LOG_CHUNK< dev->log_size);
> > if (end< start) {
> > return;
> > }
> >+ assert(end / VHOST_LOG_CHUNK< dev->log_size);
> >+ assert(start / VHOST_LOG_CHUNK< dev->log_size);
> > for (;from< to; ++from) {
> > vhost_log_chunk_t log;
> > int bit;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-01 8:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 20:33 [Qemu-devel] [PATCH] vhost-net: Move asserts to after check for end < start Bruce Rogers
2012-03-31 2:21 ` Josh Durgin
2012-04-01 8:54 ` Michael S. Tsirkin
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).