Re: [PATCH 12/12] drm/i915: Support for capturing MMIO register values

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

 



Hi Sourab,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on next-20170731]
[cannot apply to v4.13-rc3]
[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/Sagar-Arun-Kamble/i915-perf-support-for-command-stream-based-OA-GPU-and-workload-metrics-capture/20170731-184412
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x003-201731 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu//drm/i915/i915_perf.c: In function 'read_properties_unlocked':
>> drivers/gpu//drm/i915/i915_perf.c:4022:35: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
       ret = copy_mmio_list(dev_priv, (u64 __user *)value);
                                      ^
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 3 include/linux/log2.h:is_power_of_2
   Cyclomatic Complexity 1 arch/x86/include/asm/current.h:get_current
   Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
   Cyclomatic Complexity 1 include/linux/list.h:__list_add_valid
   Cyclomatic Complexity 1 include/linux/list.h:__list_del_entry_valid
   Cyclomatic Complexity 2 include/linux/list.h:__list_add
   Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
   Cyclomatic Complexity 1 include/linux/list.h:__list_del
   Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
   Cyclomatic Complexity 1 include/linux/list.h:list_del
   Cyclomatic Complexity 1 include/linux/list.h:list_move_tail
   Cyclomatic Complexity 1 include/linux/list.h:list_empty
   Cyclomatic Complexity 1 include/linux/list.h:__list_splice
   Cyclomatic Complexity 2 include/linux/list.h:list_splice
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_read
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_dec
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 1 include/linux/thread_info.h:check_object_size
   Cyclomatic Complexity 6 include/linux/thread_info.h:check_copy_size
   Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irqrestore
   Cyclomatic Complexity 1 include/linux/ktime.h:ns_to_ktime
   Cyclomatic Complexity 56 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 67 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 9 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 2 include/linux/uaccess.h:copy_from_user
   Cyclomatic Complexity 2 include/linux/uaccess.h:copy_to_user
   Cyclomatic Complexity 1 include/linux/ratelimit.h:ratelimit_set_flags
   Cyclomatic Complexity 1 include/drm/drm_mm.h:drm_mm_node_allocated
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_reg.h:i915_mmio_reg_offset
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_gem_request.h:dma_fence_is_i915
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_gem_request.h:i915_gem_request_global_seqno
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_gem_request.h:i915_seqno_passed
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_gem_request.h:i915_gem_active_raw
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_ringbuffer.h:intel_read_status_page
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_ringbuffer.h:intel_engine_get_seqno
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_vma.h:i915_vma_is_ggtt
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_vma.h:i915_vma_pin_count
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_vma.h:i915_vma_is_pinned
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_vma.h:__i915_vma_unpin
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:intel_info
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:i915_gem_object_has_pinned_pages
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:gen8_oa_hw_tail_read
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:gen7_oa_hw_tail_read
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:get_gpu_ts_from_oa_report
   Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_perf.c:config_oa_regs
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:hsw_disable_metric_set
   Cyclomatic Complexity 5 drivers/gpu//drm/i915/i915_perf.c:gen8_update_reg_state_unlocked
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:gen7_oa_disable
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:gen8_oa_disable
   Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_perf.c:i915_perf_read_locked
   Cyclomatic Complexity 3 arch/x86/include/asm/div64.h:div_u64_rem
   Cyclomatic Complexity 1 include/linux/math64.h:div_u64
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:oa_exponent_to_ns
   Cyclomatic Complexity 10 drivers/gpu//drm/i915/i915_perf.c:check_mmio_whitelist
   Cyclomatic Complexity 5 drivers/gpu//drm/i915/i915_perf.c:i915_perf_disable_locked
   Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_perf.c:i915_perf_poll_locked
   Cyclomatic Complexity 4 drivers/gpu//drm/i915/i915_perf.c:append_oa_status
   Cyclomatic Complexity 25 drivers/gpu//drm/i915/i915_perf.c:append_perf_sample
   Cyclomatic Complexity 21 drivers/gpu//drm/i915/i915_perf.c:append_cs_buffer_sample
   Cyclomatic Complexity 12 include/linux/poll.h:poll_wait
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:i915_perf_stream_poll_wait
   Cyclomatic Complexity 5 drivers/gpu//drm/i915/i915_perf.c:i915_perf_enable_locked
   Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_perf.c:i915_perf_ioctl_locked
   Cyclomatic Complexity 15 drivers/gpu//drm/i915/i915_perf.c:append_oa_buffer_sample
   Cyclomatic Complexity 1 include/linux/srcu.h:srcu_read_lock
   Cyclomatic Complexity 1 include/linux/srcu.h:srcu_read_unlock
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:i915_perf_ioctl
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:i915_perf_poll
   Cyclomatic Complexity 10 drivers/gpu//drm/i915/i915_perf.c:i915_perf_read
   Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_perf.c:oa_put_render_ctx_id
   Cyclomatic Complexity 10 drivers/gpu//drm/i915/i915_perf.c:copy_mmio_list
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 124 drivers/gpu//drm/i915/i915_perf.c:read_properties_unlocked
   Cyclomatic Complexity 2 include/linux/thread_info.h:copy_overflow
   Cyclomatic Complexity 11 drivers/gpu//drm/i915/i915_perf.c:gen8_oa_buffer_get_ctx_id
   Cyclomatic Complexity 9 drivers/gpu//drm/i915/i915_perf.c:gen7_oa_buffer_get_ctx_id
   Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_read_lock
   Cyclomatic Complexity 1 include/linux/idr.h:idr_find
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:__i915_gem_context_lookup_rcu
   Cyclomatic Complexity 1 include/linux/kref.h:kref_get_unless_zero
   Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_read_unlock
   Cyclomatic Complexity 4 drivers/gpu//drm/i915/i915_drv.h:i915_gem_context_lookup
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_ringbuffer.h:intel_ring_advance
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:__i915_gem_object_unpin_pages
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:i915_gem_object_unpin_pages
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:i915_gem_object_unpin_map
   Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_gem_request.h:__i915_gem_request_completed
   Cyclomatic Complexity 3 drivers/gpu//drm/i915/i915_gem_request.h:i915_gem_request_completed
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_vma.h:i915_ggtt_offset
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:gen8_init_oa_buffer
   Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_perf.c:gen8_oa_enable

vim +4022 drivers/gpu//drm/i915/i915_perf.c

  3867	
  3868	/**
  3869	 * read_properties_unlocked - validate + copy userspace stream open properties
  3870	 * @dev_priv: i915 device instance
  3871	 * @uprops: The array of u64 key value pairs given by userspace
  3872	 * @n_props: The number of key value pairs expected in @uprops
  3873	 * @props: The stream configuration built up while validating properties
  3874	 *
  3875	 * Note this function only validates properties in isolation it doesn't
  3876	 * validate that the combination of properties makes sense or that all
  3877	 * properties necessary for a particular kind of stream have been set.
  3878	 *
  3879	 * Note that there currently aren't any ordering requirements for properties so
  3880	 * we shouldn't validate or assume anything about ordering here. This doesn't
  3881	 * rule out defining new properties with ordering requirements in the future.
  3882	 */
  3883	static int read_properties_unlocked(struct drm_i915_private *dev_priv,
  3884					    u64 __user *uprops,
  3885					    u32 n_props,
  3886					    struct perf_open_properties *props)
  3887	{
  3888		u64 __user *uprop = uprops;
  3889		int i;
  3890	
  3891		memset(props, 0, sizeof(struct perf_open_properties));
  3892	
  3893		if (!n_props) {
  3894			DRM_DEBUG("No i915 perf properties given\n");
  3895			return -EINVAL;
  3896		}
  3897	
  3898		/* Considering that ID = 0 is reserved and assuming that we don't
  3899		 * (currently) expect any configurations to ever specify duplicate
  3900		 * values for a particular property ID then the last _PROP_MAX value is
  3901		 * one greater than the maximum number of properties we expect to get
  3902		 * from userspace.
  3903		 */
  3904		if (n_props >= DRM_I915_PERF_PROP_MAX) {
  3905			DRM_DEBUG("More i915 perf properties specified than exist\n");
  3906			return -EINVAL;
  3907		}
  3908	
  3909		for (i = 0; i < n_props; i++) {
  3910			u64 oa_period, oa_freq_hz;
  3911			u64 id, value;
  3912			int ret;
  3913	
  3914			ret = get_user(id, uprop);
  3915			if (ret)
  3916				return ret;
  3917	
  3918			ret = get_user(value, uprop + 1);
  3919			if (ret)
  3920				return ret;
  3921	
  3922			if (id == 0 || id >= DRM_I915_PERF_PROP_MAX) {
  3923				DRM_DEBUG("Unknown i915 perf property ID\n");
  3924				return -EINVAL;
  3925			}
  3926	
  3927			switch ((enum drm_i915_perf_property_id)id) {
  3928			case DRM_I915_PERF_PROP_CTX_HANDLE:
  3929				props->single_context = 1;
  3930				props->ctx_handle = value;
  3931				break;
  3932			case DRM_I915_PERF_PROP_SAMPLE_OA:
  3933				props->sample_flags |= SAMPLE_OA_REPORT;
  3934				break;
  3935			case DRM_I915_PERF_PROP_OA_METRICS_SET:
  3936				if (value == 0 ||
  3937				    value > dev_priv->perf.oa.n_builtin_sets) {
  3938					DRM_DEBUG("Unknown OA metric set ID\n");
  3939					return -EINVAL;
  3940				}
  3941				props->metrics_set = value;
  3942				break;
  3943			case DRM_I915_PERF_PROP_OA_FORMAT:
  3944				if (value == 0 || value >= I915_OA_FORMAT_MAX) {
  3945					DRM_DEBUG("Out-of-range OA report format %llu\n",
  3946						  value);
  3947					return -EINVAL;
  3948				}
  3949				if (!dev_priv->perf.oa.oa_formats[value].size) {
  3950					DRM_DEBUG("Unsupported OA report format %llu\n",
  3951						  value);
  3952					return -EINVAL;
  3953				}
  3954				props->oa_format = value;
  3955				break;
  3956			case DRM_I915_PERF_PROP_OA_EXPONENT:
  3957				if (value > OA_EXPONENT_MAX) {
  3958					DRM_DEBUG("OA timer exponent too high (> %u)\n",
  3959						 OA_EXPONENT_MAX);
  3960					return -EINVAL;
  3961				}
  3962	
  3963				/* Theoretically we can program the OA unit to sample
  3964				 * e.g. every 160ns for HSW, 167ns for BDW/SKL or 104ns
  3965				 * for BXT. We don't allow such high sampling
  3966				 * frequencies by default unless root.
  3967				 */
  3968	
  3969				BUILD_BUG_ON(sizeof(oa_period) != 8);
  3970				oa_period = oa_exponent_to_ns(dev_priv, value);
  3971	
  3972				/* This check is primarily to ensure that oa_period <=
  3973				 * UINT32_MAX (before passing to do_div which only
  3974				 * accepts a u32 denominator), but we can also skip
  3975				 * checking anything < 1Hz which implicitly can't be
  3976				 * limited via an integer oa_max_sample_rate.
  3977				 */
  3978				if (oa_period <= NSEC_PER_SEC) {
  3979					u64 tmp = NSEC_PER_SEC;
  3980					do_div(tmp, oa_period);
  3981					oa_freq_hz = tmp;
  3982				} else
  3983					oa_freq_hz = 0;
  3984	
  3985				if (oa_freq_hz > i915_oa_max_sample_rate &&
  3986				    !capable(CAP_SYS_ADMIN)) {
  3987					DRM_DEBUG("OA exponent would exceed the max sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n",
  3988						  i915_oa_max_sample_rate);
  3989					return -EACCES;
  3990				}
  3991	
  3992				props->oa_periodic = true;
  3993				props->oa_period_exponent = value;
  3994				break;
  3995			case DRM_I915_PERF_PROP_SAMPLE_OA_SOURCE:
  3996				props->sample_flags |= SAMPLE_OA_SOURCE;
  3997				break;
  3998			case DRM_I915_PERF_PROP_ENGINE: {
  3999					unsigned int user_ring_id =
  4000						value & I915_EXEC_RING_MASK;
  4001	
  4002					if (user_ring_id > I915_USER_RINGS)
  4003						return -EINVAL;
  4004	
  4005					props->cs_mode = true;
  4006					props->engine = user_ring_map[user_ring_id];
  4007				}
  4008				break;
  4009			case DRM_I915_PERF_PROP_SAMPLE_CTX_ID:
  4010				props->sample_flags |= SAMPLE_CTX_ID;
  4011				break;
  4012			case DRM_I915_PERF_PROP_SAMPLE_PID:
  4013				props->sample_flags |= SAMPLE_PID;
  4014				break;
  4015			case DRM_I915_PERF_PROP_SAMPLE_TAG:
  4016				props->sample_flags |= SAMPLE_TAG;
  4017				break;
  4018			case DRM_I915_PERF_PROP_SAMPLE_TS:
  4019				props->sample_flags |= SAMPLE_TS;
  4020				break;
  4021			case DRM_I915_PERF_PROP_SAMPLE_MMIO:
> 4022				ret = copy_mmio_list(dev_priv, (u64 __user *)value);
  4023				if (ret)
  4024					return ret;
  4025				props->sample_flags |= SAMPLE_MMIO;
  4026				break;
  4027			case DRM_I915_PERF_PROP_MAX:
  4028				MISSING_CASE(id);
  4029				return -EINVAL;
  4030			}
  4031	
  4032			uprop += 2;
  4033		}
  4034	
  4035		return 0;
  4036	}
  4037	

---
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]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux