From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH RFC v2 4/4] Use macro to iterate over vcpus. Date: Tue, 26 May 2009 11:56:18 +0300 Message-ID: <4A1BAEB2.9090901@redhat.com> References: <1243266636-16914-1-git-send-email-gleb@redhat.com> <1243266636-16914-5-git-send-email-gleb@redhat.com> <4A1BA5C3.3000204@redhat.com> <20090526083759.GN3948@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: Gleb Natapov Return-path: Received: from mx2.redhat.com ([66.187.237.31]:34885 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753490AbZEZI4S (ORCPT ); Tue, 26 May 2009 04:56:18 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n4Q8uLNZ006294 for ; Tue, 26 May 2009 04:56:21 -0400 In-Reply-To: <20090526083759.GN3948@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Gleb Natapov wrote: > >>> + >>> +#define kvm_for_each_vcpu(idx, vcpup, kvm) \ >>> + for (idx = 0, vcpup = kvm_get_vcpu(kvm, idx); \ >>> + idx < atomic_read(&kvm->online_vcpus) && vcpup; \ >>> + vcpup = kvm_get_vcpu(kvm, ++idx)) >>> + >>> >>> >> This will stop when reaching the first empty vcpu slot, while current >> code skips over empty slots. Please preserve existing behaviour. >> >> > That's the idea, there is no more empty slots in vcpus array. Otherwise > we always need to iterate over MAX_CPUS and not online_vcpus. > Yes, of course. -- error compiling committee.c: too many arguments to function