diff --git a/slides/img/keep_breathing.jpg b/slides/img/keep_breathing.jpg new file mode 100644 index 0000000..57f50d7 Binary files /dev/null and b/slides/img/keep_breathing.jpg differ diff --git a/slides/slides.tex b/slides/slides.tex index 3fb26e1..707070c 100644 --- a/slides/slides.tex +++ b/slides/slides.tex @@ -8,6 +8,8 @@ \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} +\usepackage{booktabs} +\usepackage{makecell} \usepackage{../shared/my_listings} %\usepackage{../shared/my_hyperref} @@ -15,6 +17,9 @@ \usepackage{../shared/common} \usepackage{../shared/todo} +\renewcommand\theadalign{c} +\renewcommand\theadfont{\scriptsize\bfseries} + \setbeamertemplate{navigation symbols}{} \newcommand{\thenalert}[1]{\only<1>{#1}\only<2>{\alert{#1}}} @@ -242,6 +247,50 @@ unwind_context_t _eh_elf( \end{itemize} \end{frame} +\begin{frame}{Compilation choices} + \textbf{In order to keep the compiler \alert{simple} and \alert{easily + testable}, the whole DWARF5 instruction set is not supported.} + + \begin{itemize} + \item Tailored for \alert{x86\_64} (while DWARF is + architecture-agnostic) + \item Only supports \alert{unwinding registers}: \reg{rip}, \reg{rsp}, + \reg{rbp}, \reg{rbx} + \begin{itemize} + \item[$\leadsto$] suitable for perf, not for gdb + \end{itemize} + \item Supports the \alert{wide majority} ($> 99.9\%$) of instructions + used (see later) + \begin{itemize} + \item Only supports few common expressions: already $~ 90\,\%$ + of expressions used + \end{itemize} + \end{itemize} +\end{frame} + + +\begin{frame}[fragile]{A word on memory maps} + \textbf{Various functions come from various ELFs}\\ + \pause{} + \hfill{}\textbf{\ldots{}and thus various \ehelfs{}} + + \begin{lstlisting}[language=, numbers=none] +55c81b11e000-55c81b126000 000k /usr/bin/cat +55c81b325000-55c81b326000 007k /usr/bin/cat +55c81b326000-55c81b327000 008k /usr/bin/cat +55c81bcf3000-55c81bd14000 000k [heap] +7f8a5b4ed000-7f8a5b50f000 000k /usr/lib/libc-2.28.so +7f8a5b50f000-7f8a5b65a000 022k /usr/lib/libc-2.28.so +7f8a5b65a000-7f8a5b6a6000 16dk /usr/lib/libc-2.28.so +7f8a5b6ec000-7f8a5b6ee000 000k /usr/lib/ld-2.28.so +7f8a5b6ee000-7f8a5b70d000 002k /usr/lib/ld-2.28.so +7f8a5b70d000-7f8a5b715000 021k /usr/lib/ld-2.28.so +7ffc8a66b000-7ffc8a68c000 000k [stack] +7ffc8a74a000-7ffc8a74d000 000k [vvar] +7ffc8a74d000-7ffc8a74f000 000k [vdso] + \end{lstlisting} +\end{frame} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Outlining} @@ -338,7 +387,183 @@ unwind_context_t _eh_elf( \end{itemize} \end{frame} +\begin{frame}{libunwind implementation} + \begin{itemize} + \item \alert{libunwind}: \textit{de facto} standard library for + unwinding + \item Uses DWARF in background + \item \alert{Used by perf} as a backend for unwinding + + \pause{}\vspace{1em} \item{} Easiest way to use \ehelfs{} in perf: + \alert{implement an alternative libunwind} + \item{} Result: \alert{alternative implementation} of libunwind, nearly + plug-and-play! + \end{itemize} +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Results} + +\begin{frame}{Time performance} + \small + \centering + \begin{tabular}{l r r r r r} + \toprule + \thead{Unwinding method} & \thead{Frames \\ unwound} + & \thead{Tot.\ time \\ ($\mu s$)} + & \thead{Avg. \\ time / frame \\ ($ns$)} + & \thead{Time \\ ratio} \\ + \midrule + \alert{\ehelfs{}} + & 23506 % Frames unwound + & 14837 % Total time + & 631 % Avg time + & 1 + \\ + \prog{libunwind}, \alert{cached} + & 27058 % Frames unwound + & 441601 % Total time + & 16320 % Avg time + & \alert{25.9} + \\ + \prog{libunwind}, \alert{uncached} + & 27058 % Frames unwound + & 671292 % Total time + & 24809 % Avg time + & \alert{39.3} + \\ + \bottomrule + \end{tabular} +\end{frame} + +\begin{frame}{Space performance} + \begin{center} + \begin{tabular}{r r r r r r} + \toprule + \thead{Object} + & \thead{Original \\ program size \\ (KiB)} + & \thead{Original \\ \lstc{.eh\_frame} \\ (KiB)} + & \thead{Generated \\ \ehelf{} \\ (KiB)} + & \thead{\% \\ original \\ size} + & \thead{Growth \\ factor} \\ + \midrule + libc + & 1\,434 & 130.1 & 313.2 & 21.88 & 2.41 \\ + libpthread + & 58.1 & 11.6 & 25.4 & 43.71 & 2.19 \\ + ld + & 129.6 & 9.6 & 28.6 & 22.09 & 2.97 \\ + hackbench + & 2.9 & 0.555 & 2.8 & 93.87 & 4.99 \\ + Total + & 1\,638 & 151.8 & 370.0 & 22.81 & \alert{2.44} \\ + \bottomrule + \end{tabular} + \end{center} +\end{frame} + +\newcommand{\ofsupp}[1]{$\left[\text{#1}\right]$} +\begin{frame}{Instructions coverage} + \scriptsize\centering + \begin{tabular}{r r r r r r} + \toprule + \thead{} + & \thead{Undef} + & \thead{Same \\ value} + & \thead{Offset} + & \thead{Val \\ offset} + & \thead{Reg} + \\ + \midrule + \makecell{Only supp. \\ columns} \vspace{.4em} + & 1698 (0.006\,\%) + & 0 + & 30\,M (99.9\,\%) + & 0 + & 14 (0\,\%) + \\ + All columns + & 1698 (0.003\,\%) + & 0 + & 55\,M (99.9\,\%) + & 0 + & 22 (0\,\%) + \\ + \bottomrule + \toprule + \thead{} + & \thead{Expr \\ \ofsupp{supported}} + & \thead{Val \\ expr} + & \thead{Archi.} + & & \thead{Total} + \\ + \midrule + \makecell{Only supp. \\ columns} \vspace{.4em} + & \makecell{4475 (0.015\,\%) \\ \ofsupp{81.4\,\%}} + & 0 + & 0 + & & 30044442 + \\ + All columns + & \makecell{12367 (0.02\,\%) \\ \ofsupp{91.7\,\%}} + & 0 + & 0 + & & 54680492 + \\ + + \bottomrule + \end{tabular} + + \vspace{2em}\pause{} + + \textbf{Among \alert{4000} randomly sampled filed, only \alert{24} + containing unsupported instructions} +\end{frame} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{A glance at future work} +\begin{frame}{What next?} + \begin{itemize} + \item \alert{Outlining} was super efficient for + compactness\ldots{} Worth trying on standard DWARF\@? + + \item Implement a release-ready, packageable, easy to use version of + perf with \ehelfs{} and submit it for inclusion + + \item{} Measure \alert{C++ exceptions overhead} precisely in common + software + \item{} Implement \alert{\ehelfs{}} support for \alert{C++ runtime} + exception handling + \item{} \ldots{}and many more possibilities to explore! + \end{itemize} +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section*{} + +\begin{frame} + \begin{columns}[c] + \begin{column}{0.35\textwidth} + \includegraphics[width=\linewidth]{img/keep_breathing} + \end{column} + \begin{column}{0.65\textwidth} + \begin{center} + \huge + And remember\ldots{} + \smallskip + + DWARF is slow! + \end{center} + \end{column} + \end{columns} + + \begin{center} + \Huge\bfseries + Thank you! + \end{center} + + +\end{frame} + \end{document}