Re: [RFC PATCH 3/3] Convert mce_disabled

From: Borislav Petkov
Date: Fri Oct 12 2012 - 17:59:00 EST


On Fri, Oct 12, 2012 at 05:46:16PM +0000, Luck, Tony wrote:
> > Or, you can modify the mca_config I have there and use bools and pass a
> > pointer to each actual bool member in each DEVICE_BIT_ATTR invocation
> > (and rename it to DEVICE_BOOL_ATTR). Yeah, that could work, unless I'm
> > missing something else, of course.
>
> This looks like the best solution to me. Sure we use a little more memory for
> a "bool" for each option instead of just a single bit. But there are only a
> handful of them, not thousands. So I think we can cope with a few extra
> bytes of memory consumption. I was still not completely convinced by the
>
> if (val)
> *bvec |= le64_to_cpu(BIT_64(bit));
>
> solution - it assumes that big endian machines also assign their bit numbers
> in a big->little way - but that isn't required by the C standard. bitfields are
> assigned at the whim of the compiler writer (the only restrictions seem to
> be on alignments of fields w.r.t. to the underlying data types).

Ok, it seems that would've been a can of worms if we'd opened it.

Fortunately, if we do bools and we pass a pointer to the respective bool
member of mca_config, we won't need to do that anymore. Instead simply:

*bool_ptr = !!val;

It can't get any simpler than that. I'll give it a try soon to see
whether it pans out as I'm imagining it.

Thanks.


--
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551
--
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/