All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] x86info: dump kvm cpuid's
@ 2012-04-30 14:38 Michael S. Tsirkin
  2012-04-30 15:03 ` Gleb Natapov
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2012-04-30 14:38 UTC (permalink / raw)
  To: davej; +Cc: xen-devel, kvm, pv-drivers, virtualization, devel

The following makes 'x86info -r' dump hypervisor leaf cpu ids
(for kvm this is signature+features) when running in a vm.

On the guest we see the signature and the features:
eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000

Hypervisor flag is checked to avoid output changes when not
running on a VM.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Changes from v1:
	Make work on non KVM hypervisors (only KVM was tested).
	Avi Kivity said kvm will in the future report
	max HV leaf in eax. For now it reports eax = 0
        so add a work around for that.

---

diff --git a/identify.c b/identify.c
index 33f35de..a4a3763 100644
--- a/identify.c
+++ b/identify.c
@@ -9,8 +9,8 @@
 
 void get_cpu_info_basics(struct cpudata *cpu)
 {
-	unsigned int maxi, maxei, vendor, address_bits;
-	unsigned int eax;
+	unsigned int maxi, maxei, maxhv, vendor, address_bits;
+	unsigned int eax, ebx, ecx;
 
 	cpuid(cpu->number, 0, &maxi, &vendor, NULL, NULL);
 	maxi &= 0xffff;		/* The high-order word is non-zero on some Cyrix CPUs */
@@ -19,7 +19,7 @@ void get_cpu_info_basics(struct cpudata *cpu)
 		return;
 
 	/* Everything that supports cpuid supports these. */
-	cpuid(cpu->number, 1, &eax, NULL, NULL, NULL);
+	cpuid(cpu->number, 1, &eax, &ebx, &ecx, NULL);
 	cpu->stepping = eax & 0xf;
 	cpu->model = (eax >> 4) & 0xf;
 	cpu->family = (eax >> 8) & 0xf;
@@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
 
 	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
 	cpu->maxei2 = maxei;
+	if (ecx & 0x80000000) {
+		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
+		/*
+		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
+		 * where it really means 0x40000001.
+		 * Most (all?) hypervisors have at least one CPUID besides
+		 * the vendor ID so assume that.
+		 */
+		cpu->maxhv = maxhv ? maxhv : 0x40000001;
+	} else {
+		/* Suppress hypervisor cpuid unless running on a hypervisor */
+		cpu->maxhv = 0;
+	}
 
 	cpuid(cpu->number, 0x80000008,&address_bits, NULL, NULL, NULL);
 	cpu->phyaddr_bits = address_bits & 0xFF;
diff --git a/x86info.c b/x86info.c
index 22c4734..80cae36 100644
--- a/x86info.c
+++ b/x86info.c
@@ -44,6 +44,10 @@ static void display_detailed_info(struct cpudata *cpu)
 
 		if (cpu->maxei2 >=0xC0000000)
 			dump_raw_cpuid(cpu->number, 0xC0000000, cpu->maxei2);
+
+		if (cpu->maxhv >= 0x40000000)
+			dump_raw_cpuid(cpu->number, 0x40000000, cpu->maxhv);
+
 	}
 
 	if (show_cacheinfo) {
diff --git a/x86info.h b/x86info.h
index 7d2a455..c4f5d81 100644
--- a/x86info.h
+++ b/x86info.h
@@ -84,7 +84,7 @@ struct cpudata {
 	unsigned int cachesize_trace;
 	unsigned int phyaddr_bits;
 	unsigned int viraddr_bits;
-	unsigned int cpuid_level, maxei, maxei2;
+	unsigned int cpuid_level, maxei, maxei2, maxhv;
 	char name[CPU_NAME_LEN];
 	enum connector connector;
 	unsigned int flags_ecx;

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-04-30 14:38 [PATCHv2] x86info: dump kvm cpuid's Michael S. Tsirkin
@ 2012-04-30 15:03 ` Gleb Natapov
  2012-05-01 12:27 ` Ian Campbell
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Gleb Natapov @ 2012-04-30 15:03 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: xen-devel, kvm, pv-drivers, virtualization, devel, davej

On Mon, Apr 30, 2012 at 05:38:35PM +0300, Michael S. Tsirkin wrote:
> The following makes 'x86info -r' dump hypervisor leaf cpu ids
> (for kvm this is signature+features) when running in a vm.
> 
> On the guest we see the signature and the features:
> eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
> eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000
> 
> Hypervisor flag is checked to avoid output changes when not
> running on a VM.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
Looks good to me.

> Changes from v1:
> 	Make work on non KVM hypervisors (only KVM was tested).
> 	Avi Kivity said kvm will in the future report
> 	max HV leaf in eax. For now it reports eax = 0
>         so add a work around for that.
> 
> ---
> 
> diff --git a/identify.c b/identify.c
> index 33f35de..a4a3763 100644
> --- a/identify.c
> +++ b/identify.c
> @@ -9,8 +9,8 @@
>  
>  void get_cpu_info_basics(struct cpudata *cpu)
>  {
> -	unsigned int maxi, maxei, vendor, address_bits;
> -	unsigned int eax;
> +	unsigned int maxi, maxei, maxhv, vendor, address_bits;
> +	unsigned int eax, ebx, ecx;
>  
>  	cpuid(cpu->number, 0, &maxi, &vendor, NULL, NULL);
>  	maxi &= 0xffff;		/* The high-order word is non-zero on some Cyrix CPUs */
> @@ -19,7 +19,7 @@ void get_cpu_info_basics(struct cpudata *cpu)
>  		return;
>  
>  	/* Everything that supports cpuid supports these. */
> -	cpuid(cpu->number, 1, &eax, NULL, NULL, NULL);
> +	cpuid(cpu->number, 1, &eax, &ebx, &ecx, NULL);
>  	cpu->stepping = eax & 0xf;
>  	cpu->model = (eax >> 4) & 0xf;
>  	cpu->family = (eax >> 8) & 0xf;
> @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
>  
>  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
>  	cpu->maxei2 = maxei;
> +	if (ecx & 0x80000000) {
> +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> +		/*
> +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> +		 * where it really means 0x40000001.
> +		 * Most (all?) hypervisors have at least one CPUID besides
> +		 * the vendor ID so assume that.
> +		 */
> +		cpu->maxhv = maxhv ? maxhv : 0x40000001;
> +	} else {
> +		/* Suppress hypervisor cpuid unless running on a hypervisor */
> +		cpu->maxhv = 0;
> +	}
>  
>  	cpuid(cpu->number, 0x80000008,&address_bits, NULL, NULL, NULL);
>  	cpu->phyaddr_bits = address_bits & 0xFF;
> diff --git a/x86info.c b/x86info.c
> index 22c4734..80cae36 100644
> --- a/x86info.c
> +++ b/x86info.c
> @@ -44,6 +44,10 @@ static void display_detailed_info(struct cpudata *cpu)
>  
>  		if (cpu->maxei2 >=0xC0000000)
>  			dump_raw_cpuid(cpu->number, 0xC0000000, cpu->maxei2);
> +
> +		if (cpu->maxhv >= 0x40000000)
> +			dump_raw_cpuid(cpu->number, 0x40000000, cpu->maxhv);
> +
>  	}
>  
>  	if (show_cacheinfo) {
> diff --git a/x86info.h b/x86info.h
> index 7d2a455..c4f5d81 100644
> --- a/x86info.h
> +++ b/x86info.h
> @@ -84,7 +84,7 @@ struct cpudata {
>  	unsigned int cachesize_trace;
>  	unsigned int phyaddr_bits;
>  	unsigned int viraddr_bits;
> -	unsigned int cpuid_level, maxei, maxei2;
> +	unsigned int cpuid_level, maxei, maxei2, maxhv;
>  	char name[CPU_NAME_LEN];
>  	enum connector connector;
>  	unsigned int flags_ecx;

--
			Gleb.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-04-30 14:38 [PATCHv2] x86info: dump kvm cpuid's Michael S. Tsirkin
  2012-04-30 15:03 ` Gleb Natapov
