Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3145761pxj; Mon, 17 May 2021 18:58:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgls3LJWGANcvEP1HSDQvLFCXS8lbZlG8hM1wwgGqq6YokU9LHXY+YWPDLumcN+/KSl9ir X-Received: by 2002:a05:6e02:92c:: with SMTP id o12mr2252003ilt.256.1621303109736; Mon, 17 May 2021 18:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621303109; cv=none; d=google.com; s=arc-20160816; b=U3bsgeXvVjDrNUyIoZsR7bYyom61hyj7y/uuo0BIcg1R3xVcJrcRZz1KFRGGB8i9HH jOLCHYNzpL/0N3jv+SA3oBBmJ7sL+O4llkiHUDB2N4STnQ0OXAt0MWN1C9g0+m4dU83O M05axQPXAJo8keQtTtEYHDvkSbk87fh+BRbrN7fkt/g25M1q0YHf4dXc8levBjQ04Mna NbXQrcLw1jiU+0W2qmZhafYyDW2ynuxPrK1ySS7m5Zy/EwhBRzmBMd0BMuOaKlVTCWsj 6qB4hyHs6ZUXfe/2a5hwzo7rVieAkGZHbNsEtthpiio7IElSSXi+bxzEK/9lQssBSQ47 8HzQ== 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=VMtA5lb976XmWxz2eZzTp17PjvznbmJvTeItiSqjQIg=; b=w6oAh2T0GvNI6NKhEOKUQL413s7ZuYuMcyjTgFyJQD9egxIUYEqW4SOjpcHytkY8PX EDuQIxd09Or3htgtVfrF+JcLuxFFBUeMX+ybv6WvBM2IQuAGuYqi92HdHHB+rWEKKffS kk8rHn/5qso3pO62TnSIN5146C/F7m8w5RB5Yxzc/aZYMt0EuKkRWknaW8oNz/mGbglh J2tGWaKUEH5dCu3V6wM77XACo7hfynA0zX8AmY7cQ3eheh6TqUF8mgFB0fvhU50ITUjK SAlgwOQkbHeywz8aJ3Yfh9DkdiUcmfFtxcKg0U0DNhb4zI8RBh6Bio66WgNJD6L2j1zW kpUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0J8Vp+72; 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 d9si8922958ils.122.2021.05.17.18.58.17; Mon, 17 May 2021 18:58:29 -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=0J8Vp+72; 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 S239553AbhEQOg3 (ORCPT + 99 others); Mon, 17 May 2021 10:36:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:43890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239405AbhEQObw (ORCPT ); Mon, 17 May 2021 10:31:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F21B960720; Mon, 17 May 2021 14:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260948; bh=4YbuxYWZXLqmOhoZbHuVpCt5pHBSQsjnP+PfCImFYhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0J8Vp+72n0kmUo1tC4/dhj7u0xH57kFBzVZJjw+zZ46gBya0LnMb1O/d063U1ATGu 4gqDZIYjq8CFVMhp02KCnb4AWvgrBZyzJ8Serdx+AaoWZg40FCxBB/vlMInINQmXMJ LYmfPNv0Ta8h2VCLFNTEw6hkPmZjUWy10e3QEcR8= 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.12 273/363] kvm: exit halt polling on need_resched() as well Date: Mon, 17 May 2021 16:02:19 +0200 Message-Id: <20210517140311.846094465@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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 @@ -2838,7 +2838,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);