From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B3C9C43461 for ; Mon, 17 May 2021 14:29:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1849A61C37 for ; Mon, 17 May 2021 14:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238936AbhEQOa4 (ORCPT ); Mon, 17 May 2021 10:30:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:53884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239434AbhEQO0S (ORCPT ); Mon, 17 May 2021 10:26:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D7BB961364; Mon, 17 May 2021 14:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260817; bh=6ddgKla64uBEGApX7ZIEwioGFErlQV89OSB8CcnYl/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PEYtFn8Ygg1of9xe5E6ClRjo2mchZJDCnLLL7sfGlXCDQ0mLNu8t1QXs14yoQrd4u Z5e86SevaZOo76B4engz6Jc/5Fhqyw6TQ4/RfJ+0cYIdEb9Su7BN9W0vlyrWdSkrhd vrnUEf4PeO2Z3NwwES3ZvfAYkoAK7ZzHBlI6WaWQ= 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.11 011/329] kvm: Cap halt polling at kvm->max_halt_poll_ns Date: Mon, 17 May 2021 15:58:42 +0200 Message-Id: <20210517140302.431230811@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.043055203@linuxfoundation.org> References: <20210517140302.043055203@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 @@ -2734,8 +2734,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: