diff mbox

[3/3] xen: ignore direction in bufioreq handling

Message ID 58356E83020000780012129C@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Nov. 23, 2016, 9:25 a.m. UTC
There's no way to communicate back read data, so only writes can ever
be usefully specified. Ignore the field, paving the road for eventually
re-using the bit for something else in a few (many?) years time.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Paul Durrant Nov. 23, 2016, 9:55 a.m. UTC | #1
> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 23 November 2016 09:25
> To: qemu-devel@nongnu.org
> Cc: Anthony Perard <anthony.perard@citrix.com>; Paul Durrant
> <Paul.Durrant@citrix.com>; Stefano Stabellini <sstabellini@kernel.org>; xen-
> devel <xen-devel@lists.xenproject.org>
> Subject: [PATCH 3/3] xen: ignore direction in bufioreq handling
> 
> There's no way to communicate back read data, so only writes can ever
> be usefully specified. Ignore the field, paving the road for eventually
> re-using the bit for something else in a few (many?) years time.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Paul Durrant <paul.durrant@citrix.com>

> 
> --- a/xen-hvm.c
> +++ b/xen-hvm.c
> @@ -997,6 +997,7 @@ static int handle_buffered_iopage(XenIOS
>      memset(&req, 0x00, sizeof(req));
>      req.state = STATE_IOREQ_READY;
>      req.count = 1;
> +    req.dir = IOREQ_WRITE;
> 
>      for (;;) {
>          uint32_t rdptr = buf_page->read_pointer, wrptr;
> @@ -1014,7 +1015,6 @@ static int handle_buffered_iopage(XenIOS
>          req.size = 1U << buf_req->size;
>          req.addr = buf_req->addr;
>          req.data = buf_req->data;
> -        req.dir = buf_req->dir;
>          req.type = buf_req->type;
>          xen_rmb();
>          qw = (req.size == 8);
> @@ -1031,10 +1031,12 @@ static int handle_buffered_iopage(XenIOS
>          handle_ioreq(state, &req);
> 
>          /* Only req.data may get updated by handle_ioreq(), albeit even that
> -         * should not happen as such data would never make it to the guest.
> +         * should not happen as such data would never make it to the guest (we
> +         * can only usefully see writes here after all).
>           */
>          assert(req.state == STATE_IOREQ_READY);
>          assert(req.count == 1);
> +        assert(req.dir == IOREQ_WRITE);
>          assert(!req.data_is_ptr);
> 
>          atomic_add(&buf_page->read_pointer, qw + 1);
> 
>
Stefano Stabellini Nov. 23, 2016, 6:16 p.m. UTC | #2
On Wed, 23 Nov 2016, Paul Durrant wrote:
> > -----Original Message-----
> > From: Jan Beulich [mailto:JBeulich@suse.com]
> > Sent: 23 November 2016 09:25
> > To: qemu-devel@nongnu.org
> > Cc: Anthony Perard <anthony.perard@citrix.com>; Paul Durrant
> > <Paul.Durrant@citrix.com>; Stefano Stabellini <sstabellini@kernel.org>; xen-
> > devel <xen-devel@lists.xenproject.org>
> > Subject: [PATCH 3/3] xen: ignore direction in bufioreq handling
> > 
> > There's no way to communicate back read data, so only writes can ever
> > be usefully specified. Ignore the field, paving the road for eventually
> > re-using the bit for something else in a few (many?) years time.
> > 
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> > 
> > --- a/xen-hvm.c
> > +++ b/xen-hvm.c
> > @@ -997,6 +997,7 @@ static int handle_buffered_iopage(XenIOS
> >      memset(&req, 0x00, sizeof(req));
> >      req.state = STATE_IOREQ_READY;
> >      req.count = 1;
> > +    req.dir = IOREQ_WRITE;
> > 
> >      for (;;) {
> >          uint32_t rdptr = buf_page->read_pointer, wrptr;
> > @@ -1014,7 +1015,6 @@ static int handle_buffered_iopage(XenIOS
> >          req.size = 1U << buf_req->size;
> >          req.addr = buf_req->addr;
> >          req.data = buf_req->data;
> > -        req.dir = buf_req->dir;
> >          req.type = buf_req->type;
> >          xen_rmb();
> >          qw = (req.size == 8);
> > @@ -1031,10 +1031,12 @@ static int handle_buffered_iopage(XenIOS
> >          handle_ioreq(state, &req);
> > 
> >          /* Only req.data may get updated by handle_ioreq(), albeit even that
> > -         * should not happen as such data would never make it to the guest.
> > +         * should not happen as such data would never make it to the guest (we
> > +         * can only usefully see writes here after all).
> >           */
> >          assert(req.state == STATE_IOREQ_READY);
> >          assert(req.count == 1);
> > +        assert(req.dir == IOREQ_WRITE);
> >          assert(!req.data_is_ptr);
> > 
> >          atomic_add(&buf_page->read_pointer, qw + 1);
> > 
> > 
>
diff mbox

Patch

--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -997,6 +997,7 @@  static int handle_buffered_iopage(XenIOS
     memset(&req, 0x00, sizeof(req));
     req.state = STATE_IOREQ_READY;
     req.count = 1;
+    req.dir = IOREQ_WRITE;
 
     for (;;) {
         uint32_t rdptr = buf_page->read_pointer, wrptr;
@@ -1014,7 +1015,6 @@  static int handle_buffered_iopage(XenIOS
         req.size = 1U << buf_req->size;
         req.addr = buf_req->addr;
         req.data = buf_req->data;
-        req.dir = buf_req->dir;
         req.type = buf_req->type;
         xen_rmb();
         qw = (req.size == 8);
@@ -1031,10 +1031,12 @@  static int handle_buffered_iopage(XenIOS
         handle_ioreq(state, &req);
 
         /* Only req.data may get updated by handle_ioreq(), albeit even that
-         * should not happen as such data would never make it to the guest.
+         * should not happen as such data would never make it to the guest (we
+         * can only usefully see writes here after all).
          */
         assert(req.state == STATE_IOREQ_READY);
         assert(req.count == 1);
+        assert(req.dir == IOREQ_WRITE);
         assert(!req.data_is_ptr);
 
         atomic_add(&buf_page->read_pointer, qw + 1);