From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH 2/2] kvmtool: assume dead vcpus are paused too Date: Wed, 4 Nov 2015 18:51:12 -0500 Message-ID: <563A99F0.10100@oracle.com> References: <1445265650-25616-1-git-send-email-sasha.levin@oracle.com> <1445265650-25616-2-git-send-email-sasha.levin@oracle.com> <20151027160802.GD20208@arm.com> <56302E2C.2010207@oracle.com> <20151028122745.GC29512@arm.com> <5630C6D7.2020608@oracle.com> <20151028133425.GB18966@arm.com> <20151104115112.GE5405@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: andre.przywara@arm.com, josh@joshtriplett.org, penberg@kernel.org, asias.hejun@gmail.com, kvm@vger.kernel.org To: Will Deacon Return-path: Received: from userp1040.oracle.com ([156.151.31.81]:30725 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932491AbbKDXv0 (ORCPT ); Wed, 4 Nov 2015 18:51:26 -0500 In-Reply-To: <20151104115112.GE5405@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/04/2015 06:51 AM, Will Deacon wrote: > + mutex_lock(&pause_lock); > + > + /* The kvm->cpus array contains a null pointer in the last location */ > + for (i = 0; ; i++) { > + if (kvm->cpus[i]) > + pthread_kill(kvm->cpus[i]->thread, SIGKVMEXIT); > + else > + break; > + } > + > + kvm__continue(kvm); In this scenario: if we grabbed pause_lock, signaled vcpu0 to exit, and it did before we called kvm__continue(), we won't end up releasing pause_lock, which might cause a lockup later, no? Thanks, Sasha