[Intel-gfx] [PATCH v12 08/11] drm/i915/perf: execute OA configuration from command stream

kbuild test robot lkp at intel.com
Sat Aug 31 04:04:06 UTC 2019


Hi Lionel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[cannot apply to v5.3-rc6 next-20190830]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Lionel-Landwerlin/drm-i915-Vulkan-performance-query-support/20190831-033234
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-h002-201934 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/i915_perf.c: In function 'i915_oa_stream_init':
>> drivers/gpu/drm/i915/i915_perf.c:2695:3: error: ignoring return value of 'i915_active_request_retire', declared with attribute warn_unused_result [-Werror=unused-result]
      i915_active_request_retire(&stream->active_config_rq,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            &stream->config_mutex);
            ~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors

vim +/i915_active_request_retire +2695 drivers/gpu/drm/i915/i915_perf.c

  2553	
  2554	/**
  2555	 * i915_oa_stream_init - validate combined props for OA stream and init
  2556	 * @stream: An i915 perf stream
  2557	 * @param: The open parameters passed to `DRM_I915_PERF_OPEN`
  2558	 * @props: The property state that configures stream (individually validated)
  2559	 *
  2560	 * While read_properties_unlocked() validates properties in isolation it
  2561	 * doesn't ensure that the combination necessarily makes sense.
  2562	 *
  2563	 * At this point it has been determined that userspace wants a stream of
  2564	 * OA metrics, but still we need to further validate the combined
  2565	 * properties are OK.
  2566	 *
  2567	 * If the configuration makes sense then we can allocate memory for
  2568	 * a circular OA buffer and apply the requested metric set configuration.
  2569	 *
  2570	 * Returns: zero on success or a negative error code.
  2571	 */
  2572	static int i915_oa_stream_init(struct i915_perf_stream *stream,
  2573				       struct drm_i915_perf_open_param *param,
  2574				       struct perf_open_properties *props)
  2575	{
  2576		struct drm_i915_private *dev_priv = stream->dev_priv;
  2577		int format_size;
  2578		int ret;
  2579	
  2580		/* If the sysfs metrics/ directory wasn't registered for some
  2581		 * reason then don't let userspace try their luck with config
  2582		 * IDs
  2583		 */
  2584		if (!dev_priv->perf.metrics_kobj) {
  2585			DRM_DEBUG("OA metrics weren't advertised via sysfs\n");
  2586			return -EINVAL;
  2587		}
  2588	
  2589		if (!(props->sample_flags & SAMPLE_OA_REPORT)) {
  2590			DRM_DEBUG("Only OA report sampling supported\n");
  2591			return -EINVAL;
  2592		}
  2593	
  2594		if (!dev_priv->perf.ops.enable_metric_set) {
  2595			DRM_DEBUG("OA unit not supported\n");
  2596			return -ENODEV;
  2597		}
  2598	
  2599		/* To avoid the complexity of having to accurately filter
  2600		 * counter reports and marshal to the appropriate client
  2601		 * we currently only allow exclusive access
  2602		 */
  2603		if (dev_priv->perf.exclusive_stream) {
  2604			DRM_DEBUG("OA unit already in use\n");
  2605			return -EBUSY;
  2606		}
  2607	
  2608		if (!props->oa_format) {
  2609			DRM_DEBUG("OA report format not specified\n");
  2610			return -EINVAL;
  2611		}
  2612	
  2613		mutex_init(&stream->config_mutex);
  2614	
  2615		stream->sample_size = sizeof(struct drm_i915_perf_record_header);
  2616	
  2617		format_size = dev_priv->perf.oa_formats[props->oa_format].size;
  2618	
  2619		stream->engine = props->engine;
  2620	
  2621		mutex_init(&stream->config_mutex);
  2622		INIT_ACTIVE_REQUEST(&stream->active_config_rq,
  2623				    &stream->config_mutex);
  2624	
  2625		stream->sample_flags |= SAMPLE_OA_REPORT;
  2626		stream->sample_size += format_size;
  2627	
  2628		stream->oa_buffer.format_size = format_size;
  2629		if (WARN_ON(stream->oa_buffer.format_size == 0))
  2630			return -EINVAL;
  2631	
  2632		stream->oa_buffer.format =
  2633			dev_priv->perf.oa_formats[props->oa_format].format;
  2634	
  2635		stream->periodic = props->oa_periodic;
  2636		if (stream->periodic)
  2637			stream->period_exponent = props->oa_period_exponent;
  2638	
  2639		if (stream->ctx) {
  2640			ret = oa_get_render_ctx_id(stream);
  2641			if (ret) {
  2642				DRM_DEBUG("Invalid context id to filter with\n");
  2643				return ret;
  2644			}
  2645		}
  2646	
  2647		ret = alloc_noa_wait(stream);
  2648		if (ret) {
  2649			DRM_DEBUG("Unable to allocate NOA wait batch buffer\n");
  2650			goto err_noa_wait_alloc;
  2651		}
  2652	
  2653		ret = i915_perf_get_oa_config_and_bo(stream, props->metrics_set,
  2654						     &stream->oa_config,
  2655						     &stream->initial_oa_config_bo);
  2656		if (ret) {
  2657			DRM_DEBUG("Invalid OA config id=%i\n", props->metrics_set);
  2658			goto err_config;
  2659		}
  2660	
  2661		/* PRM - observability performance counters:
  2662		 *
  2663		 *   OACONTROL, performance counter enable, note:
  2664		 *
  2665		 *   "When this bit is set, in order to have coherent counts,
  2666		 *   RC6 power state and trunk clock gating must be disabled.
  2667		 *   This can be achieved by programming MMIO registers as
  2668		 *   0xA094=0 and 0xA090[31]=1"
  2669		 *
  2670		 *   In our case we are expecting that taking pm + FORCEWAKE
  2671		 *   references will effectively disable RC6.
  2672		 */
  2673		stream->wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
  2674		intel_uncore_forcewake_get(&dev_priv->uncore, FORCEWAKE_ALL);
  2675	
  2676		ret = alloc_oa_buffer(stream);
  2677		if (ret)
  2678			goto err_oa_buf_alloc;
  2679	
  2680		ret = i915_mutex_lock_interruptible(&dev_priv->drm);
  2681		if (ret)
  2682			goto err_lock;
  2683	
  2684		stream->ops = &i915_oa_stream_ops;
  2685		dev_priv->perf.exclusive_stream = stream;
  2686	
  2687		mutex_lock(&stream->config_mutex);
  2688		ret = dev_priv->perf.ops.enable_metric_set(stream);
  2689		if (ret) {
  2690			DRM_DEBUG("Unable to enable metric set\n");
  2691			/*
  2692			 * Ignore the return value since we already have an error from
  2693			 * the enable vfunc.
  2694			 */
> 2695			i915_active_request_retire(&stream->active_config_rq,
  2696						   &stream->config_mutex);
  2697		} else {
  2698			ret = i915_active_request_retire(&stream->active_config_rq,
  2699							 &stream->config_mutex);
  2700		}
  2701	
  2702		mutex_unlock(&stream->config_mutex);
  2703		mutex_unlock(&dev_priv->drm.struct_mutex);
  2704	
  2705		i915_gem_object_put(stream->initial_oa_config_bo);
  2706		stream->initial_oa_config_bo = NULL;
  2707		if (ret)
  2708			goto err_enable;
  2709	
  2710		DRM_DEBUG("opening stream oa config uuid=%s\n", stream->oa_config->uuid);
  2711	
  2712		hrtimer_init(&stream->poll_check_timer,
  2713			     CLOCK_MONOTONIC, HRTIMER_MODE_REL);
  2714		stream->poll_check_timer.function = oa_poll_check_timer_cb;
  2715		init_waitqueue_head(&stream->poll_wq);
  2716		spin_lock_init(&stream->oa_buffer.ptr_lock);
  2717	
  2718		return 0;
  2719	
  2720	err_enable:
  2721		mutex_lock(&dev_priv->drm.struct_mutex);
  2722		mutex_lock(&stream->config_mutex);
  2723		dev_priv->perf.ops.disable_metric_set(stream);
  2724		mutex_unlock(&stream->config_mutex);
  2725		dev_priv->perf.exclusive_stream = NULL;
  2726		mutex_unlock(&dev_priv->drm.struct_mutex);
  2727	
  2728	err_lock:
  2729		free_oa_buffer(stream);
  2730	
  2731	err_oa_buf_alloc:
  2732		i915_oa_config_put(stream->oa_config);
  2733	
  2734		intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
  2735		intel_runtime_pm_put(&dev_priv->runtime_pm, stream->wakeref);
  2736	
  2737		free_oa_configs(stream);
  2738	
  2739		i915_gem_object_put(stream->initial_oa_config_bo);
  2740	
  2741	err_config:
  2742		free_noa_wait(stream);
  2743	
  2744	err_noa_wait_alloc:
  2745		if (stream->ctx)
  2746			oa_put_render_ctx_id(stream);
  2747	
  2748		return ret;
  2749	}
  2750	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 34295 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20190831/c58119df/attachment-0001.gz>


More information about the Intel-gfx mailing list