mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure
@ 2015-02-20 12:29 Vitaly Kuznetsov
  2015-03-02 10:33 ` Vitaly Kuznetsov
  2015-03-05  8:06 ` Jason Wang
  0 siblings, 2 replies; 4+ messages in thread
From: Vitaly Kuznetsov @ 2015-02-20 12:29 UTC (permalink / raw)
  To: K. Y. Srinivasan, devel; +Cc: Haiyang Zhang, linux-kernel, Dexuan Cui

When add_memory() fails the following BUG is observed:
[  743.646107] hv_balloon: hot_add memory failed error is -17
[  743.679973]
[  743.680930] =====================================
[  743.680930] [ BUG: bad unlock balance detected! ]
[  743.680930] 3.19.0-rc5_bug1131426+ #552 Not tainted
[  743.680930] -------------------------------------
[  743.680930] kworker/0:2/255 is trying to release lock (&dm_device.ha_region_mutex) at:
[  743.680930] [<ffffffff81aae5fe>] mutex_unlock+0xe/0x10
[  743.680930] but there are no more locks to release!

This happens as we don't acquire ha_region_mutex and hot_add_req() expects us
to as it does unconditional mutex_unlock(). Acquire the lock on the error path.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
This patch is dependent on the previously posted 'Drivers: hv: hv_balloon:
eliminate the trylock path in acquire/release_region_mutex'.
---
 drivers/hv/hv_balloon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 1283035..771bf84 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -654,6 +654,7 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size,
 			}
 			has->ha_end_pfn -= HA_CHUNK;
 			has->covered_end_pfn -=  processed_pfn;
+			mutex_lock(&dm_device.ha_region_mutex);
 			break;
 		}
 
-- 
1.9.3


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

* Re: [PATCH] Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure
  2015-02-20 12:29 [PATCH] Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure Vitaly Kuznetsov
@ 2015-03-02 10:33 ` Vitaly Kuznetsov
  2015-03-07  0:35   ` KY Srinivasan
  2015-03-05  8:06 ` Jason Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Vitaly Kuznetsov @ 2015-03-02 10:33 UTC (permalink / raw)
  To: K. Y. Srinivasan; +Cc: devel, Haiyang Zhang, linux-kernel, Dexuan Cui

Vitaly Kuznetsov <vkuznets@redhat.com> writes:

> When add_memory() fails the following BUG is observed:
> [  743.646107] hv_balloon: hot_add memory failed error is -17
> [  743.679973]
> [  743.680930] =====================================
> [  743.680930] [ BUG: bad unlock balance detected! ]
> [  743.680930] 3.19.0-rc5_bug1131426+ #552 Not tainted
> [  743.680930] -------------------------------------
> [  743.680930] kworker/0:2/255 is trying to release lock (&dm_device.ha_region_mutex) at:
> [  743.680930] [<ffffffff81aae5fe>] mutex_unlock+0xe/0x10
> [  743.680930] but there are no more locks to release!
>
> This happens as we don't acquire ha_region_mutex and hot_add_req() expects us
> to as it does unconditional mutex_unlock(). Acquire the lock on the error path.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> This patch is dependent on the previously posted 'Drivers: hv: hv_balloon:
> eliminate the trylock path in acquire/release_region_mutex'.

Hi K.Y.,

I don't see this patch in your '[PATCH 0/7] Drivers: hv: Collection
fixes and enhancements' sent to Greg. Please let me know if you see any
issues with it as it looks like a pretty important bugfix to me.

Thanks,

> ---
>  drivers/hv/hv_balloon.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index 1283035..771bf84 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -654,6 +654,7 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size,
>  			}
>  			has->ha_end_pfn -= HA_CHUNK;
>  			has->covered_end_pfn -=  processed_pfn;
> +			mutex_lock(&dm_device.ha_region_mutex);
>  			break;
>  		}

-- 
  Vitaly

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

* Re: [PATCH] Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure
  2015-02-20 12:29 [PATCH] Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure Vitaly Kuznetsov
  2015-03-02 10:33 ` Vitaly Kuznetsov
