Re: [PATCH v15 10/13] drm/i915/perf: execute OA configuration from command stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-rc8 next-20190904]
[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/20190907-052009
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-f004-201936 (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@xxxxxxxxx>

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:2697: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, 0,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            &stream->config_mutex);
            ~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors

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

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

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux