On Wed, Nov 28, 2012 at 04:14:43PM -0800, H. Peter Anvin wrote:
> Wrong barrier semantics.

Let me try to understand what you mean by that :)

Now, your version's asm output looks like this:

----
        .loc 2 95 0
        movl    $139, %esi      #, tmp140
        xorl    %eax, %eax      # tmp141
        movl    %esi, %ecx      # tmp140,
        movl    %eax, %edx      # tmp141,
#APP
# 95 "/home/boris/kernel/linux-2.6/arch/x86/include/asm/msr.h" 1
        wrmsr
# 0 "" 2
#NO_APP
        .loc 3 694 0
        movb    $1, %al #,
#APP
# 694 "/home/boris/kernel/linux-2.6/arch/x86/include/asm/processor.h" 1
        cpuid
# 0 "" 2
.LVL15:
#NO_APP
----

This is the sync_core() call from early_init_intel(). Now look like 139
remains in %ecx after the WRMSR and CPUID actually gets called with
RAX=1 and RCX=139 (btw, 139 is MSR_IA32_UCODE_REV). Even if this works
I'd say, we don't want to have any stray values in RCX when doing CPUID,
no?

Now here's the version with the change I proposed:

----
        .loc 2 95 0
        xorl    %esi, %esi      # tmp144
        movl    $139, %edi      #, tmp143
        movl    %edi, %ecx      # tmp143,
        movl    %esi, %eax      # tmp144,
        movl    %esi, %edx      # tmp144,
#APP
# 95 "/home/boris/kernel/linux-2.6/arch/x86/include/asm/msr.h" 1
        wrmsr
# 0 "" 2
.LVL15:
#NO_APP
        .loc 3 199 0
        movb    $1, %al #,
        movl    %esi, %ecx      # tmp144, ecx
#APP
# 199 "/home/boris/kernel/linux-2.6/arch/x86/include/asm/processor.h" 1
        cpuid
# 0 "" 2
.LVL16:
#NO_APP
----

RCX gets correctly cleaned to 0 and *then* we call CPUID.

And the asm output is the same except that RCX gets correctly cleaned up
before calling CPUID.

So what am I missing?

Thanks.

-- 
Regards/Gruss,
    Boris.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to