[PATCH v11 05/12] vdpa: document set_group_asid thread safety

Eugenio Pérez posted 12 patches 4 weeks, 1 day ago
There is a newer version of this series
[PATCH v11 05/12] vdpa: document set_group_asid thread safety
Posted by Eugenio Pérez 4 weeks, 1 day ago
Document that the function races with the check of DRIVER_OK.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
Requested at
https://lore.kernel.org/lkml/CACGkMEvXdV4ukZE6xhLL0sSN70G=AWVQgpRnH98Fr4btzMkK9g@mail.gmail.com/
---
 include/linux/vdpa.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
index 4cf21d6e9cfd..cd1b1f1321b9 100644
--- a/include/linux/vdpa.h
+++ b/include/linux/vdpa.h
@@ -312,7 +312,9 @@ struct vdpa_map_file {
  *				@idx: virtqueue index
  *				Returns the affinity mask
  * @set_group_asid:		Set address space identifier for a
- *				virtqueue group (optional)
+ *				virtqueue group (optional).  It's not thread
+ *				safe to call this function concurrently with
+ *				set_status.
  *				@vdev: vdpa device
  *				@group: virtqueue group
  *				@asid: address space id for this group
-- 
2.52.0

Re: [PATCH v11 05/12] vdpa: document set_group_asid thread safety
Posted by Michael S. Tsirkin 4 weeks ago
On Fri, Jan 09, 2026 at 04:24:23PM +0100, Eugenio Pérez wrote:
> Document that the function races with the check of DRIVER_OK.
> 
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
> Requested at
> https://lore.kernel.org/lkml/CACGkMEvXdV4ukZE6xhLL0sSN70G=AWVQgpRnH98Fr4btzMkK9g@mail.gmail.com/
> ---
>  include/linux/vdpa.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
> index 4cf21d6e9cfd..cd1b1f1321b9 100644
> --- a/include/linux/vdpa.h
> +++ b/include/linux/vdpa.h
> @@ -312,7 +312,9 @@ struct vdpa_map_file {
>   *				@idx: virtqueue index
>   *				Returns the affinity mask
>   * @set_group_asid:		Set address space identifier for a
> - *				virtqueue group (optional)
> + *				virtqueue group (optional).  It's not thread
> + *				safe to call this function concurrently with
> + *				set_status.

Let's be explicit about what to do.
"Caller must prevent this from being executed concurrently with
set_status"?


>   *				@vdev: vdpa device
>   *				@group: virtqueue group
>   *				@asid: address space id for this group
> -- 
> 2.52.0
Re: [PATCH v11 05/12] vdpa: document set_group_asid thread safety
Posted by Eugenio Perez Martin 3 weeks, 6 days ago
On Sun, Jan 11, 2026 at 12:48 AM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Fri, Jan 09, 2026 at 04:24:23PM +0100, Eugenio Pérez wrote:
> > Document that the function races with the check of DRIVER_OK.
> >
> > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > ---
> > Requested at
> > https://lore.kernel.org/lkml/CACGkMEvXdV4ukZE6xhLL0sSN70G=AWVQgpRnH98Fr4btzMkK9g@mail.gmail.com/
> > ---
> >  include/linux/vdpa.h | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
> > index 4cf21d6e9cfd..cd1b1f1321b9 100644
> > --- a/include/linux/vdpa.h
> > +++ b/include/linux/vdpa.h
> > @@ -312,7 +312,9 @@ struct vdpa_map_file {
> >   *                           @idx: virtqueue index
> >   *                           Returns the affinity mask
> >   * @set_group_asid:          Set address space identifier for a
> > - *                           virtqueue group (optional)
> > + *                           virtqueue group (optional).  It's not thread
> > + *                           safe to call this function concurrently with
> > + *                           set_status.
>
> Let's be explicit about what to do.
> "Caller must prevent this from being executed concurrently with
> set_status"?
>

Sure, I prefer your version too. Rewording for the next version, thanks!

>
> >   *                           @vdev: vdpa device
> >   *                           @group: virtqueue group
> >   *                           @asid: address space id for this group
> > --
> > 2.52.0
>