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 01/10] drm/xe: Allocate dedicated workqueue for SR-IOV workers
Date: Fri, 29 Dec 2023 22:06:24 +0100	[thread overview]
Message-ID: <20231229210624.wbr62pode7kp2vdj@intel.com> (raw)
In-Reply-To: <20231227235838.212-2-michal.wajdeczko@intel.com>

Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on czw [2023-gru-28 00:58:29 +0100]:
> We plan to use several workers where we might be running long
> operations. Allocate dedicated workqueue to avoid undesired
> interaction with non-virtualized workers.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_device.c       |  4 +++
>  drivers/gpu/drm/xe/xe_device_types.h |  2 ++
>  drivers/gpu/drm/xe/xe_sriov.c        | 37 ++++++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_sriov.h        |  1 +
>  4 files changed, 44 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 86867d42d532..004e65544e8d 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -438,6 +438,10 @@ int xe_device_probe(struct xe_device *xe)
>  
>  	xe_pat_init_early(xe);
>  
> +	err = xe_sriov_init(xe);
> +	if (err)
> +		return err;
> +
>  	xe->info.mem_region_mask = 1;
>  	err = xe_display_init_nommio(xe);
>  	if (err)
> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
> index 71f23ac365e6..163d889d407b 100644
> --- a/drivers/gpu/drm/xe/xe_device_types.h
> +++ b/drivers/gpu/drm/xe/xe_device_types.h
> @@ -321,6 +321,8 @@ struct xe_device {
>  	struct {
>  		/** @sriov.__mode: SR-IOV mode (Don't access directly!) */
>  		enum xe_sriov_mode __mode;
> +		/** @sriov.wq: workqueue used by the virtualization workers */
> +		struct workqueue_struct *wq;
>  	} sriov;
>  
>  	/** @clients: drm clients info */
> diff --git a/drivers/gpu/drm/xe/xe_sriov.c b/drivers/gpu/drm/xe/xe_sriov.c
> index 42a0e0c917a0..4960e8f461c8 100644
> --- a/drivers/gpu/drm/xe/xe_sriov.c
> +++ b/drivers/gpu/drm/xe/xe_sriov.c
> @@ -3,6 +3,8 @@
>   * Copyright © 2023 Intel Corporation
>   */
>  
> +#include <drm/drm_managed.h>
> +
>  #include "xe_assert.h"
>  #include "xe_sriov.h"
>  
> @@ -53,3 +55,38 @@ void xe_sriov_probe_early(struct xe_device *xe, bool has_sriov)
>  		drm_info(&xe->drm, "Running in %s mode\n",
>  			 xe_sriov_mode_to_string(xe_device_sriov_mode(xe)));
>  }
> +
> +static void fini_sriov(struct drm_device *drm, void *arg)
> +{
> +	struct xe_device *xe = arg;
> +
> +	destroy_workqueue(xe->sriov.wq);
> +	xe->sriov.wq = NULL;
> +}
> +
> +/**
> + * xe_sriov_init - Initialize SR-IOV specific data.
> + * @xe: the &xe_device to initialize
> + *
> + * While most of the initialization errors would be fatal for the Virtual
> + * Function (VF) device driver, in case of the Physical Function (PF) we
> + * might just limit the PF functionality and continue run as a native
> + * (non-virtualized) driver.
> + *

The description suggests a functionality that has not yet been introduced
in this series.

> + * In this function we just create dedicated workqueue that will be used
> + * by the SR-IOV specific workers.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int xe_sriov_init(struct xe_device *xe)
> +{
> +	if (!IS_SRIOV(xe))
> +		return 0;
> +
> +	xe_assert(xe, !xe->sriov.wq);
> +	xe->sriov.wq = alloc_workqueue("xe-sriov-wq", 0, 0);
> +	if (!xe->sriov.wq)
> +		return -ENOMEM;
> +
> +	return drmm_add_action_or_reset(&xe->drm, fini_sriov, xe);
> +}
> diff --git a/drivers/gpu/drm/xe/xe_sriov.h b/drivers/gpu/drm/xe/xe_sriov.h
> index 5af73a3172b0..1545552162c9 100644
> --- a/drivers/gpu/drm/xe/xe_sriov.h
> +++ b/drivers/gpu/drm/xe/xe_sriov.h
> @@ -13,6 +13,7 @@
>  const char *xe_sriov_mode_to_string(enum xe_sriov_mode mode);
>  
>  void xe_sriov_probe_early(struct xe_device *xe, bool has_sriov);
> +int xe_sriov_init(struct xe_device *xe);
>  
>  static inline enum xe_sriov_mode xe_device_sriov_mode(struct xe_device *xe)
>  {

I would suggest remove the comment I mentioned so as not to confuse others until this
functionality actually appears.
However, the rest of the code is ok for me:
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>



> -- 
> 2.25.1
> 

-- 

  reply	other threads:[~2023-12-29 21:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-27 23:58 [PATCH 00/10] Introduce Relay Communication for SR-IOV Michal Wajdeczko
2023-12-27 23:58 ` [PATCH 01/10] drm/xe: Allocate dedicated workqueue for SR-IOV workers Michal Wajdeczko
2023-12-29 21:06   ` Piotr Piórkowski [this message]
2023-12-27 23:58 ` [PATCH 02/10] drm/xe: Define Virtual Function Identifier Michal Wajdeczko
2023-12-29 21:07   ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 03/10] drm/xe: Introduce GT-oriented SR-IOV logging macros Michal Wajdeczko
2023-12-29 21:07   ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 04/10] drm/xe/guc: Add helpers for HXG messages Michal Wajdeczko
2023-12-29 21:08   ` Piotr Piórkowski
2023-12-29 22:10     ` Michal Wajdeczko
2023-12-27 23:58 ` [PATCH 05/10] drm/xe/guc: Update few GuC CTB ABI definitions Michal Wajdeczko
2023-12-29 21:09   ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 06/10] drm/xe/guc: Add Relay Communication " Michal Wajdeczko
2023-12-29 21:09   ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 07/10] drm/xe/guc: Introduce Relay Communication for SR-IOV Michal Wajdeczko
2023-12-29 21:14   ` Piotr Piórkowski
2023-12-29 22:55     ` Michal Wajdeczko
2023-12-27 23:58 ` [PATCH 08/10] drm/xe/kunit: Allow to replace xe_guc_ct_send_recv() with stub Michal Wajdeczko
2023-12-29 21:15   ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 09/10] drm/xe/kunit: Add GuC Relay kunit tests Michal Wajdeczko
2023-12-29 21:15   ` Piotr Piórkowski
2023-12-27 23:58 ` [PATCH 10/10] drm/xe/guc: Start handling GuC Relay event messages Michal Wajdeczko
2023-12-29 21:16   ` Piotr Piórkowski
2024-01-04  5:43 ` ✓ CI.Patch_applied: success for Introduce Relay Communication for SR-IOV Patchwork
2024-01-04  5:43 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-04  5:44 ` ✓ CI.KUnit: success " Patchwork
2024-01-04  5:52 ` ✓ CI.Build: " Patchwork
2024-01-04  5:52 ` ✗ CI.Hooks: failure " Patchwork
2024-01-04  5:53 ` ✓ CI.checksparse: success " Patchwork
2024-01-04  6:30 ` ✗ CI.BAT: failure " 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=20231229210624.wbr62pode7kp2vdj@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