@ 2012-05-01 12:27 ` Ian Campbell
  2012-05-01 12:35   ` Michael S. Tsirkin
  2012-05-01 13:04   ` Gleb Natapov
  2012-05-01 12:27 ` Ian Campbell
  2012-09-05 17:33 ` Michael S. Tsirkin
  3 siblings, 2 replies; 14+ messages in thread
From: Ian Campbell @ 2012-05-01 12:27 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: xen-devel, kvm, pv-drivers, virtualization, devel, davej

On Mon, 2012-04-30 at 17:38 +0300, Michael S. Tsirkin wrote:
> The following makes 'x86info -r' dump hypervisor leaf cpu ids
> (for kvm this is signature+features) when running in a vm.
> 
> On the guest we see the signature and the features:
> eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
> eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000
> 
> Hypervisor flag is checked to avoid output changes when not
> running on a VM.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Changes from v1:
> 	Make work on non KVM hypervisors (only KVM was tested).
> 	Avi Kivity said kvm will in the future report
> 	max HV leaf in eax. For now it reports eax = 0
>         so add a work around for that.
> 
> ---
> 
> diff --git a/identify.c b/identify.c
> index 33f35de..a4a3763 100644
> --- a/identify.c
> +++ b/identify.c
> @@ -9,8 +9,8 @@
>  
>  void get_cpu_info_basics(struct cpudata *cpu)
>  {
> -	unsigned int maxi, maxei, vendor, address_bits;
> -	unsigned int eax;
> +	unsigned int maxi, maxei, maxhv, vendor, address_bits;
> +	unsigned int eax, ebx, ecx;
>  
>  	cpuid(cpu->number, 0, &maxi, &vendor, NULL, NULL);
>  	maxi &= 0xffff;		/* The high-order word is non-zero on some Cyrix CPUs */
> @@ -19,7 +19,7 @@ void get_cpu_info_basics(struct cpudata *cpu)
>  		return;
>  
>  	/* Everything that supports cpuid supports these. */
> -	cpuid(cpu->number, 1, &eax, NULL, NULL, NULL);
> +	cpuid(cpu->number, 1, &eax, &ebx, &ecx, NULL);

You probably want to check ebx, ecx, edx for the signatures of the
hypervisor's you are willing to support and which you know do something
sane with eax? Also it would be something worth reporting in its own
right?

BTW, according to arch/x86/include/asm/kvm_para.h unsurprisingly KVM has
a signature too 'KVMKVMKVM'.

>  	cpu->stepping = eax & 0xf;
>  	cpu->model = (eax >> 4) & 0xf;
>  	cpu->family = (eax >> 8) & 0xf;
> @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
>  
>  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
>  	cpu->maxei2 = maxei;
> +	if (ecx & 0x80000000) {
> +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> +		/*
> +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> +		 * where it really means 0x40000001.

This is something where I definitely think you want to check the
signature first.

Ian.

> +		 * Most (all?) hypervisors have at least one CPUID besides
> +		 * the vendor ID so assume that.
> +		 */
> +		cpu->maxhv = maxhv ? maxhv : 0x40000001;
> +	} else {
> +		/* Suppress hypervisor cpuid unless running on a hypervisor */
> +		cpu->maxhv = 0;
> +	}
>  
>  	cpuid(cpu->number, 0x80000008,&address_bits, NULL, NULL, NULL);
>  	cpu->phyaddr_bits = address_bits & 0xFF;
> diff --git a/x86info.c b/x86info.c
> index 22c4734..80cae36 100644
> --- a/x86info.c
> +++ b/x86info.c
> @@ -44,6 +44,10 @@ static void display_detailed_info(struct cpudata *cpu)
>  
>  		if (cpu->maxei2 >=0xC0000000)
>  			dump_raw_cpuid(cpu->number, 0xC0000000, cpu->maxei2);
> +
> +		if (cpu->maxhv >= 0x40000000)
> +			dump_raw_cpuid(cpu->number, 0x40000000, cpu->maxhv);
> +
>  	}
>  
>  	if (show_cacheinfo) {
> diff --git a/x86info.h b/x86info.h
> index 7d2a455..c4f5d81 100644
> --- a/x86info.h
> +++ b/x86info.h
> @@ -84,7 +84,7 @@ struct cpudata {
>  	unsigned int cachesize_trace;
>  	unsigned int phyaddr_bits;
>  	unsigned int viraddr_bits;
> -	unsigned int cpuid_level, maxei, maxei2;
> +	unsigned int cpuid_level, maxei, maxei2, maxhv;
>  	char name[CPU_NAME_LEN];
>  	enum connector connector;
>  	unsigned int flags_ecx;
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
> 

-- 
Ian Campbell

Your own qualities will help prevent your advancement in the world.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-04-30 14:38 [PATCHv2] x86info: dump kvm cpuid's Michael S. Tsirkin
  2012-04-30 15:03 ` Gleb Natapov
  2012-05-01 12:27 ` Ian Campbell
@ 2012-05-01 12:27 ` Ian Campbell
  2012-09-05 17:33 ` Michael S. Tsirkin
  3 siblings, 0 replies; 14+ messages in thread
From: Ian Campbell @ 2012-05-01 12:27 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: xen-devel, kvm, pv-drivers, virtualization, devel, davej

On Mon, 2012-04-30 at 17:38 +0300, Michael S. Tsirkin wrote:
> The following makes 'x86info -r' dump hypervisor leaf cpu ids
> (for kvm this is signature+features) when running in a vm.
> 
> On the guest we see the signature and the features:
> eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
> eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000
> 
> Hypervisor flag is checked to avoid output changes when not
> running on a VM.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Changes from v1:
> 	Make work on non KVM hypervisors (only KVM was tested).
> 	Avi Kivity said kvm will in the future report
> 	max HV leaf in eax. For now it reports eax = 0
>         so add a work around for that.
> 
> ---
> 
> diff --git a/identify.c b/identify.c
> index 33f35de..a4a3763 100644
> --- a/identify.c
> +++ b/identify.c
> @@ -9,8 +9,8 @@
>  
>  void get_cpu_info_basics(struct cpudata *cpu)
>  {
> -	unsigned int maxi, maxei, vendor, address_bits;
> -	unsigned int eax;
> +	unsigned int maxi, maxei, maxhv, vendor, address_bits;
> +	unsigned int eax, ebx, ecx;
>  
>  	cpuid(cpu->number, 0, &maxi, &vendor, NULL, NULL);
>  	maxi &= 0xffff;		/* The high-order word is non-zero on some Cyrix CPUs */
> @@ -19,7 +19,7 @@ void get_cpu_info_basics(struct cpudata *cpu)
>  		return;
>  
>  	/* Everything that supports cpuid supports these. */
> -	cpuid(cpu->number, 1, &eax, NULL, NULL, NULL);
> +	cpuid(cpu->number, 1, &eax, &ebx, &ecx, NULL);

You probably want to check ebx, ecx, edx for the signatures of the
hypervisor's you are willing to support and which you know do something
sane with eax? Also it would be something worth reporting in its own
right?

BTW, according to arch/x86/include/asm/kvm_para.h unsurprisingly KVM has
a signature too 'KVMKVMKVM'.

>  	cpu->stepping = eax & 0xf;
>  	cpu->model = (eax >> 4) & 0xf;
>  	cpu->family = (eax >> 8) & 0xf;
> @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
>  
>  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
>  	cpu->maxei2 = maxei;
> +	if (ecx & 0x80000000) {
> +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> +		/*
> +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> +		 * where it really means 0x40000001.

This is something where I definitely think you want to check the
signature first.

Ian.

> +		 * Most (all?) hypervisors have at least one CPUID besides
> +		 * the vendor ID so assume that.
> +		 */
> +		cpu->maxhv = maxhv ? maxhv : 0x40000001;
> +	} else {
> +		/* Suppress hypervisor cpuid unless running on a hypervisor */
> +		cpu->maxhv = 0;
> +	}
>  
>  	cpuid(cpu->number, 0x80000008,&address_bits, NULL, NULL, NULL);
>  	cpu->phyaddr_bits = address_bits & 0xFF;
> diff --git a/x86info.c b/x86info.c
> index 22c4734..80cae36 100644
> --- a/x86info.c
> +++ b/x86info.c
> @@ -44,6 +44,10 @@ static void display_detailed_info(struct cpudata *cpu)
>  
>  		if (cpu->maxei2 >=0xC0000000)
>  			dump_raw_cpuid(cpu->number, 0xC0000000, cpu->maxei2);
> +
> +		if (cpu->maxhv >= 0x40000000)
> +			dump_raw_cpuid(cpu->number, 0x40000000, cpu->maxhv);
> +
>  	}
>  
>  	if (show_cacheinfo) {
> diff --git a/x86info.h b/x86info.h
> index 7d2a455..c4f5d81 100644
> --- a/x86info.h
> +++ b/x86info.h
> @@ -84,7 +84,7 @@ struct cpudata {
>  	unsigned int cachesize_trace;
>  	unsigned int phyaddr_bits;
>  	unsigned int viraddr_bits;
> -	unsigned int cpuid_level, maxei, maxei2;
> +	unsigned int cpuid_level, maxei, maxei2, maxhv;
>  	char name[CPU_NAME_LEN];
>  	enum connector connector;
>  	unsigned int flags_ecx;
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
> 

-- 
Ian Campbell

Your own qualities will help prevent your advancement in the world.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-05-01 12:27 ` Ian Campbell
@ 2012-05-01 12:35   ` Michael S. Tsirkin
  2012-05-01 13:04   ` Gleb Natapov
  1 sibling, 0 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2012-05-01 12:35 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel, kvm, pv-drivers, virtualization, devel, davej

