lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 5 Apr 2010 15:58:33 -0700
From:	Dmitry Torokhov <dtor@...are.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"pv-drivers@...are.com" <pv-drivers@...are.com>,
	Avi Kivity <avi@...hat.com>,
	Jeremy Fitzhardinge <jeremy@...p.org>
Subject: Re: [PATCH] VMware Balloon driver

On Mon, Apr 05, 2010 at 02:24:19PM -0700, Andrew Morton wrote:
> On Sun, 4 Apr 2010 14:52:02 -0700
> Dmitry Torokhov <dtor@...are.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.
> 

Jeremy provided a very good writeup; I will aldo expand changelog in the
next version.

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

The driver is expected to be used on VMware platform - mainly ESX.
Originally we tried to converge with KVM and use virtio and
stock virtio_balloon driver but Avi mentioned that our code emulating
virtqueue was more than balloon code itself and thus using virtio did
not make nuch sense.

> 
> 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.

OK.

> 
> >
> > ...
> >
> > +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.

OK, I will address lack of comments.

> 
> >
> > ...
> >
> > +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.

OK.

> 
> > +	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 ;)

Thanks ;). BTW, please send input stuff to my gmail addresss till.

-- 
Dmitry

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