> On Jul 19, 2021, at 12:59 PM, Peter Xu <pet...@redhat.com> wrote: > > > Here vfio_user_send_recv() looks tricky to me - it releases the bql within a > memory update procedure, and IMHO it needs some serious justification on why > it > can do so. For example, what if memory layout changed when waiting for the > reply? As it can happen in parallel if without bql, afaict. >
The reason bql is dropped is usually the thread will sleep waiting for a reply from the server, and I didn't think it was a good idea to block all threads in the meantime. Most vfio-user requests result from a guest action, so just blocking the single CPU thread for the reply is good. The vfio-user code doesn’t depend on the memory layout being stable, it’s just sending the layout updates to the server. Would it be better to send memory updates asynchronously, and wait for all the replies in the commit callback? JJ