[Intel-gfx] [PATCH v8 6/6] drm/i915/perf: Implement I915_PERF_ADD/REMOVE_CONFIG interface

kbuild test robot lkp at intel.com
Sun Jul 30 04:12:24 UTC 2017


Hi Lionel,

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.13-rc2 next-20170728]
[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/Add-support-for-loadable-OA-configs/20170730-082717
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
   include/linux/init.h:1: warning: no structured comments found
   include/linux/mod_devicetable.h:687: warning: Excess struct/union/enum/typedef member 'ver_major' description in 'fsl_mc_device_id'
   include/linux/mod_devicetable.h:687: warning: Excess struct/union/enum/typedef member 'ver_minor' description in 'fsl_mc_device_id'
   kernel/sched/core.c:2080: warning: No description found for parameter 'rf'
   kernel/sched/core.c:2080: warning: Excess function parameter 'cookie' description in 'try_to_wake_up_local'
   include/linux/wait.h:555: warning: No description found for parameter 'wq'
   include/linux/wait.h:555: warning: Excess function parameter 'wq_head' description in 'wait_event_interruptible_hrtimeout'
   include/linux/wait.h:759: warning: No description found for parameter 'wq_head'
   include/linux/wait.h:759: warning: Excess function parameter 'wq' description in 'wait_event_killable'
   include/linux/kthread.h:26: warning: Excess function parameter '...' description in 'kthread_create'
   kernel/sys.c:1: warning: no structured comments found
   include/linux/device.h:968: warning: No description found for parameter 'dma_ops'
   drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found
   include/linux/iio/iio.h:603: warning: No description found for parameter 'trig_readonly'
   include/linux/iio/trigger.h:151: warning: No description found for parameter 'indio_dev'
   include/linux/iio/trigger.h:151: warning: No description found for parameter 'trig'
   include/linux/device.h:969: warning: No description found for parameter 'dma_ops'
   drivers/ata/libata-eh.c:1449: warning: No description found for parameter 'link'
   drivers/ata/libata-eh.c:1449: warning: Excess function parameter 'ap' description in 'ata_eh_done'
   drivers/ata/libata-eh.c:1590: warning: No description found for parameter 'qc'
   drivers/ata/libata-eh.c:1590: warning: Excess function parameter 'dev' description in 'ata_eh_request_sense'
   drivers/mtd/nand/nand_base.c:2751: warning: Excess function parameter 'cached' description in 'nand_write_page'
   drivers/mtd/nand/nand_base.c:2751: warning: Excess function parameter 'cached' description in 'nand_write_page'
   arch/s390/include/asm/cmb.h:1: warning: no structured comments found
   drivers/scsi/scsi_lib.c:1116: warning: No description found for parameter 'rq'
   drivers/scsi/constants.c:1: warning: no structured comments found
   include/linux/usb/gadget.h:230: warning: No description found for parameter 'claimed'
   include/linux/usb/gadget.h:230: warning: No description found for parameter 'enabled'
   include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_altset_not_supp'
   include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_stall_not_supp'
   include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_zlp_not_supp'
   fs/inode.c:1666: warning: No description found for parameter 'rcu'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_next_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_list'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_vfs_inode'
   include/linux/jbd2.h:443: warning: No description found for parameter 'i_flags'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_rsv_handle'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_reserved'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_type'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_line_no'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_start_jiffies'
   include/linux/jbd2.h:497: warning: No description found for parameter 'h_requested_credits'
   include/linux/jbd2.h:497: warning: No description found for parameter 'saved_alloc_context'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chkpt_bhs'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_devname'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_average_commit_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_min_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_max_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_commit_callback'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_failed_commit'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chksum_driver'
   include/linux/jbd2.h:1050: warning: No description found for parameter 'j_csum_seed'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'type'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'line_no'
   fs/jbd2/transaction.c:641: warning: No description found for parameter 'gfp_mask'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'debugfs_init'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_open_object'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_close_object'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'prime_handle_to_fd'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'prime_fd_to_handle'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_export'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_import'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_pin'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_unpin'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_res_obj'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_get_sg_table'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_import_sg_table'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_vmap'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_vunmap'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_prime_mmap'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'gem_vm_ops'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'major'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'minor'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'patchlevel'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'name'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'desc'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'date'
   include/drm/drm_drv.h:553: warning: No description found for parameter 'driver_features'
   drivers/gpu/drm/drm_modes.c:1623: warning: No description found for parameter 'display'
   drivers/gpu/drm/drm_modes.c:1623: warning: Excess function parameter 'connector' description in 'drm_mode_is_420_only'
   drivers/gpu/drm/drm_syncobj.c:341: warning: Excess function parameter 'dev' description in 'drm_syncobj_open'
   drivers/gpu/drm/drm_syncobj.c:366: warning: Excess function parameter 'dev' description in 'drm_syncobj_release'
   include/drm/drm_syncobj.h:1: warning: no structured comments found
   drivers/gpu/drm/drm_syncobj.c:342: warning: Excess function parameter 'dev' description in 'drm_syncobj_open'
   drivers/gpu/drm/drm_syncobj.c:367: warning: Excess function parameter 'dev' description in 'drm_syncobj_release'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: Excess function parameter 'dev_priv' description in 'i915_perf_add_config_ioctl'
   drivers/gpu/drm/i915/i915_perf.c:3296: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3296: warning: Excess function parameter 'dev_priv' description in 'i915_perf_remove_config_ioctl'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: Excess function parameter 'dev_priv' description in 'i915_perf_add_config_ioctl'
   drivers/gpu/drm/i915/i915_perf.c:3296: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3296: warning: Excess function parameter 'dev_priv' description in 'i915_perf_remove_config_ioctl'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: Excess function parameter 'dev_priv' description in 'i915_perf_add_config_ioctl'
   drivers/gpu/drm/i915/i915_perf.c:3296: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3296: warning: Excess function parameter 'dev_priv' description in 'i915_perf_remove_config_ioctl'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: Excess function parameter 'dev_priv' description in 'i915_perf_add_config_ioctl'
   drivers/gpu/drm/i915/i915_perf.c:3296: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3296: warning: Excess function parameter 'dev_priv' description in 'i915_perf_remove_config_ioctl'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: Excess function parameter 'dev_priv' description in 'i915_perf_add_config_ioctl'
   drivers/gpu/drm/i915/i915_perf.c:3296: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3296: warning: Excess function parameter 'dev_priv' description in 'i915_perf_remove_config_ioctl'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: Excess function parameter 'dev_priv' description in 'i915_perf_add_config_ioctl'
   drivers/gpu/drm/i915/i915_perf.c:3296: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3296: warning: Excess function parameter 'dev_priv' description in 'i915_perf_remove_config_ioctl'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: No description found for parameter 'dev'
>> drivers/gpu/drm/i915/i915_perf.c:3147: warning: Excess function parameter 'dev_priv' description in 'i915_perf_add_config_ioctl'
   drivers/gpu/drm/i915/i915_perf.c:3296: warning: No description found for parameter 'dev'

vim +/dev +3147 drivers/gpu/drm/i915/i915_perf.c

  3131	
  3132	/**
  3133	 * i915_perf_add_config_ioctl - DRM ioctl() for userspace to add a new OA config
  3134	 * @dev_priv: i915 device instance
  3135	 * @data: ioctl data (pointer to struct drm_i915_perf_oa_config) copied from
  3136	 *        userspace (unvalidated)
  3137	 * @file: drm file
  3138	 *
  3139	 * Validates the submitted OA register to be saved into a new OA config that
  3140	 * can then be used for programming the OA unit and its NOA network.
  3141	 *
  3142	 * Returns: A new allocated config number to be used with the perf open ioctl
  3143	 * or a negative error code on failure.
  3144	 */
  3145	int i915_perf_add_config_ioctl(struct drm_device *dev, void *data,
  3146				       struct drm_file *file)
> 3147	{
  3148		struct drm_i915_private *dev_priv = dev->dev_private;
  3149		struct drm_i915_perf_oa_config *args = data;
  3150		struct i915_oa_config *oa_config, *tmp;
  3151		int err, id;
  3152	
  3153		if (!dev_priv->perf.initialized) {
  3154			DRM_DEBUG("i915 perf interface not available for this system\n");
  3155			return -ENOTSUPP;
  3156		}
  3157	
  3158		if (!dev_priv->perf.metrics_kobj) {
  3159			DRM_DEBUG("OA metrics weren't advertised via sysfs\n");
  3160			return -EINVAL;
  3161		}
  3162	
  3163		if (i915_perf_stream_paranoid && !capable(CAP_SYS_ADMIN)) {
  3164			DRM_DEBUG("Insufficient privileges to add i915 OA config\n");
  3165			return -EACCES;
  3166		}
  3167	
  3168		if ((!args->mux_regs_ptr || !args->n_mux_regs) &&
  3169		    (!args->boolean_regs_ptr || !args->n_boolean_regs) &&
  3170		    (!args->flex_regs_ptr || !args->n_flex_regs)) {
  3171			DRM_DEBUG("No OA registers given\n");
  3172			return -EINVAL;
  3173		}
  3174	
  3175		oa_config = kzalloc(sizeof(*oa_config), GFP_KERNEL);
  3176		if (!oa_config) {
  3177			DRM_DEBUG("Failed to allocate memory for the OA config\n");
  3178			return -ENOMEM;
  3179		}
  3180	
  3181		atomic_set(&oa_config->ref_count, 1);
  3182	
  3183		if (!uuid_is_valid(args->uuid)) {
  3184			DRM_DEBUG("Invalid uuid format for OA config\n");
  3185			err = -EINVAL;
  3186			goto reg_err;
  3187		}
  3188	
  3189		/* Last character in oa_config->uuid will be 0 because oa_config is
  3190		 * kzalloc.
  3191		 */
  3192		memcpy(oa_config->uuid, args->uuid, sizeof(args->uuid));
  3193	
  3194		oa_config->mux_regs_len = args->n_mux_regs;
  3195		oa_config->mux_regs =
  3196			alloc_oa_regs(dev_priv,
  3197				      dev_priv->perf.oa.ops.is_valid_mux_reg,
  3198				      u64_to_user_ptr(args->mux_regs_ptr),
  3199				      args->n_mux_regs);
  3200	
  3201		if (IS_ERR(oa_config->mux_regs)) {
  3202			DRM_DEBUG("Failed to create OA config for mux_regs\n");
  3203			err = PTR_ERR(oa_config->mux_regs);
  3204			goto reg_err;
  3205		}
  3206	
  3207		oa_config->b_counter_regs_len = args->n_boolean_regs;
  3208		oa_config->b_counter_regs =
  3209			alloc_oa_regs(dev_priv,
  3210				      dev_priv->perf.oa.ops.is_valid_b_counter_reg,
  3211				      u64_to_user_ptr(args->boolean_regs_ptr),
  3212				      args->n_boolean_regs);
  3213	
  3214		if (IS_ERR(oa_config->b_counter_regs)) {
  3215			DRM_DEBUG("Failed to create OA config for b_counter_regs\n");
  3216			err = PTR_ERR(oa_config->b_counter_regs);
  3217			goto reg_err;
  3218		}
  3219	
  3220		if (INTEL_GEN(dev_priv) < 8) {
  3221			if (args->n_flex_regs != 0) {
  3222				err = -EINVAL;
  3223				goto reg_err;
  3224			}
  3225		} else {
  3226			oa_config->flex_regs_len = args->n_flex_regs;
  3227			oa_config->flex_regs =
  3228				alloc_oa_regs(dev_priv,
  3229					      dev_priv->perf.oa.ops.is_valid_flex_reg,
  3230					      u64_to_user_ptr(args->flex_regs_ptr),
  3231					      args->n_flex_regs);
  3232	
  3233			if (IS_ERR(oa_config->flex_regs)) {
  3234				DRM_DEBUG("Failed to create OA config for flex_regs\n");
  3235				err = PTR_ERR(oa_config->flex_regs);
  3236				goto reg_err;
  3237			}
  3238		}
  3239	
  3240		err = mutex_lock_interruptible(&dev_priv->perf.metrics_lock);
  3241		if (err)
  3242			goto reg_err;
  3243	
  3244		/* We shouldn't have too many configs, so this iteration shouldn't be
  3245		 * too costly.
  3246		 */
  3247		idr_for_each_entry(&dev_priv->perf.metrics_idr, tmp, id) {
  3248			if (!strcmp(tmp->uuid, oa_config->uuid)) {
  3249				DRM_DEBUG("OA config already exists with this uuid\n");
  3250				err = -EADDRINUSE;
  3251				goto sysfs_err;
  3252			}
  3253		}
  3254	
  3255		err = create_dynamic_oa_sysfs_entry(dev_priv, oa_config);
  3256		if (err) {
  3257			DRM_DEBUG("Failed to create sysfs entry for OA config\n");
  3258			goto sysfs_err;
  3259		}
  3260	
  3261		/* Config id 0 is invalid, id 1 for kernel stored test config. */
  3262		oa_config->id = idr_alloc(&dev_priv->perf.metrics_idr,
  3263					  oa_config, 2,
  3264					  0, GFP_KERNEL);
  3265		if (oa_config->id < 0) {
  3266			DRM_DEBUG("Failed to create sysfs entry for OA config\n");
  3267			err = oa_config->id;
  3268			goto sysfs_err;
  3269		}
  3270	
  3271		mutex_unlock(&dev_priv->perf.metrics_lock);
  3272	
  3273		return oa_config->id;
  3274	
  3275	sysfs_err:
  3276		mutex_unlock(&dev_priv->perf.metrics_lock);
  3277	reg_err:
  3278		put_oa_config(dev_priv, oa_config);
  3279		DRM_DEBUG("Failed to add new OA config\n");
  3280		return err;
  3281	}
  3282	
  3283	/**
  3284	 * i915_perf_remove_config_ioctl - DRM ioctl() for userspace to remove an OA config
  3285	 * @dev_priv: i915 device instance
  3286	 * @data: ioctl data (pointer to u64 integer) copied from userspace
  3287	 * @file: drm file
  3288	 *
  3289	 * Configs can be removed while being used, the will stop appearing in sysfs
  3290	 * and their content will be freed when the stream using the config is closed.
  3291	 *
  3292	 * Returns: 0 on success or a negative error code on failure.
  3293	 */
  3294	int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data,
  3295					  struct drm_file *file)
