diff mbox series

[1/3] KVM: PPC: Book3S HV: exit halt polling on need_resched() as well

Message ID 1620466310-8428-1-git-send-email-wanpengli@tencent.com (mailing list archive)
State New, archived
Headers show
Series [1/3] KVM: PPC: Book3S HV: exit halt polling on need_resched() as well | expand

Commit Message

Wanpeng Li May 8, 2021, 9:31 a.m. UTC
From: Wanpeng Li <wanpengli@tencent.com>

Inspired by commit 262de4102c7bb8 (kvm: exit halt polling on need_resched() 
as well), due to PPC implements an arch specific halt polling logic, we should 
add the need_resched() checking there as well.

Cc: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
---
 arch/powerpc/kvm/book3s_hv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Wanpeng Li May 12, 2021, 12:02 a.m. UTC | #1
Cc more guys,
On Sat, 8 May 2021 at 17:32, Wanpeng Li <kernellwp@gmail.com> wrote:
>
> From: Wanpeng Li <wanpengli@tencent.com>
>
> Inspired by commit 262de4102c7bb8 (kvm: exit halt polling on need_resched()
> as well), due to PPC implements an arch specific halt polling logic, we should
> add the need_resched() checking there as well.
>

Update the patch description:

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: Paul Mackerras <paulus@ozlabs.org>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
>  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
>
diff mbox series

Patch

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;