When a record does not fit in the current per-CPU log buffer,
pmclog_reserve() schedules that buffer for output, takes a fresh one
and returns its base as the record address, but leaves plb_ptr at the
base. The buffer still looks empty, so the next reservation on that
CPU is handed the same address and overwrites the record. The record
is lost and no drop is counted. A record that ends exactly at the end
of its buffer is not affected.
Advance plb_ptr on both paths and assert that the record fits in the
fresh buffer. The parent revision makes that assertion hold for every
accepted buffer size.
The omission dates back to the first revision of hwpmc_logging.c.
MFC after: 1 week
Signed-off-by: Davi Chaves Azevedo <dchavesa@amd.com>
Sponsored by: Advanced Micro Devices, Inc.