[PATCH openEuler-1.0-LTS v4 191/292] perf/x86/core: Refactor hw->idx checks and cleanup