Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Jonathan Cavitt <jonathan.cavitt@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <saurabhg.gupta@intel.com>,
	<alex.zuo@intel.com>, <joonas.lahtinen@linux.intel.com>,
	<jianxun.zhang@intel.com>, <shuicheng.lin@intel.com>,
	<dri-devel@lists.freedesktop.org>, <Michal.Wajdeczko@intel.com>,
	<michal.mrozek@intel.com>, <raag.jadav@intel.com>,
	<ivan.briano@intel.com>, <matthew.auld@intel.com>,
	<dafna.hirschfeld@intel.com>
Subject: Re: [PATCH v29 2/5] drm/xe/xe_pagefault: Track address precision per pagefault
Date: Tue, 2 Dec 2025 13:45:10 -0800	[thread overview]
Message-ID: <aS9d5mOtJCEOC/SU@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20251202184636.96142-9-jonathan.cavitt@intel.com>

On Tue, Dec 02, 2025 at 06:46:39PM +0000, Jonathan Cavitt wrote:
> Add an address precision field to the pagefault consumer.  This captures
> the fact that pagefaults are reported on a SZ_4K granularity by GuC,
> meaning the reported pagefault address is only the address of the page
> where the faulting access occurred rather than the exact address of the
> fault.  This field is necessary in case more reporters are added where
> the granularity can be different.
> 
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_pagefault.c   | 1 +
>  drivers/gpu/drm/xe/xe_pagefault.c       | 2 ++
>  drivers/gpu/drm/xe/xe_pagefault_types.h | 8 +++++++-
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_pagefault.c b/drivers/gpu/drm/xe/xe_guc_pagefault.c
> index 719a18187a31..79b790fedda8 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pagefault.c
> @@ -74,6 +74,7 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 *msg, u32 len)
>  				      << PFD_VIRTUAL_ADDR_HI_SHIFT) |
>  		(FIELD_GET(PFD_VIRTUAL_ADDR_LO, msg[2]) <<
>  		 PFD_VIRTUAL_ADDR_LO_SHIFT);
> +	pf.consumer.addr_precision = 12;
>  	pf.consumer.asid = FIELD_GET(PFD_ASID, msg[1]);
>  	pf.consumer.access_type = FIELD_GET(PFD_ACCESS_TYPE, msg[2]);
>  	pf.consumer.fault_type = FIELD_GET(PFD_FAULT_TYPE, msg[2]);
> diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
> index 0b625a52a598..47dec46515b5 100644
> --- a/drivers/gpu/drm/xe/xe_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_pagefault.c
> @@ -231,6 +231,7 @@ static void xe_pagefault_print(struct xe_pagefault *pf)
>  {
>  	xe_gt_dbg(pf->gt, "\n\tASID: %d\n"
>  		  "\tFaulted Address: 0x%08x%08x\n"
> +		  "\tAddress Precision: %lu\n"
>  		  "\tFaultType: %d\n"
>  		  "\tAccessType: %d\n"
>  		  "\tFaultLevel: %d\n"
> @@ -239,6 +240,7 @@ static void xe_pagefault_print(struct xe_pagefault *pf)
>  		  pf->consumer.asid,
>  		  upper_32_bits(pf->consumer.page_addr),
>  		  lower_32_bits(pf->consumer.page_addr),
> +		  BIT(pf->consumer.addr_precision),
>  		  pf->consumer.fault_type,
>  		  pf->consumer.access_type,
>  		  pf->consumer.fault_level,
> diff --git a/drivers/gpu/drm/xe/xe_pagefault_types.h b/drivers/gpu/drm/xe/xe_pagefault_types.h
> index d3b516407d60..2cf439658466 100644
> --- a/drivers/gpu/drm/xe/xe_pagefault_types.h
> +++ b/drivers/gpu/drm/xe/xe_pagefault_types.h
> @@ -65,6 +65,12 @@ struct xe_pagefault {
>  	struct {
>  		/** @consumer.page_addr: address of page fault */
>  		u64 page_addr;
> +		/**
> +		 * @consumer.addr_precision: precision of the page fault address.
> +		 * u8 rather than u32 to keep compact - actual precision is
> +		 * BIT(consumer.addr_precision).  Currently only 12
> +		 */
> +		u8 addr_precision;

This is going to make this structure bigger, notice this carefully
packed to to be 64 bytes. I believe the structure will be larger than
that after this change cause the PF queue to view this as 128 bytes (it
aligns size to a pow2). This should be placed by the other u8 in this
structure.

Matt

>  		/** @consumer.asid: address space ID */
>  		u32 asid;
>  		/**
> @@ -85,7 +91,7 @@ struct xe_pagefault {
>  		/** @consumer.engine_instance: engine instance */
>  		u8 engine_instance;
>  		/** consumer.reserved: reserved bits for future expansion */
> -		u8 reserved[7];
> +		u8 reserved[6];
>  	} consumer;
>  	/**
>  	 * @producer: State for the producer (i.e., HW/FW interface). Populated
> -- 
> 2.43.0
> 

  reply	other threads:[~2025-12-02 21:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 18:46 [PATCH v29 0/5] drm/xe/xe_vm: Implement xe_vm_get_property_ioctl Jonathan Cavitt
2025-12-02 18:46 ` [PATCH v29 1/5] drm/xe/xe_pagefault: Disallow writes to read-only VMAs Jonathan Cavitt
2025-12-02 18:46 ` [PATCH v29 2/5] drm/xe/xe_pagefault: Track address precision per pagefault Jonathan Cavitt
2025-12-02 21:45   ` Matthew Brost [this message]
2025-12-03  3:00     ` Matthew Brost
2025-12-02 18:46 ` [PATCH v29 3/5] drm/xe/uapi: Define drm_xe_vm_get_property Jonathan Cavitt
2025-12-04 22:46   ` ivan.briano
2025-12-02 18:46 ` [PATCH v29 4/5] drm/xe/xe_vm: Add per VM fault info Jonathan Cavitt
2025-12-02 21:48   ` Matthew Brost
2025-12-02 18:46 ` [PATCH v29 5/5] drm/xe/xe_vm: Implement xe_vm_get_property_ioctl Jonathan Cavitt
2025-12-02 21:51   ` Matthew Brost
2025-12-02 21:29 ` ✗ CI.checkpatch: warning for " Patchwork
2025-12-02 21:30 ` ✓ CI.KUnit: success " Patchwork
2025-12-02 21:52 ` [PATCH v29 0/5] " Matthew Brost
2025-12-02 22:03   ` Cavitt, Jonathan
2025-12-02 22:31 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-12-03  5:53 ` ✗ Xe.CI.Full: 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=aS9d5mOtJCEOC/SU@lstrano-desk.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=Michal.Wajdeczko@intel.com \
    --cc=alex.zuo@intel.com \
    --cc=dafna.hirschfeld@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=ivan.briano@intel.com \
    --cc=jianxun.zhang@intel.com \
    --cc=jonathan.cavitt@intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=matthew.auld@intel.com \
    --cc=michal.mrozek@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=saurabhg.gupta@intel.com \
    --cc=shuicheng.lin@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