From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: "Piotr Piórkowski" <piotr.piorkowski@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 6/6] drm/xe/pf: Add support to configure SR-IOV VFs
Date: Mon, 15 Apr 2024 19:06:41 +0200 [thread overview]
Message-ID: <a46e00bc-6274-4d05-a4ea-45569b6ec821@intel.com> (raw)
In-Reply-To: <20240415142957.2tmcl7n6xyovbnia@intel.com>
On 15.04.2024 16:29, Piotr Piórkowski wrote:
> Michal Wajdeczko <michal.wajdeczko@intel.com> wrote on nie [2024-kwi-14 21:01:37 +0200]:
...
>> +static int pf_push_full_vf_config(struct xe_gt *gt, unsigned int vfid)
>> +{
>> + struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
>> + u32 max_cfg_dwords = SZ_4K / sizeof(u32);
>> + u32 num_dwords;
>> + int num_klvs;
>> + u32 *cfg;
>> + int err;
>> +
>> + cfg = kcalloc(max_cfg_dwords, sizeof(u32), GFP_KERNEL);
>> + if (!cfg)
>> + return -ENOMEM;
>> +
>> + num_dwords = encode_config(cfg, config);
>> + xe_gt_assert(gt, num_dwords <= max_cfg_dwords);
>> +
>
> NIT: I would add some commentary as to why in the case of media GT we do GGTT provisioning
> with values from primary GT.
> At first glance, it looks like we are adding KLV twice for GGTT - at least I caught myself
> doing that.
sure, will add small comment there (maybe also together with an assert
to enforce that there shall be no GGTT config on the media-GT that could
have been emitted by the encode_config()
...
>> +int xe_gt_sriov_pf_config_bulk_set_ggtt(struct xe_gt *gt, unsigned int vfid,
>> + unsigned int num_vfs, u64 size)
>> +{
>> + unsigned int n;
>> + int err = 0;
>> +
>> + xe_gt_assert(gt, vfid);
>> + xe_gt_assert(gt, !xe_gt_is_media_type(gt));
>> +
>
> NIT: Maybe you should add an assert here to check if vfid + num_vfs <= total_vfs
no really needed as there is an existing assert in pf_pick_vf_config()
helper which is called by most of the functions including the
pf_provision_vf_ggtt() from the loop below
>
>> + if (!num_vfs)
>> + return 0;
>> +
>> + mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
>> + for (n = vfid; n < vfid + num_vfs; n++) {
>> + err = pf_provision_vf_ggtt(gt, n, size);
>> + if (err)
>> + break;
>> + }
>> + mutex_unlock(xe_gt_sriov_pf_master_mutex(gt));
>> +
>> + return pf_config_bulk_set_u64_done(gt, vfid, num_vfs, size,
>> + xe_gt_sriov_pf_config_get_ggtt,
>> + "GGTT", n, err);
>> +}
...
>> +static u64 pf_estimate_fair_ggtt(struct xe_gt *gt, unsigned int num_vfs)
>> +{
>> + u64 available = pf_get_max_ggtt(gt);
>> + u64 alignment = pf_get_ggtt_alignment(gt);
>> + u64 fair;
>> +
>> + fair = div_u64(available, num_vfs);
>> + fair = ALIGN_DOWN(fair, alignment);
>> + xe_gt_sriov_dbg_verbose(gt, "GGTT available(%lluK) fair(%u x %lluK)\n",
>> + available / SZ_1K, num_vfs, fair / SZ_1K);
>> + return fair;
>> +}
> NIT: This is not the most optimal solution in any case.
> Perhaps it is worth noting here in the comment that it is a conscious decision
well, it's still the best solution for 1 VF
note that 'fair' allocations used by auto-provisioning are best-effort,
as we aim to expose some kind of uabi that will allow to setup specific
predefined configuration that could provide some SLA
anyway, added some comment in v2
>
>> +
>> +/**
>> + * xe_gt_sriov_pf_config_set_fair_ggtt - Provision many VFs with fair GGTT.
>> + * @gt: the &xe_gt (can't be media)
>> + * @vfid: starting VF identifier (can't be 0)
>> + * @num_vfs: number of VFs to provision
>> + *
>> + * This function can only be called on PF.
>> + *
>> + * Return: 0 on success or a negative error code on failure.
>> + */
>> +int xe_gt_sriov_pf_config_set_fair_ggtt(struct xe_gt *gt,
>> + unsigned int vfid, unsigned int num_vfs)
>
> NIT: In my opinion strangely divided into a new line these parameters
>
fixed in v2
...
>> +static const char *exec_quantum_unit(u32 exec_quantum)
>> +{
>> + return exec_quantum ? "ms" : "(inifinity)";
>
> typo
oops
...
>
> Several NITs, 2 typo (in the same word).
> But the functionality seems to be ok.
> After the necessary fixes (I mean mainly typo, but also pls consider my comments):
>
> Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
thanks!
Michal
next prev parent reply other threads:[~2024-04-15 17:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-14 19:01 [PATCH 0/6] PF: Add support to configure SR-IOV VFs Michal Wajdeczko
2024-04-14 19:01 ` [PATCH 1/6] drm/xe: Add helper to format SR-IOV function name Michal Wajdeczko
2024-04-15 3:47 ` Ghimiray, Himal Prasad
2024-04-15 7:56 ` Piotr Piórkowski
2024-04-15 8:30 ` Michal Wajdeczko
2024-04-14 19:01 ` [PATCH 2/6] drm/xe: Allow to assign GGTT region to the VF Michal Wajdeczko
2024-04-15 4:49 ` Ghimiray, Himal Prasad
2024-04-15 9:01 ` Michal Wajdeczko
2024-04-15 9:10 ` Piotr Piórkowski
2024-04-15 9:12 ` Ghimiray, Himal Prasad
2024-04-14 19:01 ` [PATCH 3/6] drm/xe: Add xe_ttm_vram_get_avail Michal Wajdeczko
2024-04-15 4:51 ` Ghimiray, Himal Prasad
2024-04-14 19:01 ` [PATCH 4/6] drm/xe/guc: Add PF2GUC_UPDATE_VF_CFG to ABI Michal Wajdeczko
2024-04-15 9:29 ` Piotr Piórkowski
2024-04-14 19:01 ` [PATCH 5/6] drm/xe/pf: Add SR-IOV PF specific early GT initialization Michal Wajdeczko
2024-04-15 5:19 ` Ghimiray, Himal Prasad
2024-04-15 8:14 ` Michal Wajdeczko
2024-04-14 19:01 ` [PATCH 6/6] drm/xe/pf: Add support to configure SR-IOV VFs Michal Wajdeczko
2024-04-15 14:29 ` Piotr Piórkowski
2024-04-15 17:06 ` Michal Wajdeczko [this message]
2024-04-15 17:15 ` ✓ CI.Patch_applied: success for PF: " Patchwork
2024-04-15 17:15 ` ✗ CI.checkpatch: warning " Patchwork
2024-04-15 17:16 ` ✓ CI.KUnit: success " Patchwork
2024-04-15 17:27 ` ✓ CI.Build: " Patchwork
2024-04-15 17:30 ` ✓ CI.Hooks: " Patchwork
2024-04-15 17:31 ` ✓ CI.checksparse: " Patchwork
2024-04-15 17:57 ` ✓ CI.BAT: " Patchwork
2024-04-16 3:44 ` ✓ 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=a46e00bc-6274-4d05-a4ea-45569b6ec821@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=piotr.piorkowski@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