Re: Should activate_page()/__set_page_dirty_buffers() use _irqsavelocking?

From: Richard Purdie
Date: Wed Jul 27 2005 - 05:15:39 EST


On Tue, 2005-07-26 at 11:38 -0700, Andrew Morton wrote:
> Richard Purdie <rpurdie@xxxxxxxxx> wrote:
> >
> > I've been experimenting with oprofile on an arm system without a PMU.
> > Whenever I enable callgraphing I see a BUG from run_posix_cpu_timers()
> > due to irqs being enabled when they should be disabled.
> >
> > Tracing this back shows interrupts are enabled after the arm backtrace
> > code completes. Further tracing reveals its the call to
> > check_user_page_readable() (within an interrupt) that is causing the
> > problem.
> >
> > Both the arm and i386 backtrace code would seem to be vulnerable to this
> > problem.
>
> ow, yes, ug.
>
> check_page_readable() won't actually call set_page_dirty() because it
> passes in `write = 0'. So it should be sufficient to use
> spin_lock_irqsave() in mark_page_accessed().
>
> But then again, that's fragile and obscure and it isn't even correct: if
> someone calls check_page_readable(), that doesn't imply an actual read of
> the page's contents.
>
> So how about we add a new flag to __follow_page() telling it whether to
> consider this as an access to the page contents?

The patch looks good to me, I've tested it (on arm) and it all seems to
work. I'm happy :).

Thanks,

Richard

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