From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgsFX-0005nZ-7s for qemu-devel@nongnu.org; Mon, 05 Sep 2016 07:39:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgsFS-0007Ou-7R for qemu-devel@nongnu.org; Mon, 05 Sep 2016 07:39:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgsFS-0007Oj-1B for qemu-devel@nongnu.org; Mon, 05 Sep 2016 07:39:34 -0400 References: <1472884428-9975-1-git-send-email-ppandit@redhat.com> From: Paolo Bonzini Message-ID: Date: Mon, 5 Sep 2016 13:39:29 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] scsi: pvscsi: request descriptor data_length to 32 bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: P J P Cc: Qemu Developers , Dmitry Fleytman , Li Qiang On 05/09/2016 13:13, P J P wrote: > +-- On Mon, 5 Sep 2016, Paolo Bonzini wrote --+ > | No, that's not what happens. chunk_size is set to sg.resid, after which: > | > | sg.dataAddr += chunk_size; > | data_length -= chunk_size; > | sg.resid -= chunk_size; > | > | The loop is reentered with sg.resid == 0, it calls into > | pvscsi_get_next_sg_elem and this sets sg.resid to a nonzero value. It's > | not an infinite loop. > > Yes, true; But 'pvscsi_get_next_sg_elem' does not return non-zero 'sg.resid' > each time. In fact, it returns more zeros and thus the loop iterates > infinitely. When I ran it with 64 bit 'data_length' and without cast, after > some time, the inner loop gets stuck and does not seem to read non-zero values > into 'sg.resid'. pvscsi_get_next_sg_elem just reads 16 bytes from guest RAM, so I guess that's because you didn't set up the SG list correctly. QEMU indeed doesn't check for that, but that's a different bug. > Is there limit to number of SG elements? Without a public spec it's hard, but I guess 2048 is more than enough. Paolo