On Tue, May 01, 2012 at 01:27:05PM +0100, Ian Campbell wrote:
> On Mon, 2012-04-30 at 17:38 +0300, Michael S. Tsirkin wrote:
> > The following makes 'x86info -r' dump hypervisor leaf cpu ids
> > (for kvm this is signature+features) when running in a vm.
> > 
> > On the guest we see the signature and the features:
> > eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
> > eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000
> > 
> > Hypervisor flag is checked to avoid output changes when not
> > running on a VM.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > Changes from v1:
> > 	Make work on non KVM hypervisors (only KVM was tested).
> > 	Avi Kivity said kvm will in the future report
> > 	max HV leaf in eax. For now it reports eax = 0
> >         so add a work around for that.
> > 
> > ---
> > 
> > diff --git a/identify.c b/identify.c
> > index 33f35de..a4a3763 100644
> > --- a/identify.c
> > +++ b/identify.c
> > @@ -9,8 +9,8 @@
> >  
> >  void get_cpu_info_basics(struct cpudata *cpu)
> >  {
> > -	unsigned int maxi, maxei, vendor, address_bits;
> > -	unsigned int eax;
> > +	unsigned int maxi, maxei, maxhv, vendor, address_bits;
> > +	unsigned int eax, ebx, ecx;
> >  
> >  	cpuid(cpu->number, 0, &maxi, &vendor, NULL, NULL);
> >  	maxi &= 0xffff;		/* The high-order word is non-zero on some Cyrix CPUs */
> > @@ -19,7 +19,7 @@ void get_cpu_info_basics(struct cpudata *cpu)
> >  		return;
> >  
> >  	/* Everything that supports cpuid supports these. */
> > -	cpuid(cpu->number, 1, &eax, NULL, NULL, NULL);
> > +	cpuid(cpu->number, 1, &eax, &ebx, &ecx, NULL);
> 
> You probably want to check ebx, ecx, edx for the signatures of the
> hypervisor's you are willing to support and which you know do something
> sane with eax?

Everyone puts the max leaf in eax - this is what hardware
CPUs do. So I think we can just interpret eax as such.
If someone wants to put broken info in cpuid,
send a patch to blacklist it.

> Also it would be something worth reporting in its own
> right?
> 
> BTW, according to arch/x86/include/asm/kvm_para.h unsurprisingly KVM has
> a signature too 'KVMKVMKVM'.
> 
> >  	cpu->stepping = eax & 0xf;
> >  	cpu->model = (eax >> 4) & 0xf;
> >  	cpu->family = (eax >> 8) & 0xf;
> > @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
> >  
> >  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
> >  	cpu->maxei2 = maxei;
> > +	if (ecx & 0x80000000) {
> > +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> > +		/*
> > +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> > +		 * where it really means 0x40000001.
> 
> This is something where I definitely think you want to check the
> signature first.
> 
> Ian.

kvm lets users change the signature.
But worst case we print one useless line.
Better than not printing something potentially useful.

-- 
MST

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-05-01 12:27 ` Ian Campbell
  2012-05-01 12:35   ` Michael S. Tsirkin
@ 2012-05-01 13:04   ` Gleb Natapov
  2012-05-02  9:45     ` Ian Campbell
  2012-05-02  9:45     ` Ian Campbell
  1 sibling, 2 replies; 14+ messages in thread
From: Gleb Natapov @ 2012-05-01 13:04 UTC (permalink / raw)
  To: Ian Campbell
  Cc: xen-devel, kvm, Michael S. Tsirkin, pv-drivers, virtualization,
	devel, davej

On Tue, May 01, 2012 at 01:27:05PM +0100, Ian Campbell wrote:
> On Mon, 2012-04-30 at 17:38 +0300, Michael S. Tsirkin wrote:
> > The following makes 'x86info -r' dump hypervisor leaf cpu ids
> > (for kvm this is signature+features) when running in a vm.
> > 
> > On the guest we see the signature and the features:
> > eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
> > eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000
> > 
> > Hypervisor flag is checked to avoid output changes when not
> > running on a VM.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > Changes from v1:
> > 	Make work on non KVM hypervisors (only KVM was tested).
> > 	Avi Kivity said kvm will in the future report
> > 	max HV leaf in eax. For now it reports eax = 0
> >         so add a work around for that.
> > 
> > ---
> > 
> > diff --git a/identify.c b/identify.c
> > index 33f35de..a4a3763 100644
> > --- a/identify.c
> > +++ b/identify.c
> > @@ -9,8 +9,8 @@
> >  
> >  void get_cpu_info_basics(struct cpudata *cpu)
> >  {
> > -	unsigned int maxi, maxei, vendor, address_bits;
> > -	unsigned int eax;
> > +	unsigned int maxi, maxei, maxhv, vendor, address_bits;
> > +	unsigned int eax, ebx, ecx;
> >  
> >  	cpuid(cpu->number, 0, &maxi, &vendor, NULL, NULL);
> >  	maxi &= 0xffff;		/* The high-order word is non-zero on some Cyrix CPUs */
> > @@ -19,7 +19,7 @@ void get_cpu_info_basics(struct cpudata *cpu)
> >  		return;
> >  
> >  	/* Everything that supports cpuid supports these. */
> > -	cpuid(cpu->number, 1, &eax, NULL, NULL, NULL);
> > +	cpuid(cpu->number, 1, &eax, &ebx, &ecx, NULL);
> 
> You probably want to check ebx, ecx, edx for the signatures of the
> hypervisor's you are willing to support and which you know do something
> sane with eax? Also it would be something worth reporting in its own
> right?
> 
Yes, but this is for -r option which only dumps raw cpuid info.
Decoding hypervisor specific info is useful thing, but should not be
pre-request for that patch.

> BTW, according to arch/x86/include/asm/kvm_para.h unsurprisingly KVM has
> a signature too 'KVMKVMKVM'.
> 
> >  	cpu->stepping = eax & 0xf;
> >  	cpu->model = (eax >> 4) & 0xf;
> >  	cpu->family = (eax >> 8) & 0xf;
> > @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
> >  
> >  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
> >  	cpu->maxei2 = maxei;
> > +	if (ecx & 0x80000000) {
> > +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> > +		/*
> > +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> > +		 * where it really means 0x40000001.
> 
> This is something where I definitely think you want to check the
> signature first.
In theory yes, but in practice what will this break?

> 
> Ian.
> 
> > +		 * Most (all?) hypervisors have at least one CPUID besides
> > +		 * the vendor ID so assume that.
> > +		 */
> > +		cpu->maxhv = maxhv ? maxhv : 0x40000001;
> > +	} else {
> > +		/* Suppress hypervisor cpuid unless running on a hypervisor */
> > +		cpu->maxhv = 0;
> > +	}
> >  
> >  	cpuid(cpu->number, 0x80000008,&address_bits, NULL, NULL, NULL);
> >  	cpu->phyaddr_bits = address_bits & 0xFF;
> > diff --git a/x86info.c b/x86info.c
> > index 22c4734..80cae36 100644
> > --- a/x86info.c
> > +++ b/x86info.c
> > @@ -44,6 +44,10 @@ static void display_detailed_info(struct cpudata *cpu)
> >  
> >  		if (cpu->maxei2 >=0xC0000000)
> >  			dump_raw_cpuid(cpu->number, 0xC0000000, cpu->maxei2);
> > +
> > +		if (cpu->maxhv >= 0x40000000)
> > +			dump_raw_cpuid(cpu->number, 0x40000000, cpu->maxhv);
> > +
> >  	}
> >  
> >  	if (show_cacheinfo) {
> > diff --git a/x86info.h b/x86info.h
> > index 7d2a455..c4f5d81 100644
> > --- a/x86info.h
> > +++ b/x86info.h
> > @@ -84,7 +84,7 @@ struct cpudata {
> >  	unsigned int cachesize_trace;
> >  	unsigned int phyaddr_bits;
> >  	unsigned int viraddr_bits;
> > -	unsigned int cpuid_level, maxei, maxei2;
> > +	unsigned int cpuid_level, maxei, maxei2, maxhv;
> >  	char name[CPU_NAME_LEN];
> >  	enum connector connector;
> >  	unsigned int flags_ecx;
> > _______________________________________________
> > Virtualization mailing list
> > Virtualization@lists.linux-foundation.org
> > https://lists.linuxfoundation.org/mailman/listinfo/virtualization
> > 
> 
> -- 
> Ian Campbell
> 
> Your own qualities will help prevent your advancement in the world.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
			Gleb.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-05-01 13:04   ` Gleb Natapov
  2012-05-02  9:45     ` Ian Campbell
@ 2012-05-02  9:45     ` Ian Campbell
  2012-05-02  9:50       ` Michael S. Tsirkin
  1 sibling, 1 reply; 14+ messages in thread
From: Ian Campbell @ 2012-05-02  9:45 UTC (permalink / raw)
  To: Gleb Natapov
  Cc: Michael S. Tsirkin, davej, xen-devel, kvm, pv-drivers,
	virtualization, devel

On Tue, 2012-05-01 at 16:04 +0300, Gleb Natapov wrote:
> > BTW, according to arch/x86/include/asm/kvm_para.h unsurprisingly KVM has
> > a signature too 'KVMKVMKVM'.
> > 
> > >  	cpu->stepping = eax & 0xf;
> > >  	cpu->model = (eax >> 4) & 0xf;
> > >  	cpu->family = (eax >> 8) & 0xf;
> > > @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
> > >  
> > >  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
> > >  	cpu->maxei2 = maxei;
> > > +	if (ecx & 0x80000000) {
> > > +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> > > +		/*
> > > +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> > > +		 * where it really means 0x40000001.
> > 
> > This is something where I definitely think you want to check the
> > signature first.
> In theory yes, but in practice what will this break?

I've got no idea -- but what's the harm in checking?

Ian.

-- 
Ian Campbell
Current Noise: Hypocrisy - Roswell 47

Angels we have heard on High
Tell us to go out and Buy.
		-- Tom Lehrer


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-05-01 13:04   ` Gleb Natapov
@ 2012-05-02  9:45     ` Ian Campbell
  2012-05-02  9:45     ` Ian Campbell
  1 sibling, 0 replies; 14+ messages in thread
From: Ian Campbell @ 2012-05-02  9:45 UTC (permalink / raw)
  To: Gleb Natapov
  Cc: xen-devel, kvm, Michael S. Tsirkin, pv-drivers, virtualization,
	devel, davej

On Tue, 2012-05-01 at 16:04 +0300, Gleb Natapov wrote:
> > BTW, according to arch/x86/include/asm/kvm_para.h unsurprisingly KVM has
> > a signature too 'KVMKVMKVM'.
> > 
> > >  	cpu->stepping = eax & 0xf;
> > >  	cpu->model = (eax >> 4) & 0xf;
> > >  	cpu->family = (eax >> 8) & 0xf;
> > > @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
> > >  
> > >  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
> > >  	cpu->maxei2 = maxei;
> > > +	if (ecx & 0x80000000) {
> > > +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> > > +		/*
> > > +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> > > +		 * where it really means 0x40000001.
> > 
> > This is something where I definitely think you want to check the
> > signature first.
> In theory yes, but in practice what will this break?

I've got no idea -- but what's the harm in checking?

Ian.

-- 
Ian Campbell
Current Noise: Hypocrisy - Roswell 47

Angels we have heard on High
Tell us to go out and Buy.
		-- Tom Lehrer

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-05-02  9:45     ` Ian Campbell
@ 2012-05-02  9:50       ` Michael S. Tsirkin
  2012-05-02  9:58         ` [Xen-devel] " Ian Campbell
  0 siblings, 1 reply; 14+ messages in thread
From: Michael S. Tsirkin @ 2012-05-02  9:50 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel, kvm, pv-drivers, virtualization, devel, davej

On Wed, May 02, 2012 at 10:45:27AM +0100, Ian Campbell wrote:
> On Tue, 2012-05-01 at 16:04 +0300, Gleb Natapov wrote:
> > > BTW, according to arch/x86/include/asm/kvm_para.h unsurprisingly KVM has
> > > a signature too 'KVMKVMKVM'.
> > > 
> > > >  	cpu->stepping = eax & 0xf;
> > > >  	cpu->model = (eax >> 4) & 0xf;
> > > >  	cpu->family = (eax >> 8) & 0xf;
> > > > @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
> > > >  
> > > >  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
> > > >  	cpu->maxei2 = maxei;
> > > > +	if (ecx & 0x80000000) {
> > > > +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> > > > +		/*
> > > > +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> > > > +		 * where it really means 0x40000001.
> > > 
> > > This is something where I definitely think you want to check the
> > > signature first.
> > In theory yes, but in practice what will this break?
> 
> I've got no idea -- but what's the harm in checking?
> 
> Ian.

Users can set kvm signature to anything, if they do
debugging will be a bit harder for them.

> -- 
> Ian Campbell
> Current Noise: Hypocrisy - Roswell 47
> 
> Angels we have heard on High
> Tell us to go out and Buy.
> 		-- Tom Lehrer

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Xen-devel] [PATCHv2] x86info: dump kvm cpuid's
  2012-05-02  9:50       ` Michael S. Tsirkin
@ 2012-05-02  9:58         ` Ian Campbell
  0 siblings, 0 replies; 14+ messages in thread
From: Ian Campbell @ 2012-05-02  9:58 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: xen-devel, kvm, pv-drivers, virtualization, davej, devel

On Wed, 2012-05-02 at 10:50 +0100, Michael S. Tsirkin wrote:
> On Wed, May 02, 2012 at 10:45:27AM +0100, Ian Campbell wrote:
> > On Tue, 2012-05-01 at 16:04 +0300, Gleb Natapov wrote:
> > > > BTW, according to arch/x86/include/asm/kvm_para.h unsurprisingly KVM has
> > > > a signature too 'KVMKVMKVM'.
> > > > 
> > > > >  	cpu->stepping = eax & 0xf;
> > > > >  	cpu->model = (eax >> 4) & 0xf;
> > > > >  	cpu->family = (eax >> 8) & 0xf;
> > > > > @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
> > > > >  
> > > > >  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
> > > > >  	cpu->maxei2 = maxei;
> > > > > +	if (ecx & 0x80000000) {
> > > > > +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> > > > > +		/*
> > > > > +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> > > > > +		 * where it really means 0x40000001.
> > > > 
> > > > This is something where I definitely think you want to check the
> > > > signature first.
> > > In theory yes, but in practice what will this break?
> > 
> > I've got no idea -- but what's the harm in checking?
> > 
> > Ian.
> 
> Users can set kvm signature to anything, if they do
> debugging will be a bit harder for them.

Ah, right, someone already mentioned that and I forgot, sorry.

And, just to complete my train of thought, cpuid just returns reserved
values for requests for non-existent leaves (rather than #GP for
example) so it's safe enough even if you do end up trying to read an
eax=0x40000001 when it doesn't exist.

Seems fine to me then.

Ian.

-- 
Ian Campbell
Current Noise: Hypocrisy - Buried

He's like a function -- he returns a value, in the form of his opinion.
It's up to you to cast it into a void or not.
		-- Phil Lapsley

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-04-30 14:38 [PATCHv2] x86info: dump kvm cpuid's Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  2012-05-01 12:27 ` Ian Campbell
@ 2012-09-05 17:33 ` Michael S. Tsirkin
  2012-12-06 11:41   ` Michael S. Tsirkin
  3 siblings, 1 reply; 14+ messages in thread
From: Michael S. Tsirkin @ 2012-09-05 17:33 UTC (permalink / raw)
  To: davej; +Cc: xen-devel, kvm, pv-drivers, virtualization, devel

On Mon, Apr 30, 2012 at 05:38:35PM +0300, Michael S. Tsirkin wrote:
> The following makes 'x86info -r' dump hypervisor leaf cpu ids
> (for kvm this is signature+features) when running in a vm.
> 
> On the guest we see the signature and the features:
> eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
> eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000
> 
> Hypervisor flag is checked to avoid output changes when not
> running on a VM.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Changes from v1:
> 	Make work on non KVM hypervisors (only KVM was tested).
> 	Avi Kivity said kvm will in the future report
> 	max HV leaf in eax. For now it reports eax = 0
>         so add a work around for that.

Ping.
Davej, any comments?
Would be nice to have this in.


> ---
> 
> diff --git a/identify.c b/identify.c
> index 33f35de..a4a3763 100644
> --- a/identify.c
> +++ b/identify.c
> @@ -9,8 +9,8 @@
>  
>  void get_cpu_info_basics(struct cpudata *cpu)
>  {
> -	unsigned int maxi, maxei, vendor, address_bits;
> -	unsigned int eax;
> +	unsigned int maxi, maxei, maxhv, vendor, address_bits;
> +	unsigned int eax, ebx, ecx;
>  
>  	cpuid(cpu->number, 0, &maxi, &vendor, NULL, NULL);
>  	maxi &= 0xffff;		/* The high-order word is non-zero on some Cyrix CPUs */
> @@ -19,7 +19,7 @@ void get_cpu_info_basics(struct cpudata *cpu)
>  		return;
>  
>  	/* Everything that supports cpuid supports these. */
> -	cpuid(cpu->number, 1, &eax, NULL, NULL, NULL);
> +	cpuid(cpu->number, 1, &eax, &ebx, &ecx, NULL);
>  	cpu->stepping = eax & 0xf;
>  	cpu->model = (eax >> 4) & 0xf;
>  	cpu->family = (eax >> 8) & 0xf;
> @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
>  
>  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
>  	cpu->maxei2 = maxei;
> +	if (ecx & 0x80000000) {
> +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> +		/*
> +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> +		 * where it really means 0x40000001.
> +		 * Most (all?) hypervisors have at least one CPUID besides
> +		 * the vendor ID so assume that.
> +		 */
> +		cpu->maxhv = maxhv ? maxhv : 0x40000001;
> +	} else {
> +		/* Suppress hypervisor cpuid unless running on a hypervisor */
> +		cpu->maxhv = 0;
> +	}
>  
>  	cpuid(cpu->number, 0x80000008,&address_bits, NULL, NULL, NULL);
>  	cpu->phyaddr_bits = address_bits & 0xFF;
> diff --git a/x86info.c b/x86info.c
> index 22c4734..80cae36 100644
> --- a/x86info.c
> +++ b/x86info.c
> @@ -44,6 +44,10 @@ static void display_detailed_info(struct cpudata *cpu)
>  
>  		if (cpu->maxei2 >=0xC0000000)
>  			dump_raw_cpuid(cpu->number, 0xC0000000, cpu->maxei2);
> +
> +		if (cpu->maxhv >= 0x40000000)
> +			dump_raw_cpuid(cpu->number, 0x40000000, cpu->maxhv);
> +
>  	}
>  
>  	if (show_cacheinfo) {
> diff --git a/x86info.h b/x86info.h
> index 7d2a455..c4f5d81 100644
> --- a/x86info.h
> +++ b/x86info.h
> @@ -84,7 +84,7 @@ struct cpudata {
>  	unsigned int cachesize_trace;
>  	unsigned int phyaddr_bits;
>  	unsigned int viraddr_bits;
> -	unsigned int cpuid_level, maxei, maxei2;
> +	unsigned int cpuid_level, maxei, maxei2, maxhv;
>  	char name[CPU_NAME_LEN];
>  	enum connector connector;
>  	unsigned int flags_ecx;

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-09-05 17:33 ` Michael S. Tsirkin
@ 2012-12-06 11:41   ` Michael S. Tsirkin
  2012-12-06 14:48     ` Dave Jones
  2012-12-06 14:48     ` Dave Jones
  0 siblings, 2 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2012-12-06 11:41 UTC (permalink / raw)
  To: davej; +Cc: xen-devel, kvm, pv-drivers, virtualization, devel

On Wed, Sep 05, 2012 at 08:33:35PM +0300, Michael S. Tsirkin wrote:
> On Mon, Apr 30, 2012 at 05:38:35PM +0300, Michael S. Tsirkin wrote:
> > The following makes 'x86info -r' dump hypervisor leaf cpu ids
> > (for kvm this is signature+features) when running in a vm.
> > 
> > On the guest we see the signature and the features:
> > eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
> > eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000
> > 
> > Hypervisor flag is checked to avoid output changes when not
> > running on a VM.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > Changes from v1:
> > 	Make work on non KVM hypervisors (only KVM was tested).
> > 	Avi Kivity said kvm will in the future report
> > 	max HV leaf in eax. For now it reports eax = 0
> >         so add a work around for that.
> 
> Ping.
> Davej, any comments?
> Would be nice to have this in.

Is this the right address?
Davej do you maintain x86info?
Thanks,
MST

> 
> > ---
> > 
> > diff --git a/identify.c b/identify.c
> > index 33f35de..a4a3763 100644
> > --- a/identify.c
> > +++ b/identify.c
> > @@ -9,8 +9,8 @@
> >  
> >  void get_cpu_info_basics(struct cpudata *cpu)
> >  {
> > -	unsigned int maxi, maxei, vendor, address_bits;
> > -	unsigned int eax;
> > +	unsigned int maxi, maxei, maxhv, vendor, address_bits;
> > +	unsigned int eax, ebx, ecx;
> >  
> >  	cpuid(cpu->number, 0, &maxi, &vendor, NULL, NULL);
> >  	maxi &= 0xffff;		/* The high-order word is non-zero on some Cyrix CPUs */
> > @@ -19,7 +19,7 @@ void get_cpu_info_basics(struct cpudata *cpu)
> >  		return;
> >  
> >  	/* Everything that supports cpuid supports these. */
> > -	cpuid(cpu->number, 1, &eax, NULL, NULL, NULL);
> > +	cpuid(cpu->number, 1, &eax, &ebx, &ecx, NULL);
> >  	cpu->stepping = eax & 0xf;
> >  	cpu->model = (eax >> 4) & 0xf;
> >  	cpu->family = (eax >> 8) & 0xf;
> > @@ -29,6 +29,19 @@ void get_cpu_info_basics(struct cpudata *cpu)
> >  
> >  	cpuid(cpu->number, 0xC0000000, &maxei, NULL, NULL, NULL);
> >  	cpu->maxei2 = maxei;
> > +	if (ecx & 0x80000000) {
> > +		cpuid(cpu->number, 0x40000000, &maxhv, NULL, NULL, NULL);
> > +		/*
> > +		 * KVM up to linux 3.4 reports 0 as the max hypervisor leaf,
> > +		 * where it really means 0x40000001.
> > +		 * Most (all?) hypervisors have at least one CPUID besides
> > +		 * the vendor ID so assume that.
> > +		 */
> > +		cpu->maxhv = maxhv ? maxhv : 0x40000001;
> > +	} else {
> > +		/* Suppress hypervisor cpuid unless running on a hypervisor */
> > +		cpu->maxhv = 0;
> > +	}
> >  
> >  	cpuid(cpu->number, 0x80000008,&address_bits, NULL, NULL, NULL);
> >  	cpu->phyaddr_bits = address_bits & 0xFF;
> > diff --git a/x86info.c b/x86info.c
> > index 22c4734..80cae36 100644
> > --- a/x86info.c
> > +++ b/x86info.c
> > @@ -44,6 +44,10 @@ static void display_detailed_info(struct cpudata *cpu)
> >  
> >  		if (cpu->maxei2 >=0xC0000000)
> >  			dump_raw_cpuid(cpu->number, 0xC0000000, cpu->maxei2);
> > +
> > +		if (cpu->maxhv >= 0x40000000)
> > +			dump_raw_cpuid(cpu->number, 0x40000000, cpu->maxhv);
> > +
> >  	}
> >  
> >  	if (show_cacheinfo) {
> > diff --git a/x86info.h b/x86info.h
> > index 7d2a455..c4f5d81 100644
> > --- a/x86info.h
> > +++ b/x86info.h
> > @@ -84,7 +84,7 @@ struct cpudata {
> >  	unsigned int cachesize_trace;
> >  	unsigned int phyaddr_bits;
> >  	unsigned int viraddr_bits;
> > -	unsigned int cpuid_level, maxei, maxei2;
> > +	unsigned int cpuid_level, maxei, maxei2, maxhv;
> >  	char name[CPU_NAME_LEN];
> >  	enum connector connector;
> >  	unsigned int flags_ecx;

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-12-06 11:41   ` Michael S. Tsirkin
  2012-12-06 14:48     ` Dave Jones
@ 2012-12-06 14:48     ` Dave Jones
  1 sibling, 0 replies; 14+ messages in thread
From: Dave Jones @ 2012-12-06 14:48 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: kvm, xen-devel, virtualization, devel, pv-drivers, Gleb Natapov

On Thu, Dec 06, 2012 at 01:41:12PM +0200, Michael S. Tsirkin wrote:
 > On Wed, Sep 05, 2012 at 08:33:35PM +0300, Michael S. Tsirkin wrote:
 > > On Mon, Apr 30, 2012 at 05:38:35PM +0300, Michael S. Tsirkin wrote:
 > > > The following makes 'x86info -r' dump hypervisor leaf cpu ids
 > > > (for kvm this is signature+features) when running in a vm.
 > > > 
 > > > On the guest we see the signature and the features:
 > > > eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
 > > > eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000
 > > > 
 > > > Hypervisor flag is checked to avoid output changes when not
 > > > running on a VM.
 > > > 
 > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 > > > 
 > > > Changes from v1:
 > > > 	Make work on non KVM hypervisors (only KVM was tested).
 > > > 	Avi Kivity said kvm will in the future report
 > > > 	max HV leaf in eax. For now it reports eax = 0
 > > >         so add a work around for that.
 > > 
 > > Ping.
 > > Davej, any comments?
 > > Would be nice to have this in.
 > 
 > Is this the right address?
 > Davej do you maintain x86info?
 > Thanks,
 > MST

It's effectively abandonware at this point, largely due to my own
lack of time. hwloc and similar tools seem to have taken it's place.
If anyone is interested in taking over x86info, I'm happy to hand
over the reins to someone capable.

	Dave


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCHv2] x86info: dump kvm cpuid's
  2012-12-06 11:41   ` Michael S. Tsirkin
@ 2012-12-06 14:48     ` Dave Jones
  2012-12-06 14:48     ` Dave Jones
  1 sibling, 0 replies; 14+ messages in thread
From: Dave Jones @ 2012-12-06 14:48 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: xen-devel, kvm, pv-drivers, virtualization, devel

On Thu, Dec 06, 2012 at 01:41:12PM +0200, Michael S. Tsirkin wrote:
 > On Wed, Sep 05, 2012 at 08:33:35PM +0300, Michael S. Tsirkin wrote:
 > > On Mon, Apr 30, 2012 at 05:38:35PM +0300, Michael S. Tsirkin wrote:
 > > > The following makes 'x86info -r' dump hypervisor leaf cpu ids
 > > > (for kvm this is signature+features) when running in a vm.
 > > > 
 > > > On the guest we see the signature and the features:
 > > > eax in: 0x40000000, eax = 00000000 ebx = 4b4d564b ecx = 564b4d56 edx = 0000004d
 > > > eax in: 0x40000001, eax = 0100007b ebx = 00000000 ecx = 00000000 edx = 00000000
 > > > 
 > > > Hypervisor flag is checked to avoid output changes when not
 > > > running on a VM.
 > > > 
 > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 > > > 
 > > > Changes from v1:
 > > > 	Make work on non KVM hypervisors (only KVM was tested).
 > > > 	Avi Kivity said kvm will in the future report
 > > > 	max HV leaf in eax. For now it reports eax = 0
 > > >         so add a work around for that.
 > > 
 > > Ping.
 > > Davej, any comments?
 > > Would be nice to have this in.
 > 
 > Is this the right address?
 > Davej do you maintain x86info?
 > Thanks,
 > MST

It's effectively abandonware at this point, largely due to my own
lack of time. hwloc and similar tools seem to have taken it's place.
If anyone is interested in taking over x86info, I'm happy to hand
over the reins to someone capable.

	Dave

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-12-06 14:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-30 14:38 [PATCHv2] x86info: dump kvm cpuid's Michael S. Tsirkin
2012-04-30 15:03 ` Gleb Natapov
2012-05-01 12:27 ` Ian Campbell
2012-05-01 12:35   ` Michael S. Tsirkin
2012-05-01 13:04   ` Gleb Natapov
2012-05-02  9:45     ` Ian Campbell
2012-05-02  9:45     ` Ian Campbell
2012-05-02  9:50       ` Michael S. Tsirkin
2012-05-02  9:58         ` [Xen-devel] " Ian Campbell
2012-05-01 12:27 ` Ian Campbell
2012-09-05 17:33 ` Michael S. Tsirkin
2012-12-06 11:41   ` Michael S. Tsirkin
2012-12-06 14:48     ` Dave Jones
2012-12-06 14:48     ` Dave Jones

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.