Re: [PATCH] kmemcheck: disable fast string operations on P4 CPUs

Pekka Enberg
2009-02-21T16:25:33Z

Vegard Nossum wrote:
> This patch may allow us to remove the REP emulation code from
> kmemcheck.
>
> Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>

Looks good to me!

Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>

> +#ifdef CONFIG_KMEMCHECK
> + /*
> + * P4s have a "fast strings" feature which causes single-
> + * stepping REP instructions to only generate a #DB on
> + * cache-line boundaries.
> + *
> + * Ingo Molnar reported a Pentium D (model 6) and a Xeon
> + * (model 2) with the same problem.
> + */

Minor nit: I'd move the latter part of the comment to the changelog.

> + if (c->x86 == 15) {
> + u64 misc_enable;
> +
> + rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
> +
> + if (misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING) {
> + printk(KERN_INFO "kmemcheck: Disabling fast string operations\n");
> +
> + misc_enable &= ~MSR_IA32_MISC_ENABLE_FAST_STRING;
> + wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
> + }
> + }
> +#endif
> }
>
> #ifdef CONFIG_X86_32