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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1620871084-4639-1-git-send-email-wanpengli@tencent.com>
Date:   Thu, 13 May 2021 09:58:04 +0800
From:   Wanpeng Li <kernellwp@...il.com>
To:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc:     Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>,
        Ben Segall <bsegall@...gle.com>,
        Venkatesh Srinivas <venkateshs@...omium.org>,
        David Matlack <dmatlack@...gle.com>,
        Paul Mackerras <paulus@...abs.org>,
        Suraj Jitindar Singh <sjitindarsingh@...il.com>
Subject: [PATCH v2 1/4] KVM: PPC: Book3S HV: exit halt polling on need_resched() as well

From: Wanpeng Li <wanpengli@...cent.com>

Inspired by commit 262de4102c7bb8 (kvm: exit halt polling on need_resched()
as well), CFS_BANDWIDTH throttling will use resched_task() when there is just
one task to get the task to block. It was likely allowing VMs to overrun their
quota when halt polling. Due to PPC implements an arch specific halt polling
logic, we should add the need_resched() checking there as well.

Cc: Ben Segall <bsegall@...gle.com>
Cc: Venkatesh Srinivas <venkateshs@...omium.org>
Cc: Jim Mattson <jmattson@...gle.com> 
Cc: David Matlack <dmatlack@...gle.com>
Cc: Paul Mackerras <paulus@...abs.org>
Cc: Suraj Jitindar Singh <sjitindarsingh@...il.com>
Signed-off-by: Wanpeng Li <wanpengli@...cent.com>
---
v1 -> v2:
 * update patch description

 arch/powerpc/kvm/book3s_hv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 28a80d2..6199397 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -3936,7 +3936,8 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc)
 				break;
 			}
 			cur = ktime_get();
-		} while (single_task_running() && ktime_before(cur, stop));
+		} while (single_task_running() && !need_resched() &&
+			 ktime_before(cur, stop));
 
 		spin_lock(&vc->lock);
 		vc->vcore_state = VCORE_INACTIVE;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