Re: [PATCH -v2 6/7] x86, NMI, Add support to notify hardware errorwith unknown NMI

From: huang ying
Date: Wed Sep 29 2010 - 04:17:38 EST


On Tue, Sep 28, 2010 at 11:32 PM, Don Zickus <dzickus@xxxxxxxxxx> wrote:
> On Tue, Sep 28, 2010 at 08:36:12AM +0800, Huang Ying wrote:
>> > I tend to agree with Robert here. ÂI don't know if there were any 'rules'
>> > to which handlers get directly called versus ones that go through the
>> > die_chain, so I was originally going to let it go. ÂBut if they aren't
>> > any, it does look cleaner to have everything in die_chains.
>>
>> Personally, I think directly call has better readability than
>
> I am confused what type of readability you are looking for? ÂCan we create
> a sysfs entry to give you that info?

Sorry for my poor English. I mean code readability here. That is,
notifier_chain makes code harder to understand than direct call.

>> notifier_chain in general. Notifier_chain is for:
>>
>> - Call functions in module.
>> - Need to enable/disable (via register/unregister) at run time.
>> - Call functions from low layer to high layer.
>>
>> Otherwise, notifier_chain should be avoid if possible. So I think it is
>> better to keep direct call as much as possible.
>
> But the problem is you have to export all this platform specific stuff to
> traps.c and surround the code with #ifdef's, which start to look ugly.

There is no #ifdef in my final default_do_nmi(), so I think the code
can be cleaned up without converting everything into notifier block. I
think the rule can be: architecture specific thing should go direct
call, while device driver should be turned into notifier block.

> Is there any reason why traps.c should know about MCA/HEST/<other hardware
> errors>? ÂShouldn't it be abstracted away?

Yes. The device drivers should be abstracted away, leaving
architectural logic, such as port 0x61 as direct call. We need
notifier chain, but I just suggest reduce its usage if possible.

> Honestly, I would be interested in creating a southbridge driver and
> moving the port 0x61 code there and keeping the default_do_nmi() function
> stupidly simple (just a call to the die_chain and the
> unknown_nmi_error()).

I think the southbridge drivers should go notifier block, but the port
0x61 code is architectural and should be kept in default_do_nmi().

Best Regards,
Huang Ying
--
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/