drm/amd/ras: take a log batch id only once there is something to log

The id is claimed before the banks are read, so a poll that ends up
logging nothing still burns one and leaves a gap that every reader of
the log then has to walk over. Claim it when the first record of the
batch is about to go in.

Signed-off-by: Xiang Liu <xiang.liu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Xiang Liu 2026-08-26 17:44:06 +08:00 committed by Alex Deucher
parent 7b3cb1f9b9
commit b518dc388f

View File

@ -394,10 +394,6 @@ static int aca_banks_update(struct ras_core_context *ras_core,
if (!count)
goto out;
/* Only one MCE error is logged for each batch */
if (ecc_type != RAS_ERR_TYPE__MCE)
batch_tag = ras_log_ring_create_batch_tag(ras_core);
for (i = 0; i < count; i++) {
memset(&bank, 0, sizeof(bank));
ret = aca_dump_bank(ras_core, ecc_type, i, &bank);
@ -420,6 +416,10 @@ static int aca_banks_update(struct ras_core_context *ras_core,
bank.seq_no = aca_get_bank_seqno(ras_core, ecc_type, aca_blk, &bank_ecc);
/* Only one MCE error is logged for each batch */
if (ecc_type != RAS_ERR_TYPE__MCE && !batch_tag)
batch_tag = ras_log_ring_create_batch_tag(ras_core);
aca_log_bank_data(ras_core, &bank, &bank_ecc, batch_tag);
aca_bank_log(ras_core, i, count, &bank, &bank_ecc);