Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 5/8] drm/xe/pf: Allow configuration of VF thresholds over debugfs
Date: Tue, 14 May 2024 11:03:50 +0200	[thread overview]
Message-ID: <20240514090350.qamnaxvbkqcce4o2@intel.com> (raw)
In-Reply-To: <20240506133814.2571-6-michal.wajdeczko@intel.com>

Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on pon [2024-maj-06 15:38:11 +0200]:
> Initial values of all thresholds used by the GuC to monitor VF's
> activity is zero (disabled) and we need to explicitly configure
> them per each VF. Expose additional attributes over debugfs.
> 
> Definitions of all attributes are generated so we will not need
> to make any changes if new thresholds would be added to the set.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c | 72 +++++++++++++++++++++
>  1 file changed, 72 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> index 5102035faa7e..eb71c2009c34 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> @@ -197,6 +197,71 @@ DEFINE_SRIOV_GT_CONFIG_DEBUGFS_ATTRIBUTE(dbs, u32, "%llu\n");
>  DEFINE_SRIOV_GT_CONFIG_DEBUGFS_ATTRIBUTE(exec_quantum, u32, "%llu\n");
>  DEFINE_SRIOV_GT_CONFIG_DEBUGFS_ATTRIBUTE(preempt_timeout, u32, "%llu\n");
>  
> +/*
> + *      /sys/kernel/debug/dri/0/
> + *      ├── gt0
> + *      │   ├── pf
> + *      │   │   ├── threshold_cat_error_count
> + *      │   │   ├── threshold_doorbell_time_us
> + *      │   │   ├── threshold_engine_reset_count
> + *      │   │   ├── threshold_guc_time_us
> + *      │   │   ├── threshold_irq_time_us
> + *      │   │   ├── threshold_page_fault_count
> + *      │   ├── vf1
> + *      │   │   ├── threshold_cat_error_count
> + *      │   │   ├── threshold_doorbell_time_us
> + *      │   │   ├── threshold_engine_reset_count
> + *      │   │   ├── threshold_guc_time_us
> + *      │   │   ├── threshold_irq_time_us
> + *      │   │   ├── threshold_page_fault_count

Only the comment is not as dynamically generated as the rest of the code :)

> + */
> +
> +static int set_threshold(void *data, u64 val, enum xe_guc_klv_threshold_index index)
> +{
> +	struct xe_gt *gt = extract_gt(data);
> +	unsigned int vfid = extract_vfid(data);
> +	struct xe_device *xe = gt_to_xe(gt);
> +	int err;
> +
> +	if (val > (u32)~0ull)
> +		return -EOVERFLOW;
> +
> +	xe_pm_runtime_get(xe);
> +	err = xe_gt_sriov_pf_config_set_threshold(gt, vfid, index, val);
> +	xe_pm_runtime_put(xe);
> +
> +	return err;
> +}
> +
> +static int get_threshold(void *data, u64 *val, enum xe_guc_klv_threshold_index index)
> +{
> +	struct xe_gt *gt = extract_gt(data);
> +	unsigned int vfid = extract_vfid(data);
> +
> +	*val = xe_gt_sriov_pf_config_get_threshold(gt, vfid, index);
> +	return 0;
> +}
> +
> +#define DEFINE_SRIOV_GT_THRESHOLD_DEBUGFS_ATTRIBUTE(THRESHOLD, INDEX)		\
> +										\
> +static int THRESHOLD##_set(void *data, u64 val)					\
> +{										\
> +	return set_threshold(data, val, INDEX);					\
> +}										\
> +										\
> +static int THRESHOLD##_get(void *data, u64 *val)				\
> +{										\
> +	return get_threshold(data, val, INDEX);					\
> +}										\
> +										\
> +DEFINE_DEBUGFS_ATTRIBUTE(THRESHOLD##_fops, THRESHOLD##_get, THRESHOLD##_set, "%llu\n")
> +
> +/* generate all threshold attributes */
> +#define define_threshold_attribute(TAG, NAME, ...) \
> +	DEFINE_SRIOV_GT_THRESHOLD_DEBUGFS_ATTRIBUTE(NAME, MAKE_XE_GUC_KLV_THRESHOLD_INDEX(TAG));
> +MAKE_XE_GUC_KLV_THRESHOLDS_SET(define_threshold_attribute)
> +#undef define_threshold_attribute
> +
>  static void pf_add_config_attrs(struct xe_gt *gt, struct dentry *parent, unsigned int vfid)
>  {
>  	xe_gt_assert(gt, gt == extract_gt(parent));
> @@ -217,6 +282,13 @@ static void pf_add_config_attrs(struct xe_gt *gt, struct dentry *parent, unsigne
>  				   &exec_quantum_fops);
>  	debugfs_create_file_unsafe("preempt_timeout_us", 0644, parent, parent,
>  				   &preempt_timeout_fops);
> +
> +	/* register all threshold attributes */
> +#define register_threshold_attribute(TAG, NAME, ...) \
> +	debugfs_create_file_unsafe("threshold_" #NAME, 0644, parent, parent, \
> +				   &NAME##_fops);
> +	MAKE_XE_GUC_KLV_THRESHOLDS_SET(register_threshold_attribute)
> +#undef register_threshold_attribute


LGTM:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>

>  }
>  
>  /*
> -- 
> 2.43.0
> 

-- 

  reply	other threads:[~2024-05-14  9:04 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 13:38 [PATCH 0/8] PF: Support for adverse events notifications Michal Wajdeczko
2024-05-06 13:38 ` [PATCH 1/8] drm/xe/guc: Add more KLV helper macros Michal Wajdeczko
2024-05-14  6:57   ` Piotr Piórkowski
2024-05-06 13:38 ` [PATCH 2/8] drm/xe/guc: Introduce GuC KLV thresholds set Michal Wajdeczko
2024-05-14  8:08   ` Piotr Piórkowski
2024-05-14 16:14     ` Michal Wajdeczko
2024-05-06 13:38 ` [PATCH 3/8] drm/xe/guc: Add support for threshold KLVs in to_string() helper Michal Wajdeczko
2024-05-14  8:20   ` Piotr Piórkowski
2024-05-14 16:15     ` Michal Wajdeczko
2024-05-06 13:38 ` [PATCH 4/8] drm/xe/pf: Introduce functions to configure VF thresholds Michal Wajdeczko
2024-05-14  8:31   ` Piotr Piórkowski
2024-05-14 16:19     ` Michal Wajdeczko
2024-05-06 13:38 ` [PATCH 5/8] drm/xe/pf: Allow configuration of VF thresholds over debugfs Michal Wajdeczko
2024-05-14  9:03   ` Piotr Piórkowski [this message]
2024-05-06 13:38 ` [PATCH 6/8] drm/xe/guc: Add GUC2PF_ADVERSE_EVENT to ABI Michal Wajdeczko
2024-05-14  9:14   ` Piotr Piórkowski
2024-05-06 13:38 ` [PATCH 7/8] drm/xe/pf: Track adverse events notifications from GuC Michal Wajdeczko
2024-05-14 10:37   ` Piotr Piórkowski
2024-05-14 16:23     ` Michal Wajdeczko
2024-05-06 13:38 ` [PATCH 8/8] drm/xe/pf: Expose PF monitor details via debugfs Michal Wajdeczko
2024-05-14 10:38   ` Piotr Piórkowski
2024-05-06 16:05 ` ✓ CI.Patch_applied: success for PF: Support for adverse events notifications Patchwork
2024-05-06 16:05 ` ✗ CI.checkpatch: warning " Patchwork
2024-05-06 16:06 ` ✓ CI.KUnit: success " Patchwork
2024-05-06 16:19 ` ✓ CI.Build: " Patchwork
2024-05-06 16:22 ` ✗ CI.Hooks: failure " Patchwork
2024-05-06 16:26 ` ✓ CI.checksparse: success " Patchwork
2024-05-06 17:48 ` ✓ CI.BAT: " Patchwork
2024-05-06 19:38 ` ✓ CI.FULL: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240514090350.qamnaxvbkqcce4o2@intel.com \
    --to=piotr.piorkowski@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox