Re: [PATCH 0/2 x86] fix some page faults in nmi if kmemcheck isenabled

From: Don Zickus
Date: Fri Mar 02 2012 - 14:45:33 EST


On Tue, Feb 28, 2012 at 10:45:41AM +0800, Li Zhong wrote:
> > > I'm not sure whether I understand it correctly. Do you mean that
> > > nmiaction is initialized in register_nmi_handler(), which indicates it
> > > will be used in nmi, so it shouldn't be marked non-present?
> >
> > No, you said that it marks memory non-present to detect uninitialized
> > stuff, but since it is initialized, it shouldn't then be non-present,
> > right?
>
> From my understanding of kmemcheck, the checking is based on the
> non-present page. So while handling page fault, if the memory hasn't
> been written before read, kmemcheck knows that it is uninitialized.
>
> I think it is used to find code errors, so it need mark all non-present,
> to check if there are any access to uninitialized memory.

I am not sure if this is what your tool is catching, but someone pointed
out to me privately that when panic'ing in an NMI, either the shutdown
path I modified or the kdump path will register an NMI handler in an NMI
context. Thus they will try to allocate memory in the NMI context.

So I will have to fix that. Wonder if that popular lockless memory
allocator can help me there... otherwise I have to go back to pass in
structs like the notifier blocks do.

Cheers,
Don
--
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/