* meaning of vmalloc shortcut comment in fault.c
@ 2001-06-05 12:56 Bjorn Wesen
2001-06-05 15:11 ` Brian Gerst
0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Wesen @ 2001-06-05 12:56 UTC (permalink / raw)
To: linux-kernel
Can someone elaborate on why it's bad to refer to tsk directly below (this
is a 2.4.5 change in x86) and why it's needed on x86 and not other archs..
What should I do for an arch that does not have a "cr3" machine register
to check with ?
/BW
vmalloc_fault:
{
/*
* Synchronize this task's top level page-table
* with the 'reference' page table.
*
* Do _not_ use "tsk" here. We might be inside
* an interrupt in the middle of a task switch..
*/
int offset = __pgd_offset(address);
pgd_t *pgd, *pgd_k;
pmd_t *pmd, *pmd_k;
pte_t *pte_k;
asm("movl %%cr3,%0":"=r" (pgd));
pgd = offset + (pgd_t *)__va(pgd);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: meaning of vmalloc shortcut comment in fault.c
2001-06-05 12:56 meaning of vmalloc shortcut comment in fault.c Bjorn Wesen
@ 2001-06-05 15:11 ` Brian Gerst
0 siblings, 0 replies; 2+ messages in thread
From: Brian Gerst @ 2001-06-05 15:11 UTC (permalink / raw)
To: Bjorn Wesen; +Cc: linux-kernel
Bjorn Wesen wrote:
>
> Can someone elaborate on why it's bad to refer to tsk directly below (this
> is a 2.4.5 change in x86) and why it's needed on x86 and not other archs..
>
> What should I do for an arch that does not have a "cr3" machine register
> to check with ?
%cr3 is the page table pointer on the x86. Changing the page table
pointer and changing the stack pointer (from which tsk is derived) is
not done atomically during a task switch. If an interrupt happens in
between and causes a page fault on a vmalloced area, using tsk may refer
to the wrong page tables. %cr3 by definition always has the current
page table pointer.
--
Brian Gerst
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-06-05 15:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-05 12:56 meaning of vmalloc shortcut comment in fault.c Bjorn Wesen
2001-06-05 15:11 ` Brian Gerst
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox