linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: George Zhang <georgezhang@vmware.com>
Cc: linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, pv-drivers@vmware.com
Subject: Re: [PATCH 12/12] VMCI: Some header and config files.
Date: Mon, 29 Oct 2012 19:38:35 -0700	[thread overview]
Message-ID: <20121030023835.GK1920@kroah.com> (raw)
In-Reply-To: <20121030010533.17788.79417.stgit@promb-2n-dhcp175.eng.vmware.com>

On Mon, Oct 29, 2012 at 06:05:38PM -0700, George Zhang wrote:
> +/*
> + * Driver version.
> + *
> + * Increment major version when you make an incompatible change.
> + * Compatibility goes both ways (old driver with new executable
> + * as well as new driver with old executable).
> + */
> +
> +/* Never change VMCI_VERSION_SHIFT_WIDTH */
> +#define VMCI_VERSION_SHIFT_WIDTH 16
> +#define VMCI_MAKE_VERSION(_major, _minor)			\
> +	((_major) << VMCI_VERSION_SHIFT_WIDTH | (u16) (_minor))
> +
> +#define VMCI_VERSION_MAJOR(v)  ((u32) (v) >> VMCI_VERSION_SHIFT_WIDTH)
> +#define VMCI_VERSION_MINOR(v)  ((u16) (v))
> +
> +/*
> + * VMCI_VERSION is always the current version.  Subsequently listed
> + * versions are ways of detecting previous versions of the connecting
> + * application (i.e., VMX).
> + *
> + * VMCI_VERSION_NOVMVM: This version removed support for VM to VM
> + * communication.
> + *
> + * VMCI_VERSION_NOTIFY: This version introduced doorbell notification
> + * support.
> + *
> + * VMCI_VERSION_HOSTQP: This version introduced host end point support
> + * for hosted products.
> + *
> + * VMCI_VERSION_PREHOSTQP: This is the version prior to the adoption of
> + * support for host end-points.
> + *
> + * VMCI_VERSION_PREVERS2: This fictional version number is intended to
> + * represent the version of a VMX which doesn't call into the driver
> + * with ioctl VERSION2 and thus doesn't establish its version with the
> + * driver.
> + */

Do we care about these old versions anymore, now that this is really
"new" code going into the kernel?

> +
> +#define VMCI_VERSION                VMCI_VERSION_NOVMVM
> +#define VMCI_VERSION_NOVMVM         VMCI_MAKE_VERSION(11, 0)
> +#define VMCI_VERSION_NOTIFY         VMCI_MAKE_VERSION(10, 0)
> +#define VMCI_VERSION_HOSTQP         VMCI_MAKE_VERSION(9, 0)
> +#define VMCI_VERSION_PREHOSTQP      VMCI_MAKE_VERSION(8, 0)
> +#define VMCI_VERSION_PREVERS2       VMCI_MAKE_VERSION(1, 0)
> +
> +#define VMCI_SOCKETS_MAKE_VERSION(_p)					\
> +	((((_p)[0] & 0xFF) << 24) | (((_p)[1] & 0xFF) << 16) | ((_p)[2]))
> +
> +/*
> + * Linux defines _IO* macros, but the core kernel code ignore the encoded
> + * ioctl value. It is up to individual drivers to decode the value (for
> + * example to look at the size of a structure to determine which version
> + * of a specific command should be used) or not (which is what we
> + * currently do, so right now the ioctl value for a given command is the
> + * command itself).
> + *
> + * Hence, we just define the IOCTL_VMCI_foo values directly, with no
> + * intermediate IOCTLCMD_ representation.
> + */
> +#define IOCTLCMD(_cmd) IOCTL_VMCI_ ## _cmd

Huh?  I don't understand, why aren't the "normal" macros good enough for
you?  What are you doing special from the entire rest of the kernel that
you need to do things differently?

