> Date: Fri, 17 Mar 2017 16:00:53 -0400
> From: Dale Rahn <dr...@dalerahn.com>
> 
> Do not preallocate the asid, wait until it is allcoated in pmap_setttb()
> Simplifies the code by only having one location that does the asid
> allocation.
> 
> There is no need to allocate the ASID direclty in pmap_activate as
> the code in pmap setttb will do that allocation so this code is just
> duplication that could potentially cause a race in the future.

I wondered if this was supposed to be an optimization, to prevent
running a potentially expensive operation with interrupts disabled.
But that doesn't really make a lot of sense.

ok kettenis@

P.S. I'm looking into using the full 16-bits to make ASID allocation
simpler.  First test shows that the full 16 bits work on the rpi3.

> diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c
> index 4d0c58c3663..d1fa358b85f 100644
> --- a/sys/arch/arm64/arm64/pmap.c
> +++ b/sys/arch/arm64/arm64/pmap.c
> @@ -1403,14 +1403,6 @@ pmap_activate(struct proc *p)
>       pcb = &p->p_addr->u_pcb;
>  
>       // printf("%s: called on proc %p %p\n", __func__, p,  pcb->pcb_pagedir);
> -     if (pm != pmap_kernel() && pm->pm_asid == -1) {
> -             // this userland process has no asid, allocate one.
> -             pmap_allocate_asid(pm);
> -     }
> -
> -     if (pm != pmap_kernel())
> -             pcb->pcb_pagedir = ((uint64_t)pm->pm_asid << 48) | pm->pm_pt0pa;
> -
>       psw = disable_interrupts();
>       if (p == curproc && pm != pmap_kernel() && pm != curcpu()->ci_curpm) {
>               // clean up old process
> Dale Rahn                             dr...@dalerahn.com
> 
> 

Reply via email to