This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 963280 - Kill the "use flash device for BIOS unless KVM" misfeature
Kill the "use flash device for BIOS unless KVM" misfeature
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Markus Armbruster
Virtualization Bugs
:
Depends On:
Blocks: 841379 895959 983997 984008 984010
  Show dependency treegraph
 
Reported: 2013-05-15 10:53 EDT by Markus Armbruster
Modified: 2014-06-18 08:23 EDT (History)
8 users (show)

See Also:
Fixed In Version: qemu-kvm-1.5.2-2.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 06:16:46 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
check with kvm under unfix build (6.65 KB, text/plain)
2013-12-17 05:10 EST, Qian Guo
no flags Details
check with tcg under unfix build (6.55 KB, text/plain)
2013-12-17 05:11 EST, Qian Guo
no flags Details
check with kvm under fix build (6.42 KB, text/plain)
2013-12-17 05:11 EST, Qian Guo
no flags Details
check with tcg under fix build (6.42 KB, text/plain)
2013-12-17 05:12 EST, Qian Guo
no flags Details
Check with kvm under unfix build, and use right script (11.84 KB, text/plain)
2013-12-19 22:42 EST, Qian Guo
no flags Details
Check with tcg under unfix build, and use right script (11.96 KB, text/plain)
2013-12-19 22:43 EST, Qian Guo
no flags Details
Check with kvm under fix build, and use right script (11.37 KB, text/plain)
2013-12-19 22:43 EST, Qian Guo
no flags Details
Check with tcg under fix build, and use right script (11.33 KB, text/plain)
2013-12-19 22:44 EST, Qian Guo
no flags Details

  None (edit)
Description Markus Armbruster 2013-05-15 10:53:45 EDT
Description of problem:

Upstream QEMU can use a flash device for the BIOS instead of a ROM,
but it doesn't actually work yet with KVM.  Flash vs. ROM is a
user-controllable option (--global pc-sysfw.rom_only=...), which
defaults to "ROM" if KVM is disabled, and for old machine types, else
to "flash".  Not a good idea, because it makes enabling/disabling KVM
guest-visible, and because it creates yet another pointless way for
users to break things.

Upstream commit 9953f88 has more details.  It was my attempt to get a
sane baseline for RHEL-7 upstream.  However, it was effectively
reverted in commit 9e1c2ec, because we expect flash with KVM to be
fixed in 1.6.

For RHEL-7, we need to

* either backport the fixes that make flash work with KVM,

* or disable flash entirely.

Regardless, we should support only either flash or ROM, not both.  I
strongly recommend to get rid of the configuration knob entirely.

How reproducible:
Always

Steps to Reproduce:
1. $ echo -e "info qtree\nq" | qemu-kvm -nodefaults -S -nographic -monitor stdio | egrep -C 1 'rom_only|pflash'
2. Add qemu-kvm option "-machine accel=kvm".
  
Actual results:
Step 1 prints:
    mmio ffffffffffffffff/0000000000000001
  dev: cfi.pflash01, id ""
    drive = pflash0
    num-blocks = 32
--
  dev: pc-sysfw, id ""
    rom_only = 0
    irq 0
Step 2 prints:
  dev: pc-sysfw, id ""
    rom_only = 1
    irq 0

Expected results:
Both steps print exactly the same.
Comment 2 Markus Armbruster 2013-07-10 06:58:13 EDT
Updated reproducer: run
    for i in kvm tcg
    do echo -e "info qtree\ninfo mtree\nq" | qemu-kvm-nodefaults -S \
    -nographic -monitor stdio -machine "accel=$i,kernel_irqchip=off"
    done
with and without the fix.

kernel_irqchip=off is just for getting some unrelated KVM vs. TCG
differences out of the way.

Compare TCG with KVM output without the fix:

* Device kvmclock exists only with KVM.  Good.

* Property pc-sysfw.rom_only is zero with TCG, one with KVM.  Harmless.

* KVM has a pc.bios memory region, while TCG has a cfi.pflash01 device
  with a system.flash memory region.  Bad.

* Memory region isa-bios is an alias for pc.bios with KVM, and a normal
  memory region with TCG (actually a copy of system.flash).  Harmless.

