From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?Q?Krcm=C3=A1r?= Subject: Re: [PATCH v3 2/4] KVM: x86: Use vector-hashing to deliver lowest-priority interrupts Date: Fri, 22 Jan 2016 15:01:54 +0100 Message-ID: <20160122140154.GD14104@potion.brq.redhat.com> References: <1453254177-103002-1-git-send-email-feng.wu@intel.com> <1453254177-103002-3-git-send-email-feng.wu@intel.com> <20160121194950.GC17514@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: "pbonzini@redhat.com" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" To: "Wu, Feng" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43041 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753569AbcAVOB6 (ORCPT ); Fri, 22 Jan 2016 09:01:58 -0500 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 2016-01-22 05:12+0000, Wu, Feng: >> From: Radim Kr=C4=8Dm=C3=A1=C5=99 [mailto:rkrcmar@redhat.com] >> 2016-01-20 09:42+0800, Feng Wu: >> > +{ >> > + u32 mod; >> > + int i, idx =3D 0; >> > + >> > + mod =3D vector % dest_vcpus; >> > + >> > + for (i =3D 0; i <=3D mod; i++) { >> > + idx =3D find_next_bit(bitmap, bitmap_size, idx) + 1; >>=20 >> I'd remove this "+ 1". Current users don't check for errors and alw= ays >> do "- 1". The new error value could be 'idx =3D bitmap_size', with = u32 as >> return type. >>=20 >=20 > Does the following code look good to you: >=20 > u32 mod; > int i, idx =3D -1; >=20 > mod =3D vector % dest_vcpus; >=20 > for (i =3D 0; i <=3D mod; i++) { > idx =3D find_next_bit(bitmap, bitmap_size, idx + 1); > BUG_ON(idx =3D=3D bitmap_size); > } >=20 > return idx; It's ok, thanks.