[PATCH] cpu: msr: GPF avoidance on BOCHs QEMU systems (LP: #925001)

Alex Hung alex.hung at canonical.com
Thu Feb 2 11:13:53 UTC 2012


On 02/02/2012 06:46 PM, Colin King wrote:
> From: Colin Ian King<colin.king at canonical.com>
>
> Bochs firmware based QEMU systems on some configurations get
> General Protection Faults when running the MSR tests.  Since this
> isn't real hardware that we care about we can just kludge around
> this by not allowing the MSR tests in Bochs based systems.
>
> Signed-off-by: Colin Ian King<colin.king at canonical.com>
> ---
>   src/cpu/msr/msr.c |   19 +++++++++++++++++++
>   1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/src/cpu/msr/msr.c b/src/cpu/msr/msr.c
> index d6aa00e..5de27a7 100644
> --- a/src/cpu/msr/msr.c
> +++ b/src/cpu/msr/msr.c
> @@ -30,6 +30,8 @@ static fwts_cpuinfo_x86 *cpuinfo;
>
>   static int msr_init(fwts_framework *fw)
>   {
> +	char *bios_vendor;
> +
>   	if ((cpuinfo = fwts_cpu_get_info(0)) == NULL) {
>   		fwts_log_error(fw, "Cannot get CPU info");
>   		return FWTS_ERROR;
> @@ -45,6 +47,23 @@ static int msr_init(fwts_framework *fw)
>   		fwts_log_error(fw, "Cannot detect the number of CPUs on this machine.");
>   		return FWTS_ABORTED;
>   	}
> +
> +	/*
> +	 * Running MSR tests inside virtual machines such as QEMU with some kernel/kvm
> +	 * combinations have been observed to cause GPFs.  We kludge around this by
> +	 * avoiding MSR tests for a Bochs BIOS based QEMU virtual machine.
> +	 */
> +	if ((bios_vendor = fwts_get("/sys/class/dmi/id/bios_vendor")) != NULL) {
> +		if (strstr(bios_vendor, "Bochs")) {
> +			fwts_log_error(fw,
> +				"MSR test being avoiding inside a virtual machine as "
> +				"this is known to cause General Protection Faults on "
> +				"some configurations.");
> +			free(bios_vendor);
> +			return FWTS_SKIP;
> +		}
> +		free(bios_vendor);
> +	}
>   	return FWTS_OK;
>   }
>
Ack'ed by Alex Hung <alex.hung at canonical.com>




More information about the fwts-devel mailing list