Patch "perf intel-pt: Fix exclude_guest setting" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf intel-pt: Fix exclude_guest setting

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-intel-pt-fix-exclude_guest-setting.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2e857bac77cde79c3a2aff71582a490932a7f34f
Author: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Date:   Tue Jun 25 13:45:32 2024 +0300

    perf intel-pt: Fix exclude_guest setting
    
    [ Upstream commit b40934ae32232140e85dc7dc1c3ea0e296986723 ]
    
    In the past, the exclude_guest setting has had no effect on Intel PT
    tracing, but that may not be the case in the future.
    
    Set the flag correctly based upon whether KVM is using Intel PT
    "Host/Guest" mode, which is determined by the kvm_intel module
    parameter pt_mode:
    
     pt_mode=0      System-wide mode : host and guest output to host buffer
     pt_mode=1      Host/Guest mode : host/guest output to host/guest
                    buffers respectively
    
    Fixes: 6e86bfdc4a60 ("perf intel-pt: Support decoding of guest kernel")
    Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20240625104532.11990-3-adrian.hunter@xxxxxxxxx
    Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index 99ae6d4d3ae3c..7cb21803455a9 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -31,6 +31,7 @@
 #include "../../../util/tsc.h"
 #include <internal/lib.h> // page_size
 #include "../../../util/intel-pt.h"
+#include <api/fs/fs.h>
 
 #define KiB(x) ((x) * 1024)
 #define MiB(x) ((x) * 1024 * 1024)
@@ -438,6 +439,16 @@ static int intel_pt_track_switches(struct evlist *evlist)
 	return 0;
 }
 
+static bool intel_pt_exclude_guest(void)
+{
+	int pt_mode;
+
+	if (sysfs__read_int("module/kvm_intel/parameters/pt_mode", &pt_mode))
+		pt_mode = 0;
+
+	return pt_mode == 1;
+}
+
 static void intel_pt_valid_str(char *str, size_t len, u64 valid)
 {
 	unsigned int val, last = 0, state = 1;
@@ -641,6 +652,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
 			}
 			evsel->core.attr.freq = 0;
 			evsel->core.attr.sample_period = 1;
+			evsel->core.attr.exclude_guest = intel_pt_exclude_guest();
 			evsel->no_aux_samples = true;
 			intel_pt_evsel = evsel;
 			opts->full_auxtrace = true;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux