Bug 860929

Summary: microcode: CPUx: update failed (for patch_level=0x6000624)
Product: Red Hat Enterprise Linux 6 Reporter: Xu Tian <xutian>
Component: qemu-kvmAssignee: Eduardo Habkost <ehabkost>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, areis, bsarathy, dyasny, juzhang, mkenneth, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Known Issue
Doc Text:
KVM guests must not be allowed to update the host CPU microcode. KVM does not allows this and instead always returns the same microcode revision or patch level value to the guest. If the guest tries to update the CPU microcode, it will fail and show an error message similar to: CPU0: update failed (for patch_level=0x6000624) To work around this, configure the guest to not install CPU microcode updates; for example, uninstall the microcode_ctl package Red Hat Enterprise Linux of Fedora guests.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-22 13:36:42 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:
Embargoed:
Attachments:
Description Flags
dmesg in amd guest none

Description Xu Tian 2012-09-27 06:25:52 UTC
Description of problem:

KVM guest update CPU microcode failed, see below message in /var/log/message, virtual code mode 'Opteron_G4':

2012-09-26 13:56:15: microcode: CPU0: patch_level=0x1000065
2012-09-26 13:56:15: microcode: CPU0: update failed (for patch_level=0x6000624)
...
2012-09-26 13:56:16: microcode: CPU15: patch_level=0x1000065
2012-09-26 13:56:16: microcode: CPU15: update failed (for patch_level=0x6000624)

but host update microcode successed, dmesg like below:

Sep 24 10:51:09 hp-dl385g7-10 kernel: platform microcode: firmware: requesting amd-ucode/microcode_amd_fam15h.bin
Sep 24 10:51:09 hp-dl385g7-10 kernel: microcode: CPU0: patch_level=0x6000626
...
Sep 24 10:51:09 hp-dl385g7-10 kernel: microcode: CPU23: patch_level=0x6000626
Sep 24 10:51:09 hp-dl385g7-10 kernel: Microcode Update Driver: v2.00 <tigran.co.uk>, Peter Oruba;


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. boot guest rhel6.4 guest with command line:
qemu-kvm -name 'vm1' -nodefaults
-chardev socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20120926-132615-nzD6SRzU,server,nowait
-mon chardev=qmp_id_qmpmonitor1,mode=control
-chardev socket,id=serial_id_20120926-132615-nzD6SRzU,path=/tmp/serial-20120926-132615-nzD6SRzU,server,nowait
-device isa-serial,chardev=serial_id_20120926-132615-nzD6SRzU
-chardev socket,id=seabioslog_id_20120926-132615-nzD6SRzU,path=/tmp/seabios-20120926-132615-nzD6SRzU,server,nowait
-device isa-debugcon,chardev=seabioslog_id_20120926-132615-nzD6SRzU,iobase=0x402
-device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=0x4
-drive file='/usr/local/staf/test/RHEV/kvm/autotest-devel/client/tests/kvm/images/RHEL-Server-6.4-32-virtio.qcow2',if=none,id=drive-virtio-disk1,media=disk,cache=none,boot=off,snapshot=off,format=qcow2,aio=native
-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1
-device virtio-net-pci,netdev=id5lhzlP,mac=9a:29:2a:2b:2c:2d,bus=pci.0,addr=0x3,id='idsgC6Mf'
-netdev tap,id=id5lhzlP,vhost=on,fd=19
-m 16384
-smp 16,cores=4,threads=2,sockets=2
-cpu 'Opteron_G4'
-M rhel6.4.0
-device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1
-spice port=3000,password=123456,addr=0,tls-port=3200,x509-dir=/tmp/spice_x509d,tls-channel=main,tls-channel=inputs,image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,streaming-video=all,agent-mouse=on,playback-compression=on,ipv4
-vga qxl 
-global qxl-vga.vram_size=33554432
-rtc base=utc,clock=host,driftfix=slew
-boot order=cdn,once=c,menu=off
-no-kvm-pit-reinjection
-bios /usr/share/seabios/bios-pm.bin
-enable-kvm

2. vim /var/log/message
  
Actual results:

guest update cpu microcode failed

Expected results:

guest update cpu microcode successful

Additional info:

cpuinfo on host:
....
processor	: 23
vendor_id	: AuthenticAMD
cpu family	: 21
model		: 1
model name	: AMD Opteron(TM) Processor 6234                 
stepping	: 2
cpu MHz		: 2400.038
cache size	: 2048 KB
physical id	: 1
siblings	: 12
core id		: 5
cpu cores	: 6
apicid		: 75
initial apicid	: 43
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nonstop_tsc extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core cpb npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
bogomips	: 4799.72
TLB size	: 1536 4K pages
clflush size	: 64
cache_alignment	: 64
address sizes	: 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb

