Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp190533pxj; Tue, 18 May 2021 00:46:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDeGRKhqJEvyob/F3ByuiHi/juzQrk60GvzDhdGr5mBo/2yvbm3Hzn6DlFzAqTsF0+P/Ql X-Received: by 2002:a92:cc43:: with SMTP id t3mr3286616ilq.250.1621323999889; Tue, 18 May 2021 00:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621323999; cv=none; d=google.com; s=arc-20160816; b=0vNEEmfRV9qK9oNgPSgNkcvu+uw5saPWSZKMD0UB27tZU5zT6nWF9LX6wg/3jYJtRW UOMsxZB0ObfIe0HMCpskmnVD9Ei1FZeVc2r9qYgVZWc3j4rrnYQBAkt7oODAg59YMsl+ Dz8rEUL7m+VG9v0eDzT2a44hyfm6lfkQ+s3978y6AhUcauWUJNYPgvobrFZiVmEbV3sJ XF3Ua3p2hLV3hBvItPwdOja+Z2VeVhVBvfxCFg0qiDnySKCpAhMRqtPA21K7ajw0mcdc 7Sw8rDO878HNUcu7lF1sk7skegwxBrHRDoBGhhDhouhO9SUPIVQkUCrRvuAktv3PueMW TSFQ== 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=C0wPFp46MKPmsPpHdaWAC6yj0yG16SJpu4VxPyb46Mk=; b=uptwcdUIwELGN4a16G0mgfeey9fjQ/XvftXrKXST6kE343+Q0YhC4dg4eZ/YcsuwQE S0T7Jy601T9SmuEGqFU5EZ7LaRdhIK2V1W/6zLLm4Y0WQ4cBMamPqTzpgq4JMAVuhPQS w9egk4mVHWhOKQRkOwp+Sg45MevuHST5gZ9OZuu3tduu/5YEezlWrGYWZijqFN8s8XO6 Y57EHBDGIokqL0H9RCpOxXhf/rFAN2FJhIyGYA/LLmHgxNWedjpqoE+9hozZCngjs1g8 wF18BADZLfPKe3ICh3SlU8MskJ8zKdIX5QAtIwwAhOwEk4vw3e8HVMYLUQJeyyQfyh0x 3uGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="op/4Cjmt"; 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 g6si20781950ild.152.2021.05.18.00.46.20; Tue, 18 May 2021 00:46:39 -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="op/4Cjmt"; 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 S241278AbhEQO5h (ORCPT + 99 others); Mon, 17 May 2021 10:57:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:43198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240356AbhEQOsT (ORCPT ); Mon, 17 May 2021 10:48:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 84AA8613C5; Mon, 17 May 2021 14:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261343; bh=wrx2QNvDWbAZD5cd2brIHG1ui/RvakMqdeTrMAp0GUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=op/4CjmtRuLsWn2rkI2QW9rto03oND8WW53pq6zDXjpOoGhQMkT1si02JiE3Tq62M SbjJOM1YENYpmnm0ltq5kwNHQVGnKT5DOHPW1Fk08ALftpCtHkdw+avpAGrKuH8rF4 WY/j2kaFPC5hVH5S2CaWVmRN53JSAdMkvrOIgV1I= 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.10 010/289] kvm: Cap halt polling at kvm->max_halt_poll_ns Date: Mon, 17 May 2021 15:58:55 +0200 Message-Id: <20210517140305.525322001@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: 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 @@ -2717,8 +2717,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: