On Sun, Apr 02, 2023 at 07:29:02PM +0000, Miod Vallat wrote:
> pmap_copy() is an optional pmap interface which has never been
> implemented. In pure Mary Kondo style, we should thank it for the joy it
> brought to CSRG people, and move it to the recycling bin - it's not
> going to be implemented anytime soon.

In Mach (Tevanian's thesis) it was described as:
"This routine is only advisory and need not do anything"

ok jsg@

> 
> Index: share/man/man9/pmap.9
> ===================================================================
> RCS file: /OpenBSD/src/share/man/man9/pmap.9,v
> retrieving revision 1.19
> diff -u -p -r1.19 pmap.9
> --- share/man/man9/pmap.9     16 Dec 2019 10:34:04 -0000      1.19
> +++ share/man/man9/pmap.9     2 Apr 2023 19:23:11 -0000
> @@ -49,8 +49,7 @@
>  .Nm pmap_growkernel ,
>  .Nm pmap_update ,
>  .Nm pmap_collect ,
> -.Nm pmap_virtual_space ,
> -.Nm pmap_copy
> +.Nm pmap_virtual_space
>  .Nd machine dependent interface to the MMU
>  .Sh SYNOPSIS
>  .In machine/pmap.h
> @@ -366,9 +365,6 @@ it contains no valid mappings.
>  .Fn pmap_collect "pmap_t pmap"
>  .Ft void
>  .Fn pmap_virtual_space "vaddr_t *vstartp" "vaddr_t *vendp"
> -.Ft void
> -.Fn pmap_copy "pmap_t dst_pmap" "pmap_t src_pmap" "vaddr_t dst_addr" \
> -              "vsize_t len" "vaddr_t src_addr"
>  .nr nS 0
>  .Pp
>  Wired memory allocation before the virtual memory system is bootstrapped
> @@ -398,26 +394,6 @@ is not expected to be used for some time
>  module a chance to prioritize.
>  The initial bounds of the kernel virtual address space are returned by
>  .Fn pmap_virtual_space .
> -.Pp
> -The
> -.Fn pmap_copy
> -function copies the range specified by
> -.Fa src_addr
> -and
> -.Fa src_len
> -from
> -.Fa src_pmap
> -to the range described by
> -.Fa dst_addr
> -and
> -.Fa dst_len
> -in
> -.Fa dst_map .
> -.Fn pmap_copy
> -is called during a
> -.Xr fork 2
> -operation to give the child process an initial set of low-level
> -mappings.
>  .Sh SEE ALSO
>  .Xr fork 2 ,
>  .Xr uvm_init 9
> Index: sys/arch/alpha/alpha/pmap.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/alpha/alpha/pmap.c,v
> retrieving revision 1.89
> diff -u -p -r1.89 pmap.c
> --- sys/arch/alpha/alpha/pmap.c       6 Feb 2023 11:16:22 -0000       1.89
> +++ sys/arch/alpha/alpha/pmap.c       2 Apr 2023 19:23:11 -0000
> @@ -2017,17 +2017,6 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
>  }
>  
>  /*
> - * pmap_copy:                        [ INTERFACE ]
> - *
> - *   Copy the mapping range specified by src_addr/len
> - *   from the source map to the range dst_addr/len
> - *   in the destination map.
> - *
> - *   This routine is only advisory and need not do anything.
> - */
> -/* call deleted in <machine/pmap.h> */
> -
> -/*
>   * pmap_collect:             [ INTERFACE ]
>   *
>   *   Garbage collects the physical map system for pages which are no
> Index: sys/arch/alpha/include/pmap.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/alpha/include/pmap.h,v
> retrieving revision 1.44
> diff -u -p -r1.44 pmap.h
> --- sys/arch/alpha/include/pmap.h     6 Feb 2023 11:16:22 -0000       1.44
> +++ sys/arch/alpha/include/pmap.h     2 Apr 2023 19:23:11 -0000
> @@ -155,7 +155,6 @@ void      pmap_do_tlb_shootdown(struct cpu_in
>  #define      pmap_resident_count(pmap)       
> ((pmap)->pm_stats.resident_count)
>  #define      pmap_wired_count(pmap)          ((pmap)->pm_stats.wired_count)
>  
> -#define pmap_copy(dp, sp, da, l, sa) /* nothing */
>  #define pmap_update(pmap)            /* nothing (yet) */
>  
>  #define pmap_proc_iflush(p, va, len) /* nothing */
> Index: sys/arch/amd64/amd64/pmap.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/amd64/amd64/pmap.c,v
> retrieving revision 1.162
> diff -u -p -r1.162 pmap.c
> --- sys/arch/amd64/amd64/pmap.c       30 Jan 2023 11:21:26 -0000      1.162
> +++ sys/arch/amd64/amd64/pmap.c       2 Apr 2023 19:23:11 -0000
> @@ -2257,17 +2257,6 @@ pmap_collect(struct pmap *pmap)
>  }
>  #endif
>  
> -/*
> - * pmap_copy: copy mappings from one pmap to another
> - *
> - * => optional function
> - * void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
> - */
> -
> -/*
> - * defined as macro in pmap.h
> - */
> -
>  void
>  pmap_enter_special(vaddr_t va, paddr_t pa, vm_prot_t prot)
>  {
> Index: sys/arch/amd64/include/pmap.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/amd64/include/pmap.h,v
> retrieving revision 1.85
> diff -u -p -r1.85 pmap.h
> --- sys/arch/amd64/include/pmap.h     31 Jan 2023 15:18:54 -0000      1.85
> +++ sys/arch/amd64/include/pmap.h     2 Apr 2023 19:23:11 -0000
> @@ -369,7 +369,6 @@ extern const long nbpd[], nkptpmax[];
>  
>  #define pmap_clear_modify(pg)                pmap_clear_attrs(pg, PG_M)
>  #define pmap_clear_reference(pg)     pmap_clear_attrs(pg, PG_U)
> -#define pmap_copy(DP,SP,D,L,S)
>  #define pmap_is_modified(pg)         pmap_test_attrs(pg, PG_M)
>  #define pmap_is_referenced(pg)               pmap_test_attrs(pg, PG_U)
>  #define pmap_move(DP,SP,D,L,S)
> Index: sys/arch/arm/include/pmap.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/arm/include/pmap.h,v
> retrieving revision 1.53
> diff -u -p -r1.53 pmap.h
> --- sys/arch/arm/include/pmap.h       31 Jan 2023 15:18:54 -0000      1.53
> +++ sys/arch/arm/include/pmap.h       2 Apr 2023 19:23:11 -0000
> @@ -240,7 +240,6 @@ extern struct pmap        kernel_pmap_store;
>       (((pg)->mdpage.pvh_attrs & PVF_REF) != 0)
>  
>  #define      pmap_deactivate(p)              do { /* nothing */ } while (0)
> -#define      pmap_copy(dp, sp, da, l, sa)    do { /* nothing */ } while (0)
>  
>  #define pmap_unuse_final(p)          do { /* nothing */ } while (0)
>  #define      pmap_remove_holes(vm)           do { /* nothing */ } while (0)
> Index: sys/arch/arm64/arm64/pmap.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/arm64/arm64/pmap.c,v
> retrieving revision 1.93
> diff -u -p -r1.93 pmap.c
> --- sys/arch/arm64/arm64/pmap.c       27 Mar 2023 19:02:47 -0000      1.93
> +++ sys/arch/arm64/arm64/pmap.c       2 Apr 2023 19:23:11 -0000
> @@ -1927,13 +1927,6 @@ pmap_clear_reference(struct vm_page *pg)
>  }
>  
>  void
> -pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vaddr_t dst_addr,
> -     vsize_t len, vaddr_t src_addr)
> -{
> -     /* NOOP */
> -}
> -
> -void
>  pmap_unwire(pmap_t pm, vaddr_t va)
>  {
>       struct pte_desc *pted;
> Index: sys/arch/hppa/include/pmap.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/hppa/include/pmap.h,v
> retrieving revision 1.54
> diff -u -p -r1.54 pmap.h
> --- sys/arch/hppa/include/pmap.h      24 Jan 2023 16:51:06 -0000      1.54
> +++ sys/arch/hppa/include/pmap.h      2 Apr 2023 19:23:11 -0000
> @@ -102,7 +102,6 @@ struct vm_page *pmap_unmap_direct(vaddr_
>  #define pmap_kernel()                        (&kernel_pmap_store)
>  #define      pmap_resident_count(pmap)       
> ((pmap)->pm_stats.resident_count)
>  #define      pmap_update(pm)                 (void)(pm)
> -#define pmap_copy(dpmap,spmap,da,len,sa)
>  
>  #define      PG_PMAP_MOD             PG_PMAP0        /* modified */
>  #define      PG_PMAP_REF             PG_PMAP1        /* referenced */
> Index: sys/arch/i386/i386/pmap.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/i386/i386/pmap.c,v
> retrieving revision 1.220
> diff -u -p -r1.220 pmap.c
> --- sys/arch/i386/i386/pmap.c 30 Jan 2023 10:49:05 -0000      1.220
> +++ sys/arch/i386/i386/pmap.c 2 Apr 2023 19:23:11 -0000
> @@ -2263,17 +2263,6 @@ pmap_collect(struct pmap *pmap)
>  }
>  
>  /*
> - * pmap_copy: copy mappings from one pmap to another
> - *
> - * => optional function
> - * void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
> - */
> -
> -/*
> - * defined as macro in pmap.h
> - */
> -
> -/*
>   * pmap_enter: enter a mapping into a pmap
>   *
>   * => must be done "now" ... no lazy-evaluation
> Index: sys/arch/i386/i386/pmapae.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/i386/i386/pmapae.c,v
> retrieving revision 1.68
> diff -u -p -r1.68 pmapae.c
> --- sys/arch/i386/i386/pmapae.c       30 Jan 2023 10:49:05 -0000      1.68
> +++ sys/arch/i386/i386/pmapae.c       2 Apr 2023 19:23:11 -0000
> @@ -820,8 +820,6 @@ pmap_bootstrap_pae(void)
>   * => we should not be holding any pv_head locks (in case we are forced
>   *   to call pmap_steal_ptp())
>   * => we may need to lock pv_head's if we have to steal a PTP
> - * => just_try: true if we want a PTP, but not enough to steal one
> - *   from another pmap (e.g. during optional functions like pmap_copy)
>   */
>  
>  struct vm_page *
> @@ -1670,17 +1668,6 @@ pmap_unwire_pae(struct pmap *pmap, vaddr
>       }
>  #endif
>  }
> -
> -/*
> - * pmap_copy: copy mappings from one pmap to another
> - *
> - * => optional function
> - * void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
> - */
> -
> -/*
> - * defined as macro in pmap.h
> - */
>  
>  /*
>   * pmap_enter: enter a mapping into a pmap
> Index: sys/arch/i386/include/pmap.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/i386/include/pmap.h,v
> retrieving revision 1.92
> diff -u -p -r1.92 pmap.h
> --- sys/arch/i386/include/pmap.h      31 Jan 2023 15:18:54 -0000      1.92
> +++ sys/arch/i386/include/pmap.h      2 Apr 2023 19:23:11 -0000
> @@ -205,7 +205,6 @@ extern struct pool pmap_pv_pool;
>  
>  #define pmap_clear_modify(pg)                pmap_clear_attrs(pg, PG_M)
>  #define pmap_clear_reference(pg)     pmap_clear_attrs(pg, PG_U)
> -#define pmap_copy(DP,SP,D,L,S)
>  #define pmap_is_modified(pg)         pmap_test_attrs(pg, PG_M)
>  #define pmap_is_referenced(pg)               pmap_test_attrs(pg, PG_U)
>  #define pmap_valid_entry(E)          ((E) & PG_V) /* is PDE or PTE valid? */
> Index: sys/arch/m88k/include/pmap.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/m88k/include/pmap.h,v
> retrieving revision 1.28
> diff -u -p -r1.28 pmap.h
> --- sys/arch/m88k/include/pmap.h      12 Feb 2023 07:02:43 -0000      1.28
> +++ sys/arch/m88k/include/pmap.h      2 Apr 2023 19:23:11 -0000
> @@ -51,7 +51,6 @@ extern      apr_t           kernel_apr, userland_apr;
>  #define pmap_resident_count(pmap)    ((pmap)->pm_stats.resident_count)
>  #define      pmap_wired_count(pmap)          ((pmap)->pm_stats.wired_count)
>  
> -#define pmap_copy(dp,sp,d,l,s)               do { /* nothing */ } while (0)
>  #define pmap_update(pmap)            do { /* nothing */ } while (0)
>  
>  #define      pmap_clear_modify(pg)           pmap_unsetbit(pg, PG_M)
> Index: sys/arch/mips64/mips64/pmap.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/mips64/mips64/pmap.c,v
> retrieving revision 1.124
> diff -u -p -r1.124 pmap.c
> --- sys/arch/mips64/mips64/pmap.c     11 Jan 2023 03:19:52 -0000      1.124
> +++ sys/arch/mips64/mips64/pmap.c     2 Apr 2023 19:23:11 -0000
> @@ -1407,22 +1407,6 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
>  }
>  
>  /*
> - *   Copy the range specified by src_addr/len
> - *   from the source map to the range dst_addr/len
> - *   in the destination map.
> - *
> - *   This routine is only advisory and need not do anything.
> - */
> -void
> -pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vaddr_t dst_addr, vsize_t len,
> -    vaddr_t src_addr)
> -{
> -
> -     DPRINTF(PDB_FOLLOW,("pmap_copy(%p, %p, %p, 0x%lx, %p)\n",
> -            dst_pmap, src_pmap, (void *)dst_addr, len, (void *)src_addr));
> -}
> -
> -/*
>   *   pmap_zero_page zeros the specified (machine independent) page.
>   */
>  void
> Index: sys/arch/powerpc/include/pmap.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/powerpc/include/pmap.h,v
> retrieving revision 1.63
> diff -u -p -r1.63 pmap.h
> --- sys/arch/powerpc/include/pmap.h   31 Jan 2023 15:18:55 -0000      1.63
> +++ sys/arch/powerpc/include/pmap.h   2 Apr 2023 19:23:11 -0000
> @@ -148,7 +148,6 @@ int pmap_copyinsn(pmap_t, vaddr_t, uint3
>  void pmap_real_memory(vaddr_t *start, vsize_t *size);
>  
>  int pte_spill_v(struct pmap *pm, u_int32_t va, u_int32_t dsisr, int 
> exec_fault);
> -#define pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) ;
>  int reserve_dumppages(caddr_t p);
>  
>  #define pmap_unuse_final(p)          /* nothing */
> Index: sys/arch/powerpc64/powerpc64/pmap.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/powerpc64/powerpc64/pmap.c,v
> retrieving revision 1.59
> diff -u -p -r1.59 pmap.c
> --- sys/arch/powerpc64/powerpc64/pmap.c       25 Jan 2023 09:53:53 -0000      
> 1.59
> +++ sys/arch/powerpc64/powerpc64/pmap.c       2 Apr 2023 19:23:11 -0000
> @@ -1047,12 +1047,6 @@ pmap_init(void)
>       pmap_initialized = 1;
>  }
>  
> -void
> -pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vaddr_t dst_addr,
> -    vsize_t len, vaddr_t src_addr)
> -{
> -}
> -
>  int
>  pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
>  {
> Index: sys/arch/riscv64/riscv64/pmap.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/riscv64/riscv64/pmap.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 pmap.c
> --- sys/arch/riscv64/riscv64/pmap.c   11 Jan 2023 11:10:25 -0000      1.29
> +++ sys/arch/riscv64/riscv64/pmap.c   2 Apr 2023 19:23:11 -0000
> @@ -1862,13 +1862,6 @@ pmap_clear_reference(struct vm_page *pg)
>  }
>  
>  void
> -pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vaddr_t dst_addr,
> -     vsize_t len, vaddr_t src_addr)
> -{
> -     /* NOOP */
> -}
> -
> -void
>  pmap_unwire(pmap_t pm, vaddr_t va)
>  {
>       struct pte_desc *pted;
> Index: sys/arch/sh/include/pmap.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/sh/include/pmap.h,v
> retrieving revision 1.19
> diff -u -p -r1.19 pmap.h
> --- sys/arch/sh/include/pmap.h        8 Mar 2023 04:43:07 -0000       1.19
> +++ sys/arch/sh/include/pmap.h        2 Apr 2023 19:23:11 -0000
> @@ -65,7 +65,6 @@ void pmap_bootstrap(void);
>  #define      pmap_kernel()                   (&__pmap_kernel)
>  #define      pmap_deactivate(pmap)           do { /* nothing */ } while (0)
>  #define      pmap_update(pmap)               do { /* nothing */ } while (0)
> -#define      pmap_copy(dp,sp,d,l,s)          do { /* nothing */ } while (0)
>  #define      pmap_wired_count(pmap)          ((pmap)->pm_stats.wired_count)
>  #define      pmap_resident_count(pmap)       
> ((pmap)->pm_stats.resident_count)
>  
> Index: sys/arch/sparc64/sparc64/pmap.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/sparc64/sparc64/pmap.c,v
> retrieving revision 1.110
> diff -u -p -r1.110 pmap.c
> --- sys/arch/sparc64/sparc64/pmap.c   24 Jan 2023 07:26:34 -0000      1.110
> +++ sys/arch/sparc64/sparc64/pmap.c   2 Apr 2023 19:23:11 -0000
> @@ -1528,19 +1528,6 @@ pmap_release(struct pmap *pm)
>  }
>  
>  /*
> - * Copy the range specified by src_addr/len
> - * from the source map to the range dst_addr/len
> - * in the destination map.
> - *
> - * This routine is only advisory and need not do anything.
> - */
> -void
> -pmap_copy(struct pmap *dst_pmap, struct pmap *src_pmap, vaddr_t dst_addr,
> -    vsize_t len, vaddr_t src_addr)
> -{
> -}
> -
> -/*
>   * Garbage collects the physical map system for
>   * pages which are no longer used.
>   * Success need not be guaranteed -- that is, there
> Index: sys/uvm/uvm_map.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/uvm/uvm_map.c,v
> retrieving revision 1.313
> diff -u -p -r1.313 uvm_map.c
> --- sys/uvm/uvm_map.c 24 Feb 2023 15:17:48 -0000      1.313
> +++ sys/uvm/uvm_map.c 2 Apr 2023 19:23:11 -0000
> @@ -3716,15 +3716,6 @@ uvm_mapent_forkshared(struct vmspace *ne
>           old_entry->end - old_entry->start, 0, old_entry->protection,
>           old_entry->max_protection, old_map, old_entry, dead);
>  
> -     /*
> -      * pmap_copy the mappings: this routine is optional
> -      * but if it is there it will reduce the number of
> -      * page faults in the new proc.
> -      */
> -     if (!UVM_ET_ISHOLE(new_entry))
> -             pmap_copy(new_map->pmap, old_map->pmap, new_entry->start,
> -                 (new_entry->end - new_entry->start), new_entry->start);
> -
>       return (new_entry);
>  }
>  
> @@ -3805,8 +3796,6 @@ uvm_mapent_forkcopy(struct vmspace *new_
>                * resolve all copy-on-write faults now
>                * (note that there is nothing to do if
>                * the old mapping does not have an amap).
> -              * XXX: is it worthwhile to bother with
> -              * pmap_copy in this case?
>                */
>               if (old_entry->aref.ar_amap)
>                       amap_cow_now(new_map, new_entry);
> @@ -3821,12 +3810,7 @@ uvm_mapent_forkcopy(struct vmspace *new_
>                        * fork operation.
>                        *
>                        * if we do not write-protect the parent, then
> -                      * we must be sure to write-protect the child
> -                      * after the pmap_copy() operation.
> -                      *
> -                      * XXX: pmap_copy should have some way of telling
> -                      * us that it didn't do anything so we can avoid
> -                      * calling pmap_protect needlessly.
> +                      * we must be sure to write-protect the child.
>                        */
>                       if (!UVM_ET_ISNEEDSCOPY(old_entry)) {
>                               if (old_entry->max_protection & PROT_WRITE) {
> @@ -3854,15 +3838,6 @@ uvm_mapent_forkcopy(struct vmspace *new_
>                       else
>                               protect_child = FALSE;
>               }
> -             /*
> -              * copy the mappings
> -              * XXX: need a way to tell if this does anything
> -              */
> -             if (!UVM_ET_ISHOLE(new_entry))
> -                     pmap_copy(new_map->pmap, old_map->pmap,
> -                         new_entry->start,
> -                         (old_entry->end - old_entry->start),
> -                         old_entry->start);
>  
>               /* protect the child's mappings if necessary */
>               if (protect_child) {
> @@ -4526,13 +4501,6 @@ uvm_map_extract(struct vm_map *srcmap, v
>                   newentry->protection != PROT_NONE)
>                       newentry->protection = newentry->max_protection;
>               newentry->protection &= ~PROT_EXEC;
> -
> -             /*
> -              * Step 2: perform pmap copy.
> -              * (Doing this in the loop saves one RB traversal.)
> -              */
> -             pmap_copy(kernel_map->pmap, srcmap->pmap,
> -                 cp_start - start + dstaddr, cp_len, cp_start);
>       }
>       pmap_update(kernel_map->pmap);
>  
> Index: sys/uvm/uvm_pmap.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/uvm/uvm_pmap.h,v
> retrieving revision 1.32
> diff -u -p -r1.32 uvm_pmap.h
> --- sys/uvm/uvm_pmap.h        1 Jan 2023 19:49:18 -0000       1.32
> +++ sys/uvm/uvm_pmap.h        2 Apr 2023 19:23:11 -0000
> @@ -128,9 +128,6 @@ boolean_t  pmap_clear_reference(struct v
>  #if !defined(pmap_collect) && defined(__HAVE_PMAP_COLLECT)
>  void          pmap_collect(pmap_t);
>  #endif
> -#if !defined(pmap_copy)
> -void          pmap_copy(pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t);
> -#endif
>  #if !defined(pmap_copy_page)
>  void          pmap_copy_page(struct vm_page *, struct vm_page *);
>  #endif
> 
> 

Reply via email to