Il 27/06/2013 04:08, liu ping fan ha scritto: >> > qdev_free is triggered by the guest, but free is a misnomer. It is >> > really "make it inaccessible from the guest and management" (the kernel >> > equivalent would be removal of /dev and /sys entries, for example). The >> > actual "free" will happen later. > > Without seeing your detail design, but I suggest that leaving the > "exit" as it is, and pick out the inaccessible related code to > removal.
We already have a reclamation point, it is instance_finalize. I posted a series a few weeks ago ("[PATCH 00/39] Delay destruction of memory regions to instance_finalize"). > Finally, when refcnt->0, exit is called, and it play as the > final sync point for the remaining access. It is the guest that determines when to start the removal phase. That's qdev_free. refcnt = 0 means that the memory is inaccessible to the guest, and that's when the reclamation phase is started (asynchronously: the instance_finalize callback is actually called at the end of the RCU grace period). Paolo