From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCUgX-0005Ri-4Z for qemu-devel@nongnu.org; Mon, 13 Jun 2016 12:25:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCUgS-0000Vd-0g for qemu-devel@nongnu.org; Mon, 13 Jun 2016 12:25:56 -0400 Received: from 9.mo173.mail-out.ovh.net ([46.105.72.44]:33443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCUgR-0000Uf-Qf for qemu-devel@nongnu.org; Mon, 13 Jun 2016 12:25:51 -0400 Received: from player711.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id BFA96FF9B68 for ; Mon, 13 Jun 2016 18:25:49 +0200 (CEST) References: <1464694565-16784-1-git-send-email-clg@kaod.org> <574D9F0F.7060904@redhat.com> <574D9FBB.60100@kaod.org> <574DA17D.5070505@redhat.com> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <575EDE86.6080201@kaod.org> Date: Mon, 13 Jun 2016 18:25:42 +0200 MIME-Version: 1.0 In-Reply-To: <574DA17D.5070505@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] m25p80: fix test on blk_pread() return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Peter Crosthwaite , Kevin Wolf , Max Reitz , qemu-block@nongnu.org, qemu-devel@nongnu.org Hello Eric, On 05/31/2016 04:36 PM, Eric Blake wrote: > On 05/31/2016 08:29 AM, C=C3=A9dric Le Goater wrote: >> On 05/31/2016 04:26 PM, Eric Blake wrote: >>> On 05/31/2016 05:36 AM, C=C3=A9dric Le Goater wrote: >>>> commit 243e6f69c129 ("m25p80: Switch to byte-based block access") >>>> replaced blk_read() calls with blk_pread() but return values are >>>> different. >>> >>> Shoot, I completely missed that when I made the conversions. Now I n= eed >>> to re-audit that entire series to see if the same problem happened >>> anywhere else. >> >> I took a quick look and most of the calls to blk_pread() test with < 0= .=20 >> So we should be fine and I should have mention that. >> >> C.=20 >> >>>> >>>> Signed-off-by: C=C3=A9dric Le Goater >>>> --- >>>> hw/block/m25p80.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> Reviewed-by: Eric Blake >>> >>>> >>>> Index: qemu-ast2400-mainline.git/hw/block/m25p80.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>>> --- qemu-ast2400-mainline.git.orig/hw/block/m25p80.c >>>> +++ qemu-ast2400-mainline.git/hw/block/m25p80.c >>>> @@ -900,7 +900,7 @@ static int m25p80_init(SSISlave *ss) >>>> s->storage =3D blk_blockalign(s->blk, s->size); >>>> =20 >>>> /* FIXME: Move to late init */ >>>> - if (blk_pread(s->blk, 0, s->storage, s->size)) { >>>> + if (blk_pread(s->blk, 0, s->storage, s->size) !=3D s->size)= { >=20 > As it is, blk_pread() (and blk_pwrite()) _always_ returns negative or > the input count value; it appears that it is incapable of reporting a > short read amount. I guess that's intentional, but a bit odd, when > compared to the standard read()/write(). It seems that commit 243e6f69c129 ("m25p80: Switch to byte-based block ac= cess")=20 is bringing another issue : qemu-system-arm: /home/legoater/work/qemu/qemu-ast2400-mainline.git/block= /io.c:1252: bdrv_aligned_pwritev: Assertion `!qiov || bytes =3D=3D qiov->= size' failed. Aborted (core dumped) The flash page size is 256.=20 How should we handle this ?=20 Thanks, C.