From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxE3T-0006If-RF for qemu-devel@nongnu.org; Tue, 26 May 2015 08:34:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxE3O-0004Uv-Pa for qemu-devel@nongnu.org; Tue, 26 May 2015 08:33:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxE3O-0004US-J7 for qemu-devel@nongnu.org; Tue, 26 May 2015 08:33:54 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t4QCXr9G031766 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 26 May 2015 08:33:54 -0400 Message-ID: <5564682D.3020005@redhat.com> Date: Tue, 26 May 2015 14:33:49 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1430152117-100558-1-git-send-email-pbonzini@redhat.com> <1430152117-100558-25-git-send-email-pbonzini@redhat.com> <20150526122734.GW13749@ad.nay.redhat.com> In-Reply-To: <20150526122734.GW13749@ad.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 24/29] bitmap: add atomic test and clear List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, stefanha@redhat.com, mst@redhat.com On 26/05/2015 14:27, Fam Zheng wrote: > It's broken if the clear range is the last part of first word: > > map = 0xFFFFFFFFFFFFFFFF, ... > > bitmap_test_and_clear_atomic(map, 60, 4): > > Expected result: > > 0xFFFFFFFFFFFFFFFF, ... > > Actual result: > > 0x0 You're right, this: /* Full words */ while (nr - bits_to_clear >= 0) { must be surrounded by an "if (mask_to_clear == ~0UL)" or "if (bits_to_clear == BITS_PER_LONG)." Patch 23 has the same problem. Paolo