Messages in this thread | | | Subject | Re: [PATCH] Turn rdmsr, rdtsc into inline functions, clarify names | From | Rusty Russell <> | Date | Sun, 06 Aug 2006 12:56:03 +1000 |
| |
On Sun, 2006-08-06 at 04:38 +0200, Andi Kleen wrote: > On Sat, Aug 05, 2006 at 07:47:41PM +1000, Rusty Russell wrote: > > [Andi, sorry, x86_64 part untested, so sending straight to you] > > > > rdmsr and rdtsc are macros, altering their arguments directly. An > > inline function would offer decent typechecking, but needs to take > > pointer args. The comment notes that gcc produces better code with > > I think I prefer the macro variant actually. Sorry. It just looks > better without the &s.
Hi Andi,
Please reconsider. This isn't about being pretty, it's about not having hidden side-effects, and having typechecking.
> We don't care very much about the code quality here because > rdmsr/wrmsr are always very slow in microcode anyways and tend > to synchronize the CPUs.
Agreed, but comment about it above the macros made me wary, so I checked it. No significant code difference with gcc >= 4.0, at least.
> If you feel a need to clean up I would suggest you convert more > users over to the ll variants which take a single 64bit value > instead of two 32bit ones.
You mean the l and ll variants? The 64 bit variants are rdmsrl and rdtscll, not to be confused with rdtscl, which returns the lower 32 bits. This confusion caused the x86_64 bug in gameport.c which the patch comment mentioned (at least, seems to be a bug to me).
See why I want to fix these names?
So if you would prefer u64 rdtsc64(), u32 rdtsc_low(), u64 rdmsr64(int msr), u32 rdmsr_low(int msr), I can convert everyone to that, although it's a more invasive change...
Thanks, Rusty. -- Help! Save Australia from the worst of the DMCA: http://linux.org.au/law
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |