All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: peter.maydell@linaro.org, stefanha@gmail.com
Cc: sstabellini@kernel.org, stefanha@redhat.com,
	anthony.perard@citrix.com, xen-devel@lists.xenproject.org,
	qemu-devel@nongnu.org, Paul Durrant <paul.durrant@citrix.com>
Subject: [Qemu-devel] [PULL 2/3] xen-disk: only advertize feature-persistent if grant copy is not available
Date: Tue, 27 Jun 2017 15:04:42 -0700	[thread overview]
Message-ID: <1498601083-11799-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1498601083-11799-1-git-send-email-sstabellini@kernel.org>

From: Paul Durrant <paul.durrant@citrix.com>

If grant copy is available then it will always be used in preference to
persistent maps. In this case feature-persistent should not be advertized
to the frontend, otherwise it may needlessly copy data into persistently
granted buffers.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 hw/block/xen_disk.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 9200511..8218741 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -1022,11 +1022,18 @@ static int blk_init(struct XenDevice *xendev)
 
     blkdev->file_blk  = BLOCK_SIZE;
 
+    blkdev->feature_grant_copy =
+                (xengnttab_grant_copy(blkdev->xendev.gnttabdev, 0, NULL) == 0);
+
+    xen_pv_printf(&blkdev->xendev, 3, "grant copy operation %s\n",
+                  blkdev->feature_grant_copy ? "enabled" : "disabled");
+
     /* fill info
      * blk_connect supplies sector-size and sectors
      */
     xenstore_write_be_int(&blkdev->xendev, "feature-flush-cache", 1);
-    xenstore_write_be_int(&blkdev->xendev, "feature-persistent", 1);
+    xenstore_write_be_int(&blkdev->xendev, "feature-persistent",
+                          !blkdev->feature_grant_copy);
     xenstore_write_be_int(&blkdev->xendev, "info", info);
 
     blk_parse_discard(blkdev);
@@ -1201,12 +1208,6 @@ static int blk_connect(struct XenDevice *xendev)
 
     xen_be_bind_evtchn(&blkdev->xendev);
 
-    blkdev->feature_grant_copy =
-                (xengnttab_grant_copy(blkdev->xendev.gnttabdev, 0, NULL) == 0);
-
-    xen_pv_printf(&blkdev->xendev, 3, "grant copy operation %s\n",
-                  blkdev->feature_grant_copy ? "enabled" : "disabled");
-
     xen_pv_printf(&blkdev->xendev, 1, "ok: proto %s, ring-ref %d, "
                   "remote port %d, local port %d\n",
                   blkdev->xendev.protocol, blkdev->ring_ref,
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Stefano Stabellini <sstabellini@kernel.org>
To: peter.maydell@linaro.org, stefanha@gmail.com
Cc: sstabellini@kernel.org, qemu-devel@nongnu.org,
	Paul Durrant <paul.durrant@citrix.com>,
	stefanha@redhat.com, anthony.perard@citrix.com,
	xen-devel@lists.xenproject.org
Subject: [PULL 2/3] xen-disk: only advertize feature-persistent if grant copy is not available
Date: Tue, 27 Jun 2017 15:04:42 -0700	[thread overview]
Message-ID: <1498601083-11799-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1498601083-11799-1-git-send-email-sstabellini@kernel.org>

From: Paul Durrant <paul.durrant@citrix.com>

If grant copy is available then it will always be used in preference to
persistent maps. In this case feature-persistent should not be advertized
to the frontend, otherwise it may needlessly copy data into persistently
granted buffers.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 hw/block/xen_disk.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 9200511..8218741 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -1022,11 +1022,18 @@ static int blk_init(struct XenDevice *xendev)
 
     blkdev->file_blk  = BLOCK_SIZE;
 
+    blkdev->feature_grant_copy =
+                (xengnttab_grant_copy(blkdev->xendev.gnttabdev, 0, NULL) == 0);
+
+    xen_pv_printf(&blkdev->xendev, 3, "grant copy operation %s\n",
+                  blkdev->feature_grant_copy ? "enabled" : "disabled");
+
     /* fill info
      * blk_connect supplies sector-size and sectors
      */
     xenstore_write_be_int(&blkdev->xendev, "feature-flush-cache", 1);
-    xenstore_write_be_int(&blkdev->xendev, "feature-persistent", 1);
+    xenstore_write_be_int(&blkdev->xendev, "feature-persistent",
+                          !blkdev->feature_grant_copy);
     xenstore_write_be_int(&blkdev->xendev, "info", info);
 
     blk_parse_discard(blkdev);
@@ -1201,12 +1208,6 @@ static int blk_connect(struct XenDevice *xendev)
 
     xen_be_bind_evtchn(&blkdev->xendev);
 
-    blkdev->feature_grant_copy =
-                (xengnttab_grant_copy(blkdev->xendev.gnttabdev, 0, NULL) == 0);
-
-    xen_pv_printf(&blkdev->xendev, 3, "grant copy operation %s\n",
-                  blkdev->feature_grant_copy ? "enabled" : "disabled");
-
     xen_pv_printf(&blkdev->xendev, 1, "ok: proto %s, ring-ref %d, "
                   "remote port %d, local port %d\n",
                   blkdev->xendev.protocol, blkdev->ring_ref,
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-06-27 22:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 22:04 [Qemu-devel] [PATCH 0/3] please pull xen-20170627-tag Stefano Stabellini
2017-06-27 22:04 ` Stefano Stabellini
2017-06-27 22:04 ` [Qemu-devel] [PULL 1/3] xen/disk: don't leak stack data via response ring Stefano Stabellini
2017-06-27 22:04   ` Stefano Stabellini
2017-06-27 22:04   ` Stefano Stabellini [this message]
2017-06-27 22:04     ` [PULL 2/3] xen-disk: only advertize feature-persistent if grant copy is not available Stefano Stabellini
2017-06-27 22:04   ` [Qemu-devel] [PULL 3/3] xen-disk: add support for multi-page shared rings Stefano Stabellini
2017-06-27 22:04     ` Stefano Stabellini
2017-07-27  6:02     ` [Qemu-devel] [Xen-devel] " Olaf Hering
2017-07-27  6:02       ` Olaf Hering
2017-07-27 19:14       ` [Qemu-devel] [Xen-devel] " Stefano Stabellini
2017-07-27 19:14         ` [Qemu-devel] " Stefano Stabellini
2017-09-23 16:05   ` [Qemu-devel] xen/disk: don't leak stack data via response ring Michael Tokarev
2017-09-23 16:05     ` Michael Tokarev
2017-09-24  9:18     ` Michael Tokarev
2017-09-24  9:18       ` Michael Tokarev
2017-09-25 22:48       ` Stefano Stabellini
2017-09-25 22:48         ` Stefano Stabellini
2017-06-29 12:12 ` [Qemu-devel] [PATCH 0/3] please pull xen-20170627-tag Peter Maydell
2017-06-29 12:12   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498601083-11799-2-git-send-email-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=anthony.perard@citrix.com \
    --cc=paul.durrant@citrix.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.