mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bob Liu <bob.liu@oracle.com>
To: xen-devel@lists.xen.org
Cc: david.vrabel@citrix.com, justing@spectralogic.com,
	konrad.wilk@oracle.com, roger.pau@citrix.com,
	paul.durrant@citrix.com, linux-kernel@vger.kernel.org,
	Bob Liu <bob.liu@oracle.com>
Subject: [PATCH 1/2] driver: xen-blkfront: move talk_to_blkback to the correct place
Date: Tue, 12 May 2015 19:01:43 +0800	[thread overview]
Message-ID: <1431428504-6623-1-git-send-email-bob.liu@oracle.com> (raw)

The right place for talk_to_blkback() to query backend features and transport
parameters is after backend entered XenbusStateInitWait. There is no problem
with this yet, but it is an violation of the design and furthermore it would not
allow frontend/backend to negotiate 'multi-page' and 'multi-queue' features
which require this.

This patch move talk_to_blkback() to blkback_changed() after backend entered
XenbusStateInitWait just like blkif.h defined:

See: xen/include/public/io/blkif.h
Front                                Back
=================================    =====================================
XenbusStateInitialising              XenbusStateInitialising
 o Query virtual device               o Query backend device identification
   properties.                          data.
 o Setup OS device instance.          o Open and validate backend device.
                                      o Publish backend features and
                                        transport parameters.
                                                     |
                                                     |
                                                     V
                                     XenbusStateInitWait

o Query backend features and
  transport parameters.
o Allocate and initialize the
  request ring.
o Publish transport parameters
  that will be in effect during
  this connection.
             |
             |
             V
XenbusStateInitialised

                                      o Query frontend transport parameters.
                                      o Connect to the request ring and
                                        event channel.
                                      o Publish backend device properties.
                                                     |
                                                     |
                                                     V
                                     XenbusStateConnected

 o Query backend device properties.
 o Finalize OS virtual device
   instance.
             |
             |
             V
XenbusStateConnected

Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
 drivers/block/xen-blkfront.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 2c61cf8..88e23fd 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1430,13 +1430,6 @@ static int blkfront_probe(struct xenbus_device *dev,
 	info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
 	dev_set_drvdata(&dev->dev, info);
 
-	err = talk_to_blkback(dev, info);
-	if (err) {
-		kfree(info);
-		dev_set_drvdata(&dev->dev, NULL);
-		return err;
-	}
-
 	return 0;
 }
 
@@ -1906,8 +1899,13 @@ static void blkback_changed(struct xenbus_device *dev,
 	dev_dbg(&dev->dev, "blkfront:blkback_changed to state %d.\n", backend_state);
 
 	switch (backend_state) {
-	case XenbusStateInitialising:
 	case XenbusStateInitWait:
+		if (talk_to_blkback(dev, info)) {
+			kfree(info);
+			dev_set_drvdata(&dev->dev, NULL);
+			break;
+		}
+	case XenbusStateInitialising:
 	case XenbusStateInitialised:
 	case XenbusStateReconfiguring:
 	case XenbusStateReconfigured:
-- 
1.8.3.1


             reply	other threads:[~2015-05-12 11:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 11:01 Bob Liu [this message]
2015-05-12 11:01 ` [PATCH v3 2/2] xen/block: add multi-page ring support Bob Liu
2015-05-15 11:13   ` Roger Pau Monné
2015-05-15 12:06     ` Bob Liu
2015-05-20  9:34       ` Roger Pau Monné
2015-05-15 10:01 ` [PATCH 1/2] driver: xen-blkfront: move talk_to_blkback to the correct place Roger Pau Monné
2015-05-15 11:03   ` Bob Liu
2015-05-15 11:14     ` Roger Pau Monné
2015-05-15 11:35       ` Bob Liu
2015-05-15 11:57         ` Roger Pau Monné

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=1431428504-6623-1-git-send-email-bob.liu@oracle.com \
    --to=bob.liu@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=justing@spectralogic.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.durrant@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®