Skip to content

Commit 57f3322

Browse files
isilenceaxboe
authored andcommitted
io_uring/notif: remove notif registration
We're going to remove the userspace exposed zerocopy notification API, remove notification registration. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/6ff00b97be99869c386958a990593c9c31cf105b.1662027856.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent d9808ce commit 57f3322

File tree

5 files changed

+1
-103
lines changed

5 files changed

+1
-103
lines changed

include/uapi/linux/io_uring.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,10 @@ enum io_uring_op {
279279
*
280280
* IORING_RECVSEND_FIXED_BUF Use registered buffers, the index is stored in
281281
* the buf_index field.
282-
*
283-
* IORING_RECVSEND_NOTIF_FLUSH Flush a notification after a successful
284-
* successful. Only for zerocopy sends.
285282
*/
286283
#define IORING_RECVSEND_POLL_FIRST (1U << 0)
287284
#define IORING_RECV_MULTISHOT (1U << 1)
288285
#define IORING_RECVSEND_FIXED_BUF (1U << 2)
289-
#define IORING_RECVSEND_NOTIF_FLUSH (1U << 3)
290286

291287
/*
292288
* accept flags stored in sqe->ioprio
@@ -474,10 +470,6 @@ enum {
474470
/* register a range of fixed file slots for automatic slot allocation */
475471
IORING_REGISTER_FILE_ALLOC_RANGE = 25,
476472

477-
/* zerocopy notification API */
478-
IORING_REGISTER_NOTIFIERS = 26,
479-
IORING_UNREGISTER_NOTIFIERS = 27,
480-
481473
/* this goes last */
482474
IORING_REGISTER_LAST
483475
};

io_uring/io_uring.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,6 @@ static __cold void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
26402640
io_unregister_personality(ctx, index);
26412641
if (ctx->rings)
26422642
io_poll_remove_all(ctx, NULL, true);
2643-
io_notif_unregister(ctx);
26442643
mutex_unlock(&ctx->uring_lock);
26452644

26462645
/* failed during ring init, it couldn't have issued any requests */
@@ -3839,15 +3838,6 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
38393838
break;
38403839
ret = io_register_file_alloc_range(ctx, arg);
38413840
break;
3842-
case IORING_REGISTER_NOTIFIERS:
3843-
ret = io_notif_register(ctx, arg, nr_args);
3844-
break;
3845-
case IORING_UNREGISTER_NOTIFIERS:
3846-
ret = -EINVAL;
3847-
if (arg || nr_args)
3848-
break;
3849-
ret = io_notif_unregister(ctx);
3850-
break;
38513841
default:
38523842
ret = -EINVAL;
38533843
break;

io_uring/net.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
889889

890890
zc->flags = READ_ONCE(sqe->ioprio);
891891
if (zc->flags & ~(IORING_RECVSEND_POLL_FIRST |
892-
IORING_RECVSEND_FIXED_BUF | IORING_RECVSEND_NOTIF_FLUSH))
892+
IORING_RECVSEND_FIXED_BUF))
893893
return -EINVAL;
894894
if (zc->flags & IORING_RECVSEND_FIXED_BUF) {
895895
unsigned idx = READ_ONCE(sqe->buf_index);
@@ -1063,8 +1063,6 @@ int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
10631063
if (ret == -ERESTARTSYS)
10641064
ret = -EINTR;
10651065
req_set_fail(req);
1066-
} else if (zc->flags & IORING_RECVSEND_NOTIF_FLUSH) {
1067-
io_notif_slot_flush_submit(notif_slot, 0);
10681066
}
10691067

10701068
if (ret >= 0)

