From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933365AbcAYQPA (ORCPT ); Mon, 25 Jan 2016 11:15:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48143 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932339AbcAYQO4 (ORCPT ); Mon, 25 Jan 2016 11:14:56 -0500 Subject: Re: [PATCH v3 2/4] KVM: x86: Use vector-hashing to deliver lowest-priority interrupts To: =?UTF-8?Q?Radim_Krcm=c3=a1r?= 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> <20160122140154.GD14104@potion.brq.redhat.com> <56A61432.3010500@redhat.com> <20160125152040.GC21252@potion.brq.redhat.com> Cc: "Wu, Feng" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" From: Paolo Bonzini X-Enigmail-Draft-Status: N1110 Message-ID: <56A649FA.7010209@redhat.com> Date: Mon, 25 Jan 2016 17:14:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160125152040.GC21252@potion.brq.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/01/2016 16:20, Radim Krcmár wrote: > 2016-01-25 13:25+0100, Paolo Bonzini: >> On 22/01/2016 15:01, Radim Krcmár wrote: >>>> for (i = 0; i <= mod; i++) { >>>> idx = find_next_bit(bitmap, bitmap_size, idx + 1); >>>> BUG_ON(idx == bitmap_size); >>>> } >> >> WARN_ON, not BUG_ON. > > Callers don't check the return value for an error, because every error > is a BUG now. I think that we should check if we return bitmap_size. > (Current paths could dereference NULL or throw unrelated warnings.) You can probably just return a random number (e.g. zero or find_first_bit) if the bug is hit. But really, the bug is easy enough to verify that BUG_ON might even be okay... Paolo