[v9, 06/11] drm/xe/guc: Use a two stage dump for GuC logs and add more info

Kees Bakker kees at ijzerbout.nl
Tue Oct 8 21:18:43 UTC 2024


Op 03-10-2024 om 02:46 schreef John.C.Harrison at Intel.com:
> From: John Harrison <John.C.Harrison at Intel.com>
>
> Split the GuC log dump into a two stage snapshot and print mechanism.
> This allows the log to be captured at the point of an error (which may
> be in a restricted context) and then dump it out later (from a regular
> context such as a worker function or a sysfs file handler).
>
> Also add a bunch of other useful pieces of information that can help
> (or are fundamentally required!) to decode and parse the log.
>
> v2: Add kerneldoc and fix a couple of comment typos - review feedback
> from Michal W.
> v3: Move chunking code to this patch as it makes the deltas simpler.
> Fix a bunch of kerneldoc issues.
> v4: Move the CS frequency out of the coredump snapshot function into
> the debugfs only code (as that info is already part of the main
> devcoredump). Add a header to the debugfs log to match the one in the
> devcoredump to aid processing by a unified tool. Add forcewake to the
> GuC timestamp read so it actually works.
> v6: Add colon to GuC version string (review feedback by Julia F).
>
> Signed-off-by: John Harrison <John.C.Harrison at Intel.com>
> Reviewed-by: Julia Filipchuk <julia.filipchuk at intel.com>
> ---
>   drivers/gpu/drm/xe/regs/xe_guc_regs.h |   1 +
>   drivers/gpu/drm/xe/xe_guc_log.c       | 178 +++++++++++++++++++++++---
>   drivers/gpu/drm/xe/xe_guc_log.h       |   4 +
>   drivers/gpu/drm/xe/xe_guc_log_types.h |  27 ++++
>   4 files changed, 195 insertions(+), 15 deletions(-)
> [...]
> + * xe_guc_log_snapshot_free - free a previously captured GuC log snapshot
> + * @snapshot: GuC log snapshot structure
> + *
> + * Return: pointer to a newly allocated snapshot object or null if out of memory. Caller is
> + * responsible for calling xe_guc_log_snapshot_free when done with the snapshot.
> + */
> +void xe_guc_log_snapshot_free(struct xe_guc_log_snapshot *snapshot)
> +{
> +	int i;
> +
> +	if (!snapshot)
> +		return;
> +
> +	if (!snapshot->copy) {
I guess you meant "if (snapshot->copy) {"
Otherwise the kfree's are going to use NULL pointers.
> +		for (i = 0; i < snapshot->num_chunks; i++)
> +			kfree(snapshot->copy[i]);
> +		kfree(snapshot->copy);
> +	}
> +
> +	kfree(snapshot);
> +}
>


More information about the Intel-xe mailing list