Bug 1328715

Summary: physical_block_size in guest (Linux) is not same as specified in qemu-kvm command
Product: Red Hat Enterprise Linux 7 Reporter: yduan
Component: qemu-kvm-rhevAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: chayang, famz, huding, juzhang, knoel, pbonzini, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-15 07:15:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description yduan 2016-04-20 07:02:29 UTC
Description of problem:
  physical_block_size in guest (Linux) is not same as qemu-kvm command when specifies physical_block_size=512 and logical_block_size=4096 in command line.

Version-Release number of selected component (if applicable):
Host:
  kernel: 3.10.0-382.el7.x86_64
  qemu-kvm-rhev: qemu-kvm-rhev-2.5.0-4.el7.x86_64
Guest:
  kernel: 3.10.0-382.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Start a VM by using following command:
 ...
 -device virtio-scsi-pci,id=scsi_pci_bus0 \
 -drive file=/dev/sdb,format=qcow2,id=drive_sysdisk,if=none,cache=none,aio=native,werror=stop,rerror=stop \
 -device scsi-hd,drive=drive_sysdisk,bus=scsi_pci_bus0.0,id=device_sysdisk,bootindex=0 \
 -device virtio-scsi-pci,id=scsi_pci_bus1 \
 -drive file=/home/scsi_test1/datadisk1.qcow2,format=qcow2,id=drive_datadisk1,if=none,cache=none,werror=stop,rerror=stop \
 -device scsi-hd,drive=drive_datadisk1,bus=scsi_pci_bus1.0,id=device_datadisk1,physical_block_size=512,logical_block_size=4096 \
 ...
2.info qtree
  ...
  bus: scsi_pci_bus1.0
              type SCSI
              dev: scsi-hd, id "device_datadisk1"
                drive = "drive_datadisk1"
                logical_block_size = 4096 (0x1000)
                physical_block_size = 512 (0x200)
  ...
3.In guest:
#cat /sys/block/sdb/queue/physical_block_size
4096
#cat /sys/block/sdb/queue/logical_block_size
4096

Actual results:
#cat /sys/block/sdb/queue/physical_block_size
4096
#cat /sys/block/sdb/queue/logical_block_size
4096

Expected results:
#cat /sys/block/sdb/queue/physical_block_size
512
#cat /sys/block/sdb/queue/logical_block_size
4096

Additional info:

Comment 2 yduan 2016-04-20 08:14:21 UTC
Reproducible with qemu-kvm-rhev-2.3.0-31.el7_2.12.x86_64

Comment 3 Kevin Wolf 2016-06-21 16:05:21 UTC
This is expected. SCSI allows physical block sizes that are smaller than the
logical block size, but it reports them as if the physical block size was the
same as the logical block size. (See READ CAPACITY (16) spec)

I'm reassigning this to Paolo to decide whether to close this as NOTABUG, or
whether we should error out if such a configuration is requested in qemu. Strictly
speaking it is a valid configuration even though it doesn't make a lot of sense.