Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2145518ybv; Fri, 21 Feb 2020 09:44:04 -0800 (PST) X-Google-Smtp-Source: APXvYqzGgS7pyWHMNQcB5slpfeTzvXiMGG9dnRqMCW2kqRb4GifPXPc9ygSIXr37hdHxVrbuMBi6 X-Received: by 2002:a9d:6c01:: with SMTP id f1mr28293965otq.133.1582307044675; Fri, 21 Feb 2020 09:44:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582307044; cv=none; d=google.com; s=arc-20160816; b=k1NI2x6svrIhPdiUxg4dwqQSTjUQk6qxSr5+O/xhnz+PHuh5lFymrPw3ecO108VGQw I4k0fXjpvhCXo3MuQEYtrRD4HEuaqTkWzewSJax7K6/S7lUw37rhtlk3oicI/5STop9x F6zWVxCEJdFh9U0feQPnFrOx3v6P7uOl2eNs2/cAhTOKtKpmFOyrbRYi5s0Er/JOvwx+ gIpr7J9+btPLEPReBTPmZLnCixevxs5KyKl3diDDplwpg+EerN+q4Kta+I9SQ1ts+PMw ffst93Ltc2SgXygNKAa9hSKwaWVmG6qxy4bfZrIl7D1kVlJbon7Q+cKiZ7DbRvDfQbS8 jAxg== 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=9f133cvsKxhKQR64pQ1RWrWzszCNf0BPxvY5zZic43I=; b=HDH+nejRQGIn7GpZGYTBrUT+WP0P8fzvrrDDesaPNAQ6xGHcgKPHxg5OtK7DxZM78d uGHRnSEbrVhMQiQgaWiHDa9BWz1247If0RmOWGBwQUg9N3CrMtSd2LVk+3/Kdrmn0f1p HrUDlSU6b6u4Z8zLX9/DQW0b5pwX29tknN7fX+WoHtmxaZFVvZn+gFFGVAa6qD3UgDvu luT4oY6xw19D6JT/cq5hNp1l2a23XxA8R/wWA6zgsJkLklw6RGVMN9wQPjKXJ18H1B2k 5ZnR9WR8+mfsjwGz9rn8KfwpFeI1+T/mec2vRufYWqdly/Ap77Tixw3GrMB2x09HRXWS C4vA== 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 g17si1772020otr.261.2020.02.21.09.43.52; Fri, 21 Feb 2020 09:44:04 -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 S1726150AbgBURnl (ORCPT + 99 others); Fri, 21 Feb 2020 12:43:41 -0500 Received: from vps-vb.mhejs.net ([37.28.154.113]:45300 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726550AbgBURnl (ORCPT ); Fri, 21 Feb 2020 12:43:41 -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 1j5CKv-0002wU-0a; Fri, 21 Feb 2020 18:43:37 +0100 From: "Maciej S. Szmigiero" To: "Rafael J. Wysocki" , Daniel Lezcano Cc: Joao Martins , Boris Ostrovsky , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpuidle-haltpoll: allow force loading on hosts without the REALTIME hint Date: Fri, 21 Feb 2020 18:43:31 +0100 Message-Id: <20200221174331.1480468-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, 11 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c index b0ce9bc78113..07e5b36076bb 100644 --- a/drivers/cpuidle/cpuidle-haltpoll.c +++ b/drivers/cpuidle/cpuidle-haltpoll.c @@ -18,6 +18,11 @@ #include #include +static bool force __read_mostly; +module_param(force, bool, 0444); +MODULE_PARM_DESC(force, + "Load even if the host does not provide the REALTIME hint"); + static struct cpuidle_device __percpu *haltpoll_cpuidle_devices; static enum cpuhp_state haltpoll_hp_state; @@ -90,6 +95,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; @@ -102,7 +112,7 @@ static int __init haltpoll_init(void) cpuidle_poll_state_init(drv); if (!kvm_para_available() || - !kvm_para_has_hint(KVM_HINTS_REALTIME)) + !haltpool_want()) return -ENODEV; ret = cpuidle_register_driver(drv);