Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2960381pxj; Mon, 17 May 2021 14:10:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpVlgHnl6qAcxxAIkj1pdajMDMDG2h47tncEePFhT7oVgpkLH/AO3fFpB02ce98poi8e7a X-Received: by 2002:a17:906:840c:: with SMTP id n12mr1898624ejx.431.1621285845848; Mon, 17 May 2021 14:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621285845; cv=none; d=google.com; s=arc-20160816; b=SAKu4OS3+0+a7O9jCgRRBZBglZP01LWwPHo4sEFDczspjmcXjDJF5NBZE6TykABy+B Jo7W4b5zJtP8P64GEPIOG1Jf8JNSFvebzK4YMStcdwioVykP3pLQBk8wshR46PaiNcSC src57PBBQAqv2PKWVAtFibNcfDDpkYYn2oUqOCh1lkqBLfJCsvPqItbnAh2EgQGPr6al peJClCdNlOZCJp5OiR7+p0K2fU3BEyMD7A17SuAwCtUWLYjk5RzUX2e8b/SbwO8GhY7u g2RfqagRhHEClEnJ6+CR8t8d4bZruIXU6Bax8VqUkGf+jfajfT6giZUNdyzqxSE2Ug1s 8wjg== 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=J4qoPljgUilKVv6rJ87iX0F+KcAJzU109LiBep1hN9A=; b=Ya8MuWJJxHmP2d6iB8OlF/+w6jb0zLzDPzCAQAPLn9WteUsLCi181V/+JTq4AbI/BV CH4nD0VthWxE/KHcKSdt0ca9I+ekdjfP++NI5w7uihxZdGycLaOa3OZ33e5ZNtuBNXJ7 OP4Fp3bn9KbYrF3By23Q4AHUal42k9rUNxMaZaaQKNpn9zWTTm3dRAZWeARGMN3qjLf2 o8C4BDds24vPTOUK18X+V2LtoqQm3pG6E1Cs1ei74yBiS4ne9gem8vMmh1fMFIwwimhz o3ejmPjwUyIq2lJ+5jETUqBstBUsPX/6CRDMQ/8fTUH9gydH3UCKhtObZejRybVr9JIL QnbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AN5x8VDA; 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 b14si3544326ejv.445.2021.05.17.14.10.21; Mon, 17 May 2021 14:10:45 -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=AN5x8VDA; 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 S237824AbhEQOG0 (ORCPT + 99 others); Mon, 17 May 2021 10:06:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:57074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237810AbhEQOF6 (ORCPT ); Mon, 17 May 2021 10:05:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 724B961221; Mon, 17 May 2021 14:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260281; bh=m5LxW08p885Yq4NLdEFRCj/2P/qR3556v3A8SahSzS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AN5x8VDAzUqChVw8mNFisXSZQv1MnShN9/KLS7cWToWkmSDk/JsNDD//EIRQSfa8Z IxTyJsBAO+q5RKC9nQiBTDqOeeDaY+w09G5eKMu2BiRLTBHYRxggXkzZfNsLoCMEoa n0aIUX0rLUMKFsW0gtrfSuBOaY90W+4vWXIB399c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Matlack , Venkatesh Srinivas , Paolo Bonzini Subject: [PATCH 5.12 011/363] kvm: Cap halt polling at kvm->max_halt_poll_ns Date: Mon, 17 May 2021 15:57:57 +0200 Message-Id: <20210517140302.934349093@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: David Matlack commit 258785ef08b323bddd844b4926a32c2b2045a1b0 upstream. When growing halt-polling, there is no check that the poll time exceeds the per-VM limit. It's possible for vcpu->halt_poll_ns to grow past kvm->max_halt_poll_ns and stay there until a halt which takes longer than kvm->halt_poll_ns. Signed-off-by: David Matlack Signed-off-by: Venkatesh Srinivas Message-Id: <20210506152442.4010298-1-venkateshs@chromium.org> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- virt/kvm/kvm_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2758,8 +2758,8 @@ static void grow_halt_poll_ns(struct kvm if (val < grow_start) val = grow_start; - if (val > halt_poll_ns) - val = halt_poll_ns; + if (val > vcpu->kvm->max_halt_poll_ns) + val = vcpu->kvm->max_halt_poll_ns; vcpu->halt_poll_ns = val; out: