* [PATCH] kvm: exit halt polling on need_resched() as well
@ 2021-04-29 16:22 Venkatesh Srinivas
2021-04-29 16:39 ` Jim Mattson
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Venkatesh Srinivas @ 2021-04-29 16:22 UTC (permalink / raw)
To: kvm, jmattson, pbonzini, dmatlack; +Cc: Benjamin Segall, Venkatesh Srinivas
From: Benjamin Segall <bsegall@google.com>
single_task_running() is usually more general than need_resched()
but CFS_BANDWIDTH throttling will use resched_task() when there
is just one task to get the task to block. This was causing
long-need_resched warnings and was likely allowing VMs to
overrun their quota when halt polling.
Signed-off-by: Ben Segall <bsegall@google.com>
Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org>
---
virt/kvm/kvm_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2799c6660cce..b9f12da6af0e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2973,7 +2973,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
goto out;
}
poll_end = cur = ktime_get();
- } while (single_task_running() && ktime_before(cur, stop));
+ } while (single_task_running() && !need_resched() &&
+ ktime_before(cur, stop));
}
prepare_to_rcuwait(&vcpu->wait);
--
2.31.1.498.g6c1eba8ee3d-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: exit halt polling on need_resched() as well
2021-04-29 16:22 [PATCH] kvm: exit halt polling on need_resched() as well Venkatesh Srinivas
@ 2021-04-29 16:39 ` Jim Mattson
2021-04-30 15:48 ` David Matlack
2021-04-30 17:43 ` Christian Borntraeger
2 siblings, 0 replies; 5+ messages in thread
From: Jim Mattson @ 2021-04-29 16:39 UTC (permalink / raw)
To: Venkatesh Srinivas
Cc: kvm list, Paolo Bonzini, David Matlack, Benjamin Segall
On Thu, Apr 29, 2021 at 9:22 AM Venkatesh Srinivas
<venkateshs@chromium.org> wrote:
>
> From: Benjamin Segall <bsegall@google.com>
>
> single_task_running() is usually more general than need_resched()
> but CFS_BANDWIDTH throttling will use resched_task() when there
> is just one task to get the task to block. This was causing
> long-need_resched warnings and was likely allowing VMs to
> overrun their quota when halt polling.
>
> Signed-off-by: Ben Segall <bsegall@google.com>
> Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org>
Reviewed-by: Jim Mattson <jmattson@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: exit halt polling on need_resched() as well
2021-04-29 16:22 [PATCH] kvm: exit halt polling on need_resched() as well Venkatesh Srinivas
2021-04-29 16:39 ` Jim Mattson
@ 2021-04-30 15:48 ` David Matlack
2021-04-30 17:43 ` Christian Borntraeger
2 siblings, 0 replies; 5+ messages in thread
From: David Matlack @ 2021-04-30 15:48 UTC (permalink / raw)
To: Venkatesh Srinivas; +Cc: kvm list, Jim Mattson, Paolo Bonzini, Benjamin Segall
On Thu, Apr 29, 2021 at 9:22 AM Venkatesh Srinivas
<venkateshs@chromium.org> wrote:
>
> From: Benjamin Segall <bsegall@google.com>
>
> single_task_running() is usually more general than need_resched()
> but CFS_BANDWIDTH throttling will use resched_task() when there
> is just one task to get the task to block. This was causing
> long-need_resched warnings and was likely allowing VMs to
> overrun their quota when halt polling.
>
> Signed-off-by: Ben Segall <bsegall@google.com>
> Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org>
Reviewed-by: David Matlack <dmatlack@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: exit halt polling on need_resched() as well
2021-04-29 16:22 [PATCH] kvm: exit halt polling on need_resched() as well Venkatesh Srinivas
2021-04-29 16:39 ` Jim Mattson
2021-04-30 15:48 ` David Matlack
@ 2021-04-30 17:43 ` Christian Borntraeger
2021-05-03 14:52 ` Paolo Bonzini
2 siblings, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2021-04-30 17:43 UTC (permalink / raw)
To: Venkatesh Srinivas, kvm, jmattson, pbonzini, dmatlack; +Cc: Benjamin Segall
On 29.04.21 18:22, Venkatesh Srinivas wrote:
> From: Benjamin Segall <bsegall@google.com>
>
> single_task_running() is usually more general than need_resched()
> but CFS_BANDWIDTH throttling will use resched_task() when there
> is just one task to get the task to block. This was causing
> long-need_resched warnings and was likely allowing VMs to
> overrun their quota when halt polling.
>
> Signed-off-by: Ben Segall <bsegall@google.com>
> Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org>
would that qualify for stable?
> ---
> virt/kvm/kvm_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 2799c6660cce..b9f12da6af0e 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -2973,7 +2973,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
> goto out;
> }
> poll_end = cur = ktime_get();
> - } while (single_task_running() && ktime_before(cur, stop));
> + } while (single_task_running() && !need_resched() &&
> + ktime_before(cur, stop));
> }
>
> prepare_to_rcuwait(&vcpu->wait);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: exit halt polling on need_resched() as well
2021-04-30 17:43 ` Christian Borntraeger
@ 2021-05-03 14:52 ` Paolo Bonzini
0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2021-05-03 14:52 UTC (permalink / raw)
To: Christian Borntraeger, Venkatesh Srinivas, kvm, jmattson, dmatlack
Cc: Benjamin Segall
On 30/04/21 19:43, Christian Borntraeger wrote:
>
>
> On 29.04.21 18:22, Venkatesh Srinivas wrote:
>> From: Benjamin Segall <bsegall@google.com>
>>
>> single_task_running() is usually more general than need_resched()
>> but CFS_BANDWIDTH throttling will use resched_task() when there
>> is just one task to get the task to block. This was causing
>> long-need_resched warnings and was likely allowing VMs to
>> overrun their quota when halt polling.
>>
>> Signed-off-by: Ben Segall <bsegall@google.com>
>> Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org>
>
> would that qualify for stable?
Good idea indeed, I added the Cc.
Paolo
>> ---
>> virt/kvm/kvm_main.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index 2799c6660cce..b9f12da6af0e 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -2973,7 +2973,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
>> goto out;
>> }
>> poll_end = cur = ktime_get();
>> - } while (single_task_running() && ktime_before(cur, stop));
>> + } while (single_task_running() && !need_resched() &&
>> + ktime_before(cur, stop));
>> }
>>
>> prepare_to_rcuwait(&vcpu->wait);
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-03 14:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 16:22 [PATCH] kvm: exit halt polling on need_resched() as well Venkatesh Srinivas
2021-04-29 16:39 ` Jim Mattson
2021-04-30 15:48 ` David Matlack
2021-04-30 17:43 ` Christian Borntraeger
2021-05-03 14:52 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).