From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 934DBC3F6B0 for ; Thu, 11 Aug 2022 07:47:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A04A8E0002; Thu, 11 Aug 2022 03:47:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 24FD08E0001; Thu, 11 Aug 2022 03:47:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C9AF8E0002; Thu, 11 Aug 2022 03:47:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F26FB8E0001 for ; Thu, 11 Aug 2022 03:47:04 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BBCD112077C for ; Thu, 11 Aug 2022 07:47:04 +0000 (UTC) X-FDA: 79786530768.16.4DE5580 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf22.hostedemail.com (Postfix) with ESMTP id 0D20CC0156 for ; Thu, 11 Aug 2022 07:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660204023; x=1691740023; h=date:from:to:cc:subject:message-id:mime-version; bh=XKp4N2u4hPVRhTJz2Clk1m4l+6YwU6doakkwzGr4b0c=; b=m6zkbNNCQH7sUH0C2AoRpKU5/TbYH5LyBrDEnd+gr8/e70zZgGHdc7Hn 3iR7EnU7deMla9dSLEHLOgGCdPgl05kGFg2wRNbOLBKf5UC6Y7/SHO8WT 8t5bsoBTfO+0WN1d8QNboB2LXdelqbwVulcvxNgqwKM/RCkZ8zj+jYqYY rLashwHSFXhc/qF09GaXQh0GUbhvzez82UweRor4t4TBruecmgVoFIa0s YcWou48zO9YiotEP0CRAH4REoew76AvuyChis20vHnWGD4RY+1kxb2tBb tpyRRi3q9o4af57UZ2ax0SZeD87c+YJn9D4xwK9YzTDWKiizCg4H6ir0n g==; X-IronPort-AV: E=McAfee;i="6400,9594,10435"; a="288852560" X-IronPort-AV: E=Sophos;i="5.93,228,1654585200"; d="scan'208";a="288852560" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2022 00:47:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,228,1654585200"; d="scan'208";a="556037015" Received: from lkp-server02.sh.intel.com (HELO d10ab0927833) ([10.239.97.151]) by orsmga003.jf.intel.com with ESMTP; 11 Aug 2022 00:46:58 -0700 Received: from kbuild by d10ab0927833 with local (Exim 4.96) (envelope-from ) id 1oM2uA-00006h-16; Thu, 11 Aug 2022 07:46:58 +0000 Date: Thu, 11 Aug 2022 15:46:35 +0800 From: kernel test robot To: Stefano Garzarella Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, Linux Memory Management List , "Michael S. Tsirkin" Subject: [linux-next:master 14849/15097] drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:201:3: error: expected expression Message-ID: <202208111501.5PSP1WaM-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660204024; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=rlqh4g104b/EZuPgl1WF6Q5RjXrMAjZd4O+doRwMnGI=; b=tHF9BGFjeo+dul5fnjvJrJVo3mvUXHVH7brlI3hTvyKT77fTGn5mzcVzPBF0wIvEzAVVgR FdJ3pcN+SKZHTfJWEuSLBVNShaVU0UEjjQuD6KJ5F7WkDLvziVpbYqtll+ke0MY0pufV83 ppaQhfv8YDvCvZaMwYbsKAuU/U4Z6LU= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=m6zkbNNC; spf=pass (imf22.hostedemail.com: domain of lkp@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660204024; a=rsa-sha256; cv=none; b=rygHiiGdi2LhY2A82RjgwrKDlIiVum+3japCwNiXiz3wTBoLSP8I6T5y1qzpgbfIXRrOoV 4vht1QDr0fTA0kLba4QC/BmtHEci6HMPTqE2Vy6lIAMLwUqFlthhwCT67/AAHF6Ge64UW5 5+Npk4vhdmVEX+njGrilK2xhSPGch8s= X-Stat-Signature: utprgsgiuj8b6jtkow4oagiem3hei8my X-Rspamd-Queue-Id: 0D20CC0156 Authentication-Results: imf22.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=m6zkbNNC; spf=pass (imf22.hostedemail.com: domain of lkp@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1660204022-542726 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 40d43a7507e1547dd45cb02af2e40d897c591870 commit: d79b32c2e4a4e66d5678410cd45815c1c2375196 [14849/15097] vdpa_sim_blk: add support for discard and write-zeroes config: i386-randconfig-a015 (https://download.01.org/0day-ci/archive/20220811/202208111501.5PSP1WaM-lkp@intel.com/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=d79b32c2e4a4e66d5678410cd45815c1c2375196 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout d79b32c2e4a4e66d5678410cd45815c1c2375196 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/vdpa/vdpa_sim/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot All error/warnings (new ones prefixed by >>): >> drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:201:3: error: expected expression struct virtio_blk_discard_write_zeroes range; ^ >> drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:204:25: error: use of undeclared identifier 'range' if (to_pull != sizeof(range)) { ^ drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:207:21: error: use of undeclared identifier 'range' to_pull, sizeof(range)); ^ drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:212:60: error: use of undeclared identifier 'range' bytes = vringh_iov_pull_iotlb(&vq->vring, &vq->out_iov, &range, ^ drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:222:38: error: use of undeclared identifier 'range' sector = vdpasim64_to_cpu(vdpasim, range.sector); ^ drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:224:43: error: use of undeclared identifier 'range' num_sectors = vdpasim32_to_cpu(vdpasim, range.num_sectors); ^ drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:225:37: error: use of undeclared identifier 'range' flags = vdpasim32_to_cpu(vdpasim, range.flags); ^ >> drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:202:7: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement] u32 num_sectors, flags; ^ 1 warning and 7 errors generated. vim +201 drivers/vdpa/vdpa_sim/vdpa_sim_blk.c 74 75 /* Returns 'true' if the request is handled (with or without an I/O error) 76 * and the status is correctly written in the last byte of the 'in iov', 77 * 'false' otherwise. 78 */ 79 static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim, 80 struct vdpasim_virtqueue *vq) 81 { 82 size_t pushed = 0, to_pull, to_push; 83 struct virtio_blk_outhdr hdr; 84 bool handled = false; 85 ssize_t bytes; 86 loff_t offset; 87 u64 sector; 88 u8 status; 89 u32 type; 90 int ret; 91 92 ret = vringh_getdesc_iotlb(&vq->vring, &vq->out_iov, &vq->in_iov, 93 &vq->head, GFP_ATOMIC); 94 if (ret != 1) 95 return false; 96 97 if (vq->out_iov.used < 1 || vq->in_iov.used < 1) { 98 dev_dbg(&vdpasim->vdpa.dev, "missing headers - out_iov: %u in_iov %u\n", 99 vq->out_iov.used, vq->in_iov.used); 100 goto err; 101 } 102 103 if (vq->in_iov.iov[vq->in_iov.used - 1].iov_len < 1) { 104 dev_dbg(&vdpasim->vdpa.dev, "request in header too short\n"); 105 goto err; 106 } 107 108 /* The last byte is the status and we checked if the last iov has 109 * enough room for it. 110 */ 111 to_push = vringh_kiov_length(&vq->in_iov) - 1; 112 113 to_pull = vringh_kiov_length(&vq->out_iov); 114 115 bytes = vringh_iov_pull_iotlb(&vq->vring, &vq->out_iov, &hdr, 116 sizeof(hdr)); 117 if (bytes != sizeof(hdr)) { 118 dev_dbg(&vdpasim->vdpa.dev, "request out header too short\n"); 119 goto err; 120 } 121 122 to_pull -= bytes; 123 124 type = vdpasim32_to_cpu(vdpasim, hdr.type); 125 sector = vdpasim64_to_cpu(vdpasim, hdr.sector); 126 offset = sector << SECTOR_SHIFT; 127 status = VIRTIO_BLK_S_OK; 128 129 if (type != VIRTIO_BLK_T_IN && type != VIRTIO_BLK_T_OUT && 130 sector != 0) { 131 dev_dbg(&vdpasim->vdpa.dev, 132 "sector must be 0 for %u request - sector: 0x%llx\n", 133 type, sector); 134 status = VIRTIO_BLK_S_IOERR; 135 goto err_status; 136 } 137 138 switch (type) { 139 case VIRTIO_BLK_T_IN: 140 if (!vdpasim_blk_check_range(vdpasim, sector, 141 to_push >> SECTOR_SHIFT, 142 VDPASIM_BLK_SIZE_MAX * VDPASIM_BLK_SEG_MAX)) { 143 status = VIRTIO_BLK_S_IOERR; 144 break; 145 } 146 147 bytes = vringh_iov_push_iotlb(&vq->vring, &vq->in_iov, 148 vdpasim->buffer + offset, 149 to_push); 150 if (bytes < 0) { 151 dev_dbg(&vdpasim->vdpa.dev, 152 "vringh_iov_push_iotlb() error: %zd offset: 0x%llx len: 0x%zx\n", 153 bytes, offset, to_push); 154 status = VIRTIO_BLK_S_IOERR; 155 break; 156 } 157 158 pushed += bytes; 159 break; 160 161 case VIRTIO_BLK_T_OUT: 162 if (!vdpasim_blk_check_range(vdpasim, sector, 163 to_pull >> SECTOR_SHIFT, 164 VDPASIM_BLK_SIZE_MAX * VDPASIM_BLK_SEG_MAX)) { 165 status = VIRTIO_BLK_S_IOERR; 166 break; 167 } 168 169 bytes = vringh_iov_pull_iotlb(&vq->vring, &vq->out_iov, 170 vdpasim->buffer + offset, 171 to_pull); 172 if (bytes < 0) { 173 dev_dbg(&vdpasim->vdpa.dev, 174 "vringh_iov_pull_iotlb() error: %zd offset: 0x%llx len: 0x%zx\n", 175 bytes, offset, to_pull); 176 status = VIRTIO_BLK_S_IOERR; 177 break; 178 } 179 break; 180 181 case VIRTIO_BLK_T_GET_ID: 182 bytes = vringh_iov_push_iotlb(&vq->vring, &vq->in_iov, 183 vdpasim_blk_id, 184 VIRTIO_BLK_ID_BYTES); 185 if (bytes < 0) { 186 dev_dbg(&vdpasim->vdpa.dev, 187 "vringh_iov_push_iotlb() error: %zd\n", bytes); 188 status = VIRTIO_BLK_S_IOERR; 189 break; 190 } 191 192 pushed += bytes; 193 break; 194 195 case VIRTIO_BLK_T_FLUSH: 196 /* nothing to do */ 197 break; 198 199 case VIRTIO_BLK_T_DISCARD: 200 case VIRTIO_BLK_T_WRITE_ZEROES: > 201 struct virtio_blk_discard_write_zeroes range; > 202 u32 num_sectors, flags; 203 > 204 if (to_pull != sizeof(range)) { 205 dev_dbg(&vdpasim->vdpa.dev, 206 "discard/write_zeroes header len: 0x%zx [expected: 0x%zx]\n", 207 to_pull, sizeof(range)); 208 status = VIRTIO_BLK_S_IOERR; 209 break; 210 } 211 212 bytes = vringh_iov_pull_iotlb(&vq->vring, &vq->out_iov, &range, 213 to_pull); 214 if (bytes < 0) { 215 dev_dbg(&vdpasim->vdpa.dev, 216 "vringh_iov_pull_iotlb() error: %zd offset: 0x%llx len: 0x%zx\n", 217 bytes, offset, to_pull); 218 status = VIRTIO_BLK_S_IOERR; 219 break; 220 } 221 222 sector = vdpasim64_to_cpu(vdpasim, range.sector); 223 offset = sector << SECTOR_SHIFT; 224 num_sectors = vdpasim32_to_cpu(vdpasim, range.num_sectors); 225 flags = vdpasim32_to_cpu(vdpasim, range.flags); 226 227 if (type == VIRTIO_BLK_T_DISCARD && flags != 0) { 228 dev_dbg(&vdpasim->vdpa.dev, 229 "discard unexpected flags set - flags: 0x%x\n", 230 flags); 231 status = VIRTIO_BLK_S_UNSUPP; 232 break; 233 } 234 235 if (type == VIRTIO_BLK_T_WRITE_ZEROES && 236 flags & ~VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP) { 237 dev_dbg(&vdpasim->vdpa.dev, 238 "write_zeroes unexpected flags set - flags: 0x%x\n", 239 flags); 240 status = VIRTIO_BLK_S_UNSUPP; 241 break; 242 } 243 244 if (!vdpasim_blk_check_range(vdpasim, sector, num_sectors, 245 VDPASIM_BLK_DWZ_MAX_SECTORS)) { 246 status = VIRTIO_BLK_S_IOERR; 247 break; 248 } 249 250 if (type == VIRTIO_BLK_T_WRITE_ZEROES) { 251 memset(vdpasim->buffer + offset, 0, 252 num_sectors << SECTOR_SHIFT); 253 } 254 255 break; 256 257 default: 258 dev_dbg(&vdpasim->vdpa.dev, 259 "Unsupported request type %d\n", type); 260 status = VIRTIO_BLK_S_IOERR; 261 break; 262 } 263 264 err_status: 265 /* If some operations fail, we need to skip the remaining bytes 266 * to put the status in the last byte 267 */ 268 if (to_push - pushed > 0) 269 vringh_kiov_advance(&vq->in_iov, to_push - pushed); 270 271 /* Last byte is the status */ 272 bytes = vringh_iov_push_iotlb(&vq->vring, &vq->in_iov, &status, 1); 273 if (bytes != 1) 274 goto err; 275 276 pushed += bytes; 277 278 /* Make sure data is wrote before advancing index */ 279 smp_wmb(); 280 281 handled = true; 282 283 err: 284 vringh_complete_iotlb(&vq->vring, vq->head, pushed); 285 286 return handled; 287 } 288 -- 0-DAY CI Kernel Test Service https://01.org/lkp