* [PATCH] drm/xe: Make p2pdma distance check verbose via dynamic debug
@ 2026-09-14 9:46 Thomas Hellström
2026-09-14 9:56 ` sashiko-bot
2026-09-14 11:34 ` Matthew Auld
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Hellström @ 2026-09-14 9:46 UTC (permalink / raw)
To: intel-xe; +Cc: Thomas Hellström, Matthew Brost, Matthew Auld
pci_p2pdma_distance() can optionally print details about how it
computed the ACS/PCIe topology distance between the two devices, but
xe_dma_buf_attach() always called it with verbose set to false,
silently hiding useful diagnostics whenever a dma-buf attach unset
attach->peer2peer.
Tie the verbose argument to a dedicated dynamic-debug callsite tagged
"xe dma-buf p2p debug" (in addition to keeping the existing
DRM_UT_DRIVER category as a default), so the extra p2pdma distance
logging can be switched on without a recompile in any of the following
ways:
- Enable the whole DRIVER category for xe via drm.debug, which is
already used elsewhere in the driver:
# echo 0x10 > /sys/module/drm/parameters/debug
- Enable dynamic debug for the whole file:
# echo 'file xe_dma_buf.c +p' > \
/sys/kernel/debug/dynamic_debug/control
- Enable dynamic debug for just this callsite by function name:
# echo 'func xe_dma_buf_attach +p' > \
/sys/kernel/debug/dynamic_debug/control
- Enable dynamic debug by matching the format string used to
register the callsite:
# echo 'format "xe dma-buf p2p debug" +p' > \
/sys/kernel/debug/dynamic_debug/control
- Enable it at boot via the dyndbg= kernel command line parameter:
dyndbg="func xe_dma_buf_attach +p"
Any of the above flips verbose_p2p_dist to true for that attach call,
causing pci_p2pdma_distance() to log its distance calculation without
requiring the whole DRM_UT_DRIVER category to be enabled.
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Assisted-by: LLM
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
drivers/gpu/drm/xe/xe_dma_buf.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_dma_buf.c b/drivers/gpu/drm/xe/xe_dma_buf.c
index 5d9f1cd24b7f..b63fd70fb4de 100644
--- a/drivers/gpu/drm/xe/xe_dma_buf.c
+++ b/drivers/gpu/drm/xe/xe_dma_buf.c
@@ -22,13 +22,21 @@
MODULE_IMPORT_NS("DMA_BUF");
+static void xe_ddebug_flip_bool(const struct _ddebug *desc, bool *flag)
+{
+ *flag = true;
+}
+
static int xe_dma_buf_attach(struct dma_buf *dmabuf,
struct dma_buf_attachment *attach)
{
struct drm_gem_object *obj = attach->dmabuf->priv;
+ bool verbose_p2p_dist = drm_debug_enabled(DRM_UT_DRIVER);
+
+ _dynamic_func_call("xe dma-buf p2p debug", xe_ddebug_flip_bool, &verbose_p2p_dist);
if (attach->peer2peer &&
- pci_p2pdma_distance(to_pci_dev(obj->dev->dev), attach->dev, false) < 0)
+ pci_p2pdma_distance(to_pci_dev(obj->dev->dev), attach->dev, verbose_p2p_dist) < 0)
attach->peer2peer = false;
if (!attach->peer2peer && !xe_bo_can_migrate(gem_to_xe_bo(obj), XE_PL_TT))
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] drm/xe: Make p2pdma distance check verbose via dynamic debug
2026-09-14 9:46 [PATCH] drm/xe: Make p2pdma distance check verbose via dynamic debug Thomas Hellström
@ 2026-09-14 9:56 ` sashiko-bot
2026-09-14 11:34 ` Matthew Auld
1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-09-14 9:56 UTC (permalink / raw)
To: Thomas Hellström; +Cc: intel-xe
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Unconditional use of the internal `_dynamic_func_call` macro causes a build failure when `CONFIG_DYNAMIC_DEBUG` is disabled.
--
commit 6e70a101effbf7ae91a2873e2642ceaadc4900a3
Author: Thomas Hellström <thomas.hellstrom@linux.intel.com>
drm/xe: Make p2pdma distance check verbose via dynamic debug
pci_p2pdma_distance() can optionally print details about how it computed
the ACS/PCIe topology distance between the two devices. Tie the verbose
argument to a dedicated dynamic-debug callsite tagged "xe dma-buf p2p
debug" so the extra p2pdma distance logging can be switched on without a
recompile.
> diff --git a/drivers/gpu/drm/xe/xe_dma_buf.c b/drivers/gpu/drm/xe/xe_dma_buf.c
> index 5d9f1cd24b7f3..b63fd70fb4de9 100644
> --- a/drivers/gpu/drm/xe/xe_dma_buf.c
> +++ b/drivers/gpu/drm/xe/xe_dma_buf.c
> @@ -22,13 +22,21 @@
>
> MODULE_IMPORT_NS("DMA_BUF");
>
> +static void xe_ddebug_flip_bool(const struct _ddebug *desc, bool *flag)
> +{
> + *flag = true;
> +}
> +
> static int xe_dma_buf_attach(struct dma_buf *dmabuf,
> struct dma_buf_attachment *attach)
> {
> struct drm_gem_object *obj = attach->dmabuf->priv;
> + bool verbose_p2p_dist = drm_debug_enabled(DRM_UT_DRIVER);
> +
> + _dynamic_func_call("xe dma-buf p2p debug", xe_ddebug_flip_bool, &verbose_p2p_dist);
^^^^^^^^^^^^^^^^^^
[Severity: Low]
Does this unconditional use of the internal _dynamic_func_call macro cause a
build failure when CONFIG_DYNAMIC_DEBUG is disabled?
Since _dynamic_func_call has no stub definition in the #else block of
include/linux/dynamic_debug.h, compiling the xe driver with CONFIG_DRM_XE
enabled but CONFIG_DYNAMIC_DEBUG disabled results in an implicit function
declaration error.
If the macro call is guarded by an ifdef, does xe_ddebug_flip_bool() also need
an ifdef guard or __maybe_unused to avoid a -Wunused-function warning?
>
> if (attach->peer2peer &&
> - pci_p2pdma_distance(to_pci_dev(obj->dev->dev), attach->dev, false) < 0)
> + pci_p2pdma_distance(to_pci_dev(obj->dev->dev), attach->dev, verbose_p2p_dist) < 0)
> attach->peer2peer = false;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914094641.8779-1-thomas.hellstrom@linux.intel.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drm/xe: Make p2pdma distance check verbose via dynamic debug
2026-09-14 9:46 [PATCH] drm/xe: Make p2pdma distance check verbose via dynamic debug Thomas Hellström
2026-09-14 9:56 ` sashiko-bot
@ 2026-09-14 11:34 ` Matthew Auld
2026-09-14 11:39 ` Thomas Hellström
1 sibling, 1 reply; 4+ messages in thread
From: Matthew Auld @ 2026-09-14 11:34 UTC (permalink / raw)
To: Thomas Hellström, intel-xe; +Cc: Matthew Brost
On 14/09/2026 10:46, Thomas Hellström wrote:
> pci_p2pdma_distance() can optionally print details about how it
> computed the ACS/PCIe topology distance between the two devices, but
> xe_dma_buf_attach() always called it with verbose set to false,
> silently hiding useful diagnostics whenever a dma-buf attach unset
> attach->peer2peer.
>
> Tie the verbose argument to a dedicated dynamic-debug callsite tagged
> "xe dma-buf p2p debug" (in addition to keeping the existing
> DRM_UT_DRIVER category as a default), so the extra p2pdma distance
> logging can be switched on without a recompile in any of the following
> ways:
>
> - Enable the whole DRIVER category for xe via drm.debug, which is
> already used elsewhere in the driver:
>
> # echo 0x10 > /sys/module/drm/parameters/debug
>
> - Enable dynamic debug for the whole file:
>
> # echo 'file xe_dma_buf.c +p' > \
> /sys/kernel/debug/dynamic_debug/control
>
> - Enable dynamic debug for just this callsite by function name:
>
> # echo 'func xe_dma_buf_attach +p' > \
> /sys/kernel/debug/dynamic_debug/control
>
> - Enable dynamic debug by matching the format string used to
> register the callsite:
>
> # echo 'format "xe dma-buf p2p debug" +p' > \
> /sys/kernel/debug/dynamic_debug/control
>
> - Enable it at boot via the dyndbg= kernel command line parameter:
>
> dyndbg="func xe_dma_buf_attach +p"
>
> Any of the above flips verbose_p2p_dist to true for that attach call,
> causing pci_p2pdma_distance() to log its distance calculation without
> requiring the whole DRM_UT_DRIVER category to be enabled.
Is drm.debug not enough here for typical usescases? If you are
interested in this you would maybe toggle that anyway, in case there is
other interesting stuff? Or do you think the dynamic debug will be useful?
>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Assisted-by: LLM
> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Either way,
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
(With the ifdef guard or so)
> ---
> drivers/gpu/drm/xe/xe_dma_buf.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_dma_buf.c b/drivers/gpu/drm/xe/xe_dma_buf.c
> index 5d9f1cd24b7f..b63fd70fb4de 100644
> --- a/drivers/gpu/drm/xe/xe_dma_buf.c
> +++ b/drivers/gpu/drm/xe/xe_dma_buf.c
> @@ -22,13 +22,21 @@
>
> MODULE_IMPORT_NS("DMA_BUF");
>
> +static void xe_ddebug_flip_bool(const struct _ddebug *desc, bool *flag)
> +{
> + *flag = true;
> +}
> +
> static int xe_dma_buf_attach(struct dma_buf *dmabuf,
> struct dma_buf_attachment *attach)
> {
> struct drm_gem_object *obj = attach->dmabuf->priv;
> + bool verbose_p2p_dist = drm_debug_enabled(DRM_UT_DRIVER);
> +
> + _dynamic_func_call("xe dma-buf p2p debug", xe_ddebug_flip_bool, &verbose_p2p_dist);
>
> if (attach->peer2peer &&
> - pci_p2pdma_distance(to_pci_dev(obj->dev->dev), attach->dev, false) < 0)
> + pci_p2pdma_distance(to_pci_dev(obj->dev->dev), attach->dev, verbose_p2p_dist) < 0)
> attach->peer2peer = false;
>
> if (!attach->peer2peer && !xe_bo_can_migrate(gem_to_xe_bo(obj), XE_PL_TT))
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drm/xe: Make p2pdma distance check verbose via dynamic debug
2026-09-14 11:34 ` Matthew Auld
@ 2026-09-14 11:39 ` Thomas Hellström
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Hellström @ 2026-09-14 11:39 UTC (permalink / raw)
To: Matthew Auld, intel-xe; +Cc: Matthew Brost
On Mon, 2026-09-14 at 12:34 +0100, Matthew Auld wrote:
> On 14/09/2026 10:46, Thomas Hellström wrote:
> > pci_p2pdma_distance() can optionally print details about how it
> > computed the ACS/PCIe topology distance between the two devices,
> > but
> > xe_dma_buf_attach() always called it with verbose set to false,
> > silently hiding useful diagnostics whenever a dma-buf attach unset
> > attach->peer2peer.
> >
> > Tie the verbose argument to a dedicated dynamic-debug callsite
> > tagged
> > "xe dma-buf p2p debug" (in addition to keeping the existing
> > DRM_UT_DRIVER category as a default), so the extra p2pdma distance
> > logging can be switched on without a recompile in any of the
> > following
> > ways:
> >
> > - Enable the whole DRIVER category for xe via drm.debug, which is
> > already used elsewhere in the driver:
> >
> > # echo 0x10 > /sys/module/drm/parameters/debug
> >
> > - Enable dynamic debug for the whole file:
> >
> > # echo 'file xe_dma_buf.c +p' > \
> > /sys/kernel/debug/dynamic_debug/control
> >
> > - Enable dynamic debug for just this callsite by function name:
> >
> > # echo 'func xe_dma_buf_attach +p' > \
> > /sys/kernel/debug/dynamic_debug/control
> >
> > - Enable dynamic debug by matching the format string used to
> > register the callsite:
> >
> > # echo 'format "xe dma-buf p2p debug" +p' > \
> > /sys/kernel/debug/dynamic_debug/control
> >
> > - Enable it at boot via the dyndbg= kernel command line
> > parameter:
> >
> > dyndbg="func xe_dma_buf_attach +p"
> >
> > Any of the above flips verbose_p2p_dist to true for that attach
> > call,
> > causing pci_p2pdma_distance() to log its distance calculation
> > without
> > requiring the whole DRM_UT_DRIVER category to be enabled.
>
> Is drm.debug not enough here for typical usescases? If you are
> interested in this you would maybe toggle that anyway, in case there
> is
> other interesting stuff? Or do you think the dynamic debug will be
> useful?
There are cases where we just want to check just if p2p is enabled. And
normally IIRC you can do this by targeting a separate pr_debug or
drm_debug using dynamic debug. But since this one triggers printouts in
the p2pdma code, it seems like this construct is neecessary.
>
> >
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: Matthew Auld <matthew.auld@intel.com>
> > Assisted-by: LLM
> > Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>
> Either way,
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Thanks,
Thomas
>
> (With the ifdef guard or so)
>
> > ---
> > drivers/gpu/drm/xe/xe_dma_buf.c | 10 +++++++++-
> > 1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_dma_buf.c
> > b/drivers/gpu/drm/xe/xe_dma_buf.c
> > index 5d9f1cd24b7f..b63fd70fb4de 100644
> > --- a/drivers/gpu/drm/xe/xe_dma_buf.c
> > +++ b/drivers/gpu/drm/xe/xe_dma_buf.c
> > @@ -22,13 +22,21 @@
> >
> > MODULE_IMPORT_NS("DMA_BUF");
> >
> > +static void xe_ddebug_flip_bool(const struct _ddebug *desc, bool
> > *flag)
> > +{
> > + *flag = true;
> > +}
> > +
> > static int xe_dma_buf_attach(struct dma_buf *dmabuf,
> > struct dma_buf_attachment *attach)
> > {
> > struct drm_gem_object *obj = attach->dmabuf->priv;
> > + bool verbose_p2p_dist = drm_debug_enabled(DRM_UT_DRIVER);
> > +
> > + _dynamic_func_call("xe dma-buf p2p debug",
> > xe_ddebug_flip_bool, &verbose_p2p_dist);
> >
> > if (attach->peer2peer &&
> > - pci_p2pdma_distance(to_pci_dev(obj->dev->dev), attach-
> > >dev, false) < 0)
> > + pci_p2pdma_distance(to_pci_dev(obj->dev->dev), attach-
> > >dev, verbose_p2p_dist) < 0)
> > attach->peer2peer = false;
> >
> > if (!attach->peer2peer &&
> > !xe_bo_can_migrate(gem_to_xe_bo(obj), XE_PL_TT))
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-14 11:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 9:46 [PATCH] drm/xe: Make p2pdma distance check verbose via dynamic debug Thomas Hellström
2026-09-14 9:56 ` sashiko-bot
2026-09-14 11:34 ` Matthew Auld
2026-09-14 11:39 ` Thomas Hellström
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox