Re: [PATCH 1/5] s390/uvdevice: Add info IOCTL

From: Heiko Carstens
Date: Fri May 12 2023 - 08:52:07 EST


On Fri, May 12, 2023 at 11:31:49AM +0200, Steffen Eiden wrote:
> Add an IOCTL that allows userspace to find out which IOCTLs the uvdevice
> supports without trial and error.
>
> Explicitly expose the IOCTL nr for the request types.
>
> Signed-off-by: Steffen Eiden <seiden@xxxxxxxxxxxxx>
> ---
> arch/s390/include/uapi/asm/uvdevice.h | 45 +++++++++++++++-
> drivers/s390/char/uvdevice.c | 77 ++++++++++++++++++++++++---
> 2 files changed, 114 insertions(+), 8 deletions(-)
...
> +static void __init set_supp_uv_cmds(struct uvio_uvdev_info *info)
> +{
> + int i;
> +
> + for (i = 0; i < UVIO_IOCTL_NUM_IOCTLS; i++) {
> + if (ioctl_nr_to_uvc_bit[i] == -1UL)
> + continue;
> + if (!test_bit_inv(ioctl_nr_to_uvc_bit[i], uv_info.inst_calls_list))
> + continue;
> + set_bit(i, (unsigned long *)&info->supp_uv_cmds);

Just a minor thing: please use

__set_bit(i, (unsigned long *)&info->supp_uv_cmds);

set_bit() is the atomic variant which may even generate a compare and swap
loop (dependent on config options) to set bits, which is not what is needed
here. Didn't see that in previous version.
So if atomicity is not needed, please use __set_bit() instead.