Q:

How to use CPUID as a serializing instruction?

CPUID can be used as a serializing instruction as described here and here. What is the minimal/simplest asm syntax to use it in that way in C++?
// Is that enough?
// What to do with registers and memory?
// Is volatile necessary?
asm volatile("CPUID":::);

A:

Is there a reason you're not using the fence operations? If the goal is to serialize a section of code you can do something like
    asm __volatile__ (
" mfence \n"
" lfence \n"
);
Your code
asm __volatile__ (
" mfence \n"
" lfence \n"
);

