Skip to contentSkip to conversation

xen-blkfront: check feature-persitent on resume

PATCH In review Roger Pau Monne 2 participants 7 messages May 22, 2014 – Jun 13, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-blkfront: check feature-persitent on resume

We are missing a check to see if the backend supports persistent grants on resume, meaning we will always run with the value fetched from the firsts host on which we run on.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
drivers/block/xen-blkfront.c +16 -7
index efe1b47..00ae36b 100644
@@ -1430,6 +1430,20 @@ static void split_bio_end(struct bio *bio, int error)
 	bio_put(bio);
 }
 
+static void blkfront_setup_persistent(struct blkfront_info *info)
+{
+	unsigned int persistent;
+	int err;
+
+	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
+			    "feature-persistent", "%u", &persistent,
+			    NULL);
+	if (err)
+		info->feature_persistent = 0;
+	else
+		info->feature_persistent = persistent;
+}
+
 static int blkif_recover(struct blkfront_info *info)
 {
 	int i;
@@ -1456,6 +1470,7 @@ static int blkif_recover(struct blkfront_info *info)
 	info->shadow_free = info->ring.req_prod_pvt;
 	info->shadow[BLK_RING_SIZE-1].req.u.rw.id = 0x0fffffff;
 
+	blkfront_setup_persistent(info);
 	rc = blkfront_setup_indirect(info);
 	if (rc) {
 		kfree(copy);
@@ -1851,13 +1866,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	if (!err && discard)
 		blkfront_setup_discard(info);
 
-	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-persistent", "%u", &persistent,
-			    NULL);
-	if (err)
-		info->feature_persistent = 0;
-	else
-		info->feature_persistent = persistent;
+	blkfront_setup_persistent(info);
 
 	err = blkfront_setup_indirect(info);
 	if (err) {
Signature · 1 line
1.7.7.5 (Apple Git-26)
#1 lore raw
Quoted 46 lines · Roger Pau Monne

We are missing a check to see if the backend supports persistent grants on resume, meaning we will always run with the value fetched from the firsts host on which we run on.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
drivers/block/xen-blkfront.c +15 -0
index efe1b47..00ae36b 100644
@@ -1430,6 +1430,20 @@ static void split_bio_end(struct bio *bio, int error)
 	bio_put(bio);
 }
 
+static void blkfront_setup_persistent(struct blkfront_info *info)
+{
+	unsigned int persistent;
+	int err;
+
+	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
+			    "feature-persistent", "%u", &persistent,
+			    NULL);
+	if (err)
+		info->feature_persistent = 0;
+	else
+		info->feature_persistent = persistent;
+}
+
 static int blkif_recover(struct blkfront_info *info)
 {
 	int i;
@@ -1456,6 +1470,7 @@ static int blkif_recover(struct blkfront_info *info)
 	info->shadow_free = info->ring.req_prod_pvt;
 	info->shadow[BLK_RING_SIZE-1].req.u.rw.id = 0x0fffffff;
 
+	blkfront_setup_persistent(info);
 	rc = blkfront_setup_indirect(info);
 	if (rc) {
 		kfree(copy);
@@ -1851,13 +1866,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	if (!err && discard)

drivers/block/xen-blkfront.c static void blkfront_connect(struct blkfront_info *info) · line 1869

Quoted 10 lines
drivers/block/xen-blkfront.c +1 -7
 		blkfront_setup_discard(info);
 
-	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-persistent", "%u", &persistent,
-			    NULL);
-	if (err)
-		info->feature_persistent = 0;
-	else
-		info->feature_persistent = persistent;
+	blkfront_setup_persistent(info);

Should we also flush the ones that are on the info->grants list if we turning it off?

Quoted 6 lines
drivers/block/xen-blkfront.c +0 -1
 	err = blkfront_setup_indirect(info);
 	if (err) {
-- 

1.7.7.5 (Apple Git-26)

#2 lore raw
In reply to Roger Pau Monne
Quoted 46 lines · Roger Pau Monne

We are missing a check to see if the backend supports persistent grants on resume, meaning we will always run with the value fetched from the firsts host on which we run on.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
drivers/block/xen-blkfront.c +15 -0
index efe1b47..00ae36b 100644
@@ -1430,6 +1430,20 @@ static void split_bio_end(struct bio *bio, int error)
 	bio_put(bio);
 }
 
+static void blkfront_setup_persistent(struct blkfront_info *info)
+{
+	unsigned int persistent;
+	int err;
+
+	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
+			    "feature-persistent", "%u", &persistent,
+			    NULL);
+	if (err)
+		info->feature_persistent = 0;
+	else
+		info->feature_persistent = persistent;
+}
+
 static int blkif_recover(struct blkfront_info *info)
 {
 	int i;
@@ -1456,6 +1470,7 @@ static int blkif_recover(struct blkfront_info *info)
 	info->shadow_free = info->ring.req_prod_pvt;
 	info->shadow[BLK_RING_SIZE-1].req.u.rw.id = 0x0fffffff;
 
+	blkfront_setup_persistent(info);
 	rc = blkfront_setup_indirect(info);
 	if (rc) {
 		kfree(copy);
@@ -1851,13 +1866,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	if (!err && discard)

drivers/block/xen-blkfront.c static void blkfront_connect(struct blkfront_info *info) · line 1869

Quoted 10 lines
drivers/block/xen-blkfront.c +1 -7
 		blkfront_setup_discard(info);
 
-	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-persistent", "%u", &persistent,
-			    NULL);
-	if (err)
-		info->feature_persistent = 0;
-	else
-		info->feature_persistent = persistent;
+	blkfront_setup_persistent(info);

Should we also flush the ones that are on the info->grants list if we turning it off?

Quoted 6 lines
drivers/block/xen-blkfront.c +0 -1
 	err = blkfront_setup_indirect(info);
 	if (err) {
-- 

1.7.7.5 (Apple Git-26)

#3 lore raw
Quoted 49 lines · Konrad Rzeszutek Wilk
Quoted 48 lines · Roger Pau Monne

We are missing a check to see if the backend supports persistent grants on resume, meaning we will always run with the value fetched from the firsts host on which we run on.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
drivers/block/xen-blkfront.c +15 -0
index efe1b47..00ae36b 100644
@@ -1430,6 +1430,20 @@ static void split_bio_end(struct bio *bio, int error)
 	bio_put(bio);
 }
 
+static void blkfront_setup_persistent(struct blkfront_info *info)
+{
+	unsigned int persistent;
+	int err;
+
+	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
+			    "feature-persistent", "%u", &persistent,
+			    NULL);
+	if (err)
+		info->feature_persistent = 0;
+	else
+		info->feature_persistent = persistent;
+}
+
 static int blkif_recover(struct blkfront_info *info)
 {
 	int i;
@@ -1456,6 +1470,7 @@ static int blkif_recover(struct blkfront_info *info)
 	info->shadow_free = info->ring.req_prod_pvt;
 	info->shadow[BLK_RING_SIZE-1].req.u.rw.id = 0x0fffffff;
 
+	blkfront_setup_persistent(info);
 	rc = blkfront_setup_indirect(info);
 	if (rc) {
 		kfree(copy);
@@ -1851,13 +1866,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	if (!err && discard)
 		blkfront_setup_discard(info);
 
Quoted 11 lines

drivers/block/xen-blkfront.c static void blkfront_connect(struct blkfront_info *info) · line 1869

Quoted 8 lines
drivers/block/xen-blkfront.c +1 -7
-	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-persistent", "%u", &persistent,
-			    NULL);
-	if (err)
-		info->feature_persistent = 0;
-	else
-		info->feature_persistent = persistent;
+	blkfront_setup_persistent(info);

Should we also flush the ones that are on the info->grants list if we turning it off?

This path is only taken on the first connection, further calls to blkfront_connect from resume code don't get here, because they take the BLKIF_STATE_SUSPENDED path and just call blkif_recover and return. And on disconnection blkfront_connect doesn't even get called.

Roger.

#4 lore raw

Ping?

Quoted 75 lines · Roger Pau Monné
Quoted 49 lines · Konrad Rzeszutek Wilk
Quoted 48 lines · Roger Pau Monne

We are missing a check to see if the backend supports persistent grants on resume, meaning we will always run with the value fetched from the firsts host on which we run on.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
drivers/block/xen-blkfront.c +15 -0
index efe1b47..00ae36b 100644
@@ -1430,6 +1430,20 @@ static void split_bio_end(struct bio *bio, int error)
 	bio_put(bio);
 }
 
