* [PATCH] ARM: KVM: fix unbalanced get_cpu() in access_dcsw
@ 2013-04-12 17:13 Marc Zyngier
2013-04-12 18:13 ` Will Deacon
0 siblings, 1 reply; 4+ messages in thread
From: Marc Zyngier @ 2013-04-12 17:13 UTC (permalink / raw)
To: linux-arm-kernel
In the very unlikely event where a guest would be foolish enough to
*read* from a write-only cache maintainance register, we end up
with preemption disabled, due to a misplaced get_cpu().
Just move the "is_write" test outside of the critical section.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/kvm/coproc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index 94eee8b..8eea97b 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -79,11 +79,11 @@ static bool access_dcsw(struct kvm_vcpu *vcpu,
unsigned long val;
int cpu;
- cpu = get_cpu();
-
if (!p->is_write)
return read_from_write_only(vcpu, p);
+ cpu = get_cpu();
+
cpumask_setall(&vcpu->arch.require_dcache_flush);
cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM: KVM: fix unbalanced get_cpu() in access_dcsw
2013-04-12 17:13 [PATCH] ARM: KVM: fix unbalanced get_cpu() in access_dcsw Marc Zyngier
@ 2013-04-12 18:13 ` Will Deacon
2013-04-12 19:17 ` Marc Zyngier
0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2013-04-12 18:13 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 12, 2013 at 06:13:48PM +0100, Marc Zyngier wrote:
> In the very unlikely event where a guest would be foolish enough to
> *read* from a write-only cache maintainance register, we end up
> with preemption disabled, due to a misplaced get_cpu().
>
> Just move the "is_write" test outside of the critical section.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
I found it second time around!
Reported-by: Will Deacon <will.deacon@arm.com>
Will
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: KVM: fix unbalanced get_cpu() in access_dcsw
2013-04-12 18:13 ` Will Deacon
@ 2013-04-12 19:17 ` Marc Zyngier
2013-04-15 6:46 ` Christoffer Dall
0 siblings, 1 reply; 4+ messages in thread
From: Marc Zyngier @ 2013-04-12 19:17 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 12 Apr 2013 19:13:32 +0100, Will Deacon <will.deacon@arm.com>
wrote:
> On Fri, Apr 12, 2013 at 06:13:48PM +0100, Marc Zyngier wrote:
>> In the very unlikely event where a guest would be foolish enough to
>> *read* from a write-only cache maintainance register, we end up
>> with preemption disabled, due to a misplaced get_cpu().
>>
>> Just move the "is_write" test outside of the critical section.
>>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>
> I found it second time around!
>
> Reported-by: Will Deacon <will.deacon@arm.com>
Indeed you did! :-)
I'll add that to the commit, and on a couple of other as well...
M.
--
Fast, cheap, reliable. Pick two.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: KVM: fix unbalanced get_cpu() in access_dcsw
2013-04-12 19:17 ` Marc Zyngier
@ 2013-04-15 6:46 ` Christoffer Dall
0 siblings, 0 replies; 4+ messages in thread
From: Christoffer Dall @ 2013-04-15 6:46 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 12, 2013 at 09:17:46PM +0200, Marc Zyngier wrote:
> On Fri, 12 Apr 2013 19:13:32 +0100, Will Deacon <will.deacon@arm.com>
> wrote:
> > On Fri, Apr 12, 2013 at 06:13:48PM +0100, Marc Zyngier wrote:
> >> In the very unlikely event where a guest would be foolish enough to
> >> *read* from a write-only cache maintainance register, we end up
> >> with preemption disabled, due to a misplaced get_cpu().
> >>
> >> Just move the "is_write" test outside of the critical section.
> >>
> >> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> >
> > I found it second time around!
> >
> > Reported-by: Will Deacon <will.deacon@arm.com>
>
> Indeed you did! :-)
>
> I'll add that to the commit, and on a couple of other as well...
I applied the patch and added the tag, thanks.
-Christoffer
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-15 6:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-12 17:13 [PATCH] ARM: KVM: fix unbalanced get_cpu() in access_dcsw Marc Zyngier
2013-04-12 18:13 ` Will Deacon
2013-04-12 19:17 ` Marc Zyngier
2013-04-15 6:46 ` Christoffer Dall
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).