Re: [PATCH v2] io_uring: add support for probing opcodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jens Axboe <axboe@xxxxxxxxx> writes:

> The application currently has no way of knowing if a given opcode is
> supported or not without having to try and issue one and see if we get
> -EINVAL or not. And even this approach is fraught with peril, as maybe
> we're getting -EINVAL due to some fields being missing, or maybe it's
> just not that easy to issue that particular command without doing some
> other leg work in terms of setup first.
>
> This adds IORING_REGISTER_PROBE, which fills in a structure with info
> on what it supported or not. This will work even with sparse opcode
> fields, which may happen in the future or even today if someone
> backports specific features to older kernels.

This looks pretty good to me.  You can call it with 0 args to get the
total number of ops, then allocate an array with that number and
re-issue the syscall.  I also like that you've allowed for backporting
subsets of functionality.

I have one question below:

> @@ -6632,6 +6674,12 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
>  			break;
>  		ret = io_eventfd_unregister(ctx);
>  		break;
> +	case IORING_REGISTER_PROBE:
> +		ret = -EINVAL;
> +		if (!arg || nr_args > 256)
> +			break;
> +		ret = io_probe(ctx, arg, nr_args);
> +		break;

Why 256?  If it's just arbitrary, please add a comment.

Otherwise looks good!

Reviewed-by: Jeff Moyer <jmoyer@xxxxxxxxxx>




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux