Re: [PATCH v4 16/32] drm/xe/tests: Add Kunit tests for xe_log
Michal Wajdeczko <[email protected]>
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
On 8/14/2026 3:36 PM, Nilawar, Badal wrote:
>
> On 13-08-2026 00:44, Michal Wajdeczko wrote:
>> All dmesg log lines generated by the xe_log() functions or helper
>> macros are expected to have a stable format. Add tests to verify
>> that generated output is not accidentally changed. Add demo pseudo
>> tests to show how to use all variants of the xe_log() helpers.
..
>> +static void fake_emit_cper(struct pci_dev *pdev, int cper_sev,
>> + enum xe_sigid sigid, u32 component, u32 location,
>> + const void *data, size_t len, struct va_format *vaf)
>> +{
>> + char msg[64];
>> + int n;
>> +
>> + pr_info("\n");
>> + pr_info("CPER SEV=%u SIGID=%u\n", cper_sev, sigid);
>> + pr_info("CPER DEVICE=%s\n", dev_name(&pdev->dev));
>> + if (location)
>> + pr_info("CPER LOCATION=%#x \t# %s.%u\n",
>> + location, location_type(location),
>> + FIELD_GET(XE_LOG_LOCATION_ID_MASK, location));
>> + if (component)
>> + pr_info("CPER COMPONENT=%#x \t# %s\n",
>> + component, component_name(component));
>> + if (IS_ERR(data))
>> + pr_info("CPER ERR=%ld \t\t# %pe\n", PTR_ERR(data), data);
>> + else if (len)
>> + print_hex_dump(KERN_INFO, "CPER BIN=", DUMP_PREFIX_OFFSET,
>> + 16, 1, data, len, false);
>> +
>> + n = vscnprintf(msg, sizeof(msg), vaf->fmt, *vaf->va);
>> + print_hex_dump(KERN_INFO, "CPER MSG=", DUMP_PREFIX_OFFSET, 16, 1, msg, n, true);
>> + pr_info("CPER END\n");
>> +}
> As I understood this is to validate parameters passed.
yes, this demo is more to prove that the right params are passed
to the log_emit_cper() which today is just a placeholder
> Otherwise, the optional CPER dump would simply contain the raw CPER buffer, for example:
>
> |[ 12.413289] xe 0000:03:00.0: [drm] <cper dump> 43 50 45 52 00 01 ff ff ff ff 02 00 00 00 00 00 ...|
whatever you do after creating full CPER is up to you
likely we will need another STUB_REDIRECT to check raw
CPER records, but that's another discussion
>
> Thanks,
> Badal
>> +