RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1734502 - qemu-kvm: backport cpuidle-haltpoll support
Summary: qemu-kvm: backport cpuidle-haltpoll support
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.8
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Marcelo Tosatti
QA Contact: Yumei Huang
URL:
Whiteboard:
Depends On:
Blocks: 1665500 1746281 1746282 1759283
TreeView+ depends on / blocked
 
Reported: 2019-07-30 17:44 UTC by Marcelo Tosatti
Modified: 2020-03-31 14:36 UTC (History)
7 users (show)

Fixed In Version: qemu-kvm-rhev-2.12.0-37.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1746281 1746282 1759283 (view as bug list)
Environment:
Last Closed: 2020-03-31 14:34:56 UTC
Target Upstream Version:
Embargoed:
jinzhao: needinfo-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:1216 0 None None None 2020-03-31 14:36:59 UTC

Description Marcelo Tosatti 2019-07-30 17:44:40 UTC
To pass SAP HANA certification its necessary to improve guest
performance.

The cpuidle haltpoll driver avoids IPIs by busy spinning in the guest, 
which allows IPI less wakeups via mwait, bringing a 10% performance.

This bugzilla is for the qemu-kvm support necessary for the cpuidle haltpoll driver.

Comment 7 Marcelo Tosatti 2019-08-27 21:53:14 UTC
Testing procedure for qemu-kvm patch:

1) Install recent kernel on both host and guest (eg: 3.10.0-1082.el7).

2) On the host, enable tracing:

cd /sys/kernel/debug/tracing
echo "kvm_msr" > set_event
echo "ecx==0x4b564d05" > events/kvm/kvm_msr/filter
echo > trace

On the destination host as well.

3) Boot guest and load cpuidle-haltpoll driver:

# modprobe cpuidle-haltpoll

On /sys/kernel/debug/tracing/trace, should see every CPU disable host halt polling:

        qemu-kvm-29062 [010] .... 16887.913508: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29050 [024] .... 16887.913517: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29051 [012] .... 16887.913520: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29052 [000] .... 16887.913527: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29054 [028] .... 16887.913527: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29055 [006] .... 16887.913527: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29057 [020] .... 16887.913528: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29058 [016] .... 16887.913528: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29053 [004] .... 16887.913529: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29056 [002] .... 16887.913532: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29059 [030] .... 16887.913534: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29061 [022] .... 16887.913538: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29060 [018] .... 16887.913542: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29066 [014] .... 16887.913544: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29063 [008] .... 16887.913548: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-29065 [012] .... 16887.913550: kvm_msr: msr_write 4b564d05 = 0x0

4) Migrate.

Should see on trace of destination host that every vCPU has MSR 0x4b564d05 written with a 0.

Repeat same process but without loading cpuidle-haltpoll driver on guest.
The MSR should contain 0x1.

Comment 8 Marcelo Tosatti 2019-08-28 00:14:55 UTC
Sorry, this won't work. Instead perform the updated steps:

(In reply to Marcelo Tosatti from comment #7)
> Testing procedure for qemu-kvm patch:
> 
> 1) Install recent kernel on both host and guest (eg: 3.10.0-1082.el7).

2) Install msr-tools from epel repository, on guest: 
yum install msr-tools.

To enable EPEL, google for "enabling EPEL on RHEL 7".

> 3) Boot guest and load cpuidle-haltpoll driver:
> 
> # modprobe cpuidle-haltpoll
 
> 4) Migrate.
> 

5) Confirm MSR 0x4b564d05 has a value of 0:

# rdmsr 0x4b564d05

Should return 0 (on guest).

Comment 16 Yumei Huang 2019-11-26 03:25:07 UTC
Verify:
qemu-kvm-rhev-2.12.0-38.el7
kernel-3.10.0-1113.el7.x86_64 (both guest and host)

Steps:
1) Enable tracing on both src and dst host