qemu version: qemu-kvm-0.12.1.2-2.316.el6.x86_64 

host kernel: 2.6.32-309.el6.x86_64
guest kernel: 2.6.32-309.el6.i686

Comment 3 Xu Tian 2012-10-17 11:25:22 UTC
Created attachment 628706 [details]
dmesg in amd guest

Test packages:
kernel-2.6.32-332.el6 (both guest and host used 332's kernel)
kernel-firmware-2.6.32-323

test with Intel I5-2400 CPU found microcode applied both host and guest

test with AMD Phenom(tm) 8750 CPU, microcode applied on host, but not apply because "not supported"; you can download guest dmesg info attachement;

qemu command line:
qemu-kvm -name 'vm1' -nodefaults -chardev socket,id=qmp_monitor_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20121017-175801-SVgS,server,nowait -mon chardev=qmp_monitor_id_qmpmonitor1,mode=control -chardev socket,id=serial_id_20121017-175801-SVgS,path=/tmp/serial-20121017-175801-SVgS,server,nowait -device isa-serial,chardev=serial_id_20121017-175801-SVgS -device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=0x4 -drive file='/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/RHEL-Server-6.4-32-virtio.qcow2',if=none,id=drive-virtio-disk1,media=disk,cache=none,boot=off,snapshot=off,format=qcow2,aio=native -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1 -device virtio-net-pci,netdev=id7cDCld,mac=9a:fc:22:e3:f6:ae,id=ndev00id7cDCld,bus=pci.0,addr=0x3 -netdev tap,id=id7cDCld,vhost=on,fd=21 -m 2048 -smp 1,cores=0,threads=1,sockets=2 -cpu 'Opteron_G3' -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 -vnc :0 -vga cirrus -rtc base=utc,clock=host,driftfix=slew -M rhel6.4.0 -boot order=cdn,once=c,menu=off    -no-kvm-pit-reinjection -bios /usr/share/seabios/bios.bin -enable-kvm

thanks,
Xu

Comment 4 Xu Tian 2012-10-17 11:27:21 UTC
(In reply to comment #3)
> Created attachment 628706 [details]
> dmesg in amd guest
> 
> Test packages:
> kernel-2.6.32-332.el6 (both guest and host used 332's kernel)
> kernel-firmware-2.6.32-323
> 
> test with Intel I5-2400 CPU found microcode applied both host and guest
> 
> test with AMD Phenom(tm) 8750 CPU, microcode applied on host, but not apply on guest dmesg show "not supported"; you can download guest dmesg info attachement;
> 
> qemu command line:
> qemu-kvm -name 'vm1' -nodefaults -chardev
> socket,id=qmp_monitor_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20121017-
> 175801-SVgS,server,nowait -mon
> chardev=qmp_monitor_id_qmpmonitor1,mode=control -chardev
> socket,id=serial_id_20121017-175801-SVgS,path=/tmp/serial-20121017-175801-
> SVgS,server,nowait -device isa-serial,chardev=serial_id_20121017-175801-SVgS
> -device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=0x4 -drive
> file='/usr/local/staf/test/RHEV/kvm-new/autotest/client/tests/kvm/images/
> RHEL-Server-6.4-32-virtio.qcow2',if=none,id=drive-virtio-disk1,media=disk,
> cache=none,boot=off,snapshot=off,format=qcow2,aio=native -device
> virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1
> -device
> virtio-net-pci,netdev=id7cDCld,mac=9a:fc:22:e3:f6:ae,id=ndev00id7cDCld,
> bus=pci.0,addr=0x3 -netdev tap,id=id7cDCld,vhost=on,fd=21 -m 2048 -smp
> 1,cores=0,threads=1,sockets=2 -cpu 'Opteron_G3' -device
> usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 -vnc :0 -vga cirrus -rtc
> base=utc,clock=host,driftfix=slew -M rhel6.4.0 -boot
> order=cdn,once=c,menu=off    -no-kvm-pit-reinjection -bios
> /usr/share/seabios/bios.bin -enable-kvm
> 
> thanks,
> Xu

Comment 6 Eduardo Habkost 2012-10-22 13:36:42 UTC
A microcode update on the virtual CPU doesn't even make sense, the guest shouldn't try to update it. We just return a dummy value on the MSR_IA32_UCODE_REV (== MSR_AMD64_PATCH_LEVEL == 0x0000008b) MSR to make some guests happier.

One thing we can consider implementing upstream is to make the patch level value configurable on the QEMU CPU model table, to make a bogus microcode update error message less likely, but that's probably not a feature for RHEL-6.