linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen-blkfront: check feature-persitent on resume
@ 2014-05-22 14:40 Roger Pau Monne
  2014-05-23 17:51 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 4+ messages in thread
From: Roger Pau Monne @ 2014-05-22 14:40 UTC (permalink / raw)
  To: xen-devel, linux-kernel
  Cc: Roger Pau Monne, Konrad Rzeszutek Wilk, David Vrabel

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.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
---
 drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index efe1b47..00ae36b 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -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) {
-- 
1.7.7.5 (Apple Git-26)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen-blkfront: check feature-persitent on resume
  2014-05-22 14:40 [PATCH] xen-blkfront: check feature-persitent on resume Roger Pau Monne
@ 2014-05-23 17:51 ` Konrad Rzeszutek Wilk
  2014-05-23 18:08   ` Roger Pau Monné
  0 siblings, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-05-23 17:51 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, linux-kernel, David Vrabel

On Thu, May 22, 2014 at 04:40:07PM +0200, Roger Pau Monne wrote:
> 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.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> ---
>  drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
>  1 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index efe1b47..00ae36b 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -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);

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

>  
>  	err = blkfront_setup_indirect(info);
>  	if (err) {
> -- 
> 1.7.7.5 (Apple Git-26)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen-blkfront: check feature-persitent on resume
  2014-05-23 17:51 ` Konrad Rzeszutek Wilk
@ 2014-05-23 18:08   ` Roger Pau Monné
  2014-06-13 15:37     ` [Xen-devel] " Roger Pau Monné
  0 siblings, 1 reply; 4+ messages in thread
From: Roger Pau Monné @ 2014-05-23 18:08 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel, linux-kernel, David Vrabel

On 23/05/14 19:51, Konrad Rzeszutek Wilk wrote:
> On Thu, May 22, 2014 at 04:40:07PM +0200, Roger Pau Monne wrote:
>> 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.
>>
>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>> Cc: David Vrabel <david.vrabel@citrix.com>
>> ---
>>  drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
>>  1 files changed, 16 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index efe1b47..00ae36b 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -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);
> 
> 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xen-devel] [PATCH] xen-blkfront: check feature-persitent on resume
  2014-05-23 18:08   ` Roger Pau Monné
@ 2014-06-13 15:37     ` Roger Pau Monné
  0 siblings, 0 replies; 4+ messages in thread
From: Roger Pau Monné @ 2014-06-13 15:37 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel, linux-kernel, David Vrabel

Ping?

On 23/05/14 20:08, Roger Pau Monné wrote:
> On 23/05/14 19:51, Konrad Rzeszutek Wilk wrote:
>> On Thu, May 22, 2014 at 04:40:07PM +0200, Roger Pau Monne wrote:
>>> 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.
>>>
>>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>>> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> Cc: David Vrabel <david.vrabel@citrix.com>
>>> ---
>>>  drivers/block/xen-blkfront.c |   23 ++++++++++++++++-------
>>>  1 files changed, 16 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>>> index efe1b47..00ae36b 100644
>>> --- a/drivers/block/xen-blkfront.c
>>> +++ b/drivers/block/xen-blkfront.c
>>> @@ -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);
>>
>> 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
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-13 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-22 14:40 [PATCH] xen-blkfront: check feature-persitent on resume Roger Pau Monne
2014-05-23 17:51 ` Konrad Rzeszutek Wilk
2014-05-23 18:08   ` Roger Pau Monné
2014-06-13 15:37     ` [Xen-devel] " Roger Pau Monné

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).