tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.aio head: 12c35f0d2d3538bcd8d699a538a0b610df09f8e2 commit: 244f9488d3aaa2e7b83f501544c8126e020cda52 [2/8] keep io_event in aio_kiocb config: nds32-allyesconfig (attached as .config) compiler: nds32le-linux-gcc (GCC) 6.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 244f9488d3aaa2e7b83f501544c8126e020cda52 # save the attached .config to linux build tree GCC_VERSION=6.4.0 make.cross ARCH=nds32 All warnings (new ones prefixed by >>): In file included from include/linux/printk.h:331:0, from include/linux/kernel.h:14, from fs/aio.c:14: fs/aio.c: In function 'aio_complete': fs/aio.c:1127:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] ctx, tail, iocb, (void __user *)iocb->ki_res.obj, iocb->ki_res.data, ^ include/linux/dynamic_debug.h:128:10: note: in definition of macro 'dynamic_pr_debug' ##__VA_ARGS__); \ ^~~~~~~~~~~ >> fs/aio.c:1126:2: note: in expansion of macro 'pr_debug' pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n", ^~~~~~~~ vim +/pr_debug +1126 fs/aio.c 875736bb Jens Axboe 2018-11-20 1093 ^1da177e Linus Torvalds 2005-04-16 1094 /* aio_complete ^1da177e Linus Torvalds 2005-04-16 1095 * Called when the io request on the given iocb is complete. ^1da177e Linus Torvalds 2005-04-16 1096 */ 54843f87 Christoph Hellwig 2018-05-02 1097 static void aio_complete(struct aio_kiocb *iocb, long res, long res2) ^1da177e Linus Torvalds 2005-04-16 1098 { ^1da177e Linus Torvalds 2005-04-16 1099 struct kioctx *ctx = iocb->ki_ctx; ^1da177e Linus Torvalds 2005-04-16 1100 struct aio_ring *ring; 21b40200 Kent Overstreet 2013-05-07 1101 struct io_event *ev_page, *event; d856f32a Benjamin LaHaise 2014-08-24 1102 unsigned tail, pos, head; ^1da177e Linus Torvalds 2005-04-16 1103 unsigned long flags; ^1da177e Linus Torvalds 2005-04-16 1104 ^1da177e Linus Torvalds 2005-04-16 1105 /* 0460fef2 Kent Overstreet 2013-05-07 1106 * Add a completion event to the ring buffer. Must be done holding 4b30f07e Tang Chen 2013-07-03 1107 * ctx->completion_lock to prevent other code from messing with the tail 0460fef2 Kent Overstreet 2013-05-07 1108 * pointer since we might be called from irq context. 0460fef2 Kent Overstreet 2013-05-07 1109 */ 0460fef2 Kent Overstreet 2013-05-07 1110 spin_lock_irqsave(&ctx->completion_lock, flags); 0460fef2 Kent Overstreet 2013-05-07 1111 58c85dc2 Kent Overstreet 2013-05-07 1112 tail = ctx->tail; 21b40200 Kent Overstreet 2013-05-07 1113 pos = tail + AIO_EVENTS_OFFSET; 21b40200 Kent Overstreet 2013-05-07 1114 58c85dc2 Kent Overstreet 2013-05-07 1115 if (++tail >= ctx->nr_events) 4bf69b2a Kenneth W Chen 2005-05-01 1116 tail = 0; ^1da177e Linus Torvalds 2005-04-16 1117 58c85dc2 Kent Overstreet 2013-05-07 1118 ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); 21b40200 Kent Overstreet 2013-05-07 1119 event = ev_page + pos % AIO_EVENTS_PER_PAGE; 21b40200 Kent Overstreet 2013-05-07 1120 875736bb Jens Axboe 2018-11-20 1121 aio_fill_event(event, iocb, res, res2); ^1da177e Linus Torvalds 2005-04-16 1122 21b40200 Kent Overstreet 2013-05-07 1123 kunmap_atomic(ev_page); 58c85dc2 Kent Overstreet 2013-05-07 1124 flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); 21b40200 Kent Overstreet 2013-05-07 1125 21b40200 Kent Overstreet 2013-05-07 @1126 pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n", 244f9488 Al Viro 2019-03-07 1127 ctx, tail, iocb, (void __user *)iocb->ki_res.obj, iocb->ki_res.data, ^1da177e Linus Torvalds 2005-04-16 1128 res, res2); ^1da177e Linus Torvalds 2005-04-16 1129 ^1da177e Linus Torvalds 2005-04-16 1130 /* after flagging the request as done, we ^1da177e Linus Torvalds 2005-04-16 1131 * must never even look at it again ^1da177e Linus Torvalds 2005-04-16 1132 */ ^1da177e Linus Torvalds 2005-04-16 1133 smp_wmb(); /* make event visible before updating tail */ ^1da177e Linus Torvalds 2005-04-16 1134 58c85dc2 Kent Overstreet 2013-05-07 1135 ctx->tail = tail; ^1da177e Linus Torvalds 2005-04-16 1136 58c85dc2 Kent Overstreet 2013-05-07 1137 ring = kmap_atomic(ctx->ring_pages[0]); d856f32a Benjamin LaHaise 2014-08-24 1138 head = ring->head; 21b40200 Kent Overstreet 2013-05-07 1139 ring->tail = tail; e8e3c3d6 Cong Wang 2011-11-25 1140 kunmap_atomic(ring); 58c85dc2 Kent Overstreet 2013-05-07 1141 flush_dcache_page(ctx->ring_pages[0]); ^1da177e Linus Torvalds 2005-04-16 1142 d856f32a Benjamin LaHaise 2014-08-24 1143 ctx->completed_events++; d856f32a Benjamin LaHaise 2014-08-24 1144 if (ctx->completed_events > 1) d856f32a Benjamin LaHaise 2014-08-24 1145 refill_reqs_available(ctx, head, tail); 0460fef2 Kent Overstreet 2013-05-07 1146 spin_unlock_irqrestore(&ctx->completion_lock, flags); 0460fef2 Kent Overstreet 2013-05-07 1147 21b40200 Kent Overstreet 2013-05-07 1148 pr_debug("added to ring %p at [%u]\n", iocb, tail); 8d1c98b0 Davide Libenzi 2008-04-10 1149 8d1c98b0 Davide Libenzi 2008-04-10 1150 /* 8d1c98b0 Davide Libenzi 2008-04-10 1151 * Check if the user asked us to deliver the result through an 8d1c98b0 Davide Libenzi 2008-04-10 1152 * eventfd. The eventfd_signal() function is safe to be called 8d1c98b0 Davide Libenzi 2008-04-10 1153 * from IRQ context. 8d1c98b0 Davide Libenzi 2008-04-10 1154 */ 54843f87 Christoph Hellwig 2018-05-02 1155 if (iocb->ki_eventfd) { 8d1c98b0 Davide Libenzi 2008-04-10 1156 eventfd_signal(iocb->ki_eventfd, 1); 54843f87 Christoph Hellwig 2018-05-02 1157 eventfd_ctx_put(iocb->ki_eventfd); 54843f87 Christoph Hellwig 2018-05-02 1158 } 8d1c98b0 Davide Libenzi 2008-04-10 1159 6cb2a210 Quentin Barnes 2008-03-19 1160 /* 6cb2a210 Quentin Barnes 2008-03-19 1161 * We have to order our ring_info tail store above and test 6cb2a210 Quentin Barnes 2008-03-19 1162 * of the wait list below outside the wait lock. This is 6cb2a210 Quentin Barnes 2008-03-19 1163 * like in wake_up_bit() where clearing a bit has to be 6cb2a210 Quentin Barnes 2008-03-19 1164 * ordered with the unlocked test. 6cb2a210 Quentin Barnes 2008-03-19 1165 */ 6cb2a210 Quentin Barnes 2008-03-19 1166 smp_mb(); 6cb2a210 Quentin Barnes 2008-03-19 1167 ^1da177e Linus Torvalds 2005-04-16 1168 if (waitqueue_active(&ctx->wait)) ^1da177e Linus Torvalds 2005-04-16 1169 wake_up(&ctx->wait); 9018ccc4 Christoph Hellwig 2018-07-24 1170 iocb_put(iocb); ^1da177e Linus Torvalds 2005-04-16 1171 } ^1da177e Linus Torvalds 2005-04-16 1172 :::::: The code at line 1126 was first introduced by commit :::::: 21b40200cfe961b1428a529c63c33b1f1e1b4738 aio: use flush_dcache_page() :::::: TO: Kent Overstreet <koverstreet@xxxxxxxxxx> :::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip