Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Patelczyk <maciej.patelczyk@intel.com>
To: <intel-xe@lists.freedesktop.org>,
	Matthew Brost <matthew.brost@intel.com>
Subject: Re: [PATCH v4 06/12] drm/xe: Engine class and instance into a u8
Date: Thu, 7 May 2026 18:20:24 +0200	[thread overview]
Message-ID: <dce056cc-eb59-41b9-ad01-d8a0cde7a5db@intel.com> (raw)
In-Reply-To: <e9b9b4da-9604-488b-89fa-8e69e8e4c432@intel.com>


On 06/05/2026 18:04, Maciej Patelczyk wrote:
> On 26/02/2026 05:28, Matthew Brost wrote:
>
>> Pack the engine class and instance fields into a single u8 to save space
>> in struct xe_pagefault. This also makes future extensions easier.
>>
>> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_guc_pagefault.c   |  7 +++++--
>>   drivers/gpu/drm/xe/xe_pagefault.c       | 12 ++++++++----
>>   drivers/gpu/drm/xe/xe_pagefault_types.h | 10 ++++++----
>>   3 files changed, 19 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_guc_pagefault.c 
>> b/drivers/gpu/drm/xe/xe_guc_pagefault.c
>> index 607e32392f46..2470faf3d5d8 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_pagefault.c
>> +++ b/drivers/gpu/drm/xe/xe_guc_pagefault.c
>> @@ -89,8 +89,11 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, 
>> u32 *msg, u32 len)
>>                      FIELD_GET(PFD_FAULT_LEVEL, msg[0])) |
>>               FIELD_PREP(XE_PAGEFAULT_TYPE_MASK,
>>                      FIELD_GET(PFD_FAULT_TYPE, msg[2]));
>> -    pf.consumer.engine_class = FIELD_GET(PFD_ENG_CLASS, msg[0]);
>> -    pf.consumer.engine_instance = FIELD_GET(PFD_ENG_INSTANCE, msg[0]);
>> +    pf.consumer.engine_class_instance =
>> +        FIELD_PREP(XE_PAGEFAULT_ENGINE_CLASS_MASK,
>> +               FIELD_GET(PFD_ENG_CLASS, msg[0])) |
>> +        FIELD_PREP(XE_PAGEFAULT_ENGINE_INSTANCE_MASK,
>> +               FIELD_GET(PFD_ENG_INSTANCE, msg[0]));
>>         pf.producer.private = guc;
>>       pf.producer.ops = &guc_pagefault_ops;
>> diff --git a/drivers/gpu/drm/xe/xe_pagefault.c 
>> b/drivers/gpu/drm/xe/xe_pagefault.c
>> index 64b1dc574ab7..a6fa790774c5 100644
>> --- a/drivers/gpu/drm/xe/xe_pagefault.c
>> +++ b/drivers/gpu/drm/xe/xe_pagefault.c
>> @@ -245,13 +245,16 @@ static bool xe_pagefault_queue_pop(struct 
>> xe_pagefault_queue *pf_queue,
>>     static void xe_pagefault_print(struct xe_pagefault *pf)
>>   {
>> +    u8 engine_class = FIELD_GET(XE_PAGEFAULT_ENGINE_CLASS_MASK,
>> +                    pf->consumer.engine_class_instance);
>> +
>>       xe_gt_info(pf->gt, "\n\tASID: %d\n"
>>              "\tFaulted Address: 0x%08x%08x\n"
>>              "\tFaultType: %lu\n"
>>              "\tAccessType: %lu\n"
>>              "\tFaultLevel: %lu\n"
>>              "\tEngineClass: %d %s\n"
>> -           "\tEngineInstance: %d\n",
>> +           "\tEngineInstance: %lu\n",
>>              pf->consumer.asid,
>>              upper_32_bits(pf->consumer.page_addr),
>>              lower_32_bits(pf->consumer.page_addr),
>> @@ -261,9 +264,10 @@ static void xe_pagefault_print(struct 
>> xe_pagefault *pf)
>>                    pf->consumer.access_type),
>>              FIELD_GET(XE_PAGEFAULT_LEVEL_MASK,
>>                    pf->consumer.fault_type_level),
>> -           pf->consumer.engine_class,
>> - xe_hw_engine_class_to_str(pf->consumer.engine_class),
>> -           pf->consumer.engine_instance);
>> +           engine_class,
>> +           xe_hw_engine_class_to_str(engine_class),
>> +           FIELD_GET(XE_PAGEFAULT_ENGINE_INSTANCE_MASK,
>> +                 pf->consumer.engine_class_instance));
>>   }
>>     static void xe_pagefault_queue_work(struct work_struct *w)
>> diff --git a/drivers/gpu/drm/xe/xe_pagefault_types.h 
>> b/drivers/gpu/drm/xe/xe_pagefault_types.h
>> index 45065c25c25f..75bc53205601 100644
>> --- a/drivers/gpu/drm/xe/xe_pagefault_types.h
>> +++ b/drivers/gpu/drm/xe/xe_pagefault_types.h
>> @@ -82,10 +82,12 @@ struct xe_pagefault {
>>   #define XE_PAGEFAULT_TYPE_LEVEL_NACK        0xff    /* Producer 
>> indicates nack fault */
>>   #define XE_PAGEFAULT_LEVEL_MASK            GENMASK(3, 0)
>>   #define XE_PAGEFAULT_TYPE_MASK            GENMASK(7, 4)
>> -        /** @consumer.engine_class: engine class */
>> -        u8 engine_class;
>> -        /** @consumer.engine_instance: engine instance */
>> -        u8 engine_instance;
>> +        /** @consumer.engine_class_instance: engine class and 
>> instance */
>> +        u8 engine_class_instance;
>> +#define XE_PAGEFAULT_ENGINE_CLASS_MASK        GENMASK(3, 0)
>> +#define XE_PAGEFAULT_ENGINE_INSTANCE_MASK    GENMASK(7, 4)
>> +        /** @pad: alignment padding */
>> +        u8 pad;
>>           /** consumer.reserved: reserved bits for future expansion */
>>           u64 reserved;
>>       } consumer;
>
> Looks good,
>
> Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
>
Sorry,