# cd /sys/kernel/debug/tracing
# echo "kvm_msr" > set_event
# echo "ecx==0x4b564d05" > events/kvm/kvm_msr/filter
# echo > trace

2) Boot guest on src host with '-cpu Opteron_G5,+kvm-poll-control'[1], load cpuidle-haltpoll driver inside guest, and run 'rdmsr 0x4b564d05'.
# modprobe cpuidle-haltpoll
# rdmsr 0x4b564d05
0

3) Check trace on src host
# cat /sys/kernel/debug/tracing/trace

        qemu-kvm-7923  [023] .... 78327.452427: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-7924  [007] .... 78327.452466: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-7925  [017] .... 78327.452499: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-7926  [004] .... 78327.452538: kvm_msr: msr_write 4b564d05 = 0x0
        qemu-kvm-7923  [015] .... 78347.070138: kvm_msr: msr_read 4b564d05 = 0x0

4) Migrate guest to dst host, then run 'rdmsr 0x4b564d05' again.
# rdmsr 0x4b564d05
0

5) Check trace on dst host
# cat /sys/kernel/debug/tracing/trace

        qemu-kvm-19519 [028] .... 71516.665124: kvm_msr: msr_read 4b564d05 = 0x0



Repeat above steps without load cpuidle-haltpoll driver, rdmsr 0x4b564d05 always returns 1 inside guest before and after migration. And trace info is as below.

Src host trace:

        qemu-kvm-7597  [016] .... 77946.621392: kvm_msr: msr_read 4b564d05 = 0x1

Dst host trace:

        qemu-kvm-19243 [004] .... 71160.351405: kvm_msr: msr_read 4b564d05 = 0x1


[1] QEMU full cli:
# /usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm1' \
    -sandbox on \
    -machine q35 \
    -nodefaults \
    -device VGA,bus=pcie.0,addr=0x1  \
    -device pvpanic,ioport=0x505,id=idoP7Hxp  \
    -device pcie-root-port,id=pcie.0-root-port-2,slot=2,chassis=2,addr=0x2,bus=pcie.0 \
    -device qemu-xhci,id=usb1,bus=pcie.0-root-port-2,addr=0x0 \
    -device pcie-root-port,id=pcie.0-root-port-3,slot=3,chassis=3,addr=0x3,bus=pcie.0 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie.0-root-port-3,addr=0x0 \
    -drive id=drive_image1,if=none,snapshot=off,aio=threads,cache=none,format=qcow2,file=/home/guest/rhel78-64-virtio-scsi.qcow2 \
    -device scsi-hd,id=image1,drive=drive_image1 \
    -device pcie-root-port,id=pcie.0-root-port-4,slot=4,chassis=4,addr=0x4,bus=pcie.0 \
    -device virtio-net-pci,mac=9a:70:71:72:73:74,id=idchA8Cw,vectors=4,netdev=idks9PPv,bus=pcie.0-root-port-4,addr=0x0  \
    -netdev tap,id=idks9PPv,vhost=on \
    -m 4096,slots=256,maxmem=40G  \
    -smp 4,maxcpus=16,threads=1,cores=4,sockets=4 \
    -cpu 'Opteron_G5',+kvm-poll-control \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -vnc :0  \
    -rtc base=utc,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off,strict=off \
    -enable-kvm \
    -monitor stdio -serial tcp:0:1234,server,nowait \
    -qmp tcp:0:4444,server,nowait \
    -monitor unix:/tmp/monitor3,server,nowait

Comment 17 Klaas Demter 2019-12-16 10:35:33 UTC
Hi,
https://access.redhat.com/errata/RHSA-2019:3179 / https://access.redhat.com/errata/RHSA-2019:3220 / https://access.redhat.com/errata/RHSA-2019:3055 seem to suggest this is already present in current rhel/rhv versions

are there plans to add this to default virtual-guest tuned profile or is this performance increase sap hana specific?

Greetings
Klaas

Comment 19 errata-xmlrpc 2020-03-31 14:34:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1216


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