Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4416084ybf; Wed, 4 Mar 2020 03:33:16 -0800 (PST) X-Google-Smtp-Source: ADFU+vtmdby6qjczo/7WT5tQkqndu7aS07kyhnrLRBzs+rzcT9X4smOOCfY6BqFqv72KeXbTFIUK X-Received: by 2002:a9d:4787:: with SMTP id b7mr1991142otf.323.1583321596533; Wed, 04 Mar 2020 03:33:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583321596; cv=none; d=google.com; s=arc-20160816; b=KeXIC8jfgM1iMRBmows5mPSdNH+eEqApHEdYBKDshkP+h8bdKdln9nyvB3JiomQPTk 9789qoX8FRuqc5TJAT0wHTCxVYpmsJYDEcY8Bg8t451Y9+tUh/ycbQesBIqv5DwiOUj1 A18yVpvsfjFMNQ4nBoOhbCkNQJ1zp4/3amaycdku7PfF9uKUAGtgDPV65dl7XQjGQpHg HykuSlvIJgi4gtD976QHJQY9OFS5lgYRmZzjDW1BGe0+xHiZEZFu8/WlOvbJKU/bc5aw 0ukR5DTEM68rdZU2CbX9Lgl1wZO4ZM8NXOPQXN3kslQqzMWCfdlU9cADCHkW/0rQh1qe VAcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=KGSeQqHs/e9BoOgaUlPOAGvN2w7Mvu9G1fDFhEWE0wI=; b=kGYpcJwzb88/xqmJwob5wFFgtb0LjtDdvHhJ1pxMKY/hqVXbHodAxHS8lYRpn5OpR3 px9mHPZTMidWROu6cru1q5t+mLiWa23rKdOrYytbpo+2sI3k9YaFh7CjisqfJKxdzSXK ICvCINWd/et47kOL/1xCFmow88wUAJY5WcpOaPYJQVhiBf7lJ95A4odNB4bs3nON2HTB sIOb50+G/Eq8XxqMSShomYeydLrRDRMeCcuwZtbfmq25s1FGthJGTUWDeTsiDVS0n/Pt 3NLD30UdP42q+caZoVf3yuvClX2bZRpoZlIHuUacTkMJvyOn/oz62it+lpNlFwG+ty4V Ez/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q131si934958oig.203.2020.03.04.03.33.04; Wed, 04 Mar 2020 03:33:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387776AbgCDLdB (ORCPT + 99 others); Wed, 4 Mar 2020 06:33:01 -0500 Received: from vps-vb.mhejs.net ([37.28.154.113]:57462 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729256AbgCDLdA (ORCPT ); Wed, 4 Mar 2020 06:33:00 -0500 Received: from MUA by vps-vb.mhejs.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1j9SGj-0000pl-Un; Wed, 04 Mar 2020 12:32:53 +0100 From: "Maciej S. Szmigiero" To: "Rafael J. Wysocki" , Daniel Lezcano Cc: Joao Martins , Boris Ostrovsky , Marcelo Tosatti , kvm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] cpuidle-haltpoll: allow force loading on hosts without the REALTIME hint Date: Wed, 4 Mar 2020 12:32:48 +0100 Message-Id: <20200304113248.1143057-1-mail@maciej.szmigiero.name> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Maciej S. Szmigiero" Before commit 1328edca4a14 ("cpuidle-haltpoll: Enable kvm guest polling when dedicated physical CPUs are available") the cpuidle-haltpoll driver could also be used in scenarios when the host does not advertise the KVM_HINTS_REALTIME hint. While the behavior introduced by the aforementioned commit makes sense as the default there are cases where the old behavior is desired, for example, when other kernel changes triggered by presence by this hint are unwanted, for some workloads where the latency benefit from polling overweights the loss from idle CPU capacity that otherwise would be available, or just when running under older Qemu versions that lack this hint. Let's provide a typical "force" module parameter that allows restoring the old behavior. Signed-off-by: Maciej S. Szmigiero --- drivers/cpuidle/cpuidle-haltpoll.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) Changes from v1: Make the module parameter description more general, don't unnecessarily break a line in haltpoll_init(). diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c index b0ce9bc78113..db124bc1ca2c 100644 --- a/drivers/cpuidle/cpuidle-haltpoll.c +++ b/drivers/cpuidle/cpuidle-haltpoll.c @@ -18,6 +18,10 @@ #include #include +static bool force __read_mostly; +module_param(force, bool, 0444); +MODULE_PARM_DESC(force, "Load unconditionally"); + static struct cpuidle_device __percpu *haltpoll_cpuidle_devices; static enum cpuhp_state haltpoll_hp_state; @@ -90,6 +94,11 @@ static void haltpoll_uninit(void) haltpoll_cpuidle_devices = NULL; } +static bool haltpool_want(void) +{ + return kvm_para_has_hint(KVM_HINTS_REALTIME) || force; +} + static int __init haltpoll_init(void) { int ret; @@ -101,8 +110,7 @@ static int __init haltpoll_init(void) cpuidle_poll_state_init(drv); - if (!kvm_para_available() || - !kvm_para_has_hint(KVM_HINTS_REALTIME)) + if (!kvm_para_available() || !haltpool_want()) return -ENODEV; ret = cpuidle_register_driver(drv);