[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [s390] possible deadlock in handle_sigp?
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [s390] possible deadlock in handle_sigp? |
Date: |
Thu, 15 Sep 2016 22:50:11 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 15/09/2016 21:21, David Hildenbrand wrote:
> Smells like having to provide a lock per CPU. Trylock that lock, if that's not
> possible, cc=busy. SIGP SET ARCHITECTURE has to lock all CPUs.
Makes sense. On the other hand:
- you have to trylock both the source and the destination, I think.
- since no one ever does a lock, only a trylock, the trylock can be
replaced by a simple test-and-set of a flag in S390CPU (e.g.
cpu->doing_sigp). Because the access to the bitmap _is_ protected by
the BQL, it needn't even use atomics and it can be as simple as
static bool start_sigp(S390CPU *src, S390CPU *dst)
{
if (!src->in_sigp && !dst->in_sigp) {
src->in_sigp = dst->in_sigp = true;
return true;
}
return false;
}
and end_sigp is similarly obvious.
Thanks,
Paolo
> That was the initital design, until I realized that this was all protected by
> the BQL.
- [Qemu-devel] [s390] possible deadlock in handle_sigp?, Paolo Bonzini, 2016/09/12
- Re: [Qemu-devel] [s390] possible deadlock in handle_sigp?, Christian Borntraeger, 2016/09/12
- Re: [Qemu-devel] [s390] possible deadlock in handle_sigp?, Paolo Bonzini, 2016/09/12
- Re: [Qemu-devel] [s390] possible deadlock in handle_sigp?, Christian Borntraeger, 2016/09/13
- Re: [Qemu-devel] [s390] possible deadlock in handle_sigp?, David Hildenbrand, 2016/09/15
- Re: [Qemu-devel] [s390] possible deadlock in handle_sigp?,
Paolo Bonzini <=
- Re: [Qemu-devel] [s390] possible deadlock in handle_sigp?, Christian Borntraeger, 2016/09/19
- Re: [Qemu-devel] [s390] possible deadlock in handle_sigp?, David Hildenbrand, 2016/09/19
- Re: [Qemu-devel] [s390] possible deadlock in handle_sigp?, Christian Borntraeger, 2016/09/19
[Qemu-devel] [PATCH] s390x/kvm: Fix potential deadlock in sigp handling, Christian Borntraeger, 2016/09/20