> I must say I'd like to get rid of the chunking transfer in scsi-disk. > To have it for scsi-disk only is really pointless, as you can > potentially send exactly the same commands via scsi-generic. > So for scsi-generic to work properly qemu need to be able to > allocate the _entire_ data buffer. And hence qemu _must_ be able to > allocate the same buffer for the scsi-disk emulation. > So any malloc space arguments don't really work out here. > > By the same reasoning we could remove the chunking altogether; > any HBA _must_ be capable of issuing the entire data (if issued via > scsi-generic) even today. So I don't really buy the argument of > chunking being required for large I/Os.
We've been over this before. Your logic is fundamentally flawed. In many cases The HBA simply doesn't know where the data is going to go until after the command has been issued. Issuing the command (which may fail) and setting up the buffer to receive the data are separate operations, and there may be guest visible state in between. Even if you assume the initial command is accepted successfully, the DMA buffer may be submitted in several parts. If the device response does not full all these parts then we should not be accessing the unused ones. And this is assuming your HBA is DMA capable to start with - a USB mass storage device almost certainly isn't. Even if you do know the full DMA buffer ahead of time, there's no guarantee that you'll actually be able to map it all at once. You have to assume that bounce buffers are required, and only a small chunk of the ram can be mapped at any point. Combine this with the fact that the guest may submit arbitrarily large requests and you need some form of chunking. IIRC the passthrough support ignores the linux interface already restricts you to relatively small requests. Paul