qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: qemu-devel@nongnu.org, lersek@redhat.com, mst@redhat.com,
	berrange@redhat.com, jferlan@redhat.com
Subject: Re: [Qemu-devel] Byte ordering of VM Generation ID in Windows VMs
Date: Thu, 5 Jul 2018 13:52:31 +0100	[thread overview]
Message-ID: <20180705125231.GD16293@redhat.com> (raw)
In-Reply-To: <20180705123929.GB16293@redhat.com>

On Thu, Jul 05, 2018 at 01:39:29PM +0100, Richard W.M. Jones wrote:
> I was doing a bit of investigation around how different hypervisors
> handle the VM Generation ID feature.  QEMU's behaviour seems quite
> strange, I wonder if this is a bug or expected?
> 
> (1) I booted a Windows 2016 VM with:
> 
>   qemu-system-x86_64 -M pc,accel=kvm -m 2G -hda w2k16-mincore.img \
>       -device vmgenid,guid=01020304-0506-0708-090a-0b0c0d0e0f00,id=vmgenid0
> 
> (2) Inside the guest I used the VMGENID.EXE program from:
> 
>   https://bugzilla.redhat.com/show_bug.cgi?id=1598350#c3
>   https://docs.microsoft.com/en-gb/windows/desktop/HyperV_v2/virtual-machine-generation-identifier
> 
> Note this is self-compiled using mingw64-g++ (not using Visual Studio
> which I don't have available), but I don't believe that could have
> caused the problem.
> 
> (3) The program prints:
> 
>   VmCounterValue: 708050601020304:f0e0d0c0b0a09
> 
> To make it easier to see, this is the same number but zero-extended:
> 
>   VmCounterValue: 07 08 05 06 01 02 03 04 : 00 0f 0e 0d 0c 0b 0a 09
>                   \________ LOW ________/   \_______ HIGH _______/
>                             WORD                     WORD
> 
> As you can see it looks like there is no clear relationship between
> the order of the bytes in the guid= parameter and the order that they
> are seen by Windows.

OK after examining util/uuid.c and the qemu_uuid_bswap function,
I sort of see what's going on here.

FWIW other hypervisors seem to store these as two 64 bit integers.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

  reply	other threads:[~2018-07-05 12:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-05 12:39 [Qemu-devel] Byte ordering of VM Generation ID in Windows VMs Richard W.M. Jones
2018-07-05 12:52 ` Richard W.M. Jones [this message]
2018-07-05 13:54   ` Michael S. Tsirkin
2018-07-05 14:11     ` Richard W.M. Jones
2018-07-09  7:36       ` Richard W.M. Jones
2018-07-09  9:05         ` Laszlo Ersek
2018-07-09  9:11           ` Richard W.M. Jones
2018-07-09 15:50         ` Richard W.M. Jones
2018-07-05 14:20   ` Laszlo Ersek
2018-07-05 16:43     ` Richard W.M. Jones
2018-07-05 17:10       ` Michael S. Tsirkin
2018-07-05 20:59         ` Richard W.M. Jones
2018-07-05 17:13       ` Daniel P. Berrangé
2018-07-05 17:15       ` Laszlo Ersek
2018-07-05 17:34         ` Michael S. Tsirkin

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=20180705125231.GD16293@redhat.com \
    --to=rjones@redhat.com \
    --cc=berrange@redhat.com \
    --cc=jferlan@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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).