Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp597783pxj; Tue, 18 May 2021 09:58:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6dZR3Lr4sg/PrbMqiFnyG7X986E93Im6K3yP3DYdxM4jRUYxnQ9sHXzlsUr2oboXXiSqU X-Received: by 2002:a05:6402:3585:: with SMTP id y5mr8214435edc.233.1621357091261; Tue, 18 May 2021 09:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621357091; cv=none; d=google.com; s=arc-20160816; b=aePHPlOscXEU3N8v80xroBfLSOY65NkgNFr4fcb3KfsjJSssKDAXYAW96wra6BeI80 KIVQHp/C+lGPaGKqkmemajlCmjtgf5upWeYE1JjGFkg7IBR9NwCcVRbPBtqDJvBP7COQ GkWlVt+0EYV6bOwF+EDUBEh0iCiV1ZsplbpqXcFf1ZywyBYK7foT7pT0awfm0K3Iv2ZQ ySbqgSscGs5iVdS5h7rKkLjTIon1Y3NzCSjM6wH7i/P9MJMMl9bkyt1uqq6+4rLvXSeb CgOWmwxrGwIB9EVps7XdOn0UonTAriZq0iuagGbqqkHtcQNtNK5SK2yEsGAgXQvPQOxF 0veg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qwk/O4/5EOV7HD5wee27iTpAQt8J4jS2LZYhS/6jyf8=; b=TdDjvSrE8CqapCGjXMgyL+Cc5XV1epGK8B95u01IYOYwaaA25B5b6FcXVsBfiozq+y IaKq6WYbW7Bc+j26pNtQYabdsABPsKtSEsmtQ7/CXz7mYNAXMrWDZ6JUYQye+wKau/dQ HsBYr7//I1wtzOaWbTavGTZ+8EhdrQtCQagW+Lr80M84lELxDxebMjgKnPz6G/7Vczmo YE99BzM9U/kxvrbHz06ScRrSzSXiQn18TVMMrenuc3OcOXANw53bQ8Zsf6BwBw9qnMtN AbKH+A7tCaGzdXhVQUzDWaAMULmZkPRPpkMUj2eM8YKaO22erzPcPWR+D0+FnATwmMGf +8Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=exMDySs+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si20436607edx.197.2021.05.18.09.57.13; Tue, 18 May 2021 09:58:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=exMDySs+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343561AbhEQQD4 (ORCPT + 99 others); Mon, 17 May 2021 12:03:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:52198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343853AbhEQPmK (ORCPT ); Mon, 17 May 2021 11:42:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CBB1C6142A; Mon, 17 May 2021 14:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262547; bh=mOYkKemhPJnFCCCEuwLfJRhltZzpoH4GVIaWY12e/ZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=exMDySs+coDTQFQ6FdOIIanf4HsulKZM7ScwO5vBsQNZ9XzvCMVjgZmK+5QX5XT9k ULDl1jXTc4E/sEe0+xfLBq4exus+rkqkyeQxwqvbq5Tkn26RJBqcu2XAB2aAHafLfs NXXaYO0o8pdMEB0F858Un890jsg3hArfOWzMdPMk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Segall , Venkatesh Srinivas , Paolo Bonzini , Jim Mattson Subject: [PATCH 5.10 211/289] kvm: exit halt polling on need_resched() as well Date: Mon, 17 May 2021 16:02:16 +0200 Message-Id: <20210517140312.226734512@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benjamin Segall commit 262de4102c7bb8e59f26a967a8ffe8cce85cc537 upstream. 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 Signed-off-by: Venkatesh Srinivas Message-Id: <20210429162233.116849-1-venkateshs@chromium.org> Signed-off-by: Paolo Bonzini Cc: stable@vger.kernel.org Reviewed-by: Jim Mattson Signed-off-by: Greg Kroah-Hartman --- virt/kvm/kvm_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2797,7 +2797,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcp 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);