<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Mangal;
        panose-1:0 0 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Hi David,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I will look into this at earliest and provide feedback.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thanks<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> David Marchand <david.marchand@redhat.com>
<br>
<b>Sent:</b> Friday, February 7, 2025 2:20 PM<br>
<b>To:</b> Jerin Jacob <jerinj@marvell.com>; Sunil Kumar Kori <skori@marvell.com><br>
<b>Cc:</b> dev@dpdk.org; Chengwen Feng <fengchengwen@huawei.com>; Kevin Laatz <kevin.laatz@intel.com>; Bruce Richardson <bruce.richardson@intel.com>; Tyler Retzlaff <roretzla@linux.microsoft.com>; Andre Muezerie <andremue@linux.microsoft.com>; Thomas Monjalon
 <thomas@monjalon.net>; Stephen Hemminger <stephen@networkplumber.org><br>
<b>Subject:</b> [EXTERNAL] Re: [PATCH v2 3/3] trace: fix undefined behavior in register<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="mso-line-height-alt:.75pt"><span style="font-size:1.0pt;color:white">Hello Jerin, Sunil, On Thu, Jan 30, 2025 at 3:</span><span style="font-size:1.0pt;font-family:"Arial",sans-serif;color:white"> </span><span style="font-size:1.0pt;color:white">59
 PM David Marchand <david.</span><span style="font-size:1.0pt;font-family:"Arial",sans-serif;color:white"> </span><span style="font-size:1.0pt;color:white">marchand@</span><span style="font-size:1.0pt;font-family:"Arial",sans-serif;color:white"> </span><span style="font-size:1.0pt;color:white">redhat.</span><span style="font-size:1.0pt;font-family:"Arial",sans-serif;color:white"> </span><span style="font-size:1.0pt;color:white">com>
 wrote: > > Registering a tracepoint handler was resulting so far in undefined > behavior at runtime. > > The RTE_TRACE_POINT_REGISTER()<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-line-height-alt:.75pt"><span style="font-size:1.0pt;color:white"><o:p></o:p></span></p>
</div>
<div>
<pre style="white-space:pre-wrap"><span style="font-size:12.0pt;font-family:"Arial",sans-serif">Hello Jerin, Sunil,<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">On Thu, Jan 30, 2025 at 3:59 PM David Marchand<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif"><<a href="mailto:david.marchand@redhat.com">david.marchand@redhat.com</a>> wrote:<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> Registering a tracepoint handler was resulting so far in undefined<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> behavior at runtime.<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> The RTE_TRACE_POINT_REGISTER() macro was casting the tracepoint handler<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> (which expects arguments) to a void (*)(void).<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> At runtime, calling this handler while registering resulted in<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> reading the current stack with no relation to this function prototype.<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> Instead, declare an additional inline _register() handler for each<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> tracepoint and make sure that the emitting macros in<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> rte_trace_point_register.h only work on arguments name and type.<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> The original tracepoint handler prototype is adjusted by adding a<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> __rte_unused for each argument (since emitting macros do nothing<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> with them).<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> This last part introduces an implementation limit of 15 arguments.<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> With this change in place, the workaround in dmadev tracepoints can be<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> removed.<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">> Signed-off-by: David Marchand <<a href="mailto:david.marchand@redhat.com">david.marchand@redhat.com</a>><o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">Can I have your opinion and review on this patch?<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">Thanks.<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">-- <o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif">David Marchand<o:p></o:p></span></pre>
<pre><span style="font-size:12.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></pre>
</div>
</div>
</div>
</body>
</html>