> 3296	{
  3297		struct drm_i915_private *dev_priv = dev->dev_private;
  3298		u64 *arg = data;
  3299		struct i915_oa_config *oa_config;
  3300		int ret;
  3301	
  3302		if (!dev_priv->perf.initialized) {
  3303			DRM_DEBUG("i915 perf interface not available for this system\n");
  3304			return -ENOTSUPP;
  3305		}
  3306	
  3307		if (i915_perf_stream_paranoid && !capable(CAP_SYS_ADMIN)) {
  3308			DRM_DEBUG("Insufficient privileges to remove i915 OA config\n");
  3309			return -EACCES;
  3310		}
  3311	
  3312		ret = mutex_lock_interruptible(&dev_priv->perf.metrics_lock);
  3313		if (ret)
  3314			goto lock_err;
  3315	
  3316		oa_config = idr_find(&dev_priv->perf.metrics_idr, *arg);
  3317		if (!oa_config) {
  3318			DRM_DEBUG("Failed to remove unknown OA config\n");
  3319			ret = -ENOENT;
  3320			goto config_err;
  3321		}
  3322	
  3323		GEM_BUG_ON(*arg != oa_config->id);
  3324	
  3325		sysfs_remove_group(dev_priv->perf.metrics_kobj,
  3326				   &oa_config->sysfs_metric);
  3327	
  3328		idr_remove(&dev_priv->perf.metrics_idr, *arg);
  3329		put_oa_config(dev_priv, oa_config);
  3330	
  3331	config_err:
  3332		mutex_unlock(&dev_priv->perf.metrics_lock);
  3333	lock_err:
  3334		return ret;
  3335	}
  3336	

---
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: 6750 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20170730/7fccf22a/attachment-0001.gz>


More information about the Intel-gfx mailing list