Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: intel-gfx@lists.freedesktop.org, kbuild-all@01.org
Subject: Re: [PATCH 5/5] drm/i915: add support for perf configuration queries
Date: Thu, 23 May 2019 13:32:02 +0300	[thread overview]
Message-ID: <20190523103202.GN19380@kadam> (raw)
In-Reply-To: <20190521140855.3957-6-lionel.g.landwerlin@intel.com>

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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

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;"

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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-05-23 10:32 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 14:08 [PATCH 0/5] drm/i915: Vulkan performance query support Lionel Landwerlin
2019-05-21 14:08 ` [PATCH 1/5] drm/i915/perf: introduce a versioning of the i915-perf uapi Lionel Landwerlin
2019-05-21 14:08 ` [PATCH 2/5] drm/i915/perf: allow holding preemption on filtered ctx Lionel Landwerlin
2019-05-21 16:36   ` Chris Wilson
2019-05-21 16:50     ` Lionel Landwerlin
2019-05-21 17:17       ` Chris Wilson
2019-05-21 17:52         ` Lionel Landwerlin
2019-05-24  9:28     ` Lionel Landwerlin
2019-05-24  9:42       ` Chris Wilson
2019-05-24  9:51         ` Lionel Landwerlin
2019-05-24 10:07           ` Chris Wilson
2019-05-27 22:11             ` Lionel Landwerlin
2019-05-22  4:33   ` kbuild test robot
2019-05-21 14:08 ` [PATCH 3/5] drm/i915/perf: allow for CS OA configs to be created lazily Lionel Landwerlin
2019-05-21 16:43   ` Chris Wilson
2019-05-21 16:55     ` Lionel Landwerlin
2019-05-21 14:08 ` [PATCH 4/5] drm/i915: add a new perf configuration execbuf parameter Lionel Landwerlin
2019-05-21 17:07   ` Chris Wilson
2019-05-21 17:19     ` Lionel Landwerlin
2019-05-21 17:48       ` Chris Wilson
2019-05-21 17:59         ` Lionel Landwerlin
2019-05-22  9:19         ` Lionel Landwerlin
2019-05-22  9:25           ` Chris Wilson
2019-05-22  9:30             ` Lionel Landwerlin
2019-05-28 10:52   ` Chris Wilson
2019-05-30 18:41     ` Lionel Landwerlin
2019-05-21 14:08 ` [PATCH 5/5] drm/i915: add support for perf configuration queries Lionel Landwerlin
2019-05-23 10:32   ` Dan Carpenter [this message]
2019-05-23 11:25     ` Lionel Landwerlin
2019-05-23 11:38       ` Dan Carpenter
2019-05-21 16:37 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Vulkan performance query support Patchwork
2019-05-21 16:40 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-05-21 17:26 ` ✗ Fi.CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190523103202.GN19380@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kbuild-all@01.org \
    --cc=kbuild@01.org \
    --cc=lionel.g.landwerlin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox