[PATCH 6.16 001/142] perf: Avoid undefined behavior from stopping/starting inactive events