Compare TCG with KVM output with the fix:

* Device kvmclock exists only with KVM.  Good.

Effect of the fix out KVM output:

* Device pc-sysfw is gone.  Good.

Effect of the fix out TCG output:

* Device pc-sysfw is gone.  Good.

* Device cfi.pflash01 with system.flash memory region is gone.  Good.

* Memory region isa-bios becomes an alias for pc.bios.  Good.
Comment 3 Miroslav Rezanina 2013-07-31 08:02:56 EDT
Fix included in qemu-kvm-1.5.2-2.el7
Comment 4 Miroslav Rezanina 2013-07-31 08:08:55 EDT
Fix included in qemu-kvm-1.5.2-2.el7
Comment 6 Qian Guo 2013-12-17 05:08:09 EST
Reproduced with qemu-kvm-1.5.1-2.el7.x86_64

Steps
1.run the script:
# echo -e "info qtree\ninfo mtree\nq" | /usr/libexec/qemu-kvm -S     -nographic -monitor stdio -machine "accel=kvm,kernel_irqchip=off" > kvm.check1

#echo -e "info qtree\ninfo mtree\nq" | /usr/libexec/qemu-kvm -S     -nographic -monitor stdio -machine "accel=tcg,kernel_irqchip=off" > tcg.check1

result:
1. Checking "kvmclock" in kvm.check1 and tcg.check1, can not find it both tcg/kvm, but find following devices in both files
  0000000000000070-0000000000000071 (prio 0, RW): rtc
  000000000000007e-000000000000007f (prio 0, RW): kvmvapic

2. Checking "Device pc-sysfw" in both files, can not find the device

3. Checking "pc.bios" and "system.flash" in both files:
From "kvm.check1"
...
pc.bios
00000000fffe0000-00000000ffffffff (prio 0, R-): pc.bios
...

and from "tcg.check1"
...
  00000000fffe0000-00000000ffffffff (prio 0, R-): system.flash
...

4. Checking isa-bios in both files:
From kvm.check1
...
  00000000000e0000-00000000000fffff (prio 1, R-): alias isa-bios @pc.bios 0000000000000000-000000000001ffff
...

from the tcg.bios
...
  00000000000e0000-00000000000fffff (prio 1, R-): isa-bios
...


So according to above, reproduced the checkpoint 3 and 4, but can not find the kvmclock device.

Try to verify this bug with qemu-kvm-1.5.3-21.el7.x86_64

Steps
1.run the script:
# echo -e "info qtree\ninfo mtree\nq" | /usr/libexec/qemu-kvm -S     -nographic -monitor stdio -machine "accel=kvm,kernel_irqchip=off" > kvm.check2

#echo -e "info qtree\ninfo mtree\nq" | /usr/libexec/qemu-kvm -S     -nographic -monitor stdio -machine "accel=tcg,kernel_irqchip=off" > tcg.check2

Result:
1. Checking "kvmclock" in kvm.check1 and tcg.check1, can not find it both tcg/kvm, but find following devices in both files
  0000000000000070-0000000000000071 (prio 0, RW): rtc
  000000000000007e-000000000000007f (prio 0, RW): kvmvapic

2.Checking "Device pc-sysfw" in both files, can not find the device

3. Checking "pc.bios" and "system.flash" in both files, get same value, and no "system.flash" anymore:
pc.bios
00000000fffe0000-00000000ffffffff (prio 0, R-): pc.bios

4. Check the "isa-bios", check in both files, get same value:
  00000000000e0000-00000000000fffff (prio 1, R-): alias isa-bios @pc.bios 0000000000000000-000000000001ffff


So according above, except the "kvmclock", all issues are fixed by qemu-kvm-1.5.3-21.el7.x86_64.

Hi, Markus

