s390x/tcg: fix locking problem with tcg_s390_tod_updated
commit30c8db0e219a3c1d8b39c19e8b858830cb141738
authorDavid Hildenbrand <david@redhat.com>
Fri, 29 Jun 2018 17:05:20 +0000 (29 19:05 +0200)
committerCornelia Huck <cohuck@redhat.com>
Mon, 2 Jul 2018 08:37:38 +0000 (2 10:37 +0200)
tree2bbe18927db1f3dbdf3bd72ab0c6bfccf9dc3994
parentd44444b0740680d996c979c8c3f63ab1c87f1cb1
s390x/tcg: fix locking problem with tcg_s390_tod_updated

tcg_s390_tod_updated() is always called with the iothread being locked
(e.g. from S390TODClass->set() e.g. via HELPER(sck) or on incoming
migration). The helper we call takes the lock itself - bad.

Let's change that by factoring out updating the ckc timer. This now looks
much nicer than having to call a helper from another function.

While touching it we also make sure that env->ckc is updated even if the
new value is -1ULL, for now it would not have been modified in that case.

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180629170520.13671-1-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
target/s390x/misc_helper.c