* [Qemu-devel] [PATCH] vhost user: fix documentation of log atomic elements
@ 2015-10-29 10:20 Victor Kaplansky
2015-10-29 12:24 ` Victor Kaplansky
0 siblings, 1 reply; 2+ messages in thread
From: Victor Kaplansky @ 2015-10-29 10:20 UTC (permalink / raw)
To: qemu-devel
Cc: changchun.ouyang, thibaut.collet, Michael S. Tsirkin,
Victor Kaplansky, marcandre.lureau
Current implementation in hw/virtio/vhost.c accesses the log by
32-bit wide chunks in host native bit and byte endianness.
Accessing the log by 8-bit wide chunks, as the spec suggests,
will be broken on big-endian hosts.
This commit changes the spec to match the implementation.
Signed-off-by: Victor Kaplansky <victork@redhat.com>
---
docs/specs/vhost-user.txt | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt
index e0d71e2..3d18771 100644
--- a/docs/specs/vhost-user.txt
+++ b/docs/specs/vhost-user.txt
@@ -177,9 +177,11 @@ addresses. The log covers from address 0 to the maximum of guest
regions. In pseudo-code, to mark page at "addr" as dirty:
page = addr / VHOST_LOG_PAGE
-log[page / 8] |= 1 << page % 8
+log[page / 32] |= 1 << page % 32
-Use atomic operations, as the log may be concurrently manipulated.
+Use atomic operations, as the log may be concurrently
+manipulated, and access the log by atomic 32-bit wide elements in
+host native bit-level endianness.
VHOST_USER_SET_LOG_FD is an optional message with an eventfd in
ancillary data, it may be used to inform the master that the log has
--
--Victor
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost user: fix documentation of log atomic elements
2015-10-29 10:20 [Qemu-devel] [PATCH] vhost user: fix documentation of log atomic elements Victor Kaplansky
@ 2015-10-29 12:24 ` Victor Kaplansky
0 siblings, 0 replies; 2+ messages in thread
From: Victor Kaplansky @ 2015-10-29 12:24 UTC (permalink / raw)
To: qemu-devel; +Cc: thibaut collet, Michael S. Tsirkin, marcandre lureau
After looking into linux driver code at hw/virtio/vhost.c,
I see that the driver does what spec says. Thus spec the should
remain as is, and QEMU need to be fixed on big-endian machines by
changing the code in hw/virtio/vhost.c
--Victor
----- Original Message -----
From: "Victor Kaplansky" <victork@redhat.com>
To: qemu-devel@nongnu.org
Cc: "thibaut collet" <thibaut.collet@6wind.com>, "marcandre lureau" <marcandre.lureau@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, "changchun ouyang" <changchun.ouyang@intel.com>, "Victor Kaplansky" <victork@redhat.com>
Sent: Thursday, October 29, 2015 12:20:31 PM
Subject: [PATCH] vhost user: fix documentation of log atomic elements
Current implementation in hw/virtio/vhost.c accesses the log by
32-bit wide chunks in host native bit and byte endianness.
Accessing the log by 8-bit wide chunks, as the spec suggests,
will be broken on big-endian hosts.
This commit changes the spec to match the implementation.
Signed-off-by: Victor Kaplansky <victork@redhat.com>
---
docs/specs/vhost-user.txt | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt
index e0d71e2..3d18771 100644
--- a/docs/specs/vhost-user.txt
+++ b/docs/specs/vhost-user.txt
@@ -177,9 +177,11 @@ addresses. The log covers from address 0 to the maximum of guest
regions. In pseudo-code, to mark page at "addr" as dirty:
page = addr / VHOST_LOG_PAGE
-log[page / 8] |= 1 << page % 8
+log[page / 32] |= 1 << page % 32
-Use atomic operations, as the log may be concurrently manipulated.
+Use atomic operations, as the log may be concurrently
+manipulated, and access the log by atomic 32-bit wide elements in
+host native bit-level endianness.
VHOST_USER_SET_LOG_FD is an optional message with an eventfd in
ancillary data, it may be used to inform the master that the log has
--
--Victor
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-29 12:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-29 10:20 [Qemu-devel] [PATCH] vhost user: fix documentation of log atomic elements Victor Kaplansky
2015-10-29 12:24 ` Victor Kaplansky
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).