From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: "Lis, Tomasz" <tomasz.lis@intel.com>, intel-xe@lists.freedesktop.org
Cc: "Michał Winiarski" <michal.winiarski@intel.com>,
"Piotr Piórkowski" <piotr.piorkowski@intel.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Lucas De Marchi" <lucas.demarchi@intel.com>
Subject: Re: [PATCH v7 4/4] drm/xe/vf: Fixup CTB send buffer messages after migration
Date: Thu, 10 Apr 2025 20:24:05 +0200 [thread overview]
Message-ID: <bb89a891-bc4f-4818-870d-77d14e9b4e00@intel.com> (raw)
In-Reply-To: <d1c9b224-685b-4f1d-9776-f12131f15331@intel.com>
On 09.04.2025 23:09, Lis, Tomasz wrote:
>
> On 08.04.2025 16:23, Michal Wajdeczko wrote:
>> On 03.04.2025 20:40, Tomasz Lis wrote:
...
>>> + u32 msg[1];
>> u32 msg;
>> or
>> u32 msg[GUC_HXG_MSG_MIN_LEN];
> I want an array, so will go with 2nd. Though this looks like unjustified
> obfuscation to me.
using magic "1" is an obfuscation to me
....
>>> + struct guc_ctb *h2g,
>> nit: this is redundant
> oh I see. by "this" you mean a spaced out separate line.
no, I just repeat that all your fixup is about H2G and since we pass ct
each helper function can easily find pointer to h2g
passing struct guc_ctb * as separate parameter may suggest that
something other than h2g could be handled (but we don't need this)
...
>>> + /* Read header */
>> you should at least assert that avail > 0 before reading even single u32
>>
>> xe_gt_assert(gt, avail >= GUC_CTB_MSG_MIN_LEN);
> This is a static function, and the caller is ensuring that. But sure, I
> can add the assert.
>> but since it is called in the loop, more appropriate would be:
>>
>> if (avail < GUC_CTB_MSG_MIN_LEN)
>> goto broken;
>
> I don't know what you mean by that. There are not that many
> possibilities for an integer value greater than 0 but smaller than 1.
caller just checks for avail > 0
but we shall check for avail >= GUC_CTB_MSG_MIN_LEN
and we should not make any assumptions about GUC_CTB_MSG_MIN_LEN value
>
> And by the changes I agreed to above and below, we've already ensured
> that GUC_CTB_MSG_MIN_LEN can only be equal to 1.
we are adding checks for 'avail'
we are not making new assumptions about ABI values
...
>> maybe it's time to introduce
>>
>> u32 move_head(u32 head, u32 step, u32 size)
> We are overdefining a lot of things already. I don't think we should
> press even harder in that direction.
it's about avoiding duplicated code and wrap it into named helper
...
>>> +
>>> +/**
>>> + * xe_guc_ct_fixup_messages_with_ggtt - Fixup any pending H2G CTB
>>> messages
>>> + * @ct: pointer to CT struct of the target GuC
>>> + * @ggtt_shift: shift to be added to all GGTT addresses within the CTB
>>> + *
>>> + * Messages in guc-to-host CTB are owned by GuC and any fixups in them
>>> + * are made by GuC. But content of the host-to-guc CTB is owned by the
>>> + * KMD, so fixups to GGTT references in any pending messages need to be
>>> + * applied here.
>> s/guc-to-host/H2G
>>
>> like you have earlier and below
> Earlier is a short description. Below I am using shortcut after defining
> it in this line. This is how the long comments should look like,
> abbreviations should be defined.
but I guess you should be aware right now that your code is not the
first that introduces the CTB feature, including G2H and H2G concept and
naming, so really above kernel-doc is not a right place to suddenly use
"guc-to-host" term (which is a bad notation anyway)
next prev parent reply other threads:[~2025-04-10 18:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 18:40 [PATCH v7 0/4] drm/xe/vf: Post-migration recovery of GGTT nodes and CTB Tomasz Lis
2025-04-03 18:40 ` [PATCH v7 1/4] drm/xe/vf: Divide GGTT ballooning into allocation and insertion Tomasz Lis
2025-04-08 11:59 ` Michal Wajdeczko
2025-04-09 20:58 ` Lis, Tomasz
2025-04-03 18:40 ` [PATCH v7 2/4] drm/xe/vf: Shifting GGTT area post migration Tomasz Lis
2025-04-08 13:23 ` Michal Wajdeczko
2025-04-09 21:03 ` Lis, Tomasz
2025-04-03 18:40 ` [PATCH v7 3/4] drm/xe/guc: Introduce enum with offsets for context register H2Gs Tomasz Lis
2025-04-08 13:34 ` Michal Wajdeczko
2025-04-09 21:04 ` Lis, Tomasz
2025-04-03 18:40 ` [PATCH v7 4/4] drm/xe/vf: Fixup CTB send buffer messages after migration Tomasz Lis
2025-04-08 14:23 ` Michal Wajdeczko
2025-04-09 21:09 ` Lis, Tomasz
2025-04-10 18:24 ` Michal Wajdeczko [this message]
2025-04-11 14:34 ` Lis, Tomasz
2025-04-04 0:22 ` ✓ CI.Patch_applied: success for drm/xe/vf: Post-migration recovery of GGTT nodes and CTB (rev6) Patchwork
2025-04-04 0:23 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-04 0:24 ` ✓ CI.KUnit: success " Patchwork
2025-04-04 0:40 ` ✓ CI.Build: " Patchwork
2025-04-04 0:43 ` ✓ CI.Hooks: " Patchwork
2025-04-04 0:44 ` ✓ CI.checksparse: " Patchwork
2025-04-04 1:29 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-04-04 10:12 ` ✓ Xe.CI.Full: success " 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=bb89a891-bc4f-4818-870d-77d14e9b4e00@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.brost@intel.com \
--cc=michal.winiarski@intel.com \
--cc=piotr.piorkowski@intel.com \
--cc=tomasz.lis@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