public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Dmitry Torokhov <dtor@vmware.com>
Cc: linux-kernel@vger.kernel.org, pv-drivers@vmware.com,
	Avi Kivity <avi@redhat.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>
Subject: Re: [PATCH] VMware Balloon driver
Date: Mon, 5 Apr 2010 14:24:19 -0700	[thread overview]
Message-ID: <20100405142419.2c9bea3d.akpm@linux-foundation.org> (raw)
In-Reply-To: <20100404215202.GA13020@dtor-ws.eng.vmware.com>

On Sun, 4 Apr 2010 14:52:02 -0700
Dmitry Torokhov <dtor@vmware.com> wrote:

> This is standalone version of VMware Balloon driver. Unlike previous
> version, that tried to integrate VMware ballooning transport into virtio
> subsystem, and use stock virtio_ballon driver, this one implements both
> controlling thread/algorithm and hypervisor transport.
> 
> We are submitting standalone driver because KVM maintainer (Avi Kivity)
> expressed opinion (rightly) that our transport does not fit well into
> virtqueue paradigm and thus it does not make much sense to integrate
> with virtio.
> 

I think I've forgotten what balloon drivers do.  Are they as nasty a
hack as I remember believing them to be?

A summary of what this code sets out to do, and how it does it would be
useful.

Also please explain the applicability of this driver.  Will xen use it?
kvm?  Out-of-tree code?

The code implements a user-visible API (in /proc, at least).  Please
fully describe the proposed interface(s) in the changelog so we can
review and understand that proposal.

>
> ...
>
> +static bool vmballoon_send_start(struct vmballoon *b)
> +{
> +	unsigned long status, dummy;
> +
> +	STATS_INC(b->stats.start);
> +
> +	status = VMWARE_BALLOON_CMD(START, VMW_BALLOON_PROTOCOL_VERSION, dummy);
> +	if (status == VMW_BALLOON_SUCCESS)
> +		return true;
> +
> +	pr_debug("%s - failed, hv returns %ld\n", __func__, status);

The code refers to something called "hv".  I suspect that's stale?

> +	STATS_INC(b->stats.start_fail);
> +	return false;
> +}
> +
> +static bool vmballoon_check_status(struct vmballoon *b, unsigned long status)
> +{
> +	switch (status) {
> +	case VMW_BALLOON_SUCCESS:
> +		return true;
> +
> +	case VMW_BALLOON_ERROR_RESET:
> +		b->reset_required = true;
> +		/* fall through */
> +
> +	default:
> +		return false;
> +	}
> +}
> +
> +static bool vmballoon_send_guest_id(struct vmballoon *b)
> +{
> +	unsigned long status, dummy;
> +
> +	status = VMWARE_BALLOON_CMD(GUEST_ID, VMW_BALLOON_GUEST_ID, dummy);
> +
> +	STATS_INC(b->stats.guest_type);
> +
> +	if (vmballoon_check_status(b, status))
> +		return true;
> +
> +	pr_debug("%s - failed, hv returns %ld\n", __func__, status);
> +	STATS_INC(b->stats.guest_type_fail);
> +	return false;
> +}

The lack of comments makes it all a bit hard to take in.

>
> ...
>
> +static int __init vmballoon_init(void)
> +{
> +	int error;
> +
> +	/*
> +	 * Check if we are running on VMware's hypervisor and bail out
> +	 * if we are not.
> +	 */
> +	if (!vmware_platform())
> +		return -ENODEV;
> +
> +	vmballoon_wq = create_freezeable_workqueue("vmmemctl");
> +	if (!vmballoon_wq) {
> +		pr_err("failed to create workqueue\n");
> +		return -ENOMEM;
> +	}
> +
> +	/* initialize global state */
> +	memset(&balloon, 0, sizeof(balloon));

The memset seems to be unneeded.

> +	INIT_LIST_HEAD(&balloon.pages);
> +	INIT_LIST_HEAD(&balloon.refused_pages);
> +
> +	/* initialize rates */
> +	balloon.rate_alloc = VMW_BALLOON_RATE_ALLOC_MAX;
> +	balloon.rate_free = VMW_BALLOON_RATE_FREE_MAX;
> +
> +	INIT_DELAYED_WORK(&balloon.dwork, vmballoon_work);
> +
> +	/*
> +	 * Start balloon.
> +	 */
> +	if (!vmballoon_send_start(&balloon)) {
> +		pr_err("failed to send start command to the host\n");
> +		error = -EIO;
> +		goto fail;
> +	}
> +
> +	if (!vmballoon_send_guest_id(&balloon)) {
> +		pr_err("failed to send guest ID to the host\n");
> +		error = -EIO;
> +		goto fail;
> +	}
> +
> +	error = vmballoon_procfs_init(&balloon);
> +	if (error)
> +		goto fail;
> +
> +	queue_delayed_work(vmballoon_wq, &balloon.dwork, 0);
> +
> +	return 0;
> +
> +fail:
> +	destroy_workqueue(vmballoon_wq);
> +	return error;
> +}
>
> ...
>

Oh well, ho hum.  Help is needed on working out what to do about this,
please.

Congrats on the new job, btw ;)


  reply	other threads:[~2010-04-05 21:24 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-04 21:52 [PATCH] VMware Balloon driver Dmitry Torokhov
2010-04-05 21:24 ` Andrew Morton [this message]
2010-04-05 22:03   ` Jeremy Fitzhardinge
2010-04-05 22:17     ` Andrew Morton
2010-04-05 22:26       ` Avi Kivity
2010-04-05 22:40         ` Andrew Morton
2010-04-05 23:01           ` Dmitry Torokhov
2010-04-05 23:03           ` Dan Magenheimer
2010-04-05 23:11             ` Andrew Morton
2010-04-05 23:28               ` Dmitry Torokhov
2010-04-06 16:28           ` Avi Kivity
2010-04-05 23:28       ` Jeremy Fitzhardinge
2010-04-05 23:34         ` Andrew Morton
2010-04-06  0:26           ` Dan Magenheimer
2010-04-06 16:30           ` Avi Kivity
2010-04-06 17:27             ` Dan Magenheimer
2010-04-06 23:20         ` Dave Hansen
2010-04-05 22:58   ` Dmitry Torokhov
2010-04-06 16:32     ` Avi Kivity
2010-04-06 17:06       ` Dmitry Torokhov
2010-04-06 17:42         ` Avi Kivity
2010-04-06 18:25       ` Jeremy Fitzhardinge
2010-04-06 18:36         ` Avi Kivity
2010-04-06 19:18           ` Jeremy Fitzhardinge
2010-04-08  5:30             ` Pavel Machek
2010-04-08  7:18               ` Avi Kivity
2010-04-08 17:01               ` Jeremy Fitzhardinge
2010-04-15 21:00   ` [PATCH v2] " Dmitry Torokhov
2010-04-21 19:59     ` Dmitry Torokhov
2010-04-21 20:18       ` Andrew Morton
2010-04-21 20:52         ` Dmitry Torokhov
2010-04-21 21:13           ` Andrew Morton
2010-04-22  0:09             ` Dmitry Torokhov
2010-04-21 23:54     ` Andrew Morton
2010-04-22  0:00       ` Dmitry Torokhov
2010-04-22  1:02         ` [Pv-drivers] " Dmitry Torokhov

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=20100405142419.2c9bea3d.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=avi@redhat.com \
    --cc=dtor@vmware.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pv-drivers@vmware.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