Linux-HyperV List
 help / color / mirror / Atom feed
* [PATCH rdma-next] RDMA/mana_ib: Retain create CQ flags field name
@ 2026-07-31  9:10 Jiri Pirko
  2026-07-31 12:54 ` Konstantin Taranov
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Pirko @ 2026-07-31  9:10 UTC (permalink / raw)
  To: linux-rdma; +Cc: jgg, leon, kotaranov, longli, linux-hyperv

From: Jiri Pirko <jiri@nvidia.com>

Commit eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata") renamed the
"flags" field of struct mana_ib_create_cq to "comp_mask", as
ib_copy_validate_udata_in_cm() only validates a member with that name.

The layout did not change, but the field has been a part of the UAPI
since commit 44b607ad4cdf ("RDMA/mana_ib: implement uapi for creation
of rnic cq"), so the rename breaks userspace referring to it,
for example the mana provider of rdma-core assigning cmd_drv->flags.

Convert the field to a union providing both names, so that
ib_copy_validate_udata_in_cm() still finds "comp_mask" and userspace
keeps "flags", without having to add a helper for this single case.

Fixes: eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata")
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 include/uapi/rdma/mana-abi.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/uapi/rdma/mana-abi.h b/include/uapi/rdma/mana-abi.h
index 410f0ddc8c89..431c7076f20a 100644
--- a/include/uapi/rdma/mana-abi.h
+++ b/include/uapi/rdma/mana-abi.h
@@ -25,7 +25,10 @@ enum mana_ib_create_cq_flags {
 
 struct mana_ib_create_cq {
 	__aligned_u64 buf_addr;
-	__u16	comp_mask;
+	union {
+		__u16	comp_mask;
+		__u16	flags; /* the original name of the field */
+	};
 	__u16	reserved0;
 	__u32	reserved1;
 };
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH rdma-next] RDMA/mana_ib: Retain create CQ flags field name
  2026-07-31  9:10 [PATCH rdma-next] RDMA/mana_ib: Retain create CQ flags field name Jiri Pirko
@ 2026-07-31 12:54 ` Konstantin Taranov
  2026-08-03 11:59   ` Jiri Pirko
  0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Taranov @ 2026-07-31 12:54 UTC (permalink / raw)
  To: Jiri Pirko, linux-rdma@vger.kernel.org
  Cc: jgg@ziepe.ca, leon@kernel.org, Long Li,
	linux-hyperv@vger.kernel.org

> From: Jiri Pirko <jiri@nvidia.com>
> 
> Commit eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata") renamed the
> "flags" field of struct mana_ib_create_cq to "comp_mask", as
> ib_copy_validate_udata_in_cm() only validates a member with that name.
> 
> The layout did not change, but the field has been a part of the UAPI since
> commit 44b607ad4cdf ("RDMA/mana_ib: implement uapi for creation of rnic
> cq"), so the rename breaks userspace referring to it, for example the mana
> provider of rdma-core assigning cmd_drv->flags.
> 
> Convert the field to a union providing both names, so that
> ib_copy_validate_udata_in_cm() still finds "comp_mask" and userspace keeps
> "flags", without having to add a helper for this single case.
> 

Thanks for the patch, but my understanding that it is a common practice to rename the fields,
and kernels headers should not accumulate historical names. 
I also faced a similar problem from renames in other providers, when I needed a new kernel header in rdma-core.
If this breaks your rdma-core in a PR, just remove the field rename in kernel update commit as that header update commit is not getting merged anyway from your PR.
My understanding that maintainers of RDMA-core will merge the kernel header update, and will bring this change from my PR:
https://github.com/linux-rdma/rdma-core/pull/1765/commits/0dcadd9316f1b98e21973e3a6e0f96186d49bd5a

- Konstantin

> Fixes: eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata")
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> ---
>  include/uapi/rdma/mana-abi.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/rdma/mana-abi.h b/include/uapi/rdma/mana-abi.h
> index 410f0ddc8c89..431c7076f20a 100644
> --- a/include/uapi/rdma/mana-abi.h
> +++ b/include/uapi/rdma/mana-abi.h
> @@ -25,7 +25,10 @@ enum mana_ib_create_cq_flags {
> 
>  struct mana_ib_create_cq {
>  	__aligned_u64 buf_addr;
> -	__u16	comp_mask;
> +	union {
> +		__u16	comp_mask;
> +		__u16	flags; /* the original name of the field */
> +	};
>  	__u16	reserved0;
>  	__u32	reserved1;
>  };
> --
> 2.54.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma-next] RDMA/mana_ib: Retain create CQ flags field name
  2026-07-31 12:54 ` Konstantin Taranov
