From: Bob Liu <bob.liu@oracle.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
konrad.wilk@oracle.com, jgross@suse.com
Subject: Re: [PATCH 3/3] xen-blkfront: dynamic configuration of per-vbd resources
Date: Mon, 25 Jul 2016 19:08:36 +0800 [thread overview]
Message-ID: <5795F334.4040106@oracle.com> (raw)
In-Reply-To: <20160725105314.aatqpi4rxaxntt5b@mac>
On 07/25/2016 06:53 PM, Roger Pau Monné wrote:
..[snip..]
>>>> * We get the device lock and blk_mq_freeze_queue() in dynamic_reconfig_device(),
>>>> and then have to release in blkif_recover() asynchronously which makes the code more difficult to readable.
>>>
>>> I'm not sure I'm following here, do you mean that you will pick the lock in
>>> dynamic_reconfig_device and release it in blkif_recover? Why wouldn't you
>>
>> Yes.
>>
>>> release the lock in dynamic_reconfig_device after doing whatever is needed?
>>>
>>
>> Both 'dynamic configuration' and migration:xenbus_dev_resume() use { blkfront_resume(); blkif_recover() } and depends on the change of xbdev->state.
>> If they happen simultaneously, the State machine of xbdev->state is going to be a mess and very difficult to track.
>>
>> The lock(actually a mutex) is like a big lock to make sure no race would happen at all.
>
> So the only thing that you should do is set the frontend state to closed and
> wait for the backend to also switch to state closed, and then switch the
> frontend state to init again in order to trigger a reconnection.
>
But if migration:xenbus_dev_resume() is triggered at the same time, any state be set might be changed.
=====
E.g
Dynamic_reconfig_device: Migration:xenbus_dev_resume()
Set the frontend state to closed
^^^^
frontend state will be reset to XenbusStateInitialising by xenbus_dev_resume()
Wait for the backend to also switch to state closed
=====
Similar situation may happen at any other place regarding set the state.
> You are right that all this process depends on the state being updated
> correctly, but I don't see how's that different from a normal connection or
> resume, and we don't seem to have races there.
>
next prev parent reply other threads:[~2016-07-25 11:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-15 9:31 [PATCH 1/3] xen-blkfront: fix places not updated after introducing 64KB page granularity Bob Liu
2016-07-15 9:31 ` [PATCH 2/3] xen-blkfront: introduce blkif_set_queue_limits() Bob Liu
2016-07-21 8:29 ` Roger Pau Monné
2016-07-21 9:44 ` Bob Liu
2016-07-15 9:31 ` [PATCH 3/3] xen-blkfront: dynamic configuration of per-vbd resources Bob Liu
2016-07-21 8:57 ` Roger Pau Monné
2016-07-21 10:08 ` Bob Liu
2016-07-22 7:45 ` Roger Pau Monné
2016-07-22 8:17 ` Bob Liu
2016-07-22 9:34 ` Roger Pau Monné
2016-07-22 9:43 ` Bob Liu
2016-07-22 11:45 ` Roger Pau Monné
2016-07-22 22:18 ` Bob Liu
2016-07-25 9:20 ` Roger Pau Monné
2016-07-25 10:29 ` Bob Liu
2016-07-25 10:53 ` Roger Pau Monné
2016-07-25 11:08 ` Bob Liu [this message]
2016-07-25 12:11 ` Roger Pau Monné
2016-07-25 12:25 ` Bob Liu
2016-07-21 8:06 ` [PATCH 1/3] xen-blkfront: fix places not updated after introducing 64KB page granularity 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=5795F334.4040106@oracle.com \
--to=bob.liu@oracle.com \
--cc=jgross@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roger.pau@citrix.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 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).