+static void blkfront_setup_persistent(struct blkfront_info *info)
+{
+	unsigned int persistent;
+	int err;
+
+	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
+			    "feature-persistent", "%u", &persistent,
+			    NULL);
+	if (err)
+		info->feature_persistent = 0;
+	else
+		info->feature_persistent = persistent;
+}
+
 static int blkif_recover(struct blkfront_info *info)
 {
 	int i;
@@ -1456,6 +1470,7 @@ static int blkif_recover(struct blkfront_info *info)
 	info->shadow_free = info->ring.req_prod_pvt;
 	info->shadow[BLK_RING_SIZE-1].req.u.rw.id = 0x0fffffff;
 
+	blkfront_setup_persistent(info);
 	rc = blkfront_setup_indirect(info);
 	if (rc) {
 		kfree(copy);
@@ -1851,13 +1866,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	if (!err && discard)
 		blkfront_setup_discard(info);
 
Quoted 11 lines

drivers/block/xen-blkfront.c static void blkfront_connect(struct blkfront_info *info) · line 1869

Quoted 8 lines
drivers/block/xen-blkfront.c +1 -7
-	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-persistent", "%u", &persistent,
-			    NULL);
-	if (err)
-		info->feature_persistent = 0;
-	else
-		info->feature_persistent = persistent;
+	blkfront_setup_persistent(info);

Should we also flush the ones that are on the info->grants list if we turning it off?

This path is only taken on the first connection, further calls to blkfront_connect from resume code don't get here, because they take the BLKIF_STATE_SUSPENDED path and just call blkif_recover and return. And on disconnection blkfront_connect doesn't even get called.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
In reply to Roger Pau Monné

Ping?

Quoted 75 lines · Roger Pau Monné
Quoted 49 lines · Konrad Rzeszutek Wilk
Quoted 48 lines · Roger Pau Monne

We are missing a check to see if the backend supports persistent grants on resume, meaning we will always run with the value fetched from the firsts host on which we run on.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
drivers/block/xen-blkfront.c +15 -0
index efe1b47..00ae36b 100644
@@ -1430,6 +1430,20 @@ static void split_bio_end(struct bio *bio, int error)
 	bio_put(bio);
 }
 
