Re: [PATCH v7 RESENT] io_uring: releasing CPU resources when polling

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

 



Hi hexue,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.11-rc2 next-20240808]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/hexue/io_uring-releasing-CPU-resources-when-polling/20240808-153455
base:   linus/master
patch link:    https://lore.kernel.org/r/20240808071712.2429842-1-xue01.he%40samsung.com
patch subject: [PATCH v7 RESENT] io_uring: releasing CPU resources when polling
config: alpha-defconfig (https://download.01.org/0day-ci/archive/20240809/202408090038.uF18SUul-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240809/202408090038.uF18SUul-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408090038.uF18SUul-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   io_uring/rw.c: In function 'io_do_iopoll':
>> io_uring/rw.c:1210:30: warning: unused variable 'file' [-Wunused-variable]
    1210 |                 struct file *file = req->file;
         |                              ^~~~


vim +/file +1210 io_uring/rw.c

e61753df273102 hexue          2024-08-08  1193  
f3b44f92e59a80 Jens Axboe     2022-06-13  1194  int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
f3b44f92e59a80 Jens Axboe     2022-06-13  1195  {
f3b44f92e59a80 Jens Axboe     2022-06-13  1196  	struct io_wq_work_node *pos, *start, *prev;
54bdd67d0f8848 Keith Busch    2023-03-20  1197  	unsigned int poll_flags = 0;
f3b44f92e59a80 Jens Axboe     2022-06-13  1198  	DEFINE_IO_COMP_BATCH(iob);
f3b44f92e59a80 Jens Axboe     2022-06-13  1199  	int nr_events = 0;
f3b44f92e59a80 Jens Axboe     2022-06-13  1200  
f3b44f92e59a80 Jens Axboe     2022-06-13  1201  	/*
f3b44f92e59a80 Jens Axboe     2022-06-13  1202  	 * Only spin for completions if we don't have multiple devices hanging
f3b44f92e59a80 Jens Axboe     2022-06-13  1203  	 * off our complete list.
f3b44f92e59a80 Jens Axboe     2022-06-13  1204  	 */
f3b44f92e59a80 Jens Axboe     2022-06-13  1205  	if (ctx->poll_multi_queue || force_nonspin)
f3b44f92e59a80 Jens Axboe     2022-06-13  1206  		poll_flags |= BLK_POLL_ONESHOT;
f3b44f92e59a80 Jens Axboe     2022-06-13  1207  
f3b44f92e59a80 Jens Axboe     2022-06-13  1208  	wq_list_for_each(pos, start, &ctx->iopoll_list) {
f3b44f92e59a80 Jens Axboe     2022-06-13  1209  		struct io_kiocb *req = container_of(pos, struct io_kiocb, comp_list);
a1119fb0711591 Jens Axboe     2022-09-02 @1210  		struct file *file = req->file;
f3b44f92e59a80 Jens Axboe     2022-06-13  1211  		int ret;
f3b44f92e59a80 Jens Axboe     2022-06-13  1212  
f3b44f92e59a80 Jens Axboe     2022-06-13  1213  		/*
f3b44f92e59a80 Jens Axboe     2022-06-13  1214  		 * Move completed and retryable entries to our local lists.
f3b44f92e59a80 Jens Axboe     2022-06-13  1215  		 * If we find a request that requires polling, break out
f3b44f92e59a80 Jens Axboe     2022-06-13  1216  		 * and complete those lists first, if we have entries there.
f3b44f92e59a80 Jens Axboe     2022-06-13  1217  		 */
f3b44f92e59a80 Jens Axboe     2022-06-13  1218  		if (READ_ONCE(req->iopoll_completed))
f3b44f92e59a80 Jens Axboe     2022-06-13  1219  			break;
f3b44f92e59a80 Jens Axboe     2022-06-13  1220  
e61753df273102 hexue          2024-08-08  1221  		if (ctx->flags & IORING_SETUP_HY_POLL)
e61753df273102 hexue          2024-08-08  1222  			ret = io_uring_hybrid_poll(req, &iob, poll_flags);
e61753df273102 hexue          2024-08-08  1223  		else
e61753df273102 hexue          2024-08-08  1224  			ret = io_uring_classic_poll(req, &iob, poll_flags);
5756a3a7e713bc Kanchan Joshi  2022-08-23  1225  
f3b44f92e59a80 Jens Axboe     2022-06-13  1226  		if (unlikely(ret < 0))
f3b44f92e59a80 Jens Axboe     2022-06-13  1227  			return ret;
f3b44f92e59a80 Jens Axboe     2022-06-13  1228  		else if (ret)
f3b44f92e59a80 Jens Axboe     2022-06-13  1229  			poll_flags |= BLK_POLL_ONESHOT;
f3b44f92e59a80 Jens Axboe     2022-06-13  1230  
f3b44f92e59a80 Jens Axboe     2022-06-13  1231  		/* iopoll may have completed current req */
f3b44f92e59a80 Jens Axboe     2022-06-13  1232  		if (!rq_list_empty(iob.req_list) ||
f3b44f92e59a80 Jens Axboe     2022-06-13  1233  		    READ_ONCE(req->iopoll_completed))
f3b44f92e59a80 Jens Axboe     2022-06-13  1234  			break;
f3b44f92e59a80 Jens Axboe     2022-06-13  1235  	}
f3b44f92e59a80 Jens Axboe     2022-06-13  1236  
f3b44f92e59a80 Jens Axboe     2022-06-13  1237  	if (!rq_list_empty(iob.req_list))
f3b44f92e59a80 Jens Axboe     2022-06-13  1238  		iob.complete(&iob);
f3b44f92e59a80 Jens Axboe     2022-06-13  1239  	else if (!pos)
f3b44f92e59a80 Jens Axboe     2022-06-13  1240  		return 0;
f3b44f92e59a80 Jens Axboe     2022-06-13  1241  
f3b44f92e59a80 Jens Axboe     2022-06-13  1242  	prev = start;
f3b44f92e59a80 Jens Axboe     2022-06-13  1243  	wq_list_for_each_resume(pos, prev) {
f3b44f92e59a80 Jens Axboe     2022-06-13  1244  		struct io_kiocb *req = container_of(pos, struct io_kiocb, comp_list);
f3b44f92e59a80 Jens Axboe     2022-06-13  1245  
f3b44f92e59a80 Jens Axboe     2022-06-13  1246  		/* order with io_complete_rw_iopoll(), e.g. ->result updates */
f3b44f92e59a80 Jens Axboe     2022-06-13  1247  		if (!smp_load_acquire(&req->iopoll_completed))
f3b44f92e59a80 Jens Axboe     2022-06-13  1248  			break;
f3b44f92e59a80 Jens Axboe     2022-06-13  1249  		nr_events++;
f3b44f92e59a80 Jens Axboe     2022-06-13  1250  		req->cqe.flags = io_put_kbuf(req, 0);
a9165b83c1937e Jens Axboe     2024-03-18  1251  		if (req->opcode != IORING_OP_URING_CMD)
a9165b83c1937e Jens Axboe     2024-03-18  1252  			io_req_rw_cleanup(req, 0);
544d163d659d45 Pavel Begunkov 2023-01-12  1253  	}
f3b44f92e59a80 Jens Axboe     2022-06-13  1254  	if (unlikely(!nr_events))
f3b44f92e59a80 Jens Axboe     2022-06-13  1255  		return 0;
f3b44f92e59a80 Jens Axboe     2022-06-13  1256  
f3b44f92e59a80 Jens Axboe     2022-06-13  1257  	pos = start ? start->next : ctx->iopoll_list.first;
f3b44f92e59a80 Jens Axboe     2022-06-13  1258  	wq_list_cut(&ctx->iopoll_list, prev, start);
ec26c225f06f59 Pavel Begunkov 2023-08-24  1259  
ec26c225f06f59 Pavel Begunkov 2023-08-24  1260  	if (WARN_ON_ONCE(!wq_list_empty(&ctx->submit_state.compl_reqs)))
ec26c225f06f59 Pavel Begunkov 2023-08-24  1261  		return 0;
ec26c225f06f59 Pavel Begunkov 2023-08-24  1262  	ctx->submit_state.compl_reqs.first = pos;
ec26c225f06f59 Pavel Begunkov 2023-08-24  1263  	__io_submit_flush_completions(ctx);
f3b44f92e59a80 Jens Axboe     2022-06-13  1264  	return nr_events;
f3b44f92e59a80 Jens Axboe     2022-06-13  1265  }
a9165b83c1937e Jens Axboe     2024-03-18  1266  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[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