Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1195769ybh; Sat, 14 Mar 2020 20:41:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs9VZ8Y5GosbzhTKmYTuIrbmnvypw+ctxnm7Z0hXLQcqCn6f8YiW7yJmGxfJoGSvWf60BgG X-Received: by 2002:a05:6808:646:: with SMTP id z6mr13027624oih.163.1584243684418; Sat, 14 Mar 2020 20:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584243684; cv=none; d=google.com; s=arc-20160816; b=nPIZHM5JC7zPeAWVsPI6IIH9LFMJ877WmF71pkNl9fMlbvLg/TJldakKNTwRqBnPbp xmMTNzicImopIL1/xYikUxqg1SAZKXkJIZObvxLvDxqpaglL0fr6V5KmUEvKFuQxB4Zn UQQLc4SXdQDNhsuR62UQQmgfqNhbzko5IjrRvcLslsE9hWnizny8bP+PD2mNUXJEdZhl mV9/lX6jdMjipAw/0Ucun5aHY3tCi361/DmVTy8R1NnRcEbZZZBDzJikBBVWJl/YGn5P scRVkAhyEGGWb1MqISfkVOnJqt/cMHNSI6QQjEMl2xmSWW3N7N7N1mFGZA5UYKsEzAtV cyrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=xWfNlXspNXP/Z3scX2GkjvDWCTPuiHmONTso2D85LQ0=; b=NTxpJYJiN8XoIHekhXAsgWAHTOplJjVp+rZeJZMq+86lLW8V0ucsUZpTg+l7WFFsp/ WxqG7oxUnH0PbEe9dBJMa4+aZZ9aVE7PCQyodCMcRlSXwxvjQwrMWMfUeOsusbX2Yk2x JRP0/0WE0iI/aoRAIffFdUoII/xJDWxYmXXZih+LEvhqiSTV7NV4/BYah35zj2wL4o6B XIfzRe5zpEpzVehm/05ERTgzRJT9pf0DaHNDKERUsC8Rl5ehenvy2a32jDybZapXw2RX ZPi8Eody5bTLjMYks/u0/zNRaQslYMvHgUClPoMctQI+rQ5pwIkoowSZsf11wWYmyCNc qbqA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si7819267otq.50.2020.03.14.20.41.12; Sat, 14 Mar 2020 20:41:24 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727527AbgCODkv (ORCPT + 99 others); Sat, 14 Mar 2020 23:40:51 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:37486 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726653AbgCODkv (ORCPT ); Sat, 14 Mar 2020 23:40:51 -0400 Received: by mail-qk1-f193.google.com with SMTP id z25so15299879qkj.4; Sat, 14 Mar 2020 20:40:50 -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=xWfNlXspNXP/Z3scX2GkjvDWCTPuiHmONTso2D85LQ0=; b=sGtaPxoOYlnTE5+b5zUoJ5Qn4z0EdmGqcfdkyzpvc+A+oNj2ctggTsHy7R5k5KZaSS bJmMY5PSsrpz4laFSZ4Cvu1/UjYJvYiDHDndj8EmjUyw16JFuCWraRfLM2fLieGE1rw/ t4GXZD+7QD+JKa0naTB5pkynZPCLuLQGIggS7Itm3YqeYqhRene0PWAK7SwTR5eN9yQl +vJlMoXeZ6j0Q6fHxZXu9BH5N9pQBpt0VboKIs4enjv3glrDqAwo24UUnZ50iNeQXMLS LYpw3WcitaT3FUhFNW5aVWy/LP1RCkHJmHHxiXiFyS60KPOk0PPhc36PkRXhY7LOVeLY VzFA== X-Gm-Message-State: ANhLgQ3XMB+dMlygbKdQ6riMKlTY/fWvpG4+Pa5qXNxz0mSZPa0BgrSc UYxcEye81dVp7IqW0xfZETMUf2fnx688Aje0f6bitg== X-Received: by 2002:a9d:1d07:: with SMTP id m7mr6029839otm.167.1584182450168; Sat, 14 Mar 2020 03:40:50 -0700 (PDT) MIME-Version: 1.0 References: <20200304113248.1143057-1-mail@maciej.szmigiero.name> <20200312161751.GA5245@fuller.cnet> In-Reply-To: From: "Rafael J. Wysocki" Date: Sat, 14 Mar 2020 11:40:38 +0100 Message-ID: Subject: Re: [PATCH v2] cpuidle-haltpoll: allow force loading on hosts without the REALTIME hint To: "Maciej S. Szmigiero" , Marcelo Tosatti Cc: "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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 13, 2020 at 6:49 PM Rafael J. Wysocki wrote: > > 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! Patch applied as 5.7 material, thanks!