[PATCH v2 3/5] KVM-INTEL: Add new module vmcsinfo-intel to fill VMCSINFO

Avi Kivity avi at redhat.com
Thu Jun 14 09:37:58 EDT 2012


On 05/16/2012 10:55 AM, zhangyanfei wrote:
> This patch implements a new module named vmcsinfo-intel. The
> module fills VMCSINFO with the VMCS revision identifier,
> and encoded offsets of VMCS fields.
> 
> Note, offsets of fields below will not be filled into VMCSINFO:
> 1. fields defined in Intel specification (Intel® 64 and
>    IA-32 Architectures Software Developer’s Manual, Volume
>    3C) but not defined in *vmcs_field*.
> 2. fields don't exist because their corresponding control bits
>    are not set.
> 
> +
> +/*
> + * We separate these five control fields from other fields
> + * because some fields only exist on processors that support
> + * the 1-setting of control bits in the five control fields.
> + */

I thought this was checked only during VMENTRY.  So perhaps you don't
need this special casing.

In fact you might be able to

   // pre-fill vmcs with patterns

  for (i = 0; i < 64k; ++i)
      if (vmcs_read_checking(i, &pattern)) {
           // decode pattern
      } else
           // field does not exist (VM Instruction error 12), ignore

with no knowledge of the control fields, or of any field name.


> +
> +/*
> + * The format of VMCSINFO is given below:
> + *   +-------------+--------------------------+
> + *   | Byte offset | Contents                 |
> + *   +-------------+--------------------------+
> + *   | 0           | VMCS revision identifier |
> + *   +-------------+--------------------------+
> + *   | 4           | <field><encoded offset>  |
> + *   +-------------+--------------------------+
> + *   | 16          | <field><encoded offset>  |
> + *   +-------------+--------------------------+
> + *   ......
> + *
> + * The first 32 bits of VMCSINFO contains the VMCS revision
> + * identifier.
> + * The remainder of VMCSINFO is used for <field><encoded offset>
> + * sets. Each set takes 12 bytes: field occupys 4 bytes
> + * and its corresponding encoded offset occupys 8 bytes.
> + *
> + * Encoded offsets are raw values read by vmcs_read{16, 64, 32, l},
> + * and they are all unsigned extended to 8 bytes for each
> + * <field><encoded offset> set has the same size.
> + * We do not decode offsets here. The decoding work is delayed
> + * in userspace tools.

It's better to do the decoding here, or no one will know how to do it.
Also have an nfields field.
-- 
error compiling committee.c: too many arguments to function





More information about the kexec mailing list