Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Sep 2004 13:18:06 -0400 (EDT)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        freebsd-current@freebsd.org
Subject:   witness oddity
Message-ID:  <16705.57806.550902.483858@grasshopper.cs.duke.edu>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16705.57806.550902.483858>