From patchwork Fri Oct 14 00:53:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 9375981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A10B660839 for ; Fri, 14 Oct 2016 00:54:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BFC12A243 for ; Fri, 14 Oct 2016 00:54:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C3822A24F; Fri, 14 Oct 2016 00:54:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 736972A243 for ; Fri, 14 Oct 2016 00:54:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756288AbcJNAyx (ORCPT ); Thu, 13 Oct 2016 20:54:53 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:34904 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751667AbcJNAyv (ORCPT ); Thu, 13 Oct 2016 20:54:51 -0400 Received: by mail-pa0-f68.google.com with SMTP id qn10so5384060pac.2; Thu, 13 Oct 2016 17:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QV05SYtu94AdlUW+K9RJYvSZA6andGknZsazm+o8FMI=; b=x8OB8mW/SBMqliZ7ToVwGAnn+P/VouRjuwufM5Ln9/yUlEtdoZvcIDwQLYiSpNCc+8 G/jJLaRgvClMn3Ar4vP0FzDcV2Lxon3ouzCn0/TGN4YZK4JBM6S/EKOVvPfCizcnE2MH FKnA4AABUfTJzdgI2px2mUj5vSP6Oh5q0nIP470khb2LmPHJGcnoEPC5sf5wyBrN9wfa DWHXYj8X6EJc4s3XuZj18qz0mH2uXTlcmgs7h7OuXn4Yqjz0/gP04wJwLNbEeEAGIams Oi/APH2kbF/WSoErgWYgc2Qu92zAnT4e+0AvHOzNq4MYWCjOGbx89jdlZSmcOV1AZ5/C q/Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QV05SYtu94AdlUW+K9RJYvSZA6andGknZsazm+o8FMI=; b=T2Z2fMuvuRiotYg4EjE5rjhC/r3ApbyOu8Adab5+xvbkTEKVBTa3QT6OiDmEBOfaCu Bfdz6SaIqdH1UV08wZ2BN8gSK874zlvAOy5Ou0QzsSnsvvcI7cJAwr5uSRBrgjoMpIYy PIj2YJrQMD6+NsP0+zQRFGOHPsOwjfvkQKB0YLzwkAWDpUTvzNrTMrienDf/T9CX+l8E rX2gAVpFsZMCyzF6/Tl3yeK0XVZJLe6w2TF1AhNyN+Sy8l07AuSDGPS14Tm2R21WBmmA UIe8mJrqPuEt8QE7uNtqppo0hof0jQG1ND4rMMFs5GWVWV2J2D0TkDla/DouGCpp7rDC pkXQ== X-Gm-Message-State: AA6/9RnCQT805LQg/ty+xK4its+tvARHxTd3I6/6NUu6V9uZ6KTPnMuhPnh3fb6KfWE+nQ== X-Received: by 10.66.84.99 with SMTP id x3mr11706665pay.83.1476406433795; Thu, 13 Oct 2016 17:53:53 -0700 (PDT) Received: from dyn253.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id f2sm22285272pfj.68.2016.10.13.17.53.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2016 17:53:53 -0700 (PDT) From: Suraj Jitindar Singh To: pbonzini@redhat.com, rkrcmar@redhat.com, agraf@suse.com, corbet@lwn.net Cc: paulus@samba.org, mpe@ellerman.id.au, sam.bobroff@au1.ibm.com, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, benh@kernel.crashing.org, linux-doc@vger.kernel.org, Suraj Jitindar Singh Subject: [PATCH 3/6] powerpc/kvm: Add check for module parameter halt_poll_ns Date: Fri, 14 Oct 2016 11:53:21 +1100 Message-Id: <1476406404-32752-4-git-send-email-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1476406404-32752-1-git-send-email-sjitindarsingh@gmail.com> References: <1476406404-32752-1-git-send-email-sjitindarsingh@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The kvm module parameter halt_poll_ns defines the global maximum halt polling interval and can be dynamically changed by writing to the /sys/module/kvm/parameters/halt_poll_ns sysfs file. However in kvm-hv this module parameter value is only ever checked when we grow the current polling interval for the given vcore. This means that if we decrease the halt_poll_ns value below the current polling interval we won't see any effect unless we try to grow the polling interval above the new max at some point or it happens to be shrunk below the halt_poll_ns value. Update the halt polling code so that we always check for a new module param value of halt_poll_ns and set the current halt polling interval to it if it's currently greater than the new max. This means that it's redundant to also perform this check in the grow_halt_poll_ns() function now. Signed-off-by: Suraj Jitindar Singh --- arch/powerpc/kvm/book3s_hv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index daad638..6503a63 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -2526,9 +2526,6 @@ static void grow_halt_poll_ns(struct kvmppc_vcore *vc) vc->halt_poll_ns = 10000; else vc->halt_poll_ns *= halt_poll_ns_grow; - - if (vc->halt_poll_ns > halt_poll_ns) - vc->halt_poll_ns = halt_poll_ns; } static void shrink_halt_poll_ns(struct kvmppc_vcore *vc) @@ -2648,6 +2645,8 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc) else if (vc->halt_poll_ns < halt_poll_ns && block_ns < halt_poll_ns) grow_halt_poll_ns(vc); + if (vc->halt_poll_ns > halt_poll_ns) + vc->halt_poll_ns = halt_poll_ns; } else vc->halt_poll_ns = 0;