Hi Dan,
Not quite sure if you read responses to what seems like an automated
message.
I have a question below.
Thanks,
-Lionel
On 23/05/2019 11:32, Dan Carpenter wrote:
Hi Lionel,
Thank you for the patch! Perhaps something to improve:
url: https://github.com/0day-ci/linux/commits/Lionel-Landwerlin/drm-i915-Vulkan-performance-query-support/20190522-083115
base: git://anongit.freedesktop.org/drm-intel for-linux-next
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
smatch warnings:
drivers/gpu/drm/i915/i915_query.c:290 query_perf_config_data() warn: inconsistent returns 'mutex:&i915->perf.metrics_lock'.
Locked on: line 220
Unlocked on: line 170
# https://github.com/0day-ci/linux/commit/2df5c78741c44ada4e0b3b7b016923cbbb30ab76
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 2df5c78741c44ada4e0b3b7b016923cbbb30ab76
vim +290 drivers/gpu/drm/i915/i915_query.c
2df5c787 Lionel Landwerlin 2019-05-21 187 if (__get_user(flags, &user_query_config_ptr->flags))
2df5c787 Lionel Landwerlin 2019-05-21 188 return -EFAULT;
2df5c787 Lionel Landwerlin 2019-05-21 189
2df5c787 Lionel Landwerlin 2019-05-21 190 if (flags != 0)
2df5c787 Lionel Landwerlin 2019-05-21 191 return -EINVAL;
2df5c787 Lionel Landwerlin 2019-05-21 192
2df5c787 Lionel Landwerlin 2019-05-21 193 ret = mutex_lock_interruptible(&i915->perf.metrics_lock);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lock
What do you mean by that?
2df5c787 Lionel Landwerlin 2019-05-21 194 if (ret)
2df5c787 Lionel Landwerlin 2019-05-21 195 return ret;
2df5c787 Lionel Landwerlin 2019-05-21 196
2df5c787 Lionel Landwerlin 2019-05-21 197 if (use_uuid) {
2df5c787 Lionel Landwerlin 2019-05-21 198 char uuid[UUID_STRING_LEN + 1] = { 0, };
2df5c787 Lionel Landwerlin 2019-05-21 199 struct i915_oa_config *tmp;
2df5c787 Lionel Landwerlin 2019-05-21 200 int id;
2df5c787 Lionel Landwerlin 2019-05-21 201
2df5c787 Lionel Landwerlin 2019-05-21 202 BUILD_BUG_ON(sizeof(user_query_config_ptr->uuid) >= sizeof(uuid));
2df5c787 Lionel Landwerlin 2019-05-21 203
2df5c787 Lionel Landwerlin 2019-05-21 204 if (__copy_from_user(uuid, user_query_config_ptr->uuid,
2df5c787 Lionel Landwerlin 2019-05-21 205 sizeof(user_query_config_ptr->uuid))) {
2df5c787 Lionel Landwerlin 2019-05-21 206 ret = -EFAULT;
2df5c787 Lionel Landwerlin 2019-05-21 207 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 208 }
2df5c787 Lionel Landwerlin 2019-05-21 209
2df5c787 Lionel Landwerlin 2019-05-21 210 idr_for_each_entry(&i915->perf.metrics_idr, tmp, id) {
2df5c787 Lionel Landwerlin 2019-05-21 211 if (!strcmp(tmp->uuid, uuid)) {
2df5c787 Lionel Landwerlin 2019-05-21 212 oa_config = tmp;
2df5c787 Lionel Landwerlin 2019-05-21 213 break;
2df5c787 Lionel Landwerlin 2019-05-21 214 }
2df5c787 Lionel Landwerlin 2019-05-21 215 }
2df5c787 Lionel Landwerlin 2019-05-21 216 } else {
2df5c787 Lionel Landwerlin 2019-05-21 217 u64 config_id;
2df5c787 Lionel Landwerlin 2019-05-21 218
2df5c787 Lionel Landwerlin 2019-05-21 219 if (__get_user(config_id, &user_query_config_ptr->config))
2df5c787 Lionel Landwerlin 2019-05-21 220 return -EFAULT;
^^^^^^^^^^^^^^
This needs to be "goto out;"
Nice catch thanks!
2df5c787 Lionel Landwerlin 2019-05-21 221
2df5c787 Lionel Landwerlin 2019-05-21 222 if (config_id == 1)
2df5c787 Lionel Landwerlin 2019-05-21 223 oa_config = &i915->perf.oa.test_config;
2df5c787 Lionel Landwerlin 2019-05-21 224 else
2df5c787 Lionel Landwerlin 2019-05-21 225 oa_config = idr_find(&i915->perf.metrics_idr, config_id);
2df5c787 Lionel Landwerlin 2019-05-21 226 }
2df5c787 Lionel Landwerlin 2019-05-21 227
2df5c787 Lionel Landwerlin 2019-05-21 228 if (!oa_config) {
2df5c787 Lionel Landwerlin 2019-05-21 229 ret = -ENOENT;
2df5c787 Lionel Landwerlin 2019-05-21 230 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 231 }
2df5c787 Lionel Landwerlin 2019-05-21 232
2df5c787 Lionel Landwerlin 2019-05-21 233 if (__copy_from_user(&user_config, user_config_ptr,
2df5c787 Lionel Landwerlin 2019-05-21 234 sizeof(user_config))) {
2df5c787 Lionel Landwerlin 2019-05-21 235 ret = -EFAULT;
2df5c787 Lionel Landwerlin 2019-05-21 236 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 237 }
2df5c787 Lionel Landwerlin 2019-05-21 238
2df5c787 Lionel Landwerlin 2019-05-21 239 ret = can_copy_perf_config_registers_or_number(user_config.n_boolean_regs,
2df5c787 Lionel Landwerlin 2019-05-21 240 user_config.boolean_regs_ptr,
2df5c787 Lionel Landwerlin 2019-05-21 241 oa_config->b_counter_regs_len);
2df5c787 Lionel Landwerlin 2019-05-21 242 if (ret)
2df5c787 Lionel Landwerlin 2019-05-21 243 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 244
2df5c787 Lionel Landwerlin 2019-05-21 245 ret = can_copy_perf_config_registers_or_number(user_config.n_flex_regs,
2df5c787 Lionel Landwerlin 2019-05-21 246 user_config.flex_regs_ptr,
2df5c787 Lionel Landwerlin 2019-05-21 247 oa_config->flex_regs_len);
2df5c787 Lionel Landwerlin 2019-05-21 248 if (ret)
2df5c787 Lionel Landwerlin 2019-05-21 249 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 250
2df5c787 Lionel Landwerlin 2019-05-21 251 ret = can_copy_perf_config_registers_or_number(user_config.n_mux_regs,
2df5c787 Lionel Landwerlin 2019-05-21 252 user_config.mux_regs_ptr,
2df5c787 Lionel Landwerlin 2019-05-21 253 oa_config->mux_regs_len);
2df5c787 Lionel Landwerlin 2019-05-21 254 if (ret)
2df5c787 Lionel Landwerlin 2019-05-21 255 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 256
2df5c787 Lionel Landwerlin 2019-05-21 257 ret = copy_perf_config_registers_or_number(oa_config->b_counter_regs,
2df5c787 Lionel Landwerlin 2019-05-21 258 oa_config->b_counter_regs_len,
2df5c787 Lionel Landwerlin 2019-05-21 259 user_config.boolean_regs_ptr,
2df5c787 Lionel Landwerlin 2019-05-21 260 &user_config.n_boolean_regs);
2df5c787 Lionel Landwerlin 2019-05-21 261 if (ret)
2df5c787 Lionel Landwerlin 2019-05-21 262 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 263
2df5c787 Lionel Landwerlin 2019-05-21 264 ret = copy_perf_config_registers_or_number(oa_config->flex_regs,
2df5c787 Lionel Landwerlin 2019-05-21 265 oa_config->flex_regs_len,
2df5c787 Lionel Landwerlin 2019-05-21 266 user_config.flex_regs_ptr,
2df5c787 Lionel Landwerlin 2019-05-21 267 &user_config.n_flex_regs);
2df5c787 Lionel Landwerlin 2019-05-21 268 if (ret)
2df5c787 Lionel Landwerlin 2019-05-21 269 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 270
2df5c787 Lionel Landwerlin 2019-05-21 271 ret = copy_perf_config_registers_or_number(oa_config->mux_regs,
2df5c787 Lionel Landwerlin 2019-05-21 272 oa_config->mux_regs_len,
2df5c787 Lionel Landwerlin 2019-05-21 273 user_config.mux_regs_ptr,
2df5c787 Lionel Landwerlin 2019-05-21 274 &user_config.n_mux_regs);
2df5c787 Lionel Landwerlin 2019-05-21 275 if (ret)
2df5c787 Lionel Landwerlin 2019-05-21 276 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 277
2df5c787 Lionel Landwerlin 2019-05-21 278 memcpy(user_config.uuid, oa_config->uuid, sizeof(user_config.uuid));
2df5c787 Lionel Landwerlin 2019-05-21 279
2df5c787 Lionel Landwerlin 2019-05-21 280 if (__copy_to_user(user_config_ptr, &user_config,
2df5c787 Lionel Landwerlin 2019-05-21 281 sizeof(user_config))) {
2df5c787 Lionel Landwerlin 2019-05-21 282 ret = -EFAULT;
2df5c787 Lionel Landwerlin 2019-05-21 283 goto out;
2df5c787 Lionel Landwerlin 2019-05-21 284 }
2df5c787 Lionel Landwerlin 2019-05-21 285
2df5c787 Lionel Landwerlin 2019-05-21 286 ret = total_size;
2df5c787 Lionel Landwerlin 2019-05-21 287
2df5c787 Lionel Landwerlin 2019-05-21 288 out:
2df5c787 Lionel Landwerlin 2019-05-21 289 mutex_unlock(&i915->perf.metrics_lock);
2df5c787 Lionel Landwerlin 2019-05-21 @290 return ret;
2df5c787 Lionel Landwerlin 2019-05-21 291 }
2df5c787 Lionel Landwerlin 2019-05-21 292
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx