Received: from eggs.gnu.org ([2001:4830:134:3::10]:60237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9a66-0000x4-QJ for qemu-devel@nongnu.org; Mon, 29 Jun 2015 10:31:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9a61-0004C2-0h for qemu-devel@nongnu.org; Mon, 29 Jun 2015 10:31:46 -0400 Date: Mon, 29 Jun 2015 15:25:07 +0100 From: Stefan Hajnoczi Message-ID: <20150629142507.GI32151@stefanha-thinkpad.redhat.com> References: <1435018875-22527-1-git-send-email-jsnow@redhat.com> <1435018875-22527-13-git-send-email-jsnow@redhat.com> <20150626154823.GD31186@stefanha-thinkpad.redhat.com> <558D81CF.3000208@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QDIl5R72YNOeCxaP" Content-Disposition: inline In-Reply-To: <558D81CF.3000208@redhat.com> Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 12/16] ahci: ncq migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, Stefan Hajnoczi --QDIl5R72YNOeCxaP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 26, 2015 at 12:46:07PM -0400, John Snow wrote: > On 06/26/2015 11:48 AM, Stefan Hajnoczi wrote: > > On Mon, Jun 22, 2015 at 08:21:11PM -0400, John Snow wrote: > >> @@ -1555,6 +1573,35 @@ static int ahci_state_post_load(void > >> *opaque, int version_id) return -1; } > >>=20 > >> + for (j =3D 0; j < AHCI_MAX_CMDS; j++) { + > >> ncq_tfs =3D &ad->ncq_tfs[j]; + ncq_tfs->drive =3D ad; + + > >> if (ncq_tfs->used !=3D ncq_tfs->halt) { + return > >> -1; + } + if (!ncq_tfs->halt) { + > >> continue; + } + if (!is_ncq(ncq_tfs->cmd)) > >> { + return -1; + } + if > >> (ncq_tfs->slot !=3D ncq_tfs->tag) { + return -1; + > >> } + if (ncq_tfs->slot > AHCI_MAX_CMDS) { + > >> return -1; + } + ncq_tfs->cmdh =3D > >> &((AHCICmdHdr *)ad->lst)[ncq_tfs->slot]; > >=20 > > Is there a guarantee that ->lst has been mapped? Maybe pr->cmd &=20 > > PORT_CMD_START was 0. > >=20 > > We need to check that the HBA is in a valid state for NCQ > > processing before attempting this. > >=20 >=20 > Slipped my mind, there should be no way to have ncq_tfs->halt set > under normal circumstances except if the engine is started (and lst is > mapped.) >=20 > That said, stream corruption is always possible, so I'll add another > validation check. >=20 > An "is not null" check here should be sufficient, due to the "if not > halt" continue up above. Sounds good. --QDIl5R72YNOeCxaP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVkVVDAAoJEJykq7OBq3PI7moIALe9FMEINQmQNvi5toRsTj39 8DrQezqIuwStxE31JjQMX9A5YEm03Gt4KO9iqDTb5D9krwHz7+vvt/Nyo5rfdpxH xRsf9G4FQi+oo2Jd6Wm3jVSOcKrkCJvHKNSIT0XApariLIr/B8OXzf6+6fsToXtX Ab3P5FU4OBdif1b1uYoKLrvFO2ccL185Ayc8bFH5CRUvAq3RqtizHIzmz2ZBG7qb TvORUNWGFKQ7yoVa5VbIzNBaD3Ny3JCNU4+Btw9MXMxcPR4aeKXEEKRGBH5D6CLj faNapDpnKUfuSClS0GO4S5Zx9DyFztPgk/rnDxhO/Dbj94Aq/MEivYEybto5hSk= =M+Zr -----END PGP SIGNATURE----- --QDIl5R72YNOeCxaP--