qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] about correctness of IDE emulation


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] about correctness of IDE emulation
Date: Tue, 15 Mar 2016 12:59:58 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

On Mon, Mar 14, 2016 at 10:09:17PM -0500, Huaicheng Li wrote:
> 
> > On Mar 13, 2016, at 8:42 PM, Fam Zheng <address@hidden> wrote:
> > 
> > On Sun, 03/13 14:37, Huaicheng Li (coperd) wrote:
> >> Hi all, 
> >> 
> >> What I’m confused about is that:
> >> 
> >> If one I/O is too large and may need several rounds (say 2) of DMA 
> >> transfers,
> >> it seems the second round transfer begins only after the completion of the
> >> first part, by reading data from **IDEState**. But the IDEState info may 
> >> have
> >> been changed by VCPU threads (by writing new I/Os to it) when the first
> >> transfer finishes. From the code, I see that IDE r/w call back function 
> >> will
> >> continue the second transfer by referencing IDEState’s information. 
> >> Wouldn’t
> >> this be problematic? Am I missing anything here?
> > 
> > Can you give an concrete example? I/O in VCPU threads that changes IDEState
> > must also take care of the DMA transfers, for example ide_reset() has
> > blk_aio_cancel and clears s->nsectors. If an I/O handler fails to do so, it 
> > is
> > a bug.
> > 
> > Fam
> 
> I get it now. ide_exec_cmd() can only proceed when BUSY_STAT|DRQ_STAT is not 
> set.
> When the 2nd DMA transfer continues, BUSY_STAT | DRQ_STAT is already
> set, i.e., no other new ide_exec_cmd() can enter. BSUY or DRQ is removed only 
> when
> all DMA transfers are done, after which new writes to IDE are allowed. Thus 
> it’s safe.
> 
> Thanks, Fam & Stefan.

Okay, happy to see that the case you were thinking of is already covered
by QEMU.  If you do notice anything in the code which looks incorrect,
just let us know.

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]