lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <DM6PR03MB41406AFEDAEF105804ACE573CD30A@DM6PR03MB4140.namprd03.prod.outlook.com>
Date:   Mon, 10 Jul 2023 14:03:23 +0800
From:   Wang Jianchao <jianchwa@...look.com>
To:     seanjc@...gle.com, tglx@...utronix.de, mingo@...hat.com,
        bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org,
        hpa@...or.com, kvm@...r.kernel.org
Cc:     arkinjob@...look.com, linux-kernel@...r.kernel.org
Subject: [RFC PATCH V2 0/4] KVM: x86: introduce pv feature lazy tscdeadline

Hi

This patchset attemps to introduce a new pv feature, lazy tscdeadline.
Everytime guest write msr of MSR_IA32_TSC_DEADLINE, a vm-exit occurs
and host side handle it. However, a lot of the vm-exit is unnecessary
because the timer is often over-written before it expires. 

v : write to msr of tsc deadline
| : timer armed by tsc deadline

         v v v v v        | | | | |
--------------------------------------->  Time

The timer armed by msr write is over-written before expires and the
vm-exit caused by it are wasted. The lazy tscdeadline works as following,

         v v v v v        |       |
--------------------------------------->  Time
                          '- arm -'

The 1st timer is responsible for arming the next timer. When the armed
timer is expired, it will check pending and arm a new timer.

In the netperf test with TCP_RR on loopback, this lazy_tscdeadline can
reduce vm-exit obviously.

                         Close               Open
--------------------------------------------------------
VM-Exit
             sum         12617503            5815737
            intr      0% 37023            0% 33002
           cpuid      0% 1                0% 0
            halt     19% 2503932         47% 2780683
       msr-write     79% 10046340        51% 2966824
           pause      0% 90               0% 84
   ept-violation      0% 584              0% 336
   ept-misconfig      0% 0                0% 2
preemption-timer      0% 29518            0% 34800
-------------------------------------------------------
MSR-Write
            sum          10046455            2966864
        apic-icr     25% 2533498         93% 2781235
    tsc-deadline     74% 7512945          6% 185629

This patchset is made and tested on 6.4.0, includes 4 patches,

The 1st one adds necessary data structures for this feature
The 2nd one adds the specific msr operations between guest and host
The 3rd one are the one make this feature works.
The 4th one adds debugfs file into /sys/kernel/debug/kvm for this feature

Changes from V1:
 - In 3rd patch, rename the variable of kvm_host_lazy_tscdeadline from 'host'
   to 'hlt'. And in addition, add more details into the comment of patch
 - Add 4th patch which add debugfs file for this patch

Any comment is welcome.

Thanks
Jianchao

Wang Jianchao (4)
	KVM: x86: add msr register and data structure for lazy tscdeadline
	KVM: x86: exchange info about lazy_tscdeadline with msr
	KVM: X86: add lazy tscdeadline support to reduce vm-exit of msr-write
    KVM: x86: add debugfs file for lazy tscdeadline


arch/x86/include/asm/kvm_host.h      |  10 +++
 arch/x86/include/uapi/asm/kvm_para.h |   9 +++
 arch/x86/kernel/apic/apic.c          |  47 ++++++++++++-
 arch/x86/kernel/kvm.c                |  13 ++++
 arch/x86/kvm/cpuid.c                 |   1 +
 arch/x86/kvm/debugfs.c               |  79 ++++++++++++++++++++-
 arch/x86/kvm/lapic.c                 | 129 ++++++++++++++++++++++++++++++++---
 arch/x86/kvm/lapic.h                 |   4 ++
 arch/x86/kvm/x86.c                   |  26 +++++++
 9 files changed, 308 insertions(+), 10 deletions(-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