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=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 CA679C4CECE for ; Fri, 13 Mar 2020 17:50:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DEC7206E9 for ; Fri, 13 Mar 2020 17:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584121800; bh=7f3thBfEynN8Kb15/c88ViQSGjrO0ZDJtS4JzsLaoTA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=HPdURWLah8hKZAWoS0HFYfSmBVypSshV99OQ02CjVf0IBmksYVmzg6ccklK8uyQkX Z6vFE9gF8IdMAYDu0aiYdSVmuRQP+I7Hno7gSTvCRUFixpq3z9w8Uqf52vmwBAvENz MhKyT3PveKKW93WTYMKxG112/7xBhStYdZEpHO+M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727175AbgCMRt6 (ORCPT ); Fri, 13 Mar 2020 13:49:58 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:36186 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726528AbgCMRt5 (ORCPT ); Fri, 13 Mar 2020 13:49:57 -0400 Received: by mail-ot1-f66.google.com with SMTP id j14so11021780otq.3; Fri, 13 Mar 2020 10:49:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ikJY8jL+WwN9m0h/0ly8EPxlXvIn8mr2TN/3Ad+1Sjw=; b=so5fYZSoCwaFwWyqYnzVHGf7R/BRTOLM0pxs/dR3qdTZ6zLyvss4/5eIoDD+FTJNin 9y0AnkjYIoZb+chMW7BbRXnVfr9Z2ca1NP30yrHHAtbTXAgk9dNOoKzW63lQc4yeI5WQ zSs7Pmgq8NoKeneJPe1rSMv9j3oImG4Z/lEskFJpRChMmb3oqZ1GU+JAYFnzcKcwtoq5 bjkQSt6g/nZyyDEVnDx9C1XDmcQOJJqYHWFXFOuUArR5xWPIcMi5egEvCD//IVrH/EbG 9UqcLjpK63Q173FzarBGGR1Hs2ZpqkNqILmCMN9BjIUbeh0nQi+CxyIlJi5VYwVJSgRH lSsw== X-Gm-Message-State: ANhLgQ0XrmWrh2NkhUjAVUv6E7z5iHQBiAjaHHK1bJT15f9AMOsts64G Ecb1pmiAlwj5u/ricw7X6Blh/tDVIUyi6Cmi09U= X-Google-Smtp-Source: ADFU+vscUcNl0XqoPtGNKufJ6d5QVPnoK1rJaGUBAwvppGXXEvwIKjNWZWqU+cwx4LdvkSpguWD67ibiRm73DRPkOAE= X-Received: by 2002:a9d:67d7:: with SMTP id c23mr12349631otn.262.1584121796924; Fri, 13 Mar 2020 10:49:56 -0700 (PDT) MIME-Version: 1.0 References: <20200304113248.1143057-1-mail@maciej.szmigiero.name> <20200312161751.GA5245@fuller.cnet> In-Reply-To: <20200312161751.GA5245@fuller.cnet> From: "Rafael J. Wysocki" Date: Fri, 13 Mar 2020 18:49:45 +0100 Message-ID: Subject: Re: [PATCH v2] cpuidle-haltpoll: allow force loading on hosts without the REALTIME hint To: Marcelo Tosatti Cc: "Maciej S. Szmigiero" , "Rafael J. Wysocki" , Daniel Lezcano , Joao Martins , Boris Ostrovsky , kvm-devel , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, Mar 12, 2020 at 5:36 PM Marcelo Tosatti wrote: > > 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 I'm taking this as a Reviewed-by, thanks!