All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: himanshu.girotra@intel.com
Cc: igt-dev@lists.freedesktop.org, nishit.sharma@intel.com
Subject: Re: [PATCH i-g-t] lib/intel_pat: Cache PAT config for unprivileged processes
Date: Wed, 04 Mar 2026 16:24:33 -0800	[thread overview]
Message-ID: <87qzpz5dj2.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20260301153553.23708-1-himanshu.girotra@intel.com>

On Sun, 01 Mar 2026 07:35:53 -0800, himanshu.girotra@intel.com wrote:
>
> diff --git a/lib/intel_pat.c b/lib/intel_pat.c
> index 8660a2515..16dfc0217 100644
> --- a/lib/intel_pat.c
> +++ b/lib/intel_pat.c
> @@ -7,6 +7,16 @@
>  #include "igt.h"
>  #include "intel_pat.h"
>
> +/*
> + * Global PAT cache.  PAT configuration is a hardware/driver property that
> + * does not change over the lifetime of a device, so we cache the result of
> + * the first successful query.  This allows unprivileged processes (e.g.
> + * after igt_drop_root()) to use the cached values without needing debugfs
> + * access.
> + */
> +static struct intel_pat_cache pat_cache;
> +static bool pat_cached;

This is not correct. The cache should be maintained as part of 'struct
xe_device'.  All tests, include xe_oa, already call xe_device_get(). The
code in lib/intel_pat.c can also call xe_device_get() to check if pat
entries are cached.

> diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
> index 927f3f4f2..37449c87c 100644
> --- a/tests/intel/xe_oa.c
> +++ b/tests/intel/xe_oa.c
> @@ -27,6 +27,7 @@
>  #include "xe/xe_ioctl.h"
>  #include "xe/xe_query.h"
>  #include "xe/xe_oa.h"
> +#include "intel_pat.h"
>
>  /**
>   * TEST: perf
> @@ -5094,6 +5095,15 @@ int igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
>		write_u64_file("/proc/sys/dev/xe/observation_paranoid", 1);
>
>		render_copy = igt_get_render_copyfunc(drm_fd);
> +
> +		/*
> +		 * Pre-cache PAT configuration while we still have root
> +		 * privileges.  Several subtests fork a child that drops
> +		 * root before using bufops/intel_bb, which internally
> +		 * needs the PAT WB index.  Without this, the child would
> +		 * fail to read debugfs after dropping privileges.
> +		 */
> +		intel_pat_precache(drm_fd);

As mentioned above, this is not needed if the cache is maintained as part
of 'struct xe_device' since xe_device_get() is being called above.

      parent reply	other threads:[~2026-03-05  0:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-01 15:35 [PATCH i-g-t] lib/intel_pat: Cache PAT config for unprivileged processes himanshu.girotra
2026-03-01 16:11 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-03-01 16:28 ` ✗ i915.CI.BAT: failure " Patchwork
2026-03-01 17:13 ` ✗ Xe.CI.FULL: " Patchwork
2026-03-02 14:35 ` [PATCH i-g-t] " Sharma, Nishit
2026-03-05  0:24 ` Dixit, Ashutosh [this message]

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=87qzpz5dj2.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=himanshu.girotra@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=nishit.sharma@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.