| Message ID | 20261105111749.2361913-1-den@openvz.org |
|---|---|
| State | New |
| Headers | show |
| Series | [v2] migration/cpr: document the BQL as the cpr fd table lock | expand |
On 5.11.2026 12:17, Denis V. Lunev wrote: > From: Denis V. Lunev <den@openvz.org> > > Every user of the cpr fd table runs under the BQL: device realize and > unrealize, backend creation, RAM block allocation and freeing (the > latter also from RCU callbacks, which take the BQL), vfio MSI-X vector > setup from vCPU threads, and the cpr state save, load and cpr-exec walk > on the main thread. The table has no lock of its own and depends on > that, but nothing says so. > > Say it at the declarations. The obvious way to break it is a socket > chardev preserved across CPR: its connection hooks run in the chardev's > GMainContext, which for the monitor is the QMP iothread, and that thread > must not take the BQL or out-of-band commands stop working. Such a user > needs the table to grow a lock of its own, and has to keep the saved > table and the preserved fds in agreement when a connection comes or goes > during cpr-exec. Both belong with the series that adds it. > > Signed-off-by: Denis V. Lunev <den@openvz.org> > Cc: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> > Cc: Peter Xu <peterx@redhat.com> > Cc: Fabiano Rosas <farosas@suse.de> > Cc: Mark Kanda <mark.kanda@oracle.com> > Cc: Ben Chaney <bchaney@akamai.com> > Cc: Steve Sistare <steven.sistare@oracle.com> > --- > v2: replace the lock with a comment, as discussed on v1: > https://lore.kernel.org/qemu-devel/20260916132428.1628553-1-den@openvz.org/ > > include/migration/cpr.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/include/migration/cpr.h b/include/migration/cpr.h > index 3ad084d5ba..5ac46b6207 100644 > --- a/include/migration/cpr.h > +++ b/include/migration/cpr.h > @@ -28,6 +28,7 @@ typedef struct CprState { > > extern CprState cpr_state; > > +/* The cpr fd table, including cpr_walk_fd(), is protected by the BQL. */ > bool cpr_save_fd(const char *name, int id, int fd, Error **errp); > void cpr_delete_fd(const char *name, int id); > int cpr_find_fd(const char *name, int id); > > base-commit: f29ccc287a6cfdd51d3a4fd17fbe9af3310a0ac5 Acked-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Thanks, Maciej
diff --git a/include/migration/cpr.h b/include/migration/cpr.h index 3ad084d5ba..5ac46b6207 100644 --- a/include/migration/cpr.h +++ b/include/migration/cpr.h @@ -28,6 +28,7 @@ typedef struct CprState { extern CprState cpr_state; +/* The cpr fd table, including cpr_walk_fd(), is protected by the BQL. */ bool cpr_save_fd(const char *name, int id, int fd, Error **errp); void cpr_delete_fd(const char *name, int id); int cpr_find_fd(const char *name, int id);