From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: Get rid of KVM_REQ_KICK Date: Tue, 04 May 2010 19:49:40 +0300 Message-ID: <4BE05024.70608@redhat.com> References: <1272896348-13514-1-git-send-email-avi@redhat.com> <20100504163150.GC20497@amt.cnet> <4BE04E85.8020608@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:55079 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754890Ab0EDQtm (ORCPT ); Tue, 4 May 2010 12:49:42 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o44GngkZ025228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 4 May 2010 12:49:42 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o44GnfbH000450 for ; Tue, 4 May 2010 12:49:41 -0400 In-Reply-To: <4BE04E85.8020608@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/04/2010 07:42 PM, Avi Kivity wrote: >>> @@ -5470,7 +5473,7 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu) >>> >>> me = get_cpu(); >>> if (cpu != me&& (unsigned)cpu< nr_cpu_ids&& cpu_online(cpu)) >>> - if (!test_and_set_bit(KVM_REQ_KICK,&vcpu->requests)) >>> + if (atomic_xchg(&vcpu->guest_mode, 0)) >>> smp_send_reschedule(cpu); >>> put_cpu(); > > > The atomic_xchg() does the trick. > btw, things like this should go into locking.txt. It's definitely tricky. -- error compiling committee.c: too many arguments to function