Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp706596ybh; Thu, 12 Mar 2020 09:36:40 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvijnXss3zlvI/KlfsLMWbKOoYvNaFczzkIoobQmlDYpbDeZLQcJ3Maij6C1Rn7/4mCd9Sm X-Received: by 2002:aca:d553:: with SMTP id m80mr3337002oig.30.1584031000471; Thu, 12 Mar 2020 09:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584031000; cv=none; d=google.com; s=arc-20160816; b=Aka87Ihovmp2TGLo3SwL8AWl3HZCr+dhQJC4JA7YdeldiHyjohzQGtd5So/4kIze4g +NyDiNCDaNtWZUMnvn8IxZXBYnIvv8lqsxD1pzZkUq/kbx7Lgm0N6nwYvGy427NcAj6+ DUBUaCpWEyGfsuNxgklFf7sPehOQrXJmfe0uacmcykruGj2l3AK60SNaZpCWMDNHOJqY il8+QI5tl85MxYy0IzS05hinmLaTk488rxf9ivZ3z1FJ7Sr7F9Nk/02EEokPmdBTXJGF KUJxdHe6OX+8OgqUy4tp8WfpP+TSYD6cUV6Lg4PV9yDYdg3tpDprWuea1FV884RbcjF7 bOqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=y+zp8ckYFu/JE3Ap00+bCw6jAqD/T1e+8NMqLw5Uqes=; b=S71/DpYrI6slkfx+/SG1pILdj6Xb5RUX+g4WPl39XSYUcg1SYo8j/nMz2V7YCYtssK mBz4mmi74JGh0OOOP3H9Qb/0XBsJJogiK9WXkLzXrpONG/cDzVo7HSJg8438O+LYevbE +UMMQFbPmqIsofiURemv0rX8gPIWhrGCXeOdLCgNmX0bpWPjIg2tzxdVkptptaJjXJvH 0/X34Rq5R2PnVEQK/vfPXjioJf7ThbrPZUNNZNDGnzxifRN4eoqxVRo37ZbGS/q6D3Y2 AcJKqirKNNKT6Hlp3pBmd8gybL10BrQDdlABw+ISYD1wBP2EkLQ0B9wOdPQRTqSjbUgl GixQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UErATaGz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 38si2683137otu.250.2020.03.12.09.36.26; Thu, 12 Mar 2020 09:36:40 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UErATaGz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726395AbgCLQgJ (ORCPT + 99 others); Thu, 12 Mar 2020 12:36:09 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:24223 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726099AbgCLQgJ (ORCPT ); Thu, 12 Mar 2020 12:36:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584030968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=y+zp8ckYFu/JE3Ap00+bCw6jAqD/T1e+8NMqLw5Uqes=; b=UErATaGzAcf/lGH3fWkC1GNLZPTFnN9qkFNSuXvyEQQemLULSV7JUKtv8X3WL/7jv4cKQ8 osM5ecNVPNV1xs8P9l48Yb2BUDTFoa9/t+snklxa8jV4nMch6SQf5cpXV1wGpAlBy+456H MTMqqitMhaJEZa79I0/+IbzN0eVxAxI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-UwYhNdmiPAqUzi-XPWcEPg-1; Thu, 12 Mar 2020 12:36:06 -0400 X-MC-Unique: UwYhNdmiPAqUzi-XPWcEPg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90D63DBA3; Thu, 12 Mar 2020 16:36:04 +0000 (UTC) Received: from fuller.cnet (ovpn-116-59.gru2.redhat.com [10.97.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38D6D19C6A; Thu, 12 Mar 2020 16:36:04 +0000 (UTC) Received: by fuller.cnet (Postfix, from userid 1000) id CEDAF418CC02; Thu, 12 Mar 2020 13:17:51 -0300 (-03) Date: Thu, 12 Mar 2020 13:17:51 -0300 From: Marcelo Tosatti To: "Maciej S. Szmigiero" Cc: "Rafael J. Wysocki" , Daniel Lezcano , Joao Martins , Boris Ostrovsky , kvm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] cpuidle-haltpoll: allow force loading on hosts without the REALTIME hint Message-ID: <20200312161751.GA5245@fuller.cnet> References: <20200304113248.1143057-1-mail@maciej.szmigiero.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200304113248.1143057-1-mail@maciej.szmigiero.name> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 04, 2020 at 12:32:48PM +0100, Maciej S. Szmigiero wrote: > 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); Signed-off-by: Marcelo Tosatti