Kill the 4MB kernel limit dead. [I hope :-)].
For UP, we were using $tmp_stk as a stack from the data section. If the kernel text section grew beyond ~3MB, the data section would be pushed beyond the temporary 4MB P==V mapping. This would cause the trampoline up to high memory to fault. The hack workaround I did was to use all of the page table pages that we already have while preparing the initial P==V mapping, instead of just the first one. For SMP, the AP bootstrap process suffered the same sort of problem and got the same treatment. MFC candidate - this breaks on 4.x just the same.. Thanks to: Richard Todd <rmtodd@ichotolot.servalan.com>
This commit is contained in:
parent
91396cbceb
commit
d7e8a2bd66
@ -889,7 +889,7 @@ map_read_write:
|
||||
/* install a pde for temporary double map of bottom of VA */
|
||||
movl R(KPTphys), %eax
|
||||
xorl %ebx, %ebx
|
||||
movl $1, %ecx
|
||||
movl $NKPT, %ecx
|
||||
fillkpt(R(IdlePTD), $PG_RW)
|
||||
|
||||
/* install pde's for pt's */
|
||||
|
@ -889,7 +889,7 @@ map_read_write:
|
||||
/* install a pde for temporary double map of bottom of VA */
|
||||
movl R(KPTphys), %eax
|
||||
xorl %ebx, %ebx
|
||||
movl $1, %ecx
|
||||
movl $NKPT, %ecx
|
||||
fillkpt(R(IdlePTD), $PG_RW)
|
||||
|
||||
/* install pde's for pt's */
|
||||
|
@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
struct globaldata *gd;
|
||||
char *stack;
|
||||
uintptr_t kptbase;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
|
||||
/* record BSP in CPU map */
|
||||
all_cpus = 1;
|
||||
|
||||
/* set up 0 -> 4MB P==V mapping for AP boot */
|
||||
*(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
|
||||
/* set up temporary P==V mapping for AP boot */
|
||||
/* XXX this is a hack, we should boot the AP on its own stack/PTD */
|
||||
kptbase = (uintptr_t)(void *)KPTphys;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = (pd_entry_t)(PG_V | PG_RW |
|
||||
((kptbase + x * PAGE_SIZE) & PG_FRAME));
|
||||
invltlb();
|
||||
|
||||
/* start each AP */
|
||||
@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
|
||||
SMPpt[1 + i] = (pt_entry_t)
|
||||
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
*(int *)PTD = 0;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = 0;
|
||||
pmap_set_opt();
|
||||
|
||||
/* number of APs actually started */
|
||||
|
@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
struct globaldata *gd;
|
||||
char *stack;
|
||||
uintptr_t kptbase;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
|
||||
/* record BSP in CPU map */
|
||||
all_cpus = 1;
|
||||
|
||||
/* set up 0 -> 4MB P==V mapping for AP boot */
|
||||
*(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
|
||||
/* set up temporary P==V mapping for AP boot */
|
||||
/* XXX this is a hack, we should boot the AP on its own stack/PTD */
|
||||
kptbase = (uintptr_t)(void *)KPTphys;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = (pd_entry_t)(PG_V | PG_RW |
|
||||
((kptbase + x * PAGE_SIZE) & PG_FRAME));
|
||||
invltlb();
|
||||
|
||||
/* start each AP */
|
||||
@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
|
||||
SMPpt[1 + i] = (pt_entry_t)
|
||||
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
*(int *)PTD = 0;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = 0;
|
||||
pmap_set_opt();
|
||||
|
||||
/* number of APs actually started */
|
||||
|
@ -282,6 +282,7 @@ pmap_bootstrap(firstaddr, loadaddr)
|
||||
{
|
||||
vm_offset_t va;
|
||||
pt_entry_t *pte;
|
||||
int i;
|
||||
|
||||
avail_start = firstaddr;
|
||||
|
||||
@ -360,8 +361,8 @@ pmap_bootstrap(firstaddr, loadaddr)
|
||||
virtual_avail = va;
|
||||
|
||||
*(int *) CMAP1 = *(int *) CMAP2 = 0;
|
||||
*(int *) PTD = 0;
|
||||
|
||||
for (i = 0; i < NKPT; i++)
|
||||
PTD[i] = 0;
|
||||
|
||||
pgeflag = 0;
|
||||
#if !defined(SMP) /* XXX - see also mp_machdep.c */
|
||||
|
@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
struct globaldata *gd;
|
||||
char *stack;
|
||||
uintptr_t kptbase;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
|
||||
/* record BSP in CPU map */
|
||||
all_cpus = 1;
|
||||
|
||||
/* set up 0 -> 4MB P==V mapping for AP boot */
|
||||
*(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
|
||||
/* set up temporary P==V mapping for AP boot */
|
||||
/* XXX this is a hack, we should boot the AP on its own stack/PTD */
|
||||
kptbase = (uintptr_t)(void *)KPTphys;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = (pd_entry_t)(PG_V | PG_RW |
|
||||
((kptbase + x * PAGE_SIZE) & PG_FRAME));
|
||||
invltlb();
|
||||
|
||||
/* start each AP */
|
||||
@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
|
||||
SMPpt[1 + i] = (pt_entry_t)
|
||||
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
*(int *)PTD = 0;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = 0;
|
||||
pmap_set_opt();
|
||||
|
||||
/* number of APs actually started */
|
||||
|
@ -889,7 +889,7 @@ map_read_write:
|
||||
/* install a pde for temporary double map of bottom of VA */
|
||||
movl R(KPTphys), %eax
|
||||
xorl %ebx, %ebx
|
||||
movl $1, %ecx
|
||||
movl $NKPT, %ecx
|
||||
fillkpt(R(IdlePTD), $PG_RW)
|
||||
|
||||
/* install pde's for pt's */
|
||||
|
@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
struct globaldata *gd;
|
||||
char *stack;
|
||||
uintptr_t kptbase;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
|
||||
/* record BSP in CPU map */
|
||||
all_cpus = 1;
|
||||
|
||||
/* set up 0 -> 4MB P==V mapping for AP boot */
|
||||
*(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
|
||||
/* set up temporary P==V mapping for AP boot */
|
||||
/* XXX this is a hack, we should boot the AP on its own stack/PTD */
|
||||
kptbase = (uintptr_t)(void *)KPTphys;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = (pd_entry_t)(PG_V | PG_RW |
|
||||
((kptbase + x * PAGE_SIZE) & PG_FRAME));
|
||||
invltlb();
|
||||
|
||||
/* start each AP */
|
||||
@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
|
||||
SMPpt[1 + i] = (pt_entry_t)
|
||||
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
*(int *)PTD = 0;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = 0;
|
||||
pmap_set_opt();
|
||||
|
||||
/* number of APs actually started */
|
||||
|
@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
struct globaldata *gd;
|
||||
char *stack;
|
||||
uintptr_t kptbase;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
|
||||
/* record BSP in CPU map */
|
||||
all_cpus = 1;
|
||||
|
||||
/* set up 0 -> 4MB P==V mapping for AP boot */
|
||||
*(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
|
||||
/* set up temporary P==V mapping for AP boot */
|
||||
/* XXX this is a hack, we should boot the AP on its own stack/PTD */
|
||||
kptbase = (uintptr_t)(void *)KPTphys;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = (pd_entry_t)(PG_V | PG_RW |
|
||||
((kptbase + x * PAGE_SIZE) & PG_FRAME));
|
||||
invltlb();
|
||||
|
||||
/* start each AP */
|
||||
@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
|
||||
SMPpt[1 + i] = (pt_entry_t)
|
||||
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
*(int *)PTD = 0;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = 0;
|
||||
pmap_set_opt();
|
||||
|
||||
/* number of APs actually started */
|
||||
|
@ -282,6 +282,7 @@ pmap_bootstrap(firstaddr, loadaddr)
|
||||
{
|
||||
vm_offset_t va;
|
||||
pt_entry_t *pte;
|
||||
int i;
|
||||
|
||||
avail_start = firstaddr;
|
||||
|
||||
@ -360,8 +361,8 @@ pmap_bootstrap(firstaddr, loadaddr)
|
||||
virtual_avail = va;
|
||||
|
||||
*(int *) CMAP1 = *(int *) CMAP2 = 0;
|
||||
*(int *) PTD = 0;
|
||||
|
||||
for (i = 0; i < NKPT; i++)
|
||||
PTD[i] = 0;
|
||||
|
||||
pgeflag = 0;
|
||||
#if !defined(SMP) /* XXX - see also mp_machdep.c */
|
||||
|
@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
struct globaldata *gd;
|
||||
char *stack;
|
||||
uintptr_t kptbase;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
|
||||
/* record BSP in CPU map */
|
||||
all_cpus = 1;
|
||||
|
||||
/* set up 0 -> 4MB P==V mapping for AP boot */
|
||||
*(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
|
||||
/* set up temporary P==V mapping for AP boot */
|
||||
/* XXX this is a hack, we should boot the AP on its own stack/PTD */
|
||||
kptbase = (uintptr_t)(void *)KPTphys;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = (pd_entry_t)(PG_V | PG_RW |
|
||||
((kptbase + x * PAGE_SIZE) & PG_FRAME));
|
||||
invltlb();
|
||||
|
||||
/* start each AP */
|
||||
@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
|
||||
SMPpt[1 + i] = (pt_entry_t)
|
||||
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
*(int *)PTD = 0;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = 0;
|
||||
pmap_set_opt();
|
||||
|
||||
/* number of APs actually started */
|
||||
|
@ -1943,6 +1943,7 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
struct globaldata *gd;
|
||||
char *stack;
|
||||
uintptr_t kptbase;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1964,8 +1965,12 @@ start_all_aps(u_int boot_addr)
|
||||
/* record BSP in CPU map */
|
||||
all_cpus = 1;
|
||||
|
||||
/* set up 0 -> 4MB P==V mapping for AP boot */
|
||||
*(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME);
|
||||
/* set up temporary P==V mapping for AP boot */
|
||||
/* XXX this is a hack, we should boot the AP on its own stack/PTD */
|
||||
kptbase = (uintptr_t)(void *)KPTphys;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = (pd_entry_t)(PG_V | PG_RW |
|
||||
((kptbase + x * PAGE_SIZE) & PG_FRAME));
|
||||
invltlb();
|
||||
|
||||
/* start each AP */
|
||||
@ -2047,7 +2052,8 @@ start_all_aps(u_int boot_addr)
|
||||
SMPpt[1 + i] = (pt_entry_t)
|
||||
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
*(int *)PTD = 0;
|
||||
for (x = 0; x < NKPT; x++)
|
||||
PTD[x] = 0;
|
||||
pmap_set_opt();
|
||||
|
||||
/* number of APs actually started */
|
||||
|
Loading…
x
Reference in New Issue
Block a user