[Intel-gfx] [PATCH v15 06/13] drm/i915/perf: move perf types to their own header

kbuild test robot lkp at intel.com
Sat Sep 7 03:23:33 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-rc7]
[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: i386-randconfig-b001-201935 (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=i386 

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

All errors (new ones prefixed by >>):

   In file included from drivers/gpu/drm/i915/i915_perf.h:11:0,
                    from <command-line>:0:
>> drivers/gpu/drm/i915/i915_perf_types.h:25:2: error: unknown type name 'i915_reg_t'
     i915_reg_t addr;
     ^~~~~~~~~~
>> drivers/gpu/drm/i915/i915_perf_types.h:30:12: error: 'UUID_STRING_LEN' undeclared here (not in a function); did you mean '_LINUX_STRING_H_'?
     char uuid[UUID_STRING_LEN + 1];
               ^~~~~~~~~~~~~~~
               _LINUX_STRING_H_
>> drivers/gpu/drm/i915/i915_perf_types.h:73:6: error: unknown type name 'poll_table'; did you mean 'poll_to_key'?
         poll_table *wait);
         ^~~~~~~~~~
         poll_to_key
>> drivers/gpu/drm/i915/i915_perf_types.h:126:2: error: unknown type name 'intel_wakeref_t'
     intel_wakeref_t wakeref;
     ^~~~~~~~~~~~~~~

vim +/i915_reg_t +25 drivers/gpu/drm/i915/i915_perf_types.h

    23	
    24	struct i915_oa_reg {
  > 25		i915_reg_t addr;
    26		u32 value;
    27	};
    28	
    29	struct i915_oa_config {
  > 30		char uuid[UUID_STRING_LEN + 1];
    31		int id;
    32	
    33		const struct i915_oa_reg *mux_regs;
    34		u32 mux_regs_len;
    35		const struct i915_oa_reg *b_counter_regs;
    36		u32 b_counter_regs_len;
    37		const struct i915_oa_reg *flex_regs;
    38		u32 flex_regs_len;
    39	
    40		struct attribute_group sysfs_metric;
    41		struct attribute *attrs[2];
    42		struct device_attribute sysfs_metric_id;
    43	
    44		atomic_t ref_count;
    45	};
    46	
    47	struct i915_perf_stream;
    48	
    49	/**
    50	 * struct i915_perf_stream_ops - the OPs to support a specific stream type
    51	 */
    52	struct i915_perf_stream_ops {
    53		/**
    54		 * @enable: Enables the collection of HW samples, either in response to
    55		 * `I915_PERF_IOCTL_ENABLE` or implicitly called when stream is opened
    56		 * without `I915_PERF_FLAG_DISABLED`.
    57		 */
    58		void (*enable)(struct i915_perf_stream *stream);
    59	
    60		/**
    61		 * @disable: Disables the collection of HW samples, either in response
    62		 * to `I915_PERF_IOCTL_DISABLE` or implicitly called before destroying
    63		 * the stream.
    64		 */
    65		void (*disable)(struct i915_perf_stream *stream);
    66	
    67		/**
    68		 * @poll_wait: Call poll_wait, passing a wait queue that will be woken
    69		 * once there is something ready to read() for the stream
    70		 */
    71		void (*poll_wait)(struct i915_perf_stream *stream,
    72				  struct file *file,
  > 73				  poll_table *wait);
    74	
    75		/**
    76		 * @wait_unlocked: For handling a blocking read, wait until there is
    77		 * something to ready to read() for the stream. E.g. wait on the same
    78		 * wait queue that would be passed to poll_wait().
    79		 */
    80		int (*wait_unlocked)(struct i915_perf_stream *stream);
    81	
    82		/**
    83		 * @read: Copy buffered metrics as records to userspace
    84		 * **buf**: the userspace, destination buffer
    85		 * **count**: the number of bytes to copy, requested by userspace
    86		 * **offset**: zero at the start of the read, updated as the read
    87		 * proceeds, it represents how many bytes have been copied so far and
    88		 * the buffer offset for copying the next record.
    89		 *
    90		 * Copy as many buffered i915 perf samples and records for this stream
    91		 * to userspace as will fit in the given buffer.
    92		 *
    93		 * Only write complete records; returning -%ENOSPC if there isn't room
    94		 * for a complete record.
    95		 *
    96		 * Return any error condition that results in a short read such as
    97		 * -%ENOSPC or -%EFAULT, even though these may be squashed before
    98		 * returning to userspace.
    99		 */
   100		int (*read)(struct i915_perf_stream *stream,
   101			    char __user *buf,
   102			    size_t count,
   103			    size_t *offset);
   104	
   105		/**
   106		 * @destroy: Cleanup any stream specific resources.
   107		 *
   108		 * The stream will always be disabled before this is called.
   109		 */
   110		void (*destroy)(struct i915_perf_stream *stream);
   111	};
   112	
   113	/**
   114	 * struct i915_perf_stream - state for a single open stream FD
   115	 */
   116	struct i915_perf_stream {
   117		/**
   118		 * @dev_priv: i915 drm device
   119		 */
   120		struct drm_i915_private *dev_priv;
   121	
   122		/**
   123		 * @wakeref: As we keep the device awake while the perf stream is
   124		 * active, we track our runtime pm reference for later release.
   125		 */
 > 126		intel_wakeref_t wakeref;
   127	
   128		/**
   129		 * @engine: Engine associated with this performance stream.
   130		 */
   131		struct intel_engine_cs *engine;
   132	
   133		/**
   134		 * @sample_flags: Flags representing the `DRM_I915_PERF_PROP_SAMPLE_*`
   135		 * properties given when opening a stream, representing the contents
   136		 * of a single sample as read() by userspace.
   137		 */
   138		u32 sample_flags;
   139	
   140		/**
   141		 * @sample_size: Considering the configured contents of a sample
   142		 * combined with the required header size, this is the total size
   143		 * of a single sample record.
   144		 */
   145		int sample_size;
   146	
   147		/**
   148		 * @ctx: %NULL if measuring system-wide across all contexts or a
   149		 * specific context that is being monitored.
   150		 */
   151		struct i915_gem_context *ctx;
   152	
   153		/**
   154		 * @enabled: Whether the stream is currently enabled, considering
   155		 * whether the stream was opened in a disabled state and based
   156		 * on `I915_PERF_IOCTL_ENABLE` and `I915_PERF_IOCTL_DISABLE` calls.
   157		 */
   158		bool enabled;
   159	
   160		/**
   161		 * @ops: The callbacks providing the implementation of this specific
   162		 * type of configured stream.
   163		 */
   164		const struct i915_perf_stream_ops *ops;
   165	
   166		/**
   167		 * @oa_config: The OA configuration used by the stream.
   168		 */
   169		struct i915_oa_config *oa_config;
   170	
   171		/**
   172		 * The OA context specific information.
   173		 */
   174		struct intel_context *pinned_ctx;
   175		u32 specific_ctx_id;
   176		u32 specific_ctx_id_mask;
   177	
   178		struct hrtimer poll_check_timer;
   179		wait_queue_head_t poll_wq;
   180		bool pollin;
   181	
   182		bool periodic;
   183		int period_exponent;
   184	
   185		/**
   186		 * State of the OA buffer.
   187		 */
   188		struct {
   189			struct i915_vma *vma;
   190			u8 *vaddr;
   191			u32 last_ctx_id;
   192			int format;
   193			int format_size;
   194			int size_exponent;
   195	
   196			/**
   197			 * Locks reads and writes to all head/tail state
   198			 *
   199			 * Consider: the head and tail pointer state needs to be read
   200			 * consistently from a hrtimer callback (atomic context) and
   201			 * read() fop (user context) with tail pointer updates happening
   202			 * in atomic context and head updates in user context and the
   203			 * (unlikely) possibility of read() errors needing to reset all
   204			 * head/tail state.
   205			 *
   206			 * Note: Contention/performance aren't currently a significant
   207			 * concern here considering the relatively low frequency of
   208			 * hrtimer callbacks (5ms period) and that reads typically only
   209			 * happen in response to a hrtimer event and likely complete
   210			 * before the next callback.
   211			 *
   212			 * Note: This lock is not held *while* reading and copying data
   213			 * to userspace so the value of head observed in htrimer
   214			 * callbacks won't represent any partial consumption of data.
   215			 */
   216			spinlock_t ptr_lock;
   217	
   218			/**
   219			 * One 'aging' tail pointer and one 'aged' tail pointer ready to
   220			 * used for reading.
   221			 *
   222			 * Initial values of 0xffffffff are invalid and imply that an
   223			 * update is required (and should be ignored by an attempted
   224			 * read)
   225			 */
   226			struct {
   227				u32 offset;
   228			} tails[2];
   229	
   230			/**
   231			 * Index for the aged tail ready to read() data up to.
   232			 */
   233			unsigned int aged_tail_idx;
   234	
   235			/**
   236			 * A monotonic timestamp for when the current aging tail pointer
   237			 * was read; used to determine when it is old enough to trust.
   238			 */
   239			u64 aging_timestamp;
   240	
   241			/**
   242			 * Although we can always read back the head pointer register,
   243			 * we prefer to avoid trusting the HW state, just to avoid any
   244			 * risk that some hardware condition could * somehow bump the
   245			 * head pointer unpredictably and cause us to forward the wrong
   246			 * OA buffer data to userspace.
   247			 */
   248			u32 head;
   249		} oa_buffer;
   250	};
   251	

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


More information about the Intel-gfx mailing list