[PATCH v3] vhost: enhance virtqueue access lock asserts
Stephen Hemminger
stephen at networkplumber.org
Mon Feb 26 21:56:47 CET 2024
On Mon, 26 Feb 2024 20:40:57 +0100
Maxime Coquelin <maxime.coquelin at redhat.com> wrote:
> > +
> > +/* vhost_user_msg_handler() locks all qps based on a handler's lock_all_qps.
> > + * Later, a handler may need to ensure the vq has been locked (for example,
> > + * when calling lock annotated helpers).
> > + *
> > + * Note: unfortunately, static_assert() does not see an array content as a
> > + * constant expression. Because of this, we can't simply check for
> > + * vhost_user_msg_handler[].lock_all_qps.
> > + * Instead, define an enum for each handler.
> > + */
> > +#define VHOST_USER_ASSERT_LOCK(dev, vq, id) do { \
> > + RTE_BUILD_BUG_ON(id ## _LOCK_ALL_QPS == false); \
Rather than the opaque output of RTE_BUILD_BUG_ON, please use
static_assert() directly.
More information about the dev
mailing list