lkml.org 
[lkml]   [2007]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Cleanup: rationalize paravirt wrappers
Rusty Russell wrote:
>>
>>> +#define rdmsr(msr,val1,val2) \
>>> + do { \
>>> + int __err; \
>>> + unsigned long long __val = native_read_msr(msr, &__err); \
>>> + val1 = __val; \
>>> + val2 = __val >> 32; \
>>> + } while(0)
>>> +
>>>
>>>
>> You're silently changing the behavior (as well as the prototype) here,
>> rdmsr() used to fail loudly, now it fails silently, with no way for the
>> caller to check.
>>
>
> Hi Avi!
>
> Not sure what you're saying about the prototype: the old macro was:
>
> -#define rdmsr(msr,val1,val2) \
> - __asm__ __volatile__("rdmsr" \
> - : "=a" (val1), "=d" (val2) \
> - : "c" (msr))
> -
>
> Which doesn't seem to be a great difference to me.
>

Right, scratch that. Was confused by rdmsr_safe().

> The behaviour change (don't oops when an invalid rdmsr is used) was
> there with CONFIG_PARAVIRT=y, the cleanup just made !CONFIG_PARAVIRT the
> same. Is it important?

I think so. A function should either never fail, or indicate that it
has failed (panic, error return, debug message). With the kinder,
gentler rdmsr() one can code the wrong msr value and not notice that
something is wrong.


--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

-
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/

\
 
 \ /
  Last update: 2007-03-22 09:13    [W:0.055 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site