../drivers/gpu/drm/xe/xe_vm.c: In function ‘xe_vm_add_fault_entry_pf’:

../drivers/gpu/drm/xe/xe_vm.c:605:51: error: ‘struct <anonymous>’ has no 
member named ‘engine_class’

   605 |         hwe = xe_gt_hw_engine(pf->gt, pf->consumer.engine_class,

       |                                                   ^

../drivers/gpu/drm/xe/xe_vm.c:606:44: error: ‘struct <anonymous>’ has no 
member named ‘engine_instance’; did you mean ‘engine_class_instance’?

  606 |  pf->consumer.engine_instance, false);

      |                                            ^~~~~~~~~~~~~~~

       | engine_class_instance


Missing:

--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -602,8 +602,12 @@ void xe_vm_add_fault_entry_pf(struct xe_vm *vm, 
struct xe_pagefault *pf)
         struct xe_hw_engine *hwe;

         /* Do not report faults on reserved engines */
-       hwe = xe_gt_hw_engine(pf->gt, pf->consumer.engine_class,
-                             pf->consumer.engine_instance, false);
+       hwe = xe_gt_hw_engine(pf->gt,
+  FIELD_GET(XE_PAGEFAULT_ENGINE_CLASS_MASK,
+  pf->consumer.engine_class_instance),
+  FIELD_GET(XE_PAGEFAULT_ENGINE_INSTANCE_MASK,
+  pf->consumer.engine_class_instance),
+                             false);
         if (!hwe || xe_hw_engine_is_reserved(hwe))


Maciej


  reply	other threads:[~2026-05-07 16:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26  4:28 [PATCH v4 00/12] Fine grained fault locking, threaded prefetch, storm cache Matthew Brost
2026-02-26  4:28 ` [PATCH v4 01/12] drm/xe: Fine grained page fault locking Matthew Brost
2026-02-26  4:28 ` [PATCH v4 02/12] drm/xe: Allow prefetch-only VM bind IOCTLs to use VM read lock Matthew Brost
2026-02-26  4:28 ` [PATCH v4 03/12] drm/xe: Thread prefetch of SVM ranges Matthew Brost
2026-02-26  4:28 ` [PATCH v4 04/12] drm/xe: Use a single page-fault queue with multiple workers Matthew Brost
2026-05-06 15:46   ` Maciej Patelczyk
2026-05-06 19:42     ` Matthew Brost
2026-05-07 12:41       ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 05/12] drm/xe: Add num_pf_work modparam Matthew Brost
2026-05-06 15:59   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 06/12] drm/xe: Engine class and instance into a u8 Matthew Brost
2026-05-06 16:04   ` Maciej Patelczyk
2026-05-07 16:20     ` Maciej Patelczyk [this message]
2026-02-26  4:28 ` [PATCH v4 07/12] drm/xe: Track pagefault worker runtime Matthew Brost
2026-05-07 12:51   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 08/12] drm/xe: Chain page faults via queue-resident cache to avoid fault storms Matthew Brost
2026-05-08 12:03   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 09/12] drm/xe: Add pagefault chaining stats Matthew Brost
2026-05-07 13:15   ` Maciej Patelczyk
2026-05-07 13:52     ` Francois Dugast
2026-02-26  4:28 ` [PATCH v4 10/12] drm/xe: Add debugfs pagefault_info Matthew Brost
2026-05-07 10:07   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 11/12] drm/xe: batch CT pagefault acks with periodic flush Matthew Brost
2026-05-08  9:24   ` Maciej Patelczyk
2026-02-26  4:28 ` [PATCH v4 12/12] drm/xe: Track parallel page fault activity in GT stats Matthew Brost
2026-05-07 13:56   ` Maciej Patelczyk
2026-05-07 14:23     ` Francois Dugast
2026-02-26  4:35 ` ✗ CI.checkpatch: warning for Fine grained fault locking, threaded prefetch, storm cache (rev4) Patchwork
2026-02-26  4:36 ` ✓ CI.KUnit: success " Patchwork
2026-02-26  5:26 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-02-26  8:59 ` ✗ Xe.CI.FULL: " Patchwork
2026-02-26 13:43 ` [PATCH v4 00/12] Fine grained fault locking, threaded prefetch, storm cache Thomas Hellström
2026-02-26 19:36   ` Matthew Brost

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=dce056cc-eb59-41b9-ad01-d8a0cde7a5db@intel.com \
    --to=maciej.patelczyk@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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