@ 2026-08-03 11:59   ` Jiri Pirko
  2026-08-03 13:28     ` Leon Romanovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Pirko @ 2026-08-03 11:59 UTC (permalink / raw)
  To: Konstantin Taranov
  Cc: linux-rdma@vger.kernel.org, jgg@ziepe.ca, leon@kernel.org,
	Long Li, linux-hyperv@vger.kernel.org

Fri, Jul 31, 2026 at 02:54:31PM +0200, kotaranov@microsoft.com wrote:
>> From: Jiri Pirko <jiri@nvidia.com>
>> 
>> Commit eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata") renamed the
>> "flags" field of struct mana_ib_create_cq to "comp_mask", as
>> ib_copy_validate_udata_in_cm() only validates a member with that name.
>> 
>> The layout did not change, but the field has been a part of the UAPI since
>> commit 44b607ad4cdf ("RDMA/mana_ib: implement uapi for creation of rnic
>> cq"), so the rename breaks userspace referring to it, for example the mana
>> provider of rdma-core assigning cmd_drv->flags.
>> 
>> Convert the field to a union providing both names, so that
>> ib_copy_validate_udata_in_cm() still finds "comp_mask" and userspace keeps
>> "flags", without having to add a helper for this single case.
>> 
>
>Thanks for the patch, but my understanding that it is a common practice to rename the fields,
>and kernels headers should not accumulate historical names. 

That is not doable in UAPI. Some userspace app, like rdma-core in
this case, might use it and rename breaks the compilation. Some other
app you don't know about may use it.


>I also faced a similar problem from renames in other providers, when I needed a new kernel header in rdma-core.
>If this breaks your rdma-core in a PR, just remove the field rename in kernel update commit as that header update commit is not getting merged anyway from your PR.
>My understanding that maintainers of RDMA-core will merge the kernel header update, and will bring this change from my PR:
>https://github.com/linux-rdma/rdma-core/pull/1765/commits/0dcadd9316f1b98e21973e3a6e0f96186d49bd5a

this is not how UAPI can be changed :/ It simply can't be changed.


>
>- Konstantin
>
>> Fixes: eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata")
>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> ---
>>  include/uapi/rdma/mana-abi.h | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/include/uapi/rdma/mana-abi.h b/include/uapi/rdma/mana-abi.h
>> index 410f0ddc8c89..431c7076f20a 100644
>> --- a/include/uapi/rdma/mana-abi.h
>> +++ b/include/uapi/rdma/mana-abi.h
>> @@ -25,7 +25,10 @@ enum mana_ib_create_cq_flags {
>> 
>>  struct mana_ib_create_cq {
>>  	__aligned_u64 buf_addr;
>> -	__u16	comp_mask;
>> +	union {
>> +		__u16	comp_mask;
>> +		__u16	flags; /* the original name of the field */
>> +	};
>>  	__u16	reserved0;
>>  	__u32	reserved1;
>>  };
>> --
>> 2.54.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma-next] RDMA/mana_ib: Retain create CQ flags field name
  2026-08-03 11:59   ` Jiri Pirko
@ 2026-08-03 13:28     ` Leon Romanovsky
  2026-08-04 11:08       ` Jiri Pirko
  0 siblings, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2026-08-03 13:28 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: Konstantin Taranov, linux-rdma@vger.kernel.org, jgg@ziepe.ca,
	Long Li, linux-hyperv@vger.kernel.org

On Mon, Aug 03, 2026 at 01:59:07PM +0200, Jiri Pirko wrote:
> Fri, Jul 31, 2026 at 02:54:31PM +0200, kotaranov@microsoft.com wrote:
> >> From: Jiri Pirko <jiri@nvidia.com>
> >> 
> >> Commit eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata") renamed the
> >> "flags" field of struct mana_ib_create_cq to "comp_mask", as
> >> ib_copy_validate_udata_in_cm() only validates a member with that name.
> >> 
> >> The layout did not change, but the field has been a part of the UAPI since
> >> commit 44b607ad4cdf ("RDMA/mana_ib: implement uapi for creation of rnic
> >> cq"), so the rename breaks userspace referring to it, for example the mana
> >> provider of rdma-core assigning cmd_drv->flags.
> >> 
> >> Convert the field to a union providing both names, so that
> >> ib_copy_validate_udata_in_cm() still finds "comp_mask" and userspace keeps
> >> "flags", without having to add a helper for this single case.
> >> 
> >
> >Thanks for the patch, but my understanding that it is a common practice to rename the fields,
> >and kernels headers should not accumulate historical names. 
> 
> That is not doable in UAPI.

There are multiple levels of UAPI contracts. In RDMA, we guarantee
binary compatibility because userspace (rdma-core) is effectively the
second half of the RDMA driver stack. These drivers do not exist
without rdma-core.

As such, this is exactly how the RDMA UAPI is intended to work.


> Some userspace app, like rdma-core in this case, might use it and rename breaks the compilation. Some other
> app you don't know about may use it.

rdma-core does not use these headers directly. Instead, it vendors
them in the kernel-headers directories specifically for this purpose.

> 
> 
> >I also faced a similar problem from renames in other providers, when I needed a new kernel header in rdma-core.
> >If this breaks your rdma-core in a PR, just remove the field rename in kernel update commit as that header update commit is not getting merged anyway from your PR.
> >My understanding that maintainers of RDMA-core will merge the kernel header update, and will bring this change from my PR:
> >https://github.com/linux-rdma/rdma-core/pull/1765/commits/0dcadd9316f1b98e21973e3a6e0f96186d49bd5a
> 
> this is not how UAPI can be changed :/ It simply can't be changed.

It can, at least in RDMA and elsewhere in the kernel, where user
access is provided through properly designed libraries.

Thanks

> 
> 
> >
> >- Konstantin
> >
> >> Fixes: eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata")
> >> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> >> ---
> >>  include/uapi/rdma/mana-abi.h | 5 ++++-
> >>  1 file changed, 4 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/include/uapi/rdma/mana-abi.h b/include/uapi/rdma/mana-abi.h
> >> index 410f0ddc8c89..431c7076f20a 100644
> >> --- a/include/uapi/rdma/mana-abi.h
> >> +++ b/include/uapi/rdma/mana-abi.h
> >> @@ -25,7 +25,10 @@ enum mana_ib_create_cq_flags {
> >> 
> >>  struct mana_ib_create_cq {
> >>  	__aligned_u64 buf_addr;
> >> -	__u16	comp_mask;
> >> +	union {
> >> +		__u16	comp_mask;
> >> +		__u16	flags; /* the original name of the field */
> >> +	};
> >>  	__u16	reserved0;
> >>  	__u32	reserved1;
> >>  };
> >> --
> >> 2.54.0
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma-next] RDMA/mana_ib: Retain create CQ flags field name
  2026-08-03 13:28     ` Leon Romanovsky
@ 2026-08-04 11:08       ` Jiri Pirko
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2026-08-04 11:08 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Konstantin Taranov, linux-rdma@vger.kernel.org, jgg@ziepe.ca,
	Long Li, linux-hyperv@vger.kernel.org

Mon, Aug 03, 2026 at 03:28:44PM +0200, leon@kernel.org wrote:
>On Mon, Aug 03, 2026 at 01:59:07PM +0200, Jiri Pirko wrote:
>> Fri, Jul 31, 2026 at 02:54:31PM +0200, kotaranov@microsoft.com wrote:
>> >> From: Jiri Pirko <jiri@nvidia.com>
>> >> 
>> >> Commit eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata") renamed the
>> >> "flags" field of struct mana_ib_create_cq to "comp_mask", as
>> >> ib_copy_validate_udata_in_cm() only validates a member with that name.
>> >> 
>> >> The layout did not change, but the field has been a part of the UAPI since
>> >> commit 44b607ad4cdf ("RDMA/mana_ib: implement uapi for creation of rnic
>> >> cq"), so the rename breaks userspace referring to it, for example the mana
>> >> provider of rdma-core assigning cmd_drv->flags.
>> >> 
>> >> Convert the field to a union providing both names, so that
>> >> ib_copy_validate_udata_in_cm() still finds "comp_mask" and userspace keeps
>> >> "flags", without having to add a helper for this single case.
>> >> 
>> >
>> >Thanks for the patch, but my understanding that it is a common practice to rename the fields,
>> >and kernels headers should not accumulate historical names. 
>> 
>> That is not doable in UAPI.
>
>There are multiple levels of UAPI contracts. In RDMA, we guarantee
>binary compatibility because userspace (rdma-core) is effectively the
>second half of the RDMA driver stack. These drivers do not exist
>without rdma-core.
>
>As such, this is exactly how the RDMA UAPI is intended to work.

That is some odd UAPI...


>
>
>> Some userspace app, like rdma-core in this case, might use it and rename breaks the compilation. Some other
>> app you don't know about may use it.
>
>rdma-core does not use these headers directly. Instead, it vendors
>them in the kernel-headers directories specifically for this purpose.
>
>> 
>> 
>> >I also faced a similar problem from renames in other providers, when I needed a new kernel header in rdma-core.
>> >If this breaks your rdma-core in a PR, just remove the field rename in kernel update commit as that header update commit is not getting merged anyway from your PR.
>> >My understanding that maintainers of RDMA-core will merge the kernel header update, and will bring this change from my PR:
>> >https://github.com/linux-rdma/rdma-core/pull/1765/commits/0dcadd9316f1b98e21973e3a6e0f96186d49bd5a
>> 
>> this is not how UAPI can be changed :/ It simply can't be changed.
>
>It can, at least in RDMA and elsewhere in the kernel, where user
>access is provided through properly designed libraries.

Ehm, up to you. Very loose.


>
>Thanks
>
>> 
>> 
>> >
>> >- Konstantin
>> >
>> >> Fixes: eb70d83a8645 ("RDMA/mana_ib: Adopt robust udata")
>> >> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> >> ---
>> >>  include/uapi/rdma/mana-abi.h | 5 ++++-
>> >>  1 file changed, 4 insertions(+), 1 deletion(-)
>> >> 
>> >> diff --git a/include/uapi/rdma/mana-abi.h b/include/uapi/rdma/mana-abi.h
>> >> index 410f0ddc8c89..431c7076f20a 100644
>> >> --- a/include/uapi/rdma/mana-abi.h
>> >> +++ b/include/uapi/rdma/mana-abi.h
>> >> @@ -25,7 +25,10 @@ enum mana_ib_create_cq_flags {
>> >> 
>> >>  struct mana_ib_create_cq {
>> >>  	__aligned_u64 buf_addr;
>> >> -	__u16	comp_mask;
>> >> +	union {
>> >> +		__u16	comp_mask;
>> >> +		__u16	flags; /* the original name of the field */
>> >> +	};
>> >>  	__u16	reserved0;
>> >>  	__u32	reserved1;
>> >>  };
>> >> --
>> >> 2.54.0
>> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-04 11:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31  9:10 [PATCH rdma-next] RDMA/mana_ib: Retain create CQ flags field name Jiri Pirko
2026-07-31 12:54 ` Konstantin Taranov
2026-08-03 11:59   ` Jiri Pirko
2026-08-03 13:28     ` Leon Romanovsky
2026-08-04 11:08       ` Jiri Pirko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox