Re: [PATCH 01/22] x86: add methods for writing of an MSR on severalCPUs
From: H. Peter Anvin
Date: Wed May 20 2009 - 01:19:34 EST
Borislav Petkov wrote:
> +
> +/* rdmsr on a bunch of CPUs
> + *
> + * @mask: which CPUs
> + * @msr_no: which MSR
> + * @msrs: array of MSR values
> + *
> + * Returns:
> + * 0 - success
> + * <0 - read failed on at least one CPU (latter in the mask)
> + */
> +int rdmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs)
> +{
> + struct msr *reg;
> + int cpu, tmp, err = 0;
> + int off = cpumask_first(mask);
> +
> + for_each_cpu(cpu, mask) {
> + reg = &msrs[cpu - off];
> +
> + tmp = rdmsr_on_cpu(cpu, msr_no, ®->l, ®->h);
> + if (tmp)
> + err = tmp;
> + }
> + return err;
> +}
> +EXPORT_SYMBOL(rdmsr_on_cpus);
> +
> +/*
> + * wrmsr of a bunch of CPUs
> + *
> + * @mask: which CPUs
> + * @msr_no: which MSR
> + * @msrs: array of MSR values
> + *
> + * Returns:
> + * 0 - success
> + * <0 - write failed on at least one CPU (latter in the mask)
> + */
> +int wrmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs)
> +{
> + struct msr reg;
> + int cpu, tmp, err = 0;
> + int off = cpumask_first(mask);
> +
> + for_each_cpu(cpu, mask) {
> + reg = msrs[cpu - off];
> +
> + tmp = wrmsr_on_cpu(cpu, msr_no, reg.l, reg.h);
> + if (tmp)
> + err = tmp;
> + }
> + return err;
> +}
> +EXPORT_SYMBOL(wrmsr_on_cpus);
> +
Okay, now I'm *really* confused.
I thought the whole point of these functions was to allow these MSR
references to take place in parallel, as opposed to doing outcalls to
each CPU in order... but that's exactly what these functions do.
So what was the point of them again?
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/