Could you help check if the result is right, I can not find devices named "kvmclock" in all files, I will attach all files in this bug
Comment 7 Qian Guo 2013-12-17 05:10:43 EST
Created attachment 837618 [details]
check with kvm under unfix build
Comment 8 Qian Guo 2013-12-17 05:11:15 EST
Created attachment 837619 [details]
check with tcg under unfix build
Comment 9 Qian Guo 2013-12-17 05:11:49 EST
Created attachment 837620 [details]
check with kvm under fix build
Comment 10 Qian Guo 2013-12-17 05:12:25 EST
Created attachment 837621 [details]
check with tcg under fix build
Comment 11 Markus Armbruster 2013-12-17 10:13:04 EST
Your attachments all start like this:

QEMU 1.5.3 monitor - type 'help' for more information
(qemu) i[K[Dif[K[D[Difo[K[D[D[Difo [K[D[D[D[Difo q[K[D[D[D[D[Difo qt[K[D[D[D[D[D[Difo qtr[K[D[D[D[D[D[D[Difo qtre[K[D[D[D[D[D[D[D[Difo qtree[K
unknown command: 'ifo'
(qemu) i[K[Din[K[D[Dinf[K[D[D[Dinfo[K[D[D[D[Dinfo [K[D[D[D[D[Dinfo m[K[D[D[D[D[D[Dinfo mt[K[D[D[D[D[D[D[Dinfo mtr[K[D[D[D[D[D[D[D[Dinfo mtre[K[D[D[D[D[D[D[D[D[Dinfo mtree[K
memory

Looks like you mistyped "info qtree".  Please try again :)
Comment 12 Qian Guo 2013-12-19 22:39:29 EST
(In reply to Markus Armbruster from comment #11)
> Your attachments all start like this:
> 
> QEMU 1.5.3 monitor - type 'help' for more information
> (qemu) i[K[Dif[K[D[Difo[K[D[D[Difo [K[D[D[D[Difo
> q[K[D[D[D[D[Difo qt[K[D[D[D[D[D[Difo
> qtr[K[D[D[D[D[D[D[Difo qtre[K[D[D[D[D[D[D[D[Difo qtree[K
> unknown command: 'ifo'
> (qemu) i[K[Din[K[D[Dinf[K[D[D[Dinfo[K[D[D[D[Dinfo
> [K[D[D[D[D[Dinfo m[K[D[D[D[D[D[Dinfo
> mt[K[D[D[D[D[D[D[Dinfo mtr[K[D[D[D[D[D[D[D[Dinfo
> mtre[K[D[D[D[D[D[D[D[D[Dinfo mtree[K
> memory
> 
> Looks like you mistyped "info qtree".  Please try again :)
Got it, thanks. the script is wrong, retest in this comment:
Reproduced with qemu-kvm-1.5.1-2.el7.x86_64

Steps
1.run the script:
# echo -e "\n\info qtree\ninfo mtree\nq" | /usr/libexec/qemu-kvm -S     -nographic -monitor stdio -machine "accel=kvm,kernel_irqchip=off" > kvm.check1_v2

# echo -e "\n\info qtree\ninfo mtree\nq" | /usr/libexec/qemu-kvm -S     -nographic -monitor stdio -machine "accel=tcg,kernel_irqchip=off" > tcg.check1_v2

result:
1. Checking "kvmclock" in kvm.check1_v2 and tcg.check1_v2,find it only with kvm.
# cat kvm.check1_v2 |grep kvmclock
  dev: kvmclock, id ""
# cat tcg.check1_v2 |grep kvmclock
# 


2. Checking "Device pc-sysfw" in both files, "rom_only=1" when test with kvm, and "rom_only=0" when with tcg
# cat kvm.check1_v2 
...
    dev: pc-sysfw, id ""
    rom_only = 1
    irq 0
...
# cat tcg.check1_v2 
...
  dev: pc-sysfw, id ""
    rom_only = 0
    irq 0


3. Checking "pc.bios" and "system.flash" in both files, find that only tcg has cfi.pflash device and has system.flash mem region and kvm has pc.bios

# cat tcg.check1_v2
...
  dev: cfi.pflash01, id ""
    drive = pflash0
    num-blocks = 32
    sector-length = 4096
    width = 1
    big-endian = 0
    id0 = 0
    id1 = 0
    id2 = 0
    id3 = 0
    name = "system.flash"
    irq 0
    mmio 00000000fffe0000/0000000000020000
...

# cat kvm.check1_v2 |grep cfi
#

# cat tcg.check1_v2 |grep pc.bios
# cat kvm.check1_v2 |grep pc.bios
  00000000000e0000-00000000000fffff (prio 1, R-): alias isa-bios @pc.bios 0000000000000000-000000000001ffff
  00000000fffe0000-00000000ffffffff (prio 0, R-): pc.bios
pc.bios
00000000fffe0000-00000000ffffffff (prio 0, R-): pc.bios


# cat kvm.check1_v2 |grep system.flash
# cat tcg.check1_v2 |grep system.flash
    name = "system.flash"
  00000000fffe0000-00000000ffffffff (prio 0, R-): system.flash


4. Checking isa-bios in both files, memory region isa-bios is an alias for pc.bios with KVM, and a normal
  memory region with TCG
# cat tcg.check1_v2 |grep isa-bios
  00000000000e0000-00000000000fffff (prio 1, R-): isa-bios
# cat kvm.check1_v2 |grep isa-bios
  00000000000e0000-00000000000fffff (prio 1, R-): alias isa-bios @pc.bios 0000000000000000-000000000001ffff

So according to above, this bug is reproduced.

Try to verify this bug with qemu-kvm-1.5.3-21.el7.x86_64

Steps
1.run the script:
# echo -e "\n\info qtree\ninfo mtree\nq" | /usr/libexec/qemu-kvm -S     -nographic -monitor stdio -machine "accel=kvm,kernel_irqchip=off" > kvm.check2_v2
# echo -e "\n\info qtree\ninfo mtree\nq" | /usr/libexec/qemu-kvm -S     -nographic -monitor stdio -machine "accel=tcg,kernel_irqchip=off" > tcg.check2_v2


Result:
1. Checking "kvmclock" in both files, only kvm has kvmclock:
# cat kvm.check2_v2 |grep kvmclock
  dev: kvmclock, id ""
# cat tcg.check2_v2 |grep kvmclock

2.Checking "Device pc-sysfw" in both files, can not find the device
# cat tcg.check2_v2 |grep pc-sysfw
# cat kvm.check2_v2 |grep pc-sysfw

3.Checking "pc.bios" and "system.flash" in both files, find that no files have cfi.pflash device or has system.flash mem region; And in both files, memory region isa-bios is an alias for pc.bios with KVM 
# cat kvm.check2_v2 |grep cfi
# cat tcg.check2_v2 |grep cfi
# cat tcg.check2_v2 |grep system.flash
# cat kvm.check2_v2 |grep system.flash

# cat kvm.check2_v2 |grep pc.bios
  00000000000e0000-00000000000fffff (prio 1, R-): alias isa-bios @pc.bios 0000000000000000-000000000001ffff
  00000000fffe0000-00000000ffffffff (prio 0, R-): pc.bios
pc.bios
00000000fffe0000-00000000ffffffff (prio 0, R-): pc.bios

# cat tcg.check2_v2 |grep pc.bios
  00000000000e0000-00000000000fffff (prio 1, R-): alias isa-bios @pc.bios 0000000000000000-000000000001ffff
  00000000fffe0000-00000000ffffffff (prio 0, R-): pc.bios
pc.bios
00000000fffe0000-00000000ffffffff (prio 0, R-): pc.bios


So according above, all issues are fixed by qemu-kvm-1.5.3-21.el7.x86_64.
Comment 13 Qian Guo 2013-12-19 22:42:41 EST
Created attachment 839328 [details]
Check with kvm under unfix build, and use right script
Comment 14 Qian Guo 2013-12-19 22:43:11 EST
Created attachment 839330 [details]
Check with tcg under unfix build, and use right script
Comment 15 Qian Guo 2013-12-19 22:43:43 EST
Created attachment 839337 [details]
Check with kvm under fix build, and use right script
Comment 16 Qian Guo 2013-12-19 22:44:17 EST
Created attachment 839345 [details]
Check with tcg under fix build, and use right script
Comment 18 Ludek Smid 2014-06-13 06:16:46 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Note You need to log in before you can comment on or make changes to this bug.