aboutsummaryrefslogtreecommitdiff
path: root/trace/ftrace.c
AgeCommit message (Collapse)AuthorFilesLines
2019-03-22trace: handle tracefs path truncationStefan Hajnoczi1-2/+10
If the tracefs mountpoint has a very long path we may exceed PATH_MAX. This is a system misconfiguration and the user must resolve it so that applications can perform path-based system calls successfully. This issue does not occur on real-world systems since tracefs is mounted on /sys/kernel/debug/tracing/, but the compiler is smart enough to foresee the possibility and warn about the unchecked snprintf(3) return value. This patch fixes the compiler warning. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Liam Merwick <liam.merwick@oracle.com> Message-id: 20190321170831.6539-2-stefanha@redhat.com Message-Id: <20190321170831.6539-2-stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-12-18trace: Try using tracefs firstNamhyung Kim1-6/+12
Recent Linux kernel provides separate tracefs which doesn't need to be mounted on the debugfs. Although most systems mount it at the traditional place on the debugfs, it'd be safer to check tracefs first. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-12-18trace: Generalize searching for debugfsNamhyung Kim1-7/+7
The find_debugfs() can be shared to find a different filesystem like tracefs. So make it more general and rename to find_mount(). Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-12-18trace: Simplify find_debugfs()Namhyung Kim1-4/+3
The return vale of find_debugfs() is 1 if it could find a mount point of debugfs. It can be saved in the while loop instead of checking it again. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-01-31trace: switch to modular code generation for sub-directoriesDaniel P. Berrange1-1/+1
Introduce rules in the top level Makefile that are able to generate trace.[ch] files in every subdirectory which has a trace-events file. The top level directory is handled specially, so instead of creating trace.h, it creates trace-root.h. This allows sub-directories to include the top level trace-root.h file, without ambiguity wrt to the trace.g file in the current sub-dir. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170125161417.31949-7-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: don't abort qemu if ftrace can't be initializedDaniel P. Berrange1-0/+6
If the ftrace backend is compiled into QEMU, any attempt to start QEMU while non-root will fail due to the inability to open /sys/kernel/debug/tracing/tracing_on. Add a fallback into the code so that it connects up the trace_marker_fd variable to /dev/null when getting EACCES on the 'trace_on' file. This allows QEMU to run, with ftrace turned into a no-op. [Fixed s/setting/getting/ and s/EACCESS/EACCES/ errors pointed out by Eric Blake <eblake@redhat.com>. --Stefan] Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-13-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-04all: Clean up includesPeter Maydell1-4/+1
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
2014-06-09trace: Multi-backend tracingLluís Vilanova1-24/+1
Adds support to compile QEMU with multiple tracing backends at the same time. For example, you can compile QEMU with: $ ./configure --enable-trace-backends=ftrace,dtrace Where 'ftrace' can be handy for having an in-flight record of events, and 'dtrace' can be later used to extract more information from the system. This patch allows having both available without recompiling QEMU. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-05-03trace: Add ftrace tracing backendEiichi Tsukata1-0/+102
This patch adds a ftrace tracing backend which sends trace event to ftrace marker file. You can effectively compare qemu trace data and kernel(especially, kvm.ko when using KVM) trace data. The ftrace backend is restricted to Linux only. To try out the ftrace backend: $ ./configure --trace-backend=ftrace $ make if you use KVM, enable kvm events in ftrace: # sudo echo 1 > /sys/kernel/debug/tracing/events/kvm/enable After running qemu by root user, you can get the trace: # cat /sys/kernel/debug/tracing/trace Signed-off-by: Eiichi Tsukata <eiichi.tsukata.xh@hitachi.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>