Patch "KVM: do not shrink halt_poll_ns below grow_start" has been added to the 5.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    KVM: do not shrink halt_poll_ns below grow_start

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-do-not-shrink-halt_poll_ns-below-grow_start.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b0d85bfc39b2af2b76ab37c46922912204f70c5a
Author: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
Date:   Thu Sep 2 12:11:00 2021 +0900

    KVM: do not shrink halt_poll_ns below grow_start
    
    [ Upstream commit ae232ea460888dc5a8b37e840c553b02521fbf18 ]
    
    grow_halt_poll_ns() ignores values between 0 and
    halt_poll_ns_grow_start (10000 by default). However,
    when we shrink halt_poll_ns we may fall way below
    halt_poll_ns_grow_start and endup with halt_poll_ns
    values that don't make a lot of sense: like 1 or 9,
    or 19.
    
    VCPU1 trace (halt_poll_ns_shrink equals 2):
    
    VCPU1 grow 10000
    VCPU1 shrink 5000
    VCPU1 shrink 2500
    VCPU1 shrink 1250
    VCPU1 shrink 625
    VCPU1 shrink 312
    VCPU1 shrink 156
    VCPU1 shrink 78
    VCPU1 shrink 39
    VCPU1 shrink 19
    VCPU1 shrink 9
    VCPU1 shrink 4
    
    Mirror what grow_halt_poll_ns() does and set halt_poll_ns
    to 0 as soon as new shrink-ed halt_poll_ns value falls
    below halt_poll_ns_grow_start.
    
    Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
    Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    Message-Id: <20210902031100.252080-1-senozhatsky@xxxxxxxxxxxx>
    Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b50dbe269f4b..1a11dcb670a3 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3053,15 +3053,19 @@ out:
 
 static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu)
 {
-	unsigned int old, val, shrink;
+	unsigned int old, val, shrink, grow_start;
 
 	old = val = vcpu->halt_poll_ns;
 	shrink = READ_ONCE(halt_poll_ns_shrink);
+	grow_start = READ_ONCE(halt_poll_ns_grow_start);
 	if (shrink == 0)
 		val = 0;
 	else
 		val /= shrink;
 
+	if (val < grow_start)
+		val = 0;
+
 	vcpu->halt_poll_ns = val;
 	trace_kvm_halt_poll_ns_shrink(vcpu->vcpu_id, val, old);
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux