From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Suiii-0004wb-9w for qemu-devel@nongnu.org; Fri, 27 Jul 2012 07:28:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Suiie-0001OD-5F for qemu-devel@nongnu.org; Fri, 27 Jul 2012 07:28:36 -0400 Message-ID: <50127B5B.2070500@suse.de> Date: Fri, 27 Jul 2012 13:28:27 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] ahci: Fix ahci cdrom read corruptions for reads > 128k List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Baron Cc: kwolf@redhat.com, aliguori@us.ibm.com, armbru@redhat.com, qemu-stable@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de, alex.williamson@redhat.com, avi@redhat.com, pbonzini@redhat.com, Bruce Rogers Hi Jason, Am 26.07.2012 21:40, schrieb Jason Baron: > While testing q35, which has its cdrom attached to the ahci controller,= I found > that the Fedora 17 install would panic on boot. The panic occurs while > squashfs is trying to read from the cdrom. The errors are: >=20 > [ 8.622711] SQUASHFS error: xz_dec_run error, data probably corrupt > [ 8.625180] SQUASHFS error: squashfs_read_data failed to read block > 0x20be48a >=20 > I was also able to produce corrupt data reads using an installed piix b= ased > qemu machine, using 'dd'. I found that the corruptions were only occuri= ng when > the read size was greater than 128k. For example, the following command > results in corrupted reads: >=20 > dd if=3D/dev/sr0 of=3D/tmp/blah bs=3D256k iflag=3Ddirect >=20 > The > 128k size reads exercise a different code path than 128k and belo= w. In > ide_atapi_cmd_read_dma_cb() s->io_buffer_size is capped at 128k. Thus, > ide_atapi_cmd_read_dma_cb() is called a second time when the read is > = 128k. > However, ahci_dma_rw_buf() restart the read from offset 0, instead of a= t 128k. > Thus, resulting in a corrupted read. >=20 > To fix this, I've introduced 'io_buffer_offset' field in IDEState to ke= ep > track of the offset. I've also modified ahci_populate_sglist() to take = a new > 3rd offset argument, so that the sglist is property initialized. >=20 > I've tested this patch using 'dd' testing, and Fedora 17 now correctly = boots > and installs on q35 with the cdrom ahci controller. >=20 > Signed-off-by: Jason Baron Tested-by: Andreas F=E4rber This also fixes my test case of running the "Check Installation Media" boot menu option on, e.g., openSUSE-12.1-GNOME-LiveCD-x86_64.iso with ich9-ahci (BNC#725008). Thanks a lot for finding the root cause! If you resubmit, please cc qemu-stable@nongnu.org, I would very much like to backport this bugfix to stable-0.15 branch. Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg