All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts
@ 2010-09-30 19:28 Scott Wood
  2010-09-30 22:07 ` [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts disabled Alexander Graf
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Scott Wood @ 2010-09-30 19:28 UTC (permalink / raw)
  To: kvm-ppc

It is not legal to call mutex_lock() with interrupts disabled.
This will assert with debug checks enabled.

If there's a real need to disable interrupts here, it could be done
after the mutex is acquired -- but I don't see why it's needed at all.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/kvm/timing.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/timing.c b/arch/powerpc/kvm/timing.c
index 46fa04f..a021f58 100644
--- a/arch/powerpc/kvm/timing.c
+++ b/arch/powerpc/kvm/timing.c
@@ -35,7 +35,6 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
 	int i;
 
 	/* pause guest execution to avoid concurrent updates */
-	local_irq_disable();
 	mutex_lock(&vcpu->mutex);
 
 	vcpu->arch.last_exit_type = 0xDEAD;
@@ -51,7 +50,6 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
 	vcpu->arch.timing_last_enter.tv64 = 0;
 
 	mutex_unlock(&vcpu->mutex);
-	local_irq_enable();
 }
 
 static void add_exit_timing(struct kvm_vcpu *vcpu, u64 duration, int type)
-- 
1.7.0.4


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

* Re: [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts disabled
  2010-09-30 19:28 [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts Scott Wood
@ 2010-09-30 22:07 ` Alexander Graf
  2010-10-04  5:22 ` Christian Ehrhardt
  2010-10-04  8:18 ` Alexander Graf
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2010-09-30 22:07 UTC (permalink / raw)
  To: kvm-ppc


On 30.09.2010, at 21:28, Scott Wood wrote:

> It is not legal to call mutex_lock() with interrupts disabled.
> This will assert with debug checks enabled.
> 
> If there's a real need to disable interrupts here, it could be done
> after the mutex is acquired -- but I don't see why it's needed at all.

Christian, IIRC this code is yours. Any comments?

Alex

> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> arch/powerpc/kvm/timing.c |    2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/timing.c b/arch/powerpc/kvm/timing.c
> index 46fa04f..a021f58 100644
> --- a/arch/powerpc/kvm/timing.c
> +++ b/arch/powerpc/kvm/timing.c
> @@ -35,7 +35,6 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
> 	int i;
> 
> 	/* pause guest execution to avoid concurrent updates */
> -	local_irq_disable();
> 	mutex_lock(&vcpu->mutex);
> 
> 	vcpu->arch.last_exit_type = 0xDEAD;
> @@ -51,7 +50,6 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
> 	vcpu->arch.timing_last_enter.tv64 = 0;
> 
> 	mutex_unlock(&vcpu->mutex);
> -	local_irq_enable();
> }
> 
> static void add_exit_timing(struct kvm_vcpu *vcpu, u64 duration, int type)
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts disabled
  2010-09-30 19:28 [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts Scott Wood
  2010-09-30 22:07 ` [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts disabled Alexander Graf
@ 2010-10-04  5:22 ` Christian Ehrhardt
  2010-10-04  8:18 ` Alexander Graf
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2010-10-04  5:22 UTC (permalink / raw)
  To: kvm-ppc


On 10/01/2010 12:07 AM, Alexander Graf wrote:
>
> On 30.09.2010, at 21:28, Scott Wood wrote:
>
>> It is not legal to call mutex_lock() with interrupts disabled.
>> This will assert with debug checks enabled.
>>
>> If there's a real need to disable interrupts here, it could be done
>> after the mutex is acquired -- but I don't see why it's needed at all.
>
> Christian, IIRC this code is yours. Any comments?

Yes, It should be save to drop the irq_disable.
IIRC it was without the lock in early stages of development (pre 
upstream git, so you can't see it) which had some obvious races.
But the lock makes it mutually exclusive per vcpu and should ensure it 
isn't running - by that it should be fine.

Reviewed-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

> Alex
>
>>
>> Signed-off-by: Scott Wood<scottwood@freescale.com>
>> ---
>> arch/powerpc/kvm/timing.c |    2 --
>> 1 files changed, 0 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/kvm/timing.c b/arch/powerpc/kvm/timing.c
>> index 46fa04f..a021f58 100644
>> --- a/arch/powerpc/kvm/timing.c
>> +++ b/arch/powerpc/kvm/timing.c
>> @@ -35,7 +35,6 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
>> 	int i;
>>
>> 	/* pause guest execution to avoid concurrent updates */
>> -	local_irq_disable();
>> 	mutex_lock(&vcpu->mutex);
>>
>> 	vcpu->arch.last_exit_type = 0xDEAD;
>> @@ -51,7 +50,6 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
>> 	vcpu->arch.timing_last_enter.tv64 = 0;
>>
>> 	mutex_unlock(&vcpu->mutex);
>> -	local_irq_enable();
>> }
>>
>> static void add_exit_timing(struct kvm_vcpu *vcpu, u64 duration, int type)
>> --
>> 1.7.0.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-- 

Grüsse / regards, Christian Ehrhardt
IBM Linux Technology Center, System z Linux Performance

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

* Re: [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts disabled
  2010-09-30 19:28 [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts Scott Wood
  2010-09-30 22:07 ` [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts disabled Alexander Graf
  2010-10-04  5:22 ` Christian Ehrhardt
@ 2010-10-04  8:18 ` Alexander Graf
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2010-10-04  8:18 UTC (permalink / raw)
  To: kvm-ppc


On 04.10.2010, at 07:22, Christian Ehrhardt wrote:

> 
> On 10/01/2010 12:07 AM, Alexander Graf wrote:
>> 
>> On 30.09.2010, at 21:28, Scott Wood wrote:
>> 
>>> It is not legal to call mutex_lock() with interrupts disabled.
>>> This will assert with debug checks enabled.
>>> 
>>> If there's a real need to disable interrupts here, it could be done
>>> after the mutex is acquired -- but I don't see why it's needed at all.
>> 
>> Christian, IIRC this code is yours. Any comments?
> 
> Yes, It should be save to drop the irq_disable.
> IIRC it was without the lock in early stages of development (pre upstream git, so you can't see it) which had some obvious races.
> But the lock makes it mutually exclusive per vcpu and should ensure it isn't running - by that it should be fine.
> 
> Reviewed-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

Ok, applied on my kvm ppc branch.


Alex


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

end of thread, other threads:[~2010-10-04  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30 19:28 [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts Scott Wood
2010-09-30 22:07 ` [PATCH] kvmppc_init_timing_stats: fix sleep with interrupts disabled Alexander Graf
2010-10-04  5:22 ` Christian Ehrhardt
2010-10-04  8:18 ` Alexander Graf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.