]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf/x86/intel/pt: Fix sampling synchronization
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 15 Jul 2024 16:07:00 +0000 (19:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:52 +0000 (16:29 +0200)
commitcb0125ec3d996158a91dfbd1c539f159a81e4ffc
tree24625d218b66b95c14f0232ec632d05f96333bef
parent19fd2f2c5fb36b61506d3208474bfd8fdf1cada3
perf/x86/intel/pt: Fix sampling synchronization

commit d92792a4b26e50b96ab734cbe203d8a4c932a7a9 upstream.

pt_event_snapshot_aux() uses pt->handle_nmi to determine if tracing
needs to be stopped, however tracing can still be going because
pt->handle_nmi is set to zero before tracing is stopped in pt_event_stop,
whereas pt_event_snapshot_aux() requires that tracing must be stopped in
order to copy a sample of trace from the buffer.

Instead call pt_config_stop() always, which anyway checks config for
RTIT_CTL_TRACEEN and does nothing if it is already clear.

Note pt_event_snapshot_aux() can continue to use pt->handle_nmi to
determine if the trace needs to be restarted afterwards.

Fixes: 25e8920b301c ("perf/x86/intel/pt: Add sampling support")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20240715160712.127117-2-adrian.hunter@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/events/intel/pt.c