io_uring/notif.c

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -86,74 +86,3 @@ void io_notif_slot_flush(struct io_notif_slot *slot)
8686
io_req_task_work_add(notif);
8787
}
8888
}
89-
90-
__cold int io_notif_unregister(struct io_ring_ctx *ctx)
91-
__must_hold(&ctx->uring_lock)
92-
{
93-
int i;
94-
95-
if (!ctx->notif_slots)
96-
return -ENXIO;
97-
98-
for (i = 0; i < ctx->nr_notif_slots; i++) {
99-
struct io_notif_slot *slot = &ctx->notif_slots[i];
100-
struct io_kiocb *notif = slot->notif;
101-
struct io_notif_data *nd;
102-
103-
if (!notif)
104-
continue;
105-
nd = io_notif_to_data(notif);
106-
slot->notif = NULL;
107-
if (!refcount_dec_and_test(&nd->uarg.refcnt))
108-
continue;
109-
notif->io_task_work.func = __io_notif_complete_tw;
110-
io_req_task_work_add(notif);
111-
}
112-
113-
kvfree(ctx->notif_slots);
114-
ctx->notif_slots = NULL;
115-
ctx->nr_notif_slots = 0;
116-
return 0;
117-
}
118-
119-
__cold int io_notif_register(struct io_ring_ctx *ctx,
120-
void __user *arg, unsigned int size)
121-
__must_hold(&ctx->uring_lock)
122-
{
123-
struct io_uring_notification_slot __user *slots;
124-
struct io_uring_notification_slot slot;
125-
struct io_uring_notification_register reg;
126-
unsigned i;
127-
128-
if (ctx->nr_notif_slots)
129-
return -EBUSY;
130-
if (size != sizeof(reg))
131-
return -EINVAL;
132-
if (copy_from_user(&reg, arg, sizeof(reg)))
133-
return -EFAULT;
134-
if (!reg.nr_slots || reg.nr_slots > IORING_MAX_NOTIF_SLOTS)
135-
return -EINVAL;
136-
if (reg.resv || reg.resv2 || reg.resv3)
137-
return -EINVAL;
138-
139-
slots = u64_to_user_ptr(reg.data);
140-
ctx->notif_slots = kvcalloc(reg.nr_slots, sizeof(ctx->notif_slots[0]),
141-
GFP_KERNEL_ACCOUNT);
142-
if (!ctx->notif_slots)
143-
return -ENOMEM;
144-
145-
for (i = 0; i < reg.nr_slots; i++, ctx->nr_notif_slots++) {
146-
struct io_notif_slot *notif_slot = &ctx->notif_slots[i];
147-
148-
if (copy_from_user(&slot, &slots[i], sizeof(slot))) {
149-
io_notif_unregister(ctx);
150-
return -EFAULT;
151-
}
152-
if (slot.resv[0] | slot.resv[1] | slot.resv[2]) {
153-
io_notif_unregister(ctx);
154-
return -EINVAL;
155-
}
156-
notif_slot->tag = slot.tag;
157-
}
158-
return 0;
159-
}

io_uring/notif.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "rsrc.h"
99

1010
#define IO_NOTIF_SPLICE_BATCH 32
11-
#define IORING_MAX_NOTIF_SLOTS (1U << 15)
1211

1312
struct io_notif_data {
1413
struct file *file;
@@ -36,10 +35,6 @@ struct io_notif_slot {
3635
u32 seq;
3736
};
3837

39-
int io_notif_register(struct io_ring_ctx *ctx,
40-
void __user *arg, unsigned int size);
41-
int io_notif_unregister(struct io_ring_ctx *ctx);
42-
4338
void io_notif_slot_flush(struct io_notif_slot *slot);
4439
struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx,
4540
struct io_notif_slot *slot);
@@ -67,12 +62,6 @@ static inline struct io_notif_slot *io_get_notif_slot(struct io_ring_ctx *ctx,
6762
return &ctx->notif_slots[idx];
6863
}
6964

70-
static inline void io_notif_slot_flush_submit(struct io_notif_slot *slot,
71-
unsigned int issue_flags)
72-
{
73-
io_notif_slot_flush(slot);
74-
}
75-
7665
static inline int io_notif_account_mem(struct io_kiocb *notif, unsigned len)
7766
{
7867
struct io_ring_ctx *ctx = notif->ctx;

0 commit comments

Comments
 (0)