All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Ky Srinivasan <ksrinivasan@novell.com>
Cc: devel@driverdev.osuosl.org, Virtualization@lists.osdl.org,
	Haiyang Zhang <haiyangz@microsoft.com>, Greg KH <gregkh@suse.de>
Subject: Re: [PATCH]: An implementation of HyperV  KVP  functionality
Date: Fri, 12 Nov 2010 13:38:15 -0800	[thread overview]
Message-ID: <20101112213815.GA9871@kroah.com> (raw)
In-Reply-To: <4CDD484E02000030000903E9@novprvoes0310.provo.novell.com>

On Fri, Nov 12, 2010 at 01:59:42PM -0700, Ky Srinivasan wrote:
> 
> 
> >>> On 11/12/2010 at  1:47 PM, in message <20101112184753.GA20893@kroah.com>, Greg
> KH <greg@kroah.com> wrote: 
> > On Fri, Nov 12, 2010 at 11:06:18AM -0700, Ky Srinivasan wrote:
> >> >> +typedef struct kvp_msg {
> >> >> +	__u32 kvp_key; /* Key */
> >> >> +	__u8  kvp_value[0]; /* Corresponding value */
> >> >> +} kvp_msg_t;
> >> > 
> >> > I thought that kvp_value was really KVP_VALUE_SIZE?
> >> 
> >> kvp_value is typed information and KVP_VALUE_SIZE specifies the
> >> maximum size of the supported value. For instance if kvp_value is a
> >> string (which is the case for all the values currently supported),
> >> KVP_VALUE_SIZE specifies the maximum size of the string that will be
> >> supported.
> > 
> > So it's a variable length structure?  How do you konw how long the
> > structure is, does that depend on the key?
> 
> kvp_value is a null terminated string. In the current implementation;
> the kernel component sends an index (key) to the user mode and
> receives the corresponding value - a string.

Why does the kernel care about the string at all?

> >> > And no typedefs, you did run your code through checkpatch.pl, right?
> >> > Why ignore the stuff it spits back at you?
> >> I will fix this.
> >> > 
> >> > 
> >> >> +static char *kvp_keys[KVP_MAX_KEY] = {"FullyQualifiedDomainName",
> >> >> +				"IntegrationServicesVersion",
> >> >> +				"NetworkAddressIPv4",
> >> >> +				"NetworkAddressIPv6",
> >> >> +				"OSBuildNumber",
> >> >> +				"OSName",
> >> >> +				"OSMajorVersion",
> >> >> +				"OSMinorVersion",
> >> >> +				"OSVersion",
> >> >> +				"ProcessorArchitecture",
> >> >> +				};
> >> > 
> >> > Why list these at all, as more might come in the future, and the kernel
> >> > really doesn't care about them, right?
> >> The core HyperV KVP protocol is such that the host iterates through an
> >> index (starting with 0); the guest is free to associate a key with the
> >> index and return the associated value. The host side iteration is
> >> stopped when the guest returns a failure on an index. MSFT has
> >> specified the keys and their ordinal value in their KVP specification.
> >> The array you see above is part of that specification.
> > 
> > So you match on the string name of the key?  I'm confused, as I didn't
> > think I saw you matching on the string name, only the key value.
> > 
> > Also, as the kernel isn't handling the key type (with one exception),
> > why even list these in the kernel at all?  I'm all for documenting
> > stuff, but don't use code memory for documentation :)
> 
> When we respond back to the host, we need to specify  the key for
> which the value is being returned. Note that the host only iterates
> over an integer key space while the guest is expected to return both
> the key name (guest is free to associate the key name with the integer
> index)  and the corresponding value.

Ah, to verify that the guest really did know what the key value that was
being used was for?  Odd way of verification, but I guess it works.

> I use, the array of strings kvp_keys[] to implement the mapping
> between the integer index and the key name. Look at the function
> kvp_respond_to_host() where we lookup the kvp_keys[] array prior to
> responding back to the host.
> 
> In the next iteration of this patch, I am thinking of moving index to
> key mapping code into the user-level daemon, so the kernel side will
> not have to be modified as the key-space expands (in the future).

Yes, I would recommend that so the kernel would not have to be modified
for every time the hyperv kernel is also changed :)

thanks,

greg k-h

  reply	other threads:[~2010-11-12 21:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 20:03 [PATCH]: An implementation of HyperV KVP functionality Ky Srinivasan
2010-11-11 20:49 ` Stephen Hemminger
2010-11-12 16:57   ` Ky Srinivasan
2010-11-12 16:57   ` Ky Srinivasan
2010-11-12 16:57   ` Ky Srinivasan
2010-11-11 21:15 ` Greg KH
2010-11-12 18:06   ` Ky Srinivasan
2010-11-12 18:47     ` Greg KH
2010-11-12 20:59       ` Ky Srinivasan
2010-11-12 21:38         ` Greg KH [this message]
2010-11-11 21:19 ` Greg KH
2010-11-12 18:29   ` Ky Srinivasan
2010-11-12 19:22     ` Greg KH
2010-11-14 10:46 ` Dor Laor

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=20101112213815.GA9871@kroah.com \
    --to=greg@kroah.com \
    --cc=Virtualization@lists.osdl.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=haiyangz@microsoft.com \
    --cc=ksrinivasan@novell.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.