All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Wilson <msw@amazon.com>
To: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: "konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
	"ian.campbell@citrix.com" <ian.campbell@citrix.com>,
	"jbeulich@suse.com" <jbeulich@suse.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH RFC] xen/sysfs: Use XENVER_guest_handle to query UUID
Date: Thu, 16 Aug 2012 13:22:46 -0700	[thread overview]
Message-ID: <20120816202246.GA6244@US-SEA-R8XVZTX> (raw)
In-Reply-To: <1345141515-31078-1-git-send-email-dgdegra@tycho.nsa.gov>

On Thu, Aug 16, 2012 at 11:25:15AM -0700, Daniel De Graaf wrote:
> The /sys/hypervisor/uuid path relies on Xenstore to query the domain's
> UUID (handle) even when the hypervisor exposes an interface to more
> directly and efficiently query this. The xenstore path /vm/UUID which is
> used for the current query is being discussed for possible removal as
> most of the information under this path is only useful for the
> toolstack, not the VM.
> 
> The UUID fetched from xenstore may also not be properly formatted as a
> UUID for the domain if the UUID has been reused (this is most often seen
> in domain 0, which if xenstored does not clean up /vm properly, can end
> up with a UUID field like "00000000-0000-0000-0000-000000000000-5").
> 
> ----8<-----------------------------------------------------
> 
> This hypercall has been present since Xen 3.1, and is the preferred
> method for a domain to obtain its UUID.

Hi Daniel,

What do you think about retaining a fallback of looking in xenstore if
the hypercall fails?

Matt

> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> ---
>  drivers/xen/sys-hypervisor.c    | 20 +++++---------------
>  include/xen/interface/version.h |  3 +++
>  2 files changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
> index 4c7db7d..416fa01 100644
> --- a/drivers/xen/sys-hypervisor.c
> +++ b/drivers/xen/sys-hypervisor.c
> @@ -116,22 +116,12 @@ static void xen_sysfs_version_destroy(void)
>  
>  static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer)
>  {
> -	char *vm, *val;
> +	xen_domain_handle_t uuid;
>  	int ret;
> -	extern int xenstored_ready;
> -
> -	if (!xenstored_ready)
> -		return -EBUSY;
> -
> -	vm = xenbus_read(XBT_NIL, "vm", "", NULL);
> -	if (IS_ERR(vm))
> -		return PTR_ERR(vm);
> -	val = xenbus_read(XBT_NIL, vm, "uuid", NULL);
> -	kfree(vm);
> -	if (IS_ERR(val))
> -		return PTR_ERR(val);
> -	ret = sprintf(buffer, "%s\n", val);
> -	kfree(val);
> +	ret = HYPERVISOR_xen_version(XENVER_guest_handle, uuid);
> +	if (ret)
> +		return ret;
> +	ret = sprintf(buffer, "%pU\n", uuid);
>  	return ret;
>  }
>  
> diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h
> index e8b6519..dd58cf5 100644
> --- a/include/xen/interface/version.h
> +++ b/include/xen/interface/version.h
> @@ -60,4 +60,7 @@ struct xen_feature_info {
>  /* arg == NULL; returns host memory page size. */
>  #define XENVER_pagesize 7
>  
> +/* arg == xen_domain_handle_t. */
> +#define XENVER_guest_handle 8
> +
>  #endif /* __XEN_PUBLIC_VERSION_H__ */

  reply	other threads:[~2012-08-16 20:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16 18:25 [PATCH RFC] xen/sysfs: Use XENVER_guest_handle to query UUID Daniel De Graaf
2012-08-16 20:22 ` Matt Wilson [this message]
2012-08-16 20:40   ` [PATCH v2] " Daniel De Graaf
2012-08-17  7:51     ` Ian Campbell
2012-08-17  9:36       ` Pasi Kärkkäinen
2012-08-17  9:39         ` Pasi Kärkkäinen
2012-08-22 16:57     ` Konrad Rzeszutek Wilk

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=20120816202246.GA6244@US-SEA-R8XVZTX \
    --to=msw@amazon.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xen.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 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.