+static void blkfront_setup_persistent(struct blkfront_info *info)
+{
+	unsigned int persistent;
+	int err;
+
+	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
+			    "feature-persistent", "%u", &persistent,
+			    NULL);
+	if (err)
+		info->feature_persistent = 0;
+	else
+		info->feature_persistent = persistent;
+}
+
 static int blkif_recover(struct blkfront_info *info)
 {
 	int i;
@@ -1456,6 +1470,7 @@ static int blkif_recover(struct blkfront_info *info)
 	info->shadow_free = info->ring.req_prod_pvt;
 	info->shadow[BLK_RING_SIZE-1].req.u.rw.id = 0x0fffffff;
 
+	blkfront_setup_persistent(info);
 	rc = blkfront_setup_indirect(info);
 	if (rc) {
 		kfree(copy);
@@ -1851,13 +1866,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	if (!err && discard)
 		blkfront_setup_discard(info);
 
Quoted 11 lines

drivers/block/xen-blkfront.c static void blkfront_connect(struct blkfront_info *info) · line 1869

Quoted 8 lines
drivers/block/xen-blkfront.c +1 -7
-	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-persistent", "%u", &persistent,
-			    NULL);
-	if (err)
-		info->feature_persistent = 0;
-	else
-		info->feature_persistent = persistent;
+	blkfront_setup_persistent(info);

Should we also flush the ones that are on the info->grants list if we turning it off?

This path is only taken on the first connection, further calls to blkfront_connect from resume code don't get here, because they take the BLKIF_STATE_SUSPENDED path and just call blkif_recover and return. And on disconnection blkfront_connect doesn't even get called.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 49 lines · Konrad Rzeszutek Wilk
Quoted 48 lines · Roger Pau Monne

We are missing a check to see if the backend supports persistent grants on resume, meaning we will always run with the value fetched from the firsts host on which we run on.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
drivers/block/xen-blkfront.c +15 -0
index efe1b47..00ae36b 100644
@@ -1430,6 +1430,20 @@ static void split_bio_end(struct bio *bio, int error)
 	bio_put(bio);
 }
 
+static void blkfront_setup_persistent(struct blkfront_info *info)
+{
+	unsigned int persistent;
+	int err;
+
+	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
+			    "feature-persistent", "%u", &persistent,
+			    NULL);
+	if (err)
+		info->feature_persistent = 0;
+	else
+		info->feature_persistent = persistent;
+}
+
 static int blkif_recover(struct blkfront_info *info)
 {
 	int i;
@@ -1456,6 +1470,7 @@ static int blkif_recover(struct blkfront_info *info)
 	info->shadow_free = info->ring.req_prod_pvt;
 	info->shadow[BLK_RING_SIZE-1].req.u.rw.id = 0x0fffffff;
 
+	blkfront_setup_persistent(info);
 	rc = blkfront_setup_indirect(info);
 	if (rc) {
 		kfree(copy);
@@ -1851,13 +1866,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	if (!err && discard)
 		blkfront_setup_discard(info);
 
Quoted 11 lines

drivers/block/xen-blkfront.c static void blkfront_connect(struct blkfront_info *info) · line 1869

Quoted 8 lines
drivers/block/xen-blkfront.c +1 -7
-	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-persistent", "%u", &persistent,
-			    NULL);
-	if (err)
-		info->feature_persistent = 0;
-	else
-		info->feature_persistent = persistent;
+	blkfront_setup_persistent(info);

Should we also flush the ones that are on the info->grants list if we turning it off?

This path is only taken on the first connection, further calls to blkfront_connect from resume code don't get here, because they take the BLKIF_STATE_SUSPENDED path and just call blkif_recover and return. And on disconnection blkfront_connect doesn't even get called.

Roger.