I have committed my first attempt in

        platform/pc32/i386/pmap.c

    Basically the rules I followed were:

        * Add (MPSAFE) in the comment at the top of the file, so each
          individual routine does not have to be tagged MPSAFE.

        * Cleaned up the comments on each routine and added comments
          indicating requirements (kinda optional but I was being careful).

        * Nearly all global procedures acquire and release the vm_token,
          while nearly all static procedures assume the vm_token is being
          held by the caller.

    The whole mess should be safe until we get the entire system locked up
    this way, because these tokens are only held along with the MP lock
    so by definition since the MP lock is already held (since we haven't
    removed it yet), all our token calls will be non-blocking until we are
    ready to remove the MP lock.

    This way non-blocking assumptions between major subsystems remain intact
    until we can do another pass to locate and deal with them.  We can do
    an entire first-pass on all system files, acquiring and releasing the
    necessary tokens, without destabilizing master.

    I need volunteers to make the same adjustments to the other three
    architectural pmap.c files.  Any takers?  It takes about 2 hours to
    do one file.

    System sources that need to be locked up with vm_token (for now):

        platform/pc32/i386/pmap.c               dillon
        platform/pc64/x86_64/pmap.c             avail
        platform/vkernel/platform/pmap.c        avail
        platform/vkernel64/platform/pmap.c      avail
        vm/vm_contig.c                          avail
        vm/vm_fault.c                           avail
        vm/vm_glue.c                            avail
        vm/vm_init.c                            avail
        vm/vm_kern.c                            avail
        vm/vm_map.c                             avail
        vm/vm_meter.c                           avail
        vm/vm_mmap.c                            avail
        vm/vm_object.c                          avail
        vm/vm_page.c                            avail
        vm/vm_pageout.c                         avail
        vm/vm_pager.c                           avail
        vm/vm_rangelock.c                       avail
        vm/vm_swap.c                            avail
        vm/vm_swapcache.c                       avail
        vm/vm_unix.c                            avail
        vm/vm_vmspace.c                         avail
        vm/vm_zeroidle.c                        avail
        vm/vm_zone.c                            avail

    Even though we will eventually go to more fine-grained locks I think
    we really want to get the whole system converted to coarse-grained tokens
    first, make sure it is all stable, remove the MP lock, and then continue
    on from there.

                                                -Matt

Reply via email to