@ 2015-03-05  8:06 ` Jason Wang
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Wang @ 2015-03-05  8:06 UTC (permalink / raw)
  To: Vitaly Kuznetsov
  Cc: K. Y. Srinivasan, devel, Haiyang Zhang, linux-kernel, Dexuan Cui



----- Original Message -----
> When add_memory() fails the following BUG is observed:
> [  743.646107] hv_balloon: hot_add memory failed error is -17
> [  743.679973]
> [  743.680930] =====================================
> [  743.680930] [ BUG: bad unlock balance detected! ]
> [  743.680930] 3.19.0-rc5_bug1131426+ #552 Not tainted
> [  743.680930] -------------------------------------
> [  743.680930] kworker/0:2/255 is trying to release lock
> (&dm_device.ha_region_mutex) at:
> [  743.680930] [<ffffffff81aae5fe>] mutex_unlock+0xe/0x10
> [  743.680930] but there are no more locks to release!
> 
> This happens as we don't acquire ha_region_mutex and hot_add_req() expects us
> to as it does unconditional mutex_unlock(). Acquire the lock on the error
> path.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>

Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> This patch is dependent on the previously posted 'Drivers: hv: hv_balloon:
> eliminate the trylock path in acquire/release_region_mutex'.
> ---
>  drivers/hv/hv_balloon.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index 1283035..771bf84 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -654,6 +654,7 @@ static void hv_mem_hot_add(unsigned long start, unsigned
> long size,
>  			}
>  			has->ha_end_pfn -= HA_CHUNK;
>  			has->covered_end_pfn -=  processed_pfn;
> +			mutex_lock(&dm_device.ha_region_mutex);
>  			break;
>  		}
>  
> --
> 1.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

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

* RE: [PATCH] Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure
  2015-03-02 10:33 ` Vitaly Kuznetsov
@ 2015-03-07  0:35   ` KY Srinivasan
  0 siblings, 0 replies; 4+ messages in thread
From: KY Srinivasan @ 2015-03-07  0:35 UTC (permalink / raw)
  To: Vitaly Kuznetsov; +Cc: devel, Haiyang Zhang, linux-kernel, Dexuan Cui



> -----Original Message-----
> From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com]
> Sent: Monday, March 2, 2015 2:34 AM
> To: KY Srinivasan
> Cc: devel@linuxdriverproject.org; Haiyang Zhang; linux-
> kernel@vger.kernel.org; Dexuan Cui
> Subject: Re: [PATCH] Drivers: hv: hv_balloon: keep locks balanced on
> add_memory() failure
> 
> Vitaly Kuznetsov <vkuznets@redhat.com> writes:
> 
> > When add_memory() fails the following BUG is observed:
> > [  743.646107] hv_balloon: hot_add memory failed error is -17 [
> > 743.679973] [  743.680930] =====================================
> > [  743.680930] [ BUG: bad unlock balance detected! ] [  743.680930]
> > 3.19.0-rc5_bug1131426+ #552 Not tainted [  743.680930]
> > -------------------------------------
> > [  743.680930] kworker/0:2/255 is trying to release lock
> (&dm_device.ha_region_mutex) at:
> > [  743.680930] [<ffffffff81aae5fe>] mutex_unlock+0xe/0x10 [
> > 743.680930] but there are no more locks to release!
> >
> > This happens as we don't acquire ha_region_mutex and hot_add_req()
> > expects us to as it does unconditional mutex_unlock(). Acquire the lock on
> the error path.
> >
> > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> > ---
> > This patch is dependent on the previously posted 'Drivers: hv: hv_balloon:
> > eliminate the trylock path in acquire/release_region_mutex'.
> 
> Hi K.Y.,
> 
> I don't see this patch in your '[PATCH 0/7] Drivers: hv: Collection fixes and
> enhancements' sent to Greg. Please let me know if you see any issues with it
> as it looks like a pretty important bugfix to me.

Yes, I am sending this patch out soon.

K. Y
> 
> Thanks,
> 
> > ---
> >  drivers/hv/hv_balloon.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index
> > 1283035..771bf84 100644
> > --- a/drivers/hv/hv_balloon.c
> > +++ b/drivers/hv/hv_balloon.c
> > @@ -654,6 +654,7 @@ static void hv_mem_hot_add(unsigned long start,
> > unsigned long size,  }  has->ha_end_pfn -= HA_CHUNK;
> > has->covered_end_pfn -=  processed_pfn;
> > +mutex_lock(&dm_device.ha_region_mutex);
> >  break;
> >  }
> 
> --
>   Vitaly


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

end of thread, other threads:[~2015-03-07  0:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 12:29 [PATCH] Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure Vitaly Kuznetsov
2015-03-02 10:33 ` Vitaly Kuznetsov
2015-03-07  0:35   ` KY Srinivasan
2015-03-05  8:06 ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome