Skip to content

Commit ecb8490

Browse files
committed
Merge branch 'io_uring-6.18' into for-6.19/io_uring
Merge 6.18-rc io_uring fixes, as certain coming changes depend on some of these. * io_uring-6.18: io_uring/rsrc: don't use blk_rq_nr_phys_segments() as number of bvecs io_uring/query: return number of available queries io_uring/rw: ensure allocated iovec gets cleared for early failure io_uring: fix regbuf vector size truncation io_uring: fix types for region size calulation io_uring/zcrx: remove sync refill uapi io_uring: fix buffer auto-commit for multishot uring_cmd io_uring: correct __must_hold annotation in io_install_fixed_file io_uring zcrx: add MAINTAINERS entry io_uring: Fix code indentation error io_uring/sqpoll: be smarter on when to update the stime usage io_uring/sqpoll: switch away from getrusage() for CPU accounting io_uring: fix incorrect unlikely() usage in io_waitid_prep() Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 parents 712fbe9 + 2d0e88f commit ecb8490

17 files changed

Lines changed: 111 additions & 138 deletions

File tree

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13111,6 +13111,15 @@ F: include/uapi/linux/io_uring.h
1311113111
F: include/uapi/linux/io_uring/
1311213112
F: io_uring/
1311313113

13114+
IO_URING ZCRX
13115+
M: Pavel Begunkov <asml.silence@gmail.com>
13116+
L: io-uring@vger.kernel.org
13117+
L: netdev@vger.kernel.org
13118+
T: git https://github.com/isilence/linux.git zcrx/for-next
13119+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git
13120+
S: Maintained
13121+
F: io_uring/zcrx.*
13122+
1311413123
IPMI SUBSYSTEM
1311513124
M: Corey Minyard <corey@minyard.net>
1311613125
L: openipmi-developer@lists.sourceforge.net (moderated for non-subscribers)

include/uapi/linux/io_uring.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,6 @@ enum io_uring_register_op {
697697
/* query various aspects of io_uring, see linux/io_uring/query.h */
698698
IORING_REGISTER_QUERY = 35,
699699

700-
/* return zcrx buffers back into circulation */
701-
IORING_REGISTER_ZCRX_REFILL = 36,
702-
703700
/* this goes last */
704701
IORING_REGISTER_LAST,
705702

@@ -1081,15 +1078,6 @@ struct io_uring_zcrx_ifq_reg {
10811078
__u64 __resv[3];
10821079
};
10831080

1084-
struct io_uring_zcrx_sync_refill {
1085-
__u32 zcrx_id;
1086-
/* the number of entries to return */
1087-
__u32 nr_entries;
1088-
/* pointer to an array of struct io_uring_zcrx_rqe */
1089-
__u64 rqes;
1090-
__u64 __resv[2];
1091-
};
1092-
10931081
#ifdef __cplusplus
10941082
}
10951083
#endif

include/uapi/linux/io_uring/query.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ struct io_uring_query_opcode {
3636
__u64 enter_flags;
3737
/* Bitmask of all supported IOSQE_* flags */
3838
__u64 sqe_flags;
39+
/* The number of available query opcodes */
40+
__u32 nr_query_opcodes;
41+
__u32 __pad;
3942
};
4043

4144
#endif

io_uring/fdinfo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
6161
{
6262
struct io_overflow_cqe *ocqe;
6363
struct io_rings *r = ctx->rings;
64-
struct rusage sq_usage;
6564
unsigned int sq_mask = ctx->sq_entries - 1, cq_mask = ctx->cq_entries - 1;
6665
unsigned int sq_head = READ_ONCE(r->sq.head);
6766
unsigned int sq_tail = READ_ONCE(r->sq.tail);
@@ -179,14 +178,15 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
179178
* thread termination.
180179
*/
181180
if (tsk) {
181+
u64 usec;
182+
182183
get_task_struct(tsk);
183184
rcu_read_unlock();
184-
getrusage(tsk, RUSAGE_SELF, &sq_usage);
185+
usec = io_sq_cpu_usec(tsk);
185186
put_task_struct(tsk);
186187
sq_pid = sq->task_pid;
187188
sq_cpu = sq->sq_cpu;
188-
sq_total_time = (sq_usage.ru_stime.tv_sec * 1000000
189-
+ sq_usage.ru_stime.tv_usec);
189+
sq_total_time = usec;
190190
sq_work_time = sq->work_time;
191191
} else {
192192
rcu_read_unlock();

io_uring/filetable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void io_free_file_tables(struct io_ring_ctx *ctx, struct io_file_table *table)
5757

5858
static int io_install_fixed_file(struct io_ring_ctx *ctx, struct file *file,
5959
u32 slot_index)
60-
__must_hold(&req->ctx->uring_lock)
60+
__must_hold(&ctx->uring_lock)
6161
{
6262
struct io_rsrc_node *node;
6363

io_uring/io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ static inline struct io_cqe io_init_cqe(u64 user_data, s32 res, u32 cflags)
846846
}
847847

848848
static __cold void io_cqe_overflow(struct io_ring_ctx *ctx, struct io_cqe *cqe,
849-
struct io_big_cqe *big_cqe)
849+
struct io_big_cqe *big_cqe)
850850
{
851851
struct io_overflow_cqe *ocqe;
852852

io_uring/kbuf.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,27 @@ static int io_provided_buffers_select(struct io_kiocb *req, size_t *len,
155155
return 1;
156156
}
157157

158+
static bool io_should_commit(struct io_kiocb *req, unsigned int issue_flags)
159+
{
160+
/*
161+
* If we came in unlocked, we have no choice but to consume the
162+
* buffer here, otherwise nothing ensures that the buffer won't
163+
* get used by others. This does mean it'll be pinned until the
164+
* IO completes, coming in unlocked means we're being called from
165+
* io-wq context and there may be further retries in async hybrid
166+
* mode. For the locked case, the caller must call commit when
167+
* the transfer completes (or if we get -EAGAIN and must poll of
168+
* retry).
169+
*/
170+
if (issue_flags & IO_URING_F_UNLOCKED)
171+
return true;
172+
173+
/* uring_cmd commits kbuf upfront, no need to auto-commit */
174+
if (!io_file_can_poll(req) && req->opcode != IORING_OP_URING_CMD)
175+
return true;
176+
return false;
177+
}
178+
158179
static struct io_br_sel io_ring_buffer_select(struct io_kiocb *req, size_t *len,
159180
struct io_buffer_list *bl,
160181
unsigned int issue_flags)
@@ -181,17 +202,7 @@ static struct io_br_sel io_ring_buffer_select(struct io_kiocb *req, size_t *len,
181202
sel.buf_list = bl;
182203
sel.addr = u64_to_user_ptr(buf->addr);
183204

184-
if (issue_flags & IO_URING_F_UNLOCKED || !io_file_can_poll(req)) {
185-
/*
186-
* If we came in unlocked, we have no choice but to consume the
187-
* buffer here, otherwise nothing ensures that the buffer won't
188-
* get used by others. This does mean it'll be pinned until the
189-
* IO completes, coming in unlocked means we're being called from
190-
* io-wq context and there may be further retries in async hybrid
191-
* mode. For the locked case, the caller must call commit when
192-
* the transfer completes (or if we get -EAGAIN and must poll of
193-
* retry).
194-
*/
205+
if (io_should_commit(req, issue_flags)) {
195206
io_kbuf_commit(req, sel.buf_list, *len, 1);
196207
sel.buf_list = NULL;
197208
}

io_uring/net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static int io_send_setup(struct io_kiocb *req, const struct io_uring_sqe *sqe)
383383
return 0;
384384

385385
if (sr->flags & IORING_SEND_VECTORIZED)
386-
return io_net_import_vec(req, kmsg, sr->buf, sr->len, ITER_SOURCE);
386+
return io_net_import_vec(req, kmsg, sr->buf, sr->len, ITER_SOURCE);
387387

388388
return import_ubuf(ITER_SOURCE, sr->buf, sr->len, &kmsg->msg.msg_iter);
389389
}

io_uring/query.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ static ssize_t io_query_ops(union io_query_data *data)
2222
e->ring_setup_flags = IORING_SETUP_FLAGS;
2323
e->enter_flags = IORING_ENTER_FLAGS;
2424
e->sqe_flags = SQE_VALID_FLAGS;
25+
e->nr_query_opcodes = __IO_URING_QUERY_MAX;
26+
e->__pad = 0;
2527
return sizeof(*e);
2628
}
2729

io_uring/register.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,9 +826,6 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
826826
case IORING_REGISTER_QUERY:
827827
ret = io_query(ctx, arg, nr_args);
828828
break;
829-
case IORING_REGISTER_ZCRX_REFILL:
830-
ret = io_zcrx_return_bufs(ctx, arg, nr_args);
831-
break;
832829
default:
833830
ret = -EINVAL;
834831
break;

0 commit comments

Comments
 (0)