Am 05.04.2016 um 20:24 hat James Shimer geschrieben:
Thanks for the responses. What you've both said makes total sense. We've tried 512 logical/ 4k physical and it works fine with Seabios. Thanks Laszlo for the OVMF tip, that's totally the route we need to take.
In practice, I don't think there is a big difference for disk accesses between using 4k logical (with OVMF) and using 512b logical (with either SeaBIOS or OVMF). So if you just want to access your data optimally in the guest and don't care if it really looks like 4kn there, using a 512e setup with SeaBIOS is probably completely fine.
It is very likely that your OS is already using 4k aligned requests because it knows the physical sector size, and apart from that both the file system block size and the page size aren't smaller than 4k either.
So while the emulation of 512b sectors costs some performance (it is done by qemu in this configuration), it should really only kick in for the boot loader and everything else should be using correctly aligned requests without any need for emulation.
Kevin
From: Laszlo Ersek lersek@redhat.com Sent: Tuesday, April 5, 2016 12:49 PM To: Kevin O'Connor Cc: James Shimer; Kevin Wolf; seabios@seabios.org Subject: Re: [SeaBIOS] virtio-blk ... block size 4096 is unsupported
On 04/05/16 18:36, Kevin O'Connor wrote:
On Tue, Apr 05, 2016 at 02:31:53PM +0200, Laszlo Ersek wrote:
On 04/05/16 06:25, James Shimer wrote:
I've been doing some testing if KVM with 4K physical sector virtio disks and they work with KVM as a none boot disk. We'd like to be able to boot a 4k physical sector disk in KVM, is there 4K support in any seabios newer/upcoming releases, or is there a way to configure for 4k sectors?
reference from master src/hw/virtio-blk.c lin 142
if (vdrive->drive.blksize != DISK_SECTOR_SIZE) { dprintf(1, "virtio-blk %pP block size %d is unsupported\n", pci, vdrive->drive.blksize); goto fail; }
This code dates back to 4030db0d2c5a7.
I'm not an expert, but I think BIOS interfaces don't support a sector size different from 512 B. It seems that a drive with 4096 B physical sectors should enable (the emulation of) a 512 B logical sector size, so that it can work with code that assumes an 512 B sector size.
The EDD standard ( https://en.wikipedia.org/wiki/Enhanced_Disk_Drive ) allows for 4K blocks. However, the older BIOS interface (eg, int 1301) only support 512 byte sectors. This means that the BIOS would need to emulate 512 byte reads should one of the older interfaces be called on one of these drives. This isn't difficult as SeaBIOS already does this for cdroms.
That sounds great, thanks. I should have thought of CD-ROMs, I guess.
I guess for a virtio-blk disk, that means:
-device virtio-blk-pci,physical_block_size=4096,logical_block_size=512
In practice, almost all real drives seem to do the above. So, adding support for drives that don't has not previously been a priority.
Right, I missed that 512e could be implemented in SeaBIOS itself (and I completely missed that it had been, for CD-ROMs).
Thanks! Laszlo