witness oddity

Andrew Gallatin gallatin at cs.duke.edu
Fri Sep 10 10:18:12 PDT 2004


I'm trying to figure out what witness is complaining about in my (out
of tree) driver code:

lock order reversal
 1st 0xe672baf0 MX foo mutex (MX foo mutex) @ /home/gallatin/mx/tiki/driver/freebsd/../common/mx_common.c:80
 2nd 0xc1c6f878 user map (user map) @ vm/vm_map.c:2994



If I call copyout() holding one of my mutexes, it will always complain
about a LOR, even if the mutex is freshly initiated:

  {
    struct mtx foo;

    bzero(&foo, sizeof(foo));
    mtx_init(&foo, "MX foo mutex", NULL, MTX_DEF);
    mtx_lock(&foo);
    /* hacky copyout which should trigger vm_fault() */
    mx_copyout(&status, 1, 4);
    mtx_unlock(&foo);
    mtx_destroy(&foo);
  }


Is this happening because the vm_map "user map" is an sx lock?

Does this imply that you can't acquire an sx lock while holding a mutex?

Thanks,

Drew


More information about the freebsd-current mailing list