> +enum {
> +	/*
> +	 * We need to bracket the range of values used for ioctls,
> +	 * because x86_64 Linux forces us to explicitly register ioctl
> +	 * handlers by value for handling 32 bit ioctl syscalls.
> +	 * Hence FIRST and LAST.  Pick something for FIRST that
> +	 * doesn't collide with vmmon (2001+).
> +	 */
> +	IOCTLCMD(FIRST) = 1951,
> +	IOCTLCMD(VERSION) = IOCTLCMD(FIRST),

I don't understand, what are you doing here with the numbering?

> +	/* BEGIN VMCI */
> +	IOCTLCMD(INIT_CONTEXT),
> +
> +	/*
> +	 * The following two were used for process and datagram
> +	 * process creation.  They are not used anymore and reserved
> +	 * for future use.  They will fail if issued.
> +	 */
> +	IOCTLCMD(RESERVED1),
> +	IOCTLCMD(RESERVED2),
> +
> +	/*
> +	 * The following used to be for shared memory. It is now
> +	 * unused and and is reserved for future use. It will fail if
> +	 * issued.
> +	 */
> +	IOCTLCMD(RESERVED3),
> +
> +	/*
> +	 * The follwoing three were also used to be for shared
> +	 * memory. An old WS6 user-mode client might try to use them
> +	 * with the new driver, but since we ensure that only contexts
> +	 * created by VMX'en of the appropriate version
> +	 * (VMCI_VERSION_NOTIFY or VMCI_VERSION_NEWQP) or higher use
> +	 * these ioctl, everything is fine.
> +	 */
> +	IOCTLCMD(QUEUEPAIR_SETVA),
> +	IOCTLCMD(NOTIFY_RESOURCE),
> +	IOCTLCMD(NOTIFICATIONS_RECEIVE),
> +	IOCTLCMD(VERSION2),
> +	IOCTLCMD(QUEUEPAIR_ALLOC),
> +	IOCTLCMD(QUEUEPAIR_SETPAGEFILE),
> +	IOCTLCMD(QUEUEPAIR_DETACH),
> +	IOCTLCMD(DATAGRAM_SEND),
> +	IOCTLCMD(DATAGRAM_RECEIVE),
> +	IOCTLCMD(DATAGRAM_REQUEST_MAP),
> +	IOCTLCMD(DATAGRAM_REMOVE_MAP),
> +	IOCTLCMD(CTX_ADD_NOTIFICATION),
> +	IOCTLCMD(CTX_REMOVE_NOTIFICATION),
> +	IOCTLCMD(CTX_GET_CPT_STATE),
> +	IOCTLCMD(CTX_SET_CPT_STATE),
> +	IOCTLCMD(GET_CONTEXT_ID),
> +	IOCTLCMD(LAST),
> +	/* END VMCI */
> +
> +	/*
> +	 * VMCI Socket IOCTLS are defined next and go from
> +	 * IOCTLCMD(LAST) (1972) to 1990.  VMware reserves a range of
> +	 * 4 ioctls for VMCI Sockets to grow.  We cannot reserve many
> +	 * ioctls here since we are close to overlapping with vmmon
> +	 * ioctls (2001+).  Define a meta-ioctl if running out of this
> +	 * binary space.
> +	 */
> +	IOCTLCMD(SOCKETS_FIRST) = IOCTLCMD(LAST),
> +	IOCTLCMD(SOCKETS_VERSION) = IOCTLCMD(SOCKETS_FIRST),
> +	IOCTLCMD(SOCKETS_BIND),
> +	IOCTLCMD(SOCKETS_SET_SYMBOLS),
> +	IOCTLCMD(SOCKETS_CONNECT),
> +	/*
> +	 * The next two values are public (vmci_sockets.h) and cannot be
> +	 * changed. That means the number of values above these cannot be
> +	 * changed either unless the base index (specified below) is updated
> +	 * accordingly.
> +	 */
> +	IOCTLCMD(SOCKETS_GET_AF_VALUE),
> +	IOCTLCMD(SOCKETS_GET_LOCAL_CID),
> +	IOCTLCMD(SOCKETS_GET_SOCK_NAME),
> +	IOCTLCMD(SOCKETS_GET_SOCK_OPT),
> +	IOCTLCMD(SOCKETS_GET_VM_BY_NAME),
> +	IOCTLCMD(SOCKETS_IOCTL),
> +	IOCTLCMD(SOCKETS_LISTEN),
> +	IOCTLCMD(SOCKETS_RECV),
> +	IOCTLCMD(SOCKETS_RECV_FROM),
> +	IOCTLCMD(SOCKETS_SELECT),
> +	IOCTLCMD(SOCKETS_SEND),
> +	IOCTLCMD(SOCKETS_SEND_TO),
> +	IOCTLCMD(SOCKETS_SET_SOCK_OPT),
> +	IOCTLCMD(SOCKETS_SHUTDOWN),
> +	IOCTLCMD(SOCKETS_SOCKET),	/* 1990 on Linux. */
> +
> +	IOCTLCMD(SOCKETS_LAST) = 1994,	/* 1994 on Linux. */

What do these two comments mean?

> +	/*
> +	 * The VSockets ioctls occupy the block above.  We define a
> +	 * new range of VMCI ioctls to maintain binary compatibility
> +	 * between the user land and the kernel driver.  Careful,
> +	 * vmmon ioctls start from 2001, so this means we can add only
> +	 * 4 new VMCI ioctls.  Define a meta-ioctl if running out of
> +	 * this binary space.
> +	 */
> +	IOCTLCMD(FIRST2),
> +	IOCTLCMD(SET_NOTIFY) = IOCTLCMD(FIRST2),	/* 1995 on Linux. */
> +	IOCTLCMD(LAST2),

Again, what are you doing here?  What are you trying to be compatible
with?

Oh, and all of your ioctls _are_ 32/64bit safe, right?  I didn't check
for that here, sorry, but you have, right?

thanks,

greg k-h

  parent reply	other threads:[~2012-10-30  2:37 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30  1:03 [PATCH 00/12] VMCI for Linux upstreaming George Zhang
2012-10-30  1:03 ` [PATCH 01/12] VMCI: context implementation George Zhang
2012-10-30  2:07   ` Greg KH
2012-10-30  2:10   ` Greg KH
2012-10-30  4:01     ` [Pv-drivers] " Dmitry Torokhov
2012-10-30 15:46       ` Greg KH
2012-10-30 15:56         ` Dmitry Torokhov
2012-10-30  1:03 ` [PATCH 02/12] VMCI: datagram implementation George Zhang
2012-10-30  1:04 ` [PATCH 03/12] VMCI: doorbell implementation George Zhang
2012-10-30  1:04 ` [PATCH 04/12] VMCI: device driver implementaton George Zhang
2012-10-30  2:21   ` Greg KH
2012-10-30  2:23   ` Greg KH
2012-10-30  4:15     ` [Pv-drivers] " Dmitry Torokhov
2012-10-30 15:49       ` Greg KH
2012-10-30  1:04 ` [PATCH 05/12] VMCI: event handling implementation George Zhang
2012-10-30  2:24   ` Greg KH
2012-10-30  4:58     ` [Pv-drivers] " Dmitry Torokhov
2012-10-30 15:50       ` Greg KH
2012-10-30  2:26   ` Greg KH
2012-10-30  5:01     ` [Pv-drivers] " Dmitry Torokhov
2012-10-30 15:50       ` Greg KH
2012-10-30 15:59         ` Dmitry Torokhov
2012-10-30  1:04 ` [PATCH 06/12] VMCI: handle array implementation George Zhang
2012-10-30  1:04 ` [PATCH 07/12] VMCI: queue pairs implementation George Zhang
2012-10-30  1:04 ` [PATCH 08/12] VMCI: resource object implementation George Zhang
2012-10-30  2:29   ` Greg KH
2012-10-30  5:20     ` [Pv-drivers] " Dmitry Torokhov
2012-10-30 15:51       ` Greg KH
2012-10-30 16:11         ` Dmitry Torokhov
2012-10-30  2:29   ` Greg KH
2012-10-30  5:21     ` [Pv-drivers] " Dmitry Torokhov
2012-10-30  1:05 ` [PATCH 09/12] VMCI: routing implementation George Zhang
2012-10-30  1:05 ` [PATCH 10/12] VMCI: guest side driver implementation George Zhang
2012-10-30  1:05 ` [PATCH 11/12] VMCI: host " George Zhang
2012-10-30  1:05 ` [PATCH 12/12] VMCI: Some header and config files George Zhang
2012-10-30  2:32   ` Greg KH
2012-10-30  5:22     ` [Pv-drivers] " Dmitry Torokhov
2012-10-30  2:38   ` Greg KH [this message]
2012-10-30  2:19 ` [PATCH 00/12] VMCI for Linux upstreaming Greg KH
2012-10-30  4:07   ` [Pv-drivers] " Dmitry Torokhov
2012-10-30 15:48     ` Greg KH
2012-10-30 16:18       ` Dmitry Torokhov
2012-10-30 16:27         ` Greg KH
2012-10-30 19:43           ` Dmitry Torokhov
2012-10-30 19:59             ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2012-11-01 17:28 George Zhang
2012-11-01 17:30 ` [PATCH 12/12] VMCI: Some header and config files George Zhang
2012-11-07 18:40 [PATCH 00/12] VMCI for Linux upstreaming George Zhang
2012-11-07 18:43 ` [PATCH 12/12] VMCI: Some header and config files George Zhang
2012-11-16  0:01   ` Greg KH
2012-11-27  0:03   ` Greg KH
2012-11-27  0:23     ` Dmitry Torokhov
2012-11-27  0:32       ` Greg KH
2012-11-30 16:47       ` Andy King
2012-11-30 17:09         ` Greg KH
2012-11-21 20:31 [PATCH 00/12] VMCI for Linux upstreaming George Zhang
2012-11-21 20:36 ` [PATCH 12/12] VMCI: Some header and config files George Zhang
2013-01-08 23:52 [PATCH 00/12] VMCI for Linux upstreaming George Zhang
2013-01-08 23:55 ` [PATCH 12/12] VMCI: Some header and config files George Zhang

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=20121030023835.GK1920@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=georgezhang@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pv-drivers@vmware.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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).