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.

Reply via email to