diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-02-17 18:11:33 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-02-28 18:42:35 +0100 |
commit | 86e9424d7252bae5ad1c17b4b8088193e6b27cbe (patch) | |
tree | ff6bbcf61d5518bd4e06f4cd09c20a4b1f6fcaa4 /drivers | |
parent | wireless: convert to use netdev_for_each_mc_addr (diff) | |
download | linux-86e9424d7252bae5ad1c17b4b8088193e6b27cbe.tar.xz linux-86e9424d7252bae5ad1c17b4b8088193e6b27cbe.zip |
vhost: logging thinko fix
vhost was dong some complex math to get
offset to log at, and got it wrong by a couple of bytes,
while in fact it's simple: get address where we write,
subtract start of buffer, add log base.
Do it this way.
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/vhost/vhost.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 6eb15259f5ae..db21518f7e8d 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -1004,10 +1004,14 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) if (unlikely(vq->log_used)) { /* Make sure data is seen before log. */ smp_wmb(); - log_write(vq->log_base, vq->log_addr + sizeof *vq->used->ring * - (vq->last_used_idx % vq->num), - sizeof *vq->used->ring); - log_write(vq->log_base, vq->log_addr, sizeof *vq->used->ring); + /* Log used ring entry write. */ + log_write(vq->log_base, + vq->log_addr + ((void *)used - (void *)vq->used), + sizeof *used); + /* Log used index update. */ + log_write(vq->log_base, + vq->log_addr + offsetof(struct vring_used, idx), + sizeof vq->used->idx); if (vq->log_ctx) eventfd_signal(vq->log_ctx, 1); } |