kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joao Martins <joao.m.martins@oracle.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Radim Krcmar <rkrcmar@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Wanpeng Li <kernellwp@gmail.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Raslan KarimAllah <karahmed@amazon.de>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Ankur Arora <ankur.a.arora@oracle.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	linux-pm@vger.kernel.org
Subject: Re: [patch 1/5] add cpuidle-haltpoll driver
Date: Thu, 4 Jul 2019 10:16:47 +0100	[thread overview]
Message-ID: <db95f834-0307-813a-323c-c5e23c90e3f5@oracle.com> (raw)
In-Reply-To: <20190703235828.340866829@amt.cnet>

On 7/4/19 12:51 AM, Marcelo Tosatti wrote:
> +++ linux-2.6-newcpuidle.git/drivers/cpuidle/cpuidle-haltpoll.c
> @@ -0,0 +1,69 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * cpuidle driver for haltpoll governor.
> + *
> + * Copyright 2019 Red Hat, Inc. and/or its affiliates.
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2.  See
> + * the COPYING file in the top-level directory.
> + *
> + * Authors: Marcelo Tosatti <mtosatti@redhat.com>
> + */
> +
> +#include <linux/init.h>
> +#include <linux/cpuidle.h>
> +#include <linux/module.h>
> +#include <linux/sched/idle.h>
> +#include <linux/kvm_para.h>
> +
> +static int default_enter_idle(struct cpuidle_device *dev,
> +			      struct cpuidle_driver *drv, int index)
> +{
> +	if (current_clr_polling_and_test()) {
> +		local_irq_enable();
> +		return index;
> +	}
> +	default_idle();
> +	return index;
> +}
> +
> +static struct cpuidle_driver haltpoll_driver = {
> +	.name = "haltpoll",
> +	.owner = THIS_MODULE,
> +	.states = {
> +		{ /* entry 0 is for polling */ },
> +		{
> +			.enter			= default_enter_idle,
> +			.exit_latency		= 1,
> +			.target_residency	= 1,
> +			.power_usage		= -1,
> +			.name			= "haltpoll idle",
> +			.desc			= "default architecture idle",
> +		},
> +	},
> +	.safe_state_index = 0,
> +	.state_count = 2,
> +};
> +
> +static int __init haltpoll_init(void)
> +{
> +	struct cpuidle_driver *drv = &haltpoll_driver;
> +
> +	cpuidle_poll_state_init(drv);
> +
> +	if (!kvm_para_available())
> +		return 0;
> +

Isn't this meant to return -ENODEV value if the module is meant to not load?

Also this check should probably be placed before initializing the poll state,
provided poll state isn't used anyways if you're not a kvm guest.

	Joao

  reply	other threads:[~2019-07-04  9:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03 23:51 [patch 0/5] cpuidle haltpoll driver and governor (v6) Marcelo Tosatti
2019-07-03 23:51 ` [patch 1/5] add cpuidle-haltpoll driver Marcelo Tosatti
2019-07-04  9:16   ` Joao Martins [this message]
2019-07-04 11:13     ` Marcelo Tosatti
2019-07-03 23:51 ` [patch 2/5] cpuidle: add poll_limit_ns to cpuidle_device structure Marcelo Tosatti
2019-07-03 23:51 ` [patch 3/5] governors: unify last_state_idx Marcelo Tosatti
2019-07-03 23:51 ` [patch 4/5] cpuidle: add haltpoll governor Marcelo Tosatti
2019-07-03 23:51 ` [patch 5/5] cpuidle-haltpoll: disable host side polling when kvm virtualized Marcelo Tosatti
2019-07-04  8:32 ` [patch 0/5] cpuidle haltpoll driver and governor (v6) Rafael J. Wysocki
2019-07-22 15:25   ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2019-07-01 18:53 [patch 0/5] cpuidle haltpoll driver and governor (v5) Marcelo Tosatti
2019-07-01 18:53 ` [patch 1/5] add cpuidle-haltpoll driver Marcelo Tosatti
2019-07-03  9:54   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db95f834-0307-813a-323c-c5e23c90e3f5@oracle.com \
    --to=joao.m.martins@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=ankur.a.arora@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=borntraeger@de.ibm.com \
    --cc=karahmed@amazon.de \
    --cc=kernellwp@gmail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).