)]}'
{
  "commit": "ffcfb0faaa95fc6ca007f7dd989e390dacf936ca",
  "tree": "aeff0071c8c935d61559473c4180859751e3a21e",
  "parents": [
    "6322b753f798337835e205b6d805356bea582c86"
  ],
  "author": {
    "name": "Tanish Desai",
    "email": "tanishdesai37@gmail.com",
    "time": "Wed May 28 19:25:28 2025 +0000"
  },
  "committer": {
    "name": "Stefan Hajnoczi",
    "email": "stefanha@redhat.com",
    "time": "Mon Jun 02 16:51:36 2025 -0400"
  },
  "message": "trace/simple: seperate hot paths of tracing fucntions\n\nThis change improves performance by moving the hot path of the trace_vhost_commit()(or any other trace function) logic to the header file.\nPreviously, even when the trace event was disabled, the function call chain:-\n\ttrace_vhost_commit()(Or any other trace function) →  _nocheck__trace_vhost_commit() →  _simple_trace_vhost_commit()\n\tincurred a significant function prologue overhead before checking the trace state.\n\nDisassembly of _simple_trace_vhost_commit() (from the .c file) showed that 11 out of the first 14 instructions were prologue-related, including:\n0x10\tstp x29, x30, [sp, #-64]!\tPrologue: allocates 64-byte frame and saves old FP (x29) \u0026 LR (x30)\n0x14\tadrp x3, trace_events_enabled_count\tPrologue: computes page-base of the trace-enable counter\n0x18\tadrp x2, __stack_chk_guard\tImportant (maybe prolog don\u0027t know?)(stack-protector): starts up the stack-canary load\n0x1c\tmov x29, sp\tPrologue: sets new frame pointer\n0x20\tldr x3, [x3]\tPrologue: loads the actual trace-enabled count\n0x24\tstp x19, x20, [sp, #16]\tPrologue: spills callee-saved regs used by this function (x19, x20)\n0x28\tand w20, w0, #0xff\tTracepoint setup: extracts the low-8 bits of arg0 as the “event boolean”\n0x2c\tldr x2, [x2]\tPrologue (cont’d): completes loading of the stack-canary value\n0x30\tand w19, w1, #0xff\tTracepoint setup: extracts low-8 bits of arg1\n0x34\tldr w0, [x3]\tImportant: loads the current trace-enabled flag from memory\n0x38\tldr x1, [x2]\tPrologue (cont’d): reads the canary\n0x3c\tstr x1, [sp, #56]\tPrologue (cont’d): writes the canary into the new frame\n0x40\tmov x1, #0\tPrologue (cont’d): zeroes out x1 for the upcoming branch test\n0x44\tcbnz w0, 0x88\tImportant: if tracing is disabled (w0\u003d\u003d0) skip the heavy path entirely\n\nThe trace-enabled check happens after the prologue. This is wasteful when tracing is disabled, which is often the case in production.\nTo optimize this:\n_nocheck__trace_vhost_commit() is now fully inlined in the .h file with\nthe hot path.It checks trace_event_get_state() before calling into _simple_trace_vhost_commit(), which remains in .c.\nThis avoids calling into the .c function altogether when the tracepoint is disabled, thereby skipping unnecessary prologue instructions.\n\nThis results in better performance by removing redundant instructions in the tracing fast path.\n\nSigned-off-by: Tanish Desai \u003ctanishdesai37@gmail.com\u003e\nMessage-id: 20250528192528.3968-1-tanishdesai37@gmail.com\nSigned-off-by: Stefan Hajnoczi \u003cstefanha@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a74d61fcd64d3d2379ea961061ee729ae17cbe19",
      "old_mode": 33188,
      "old_path": "scripts/tracetool/backend/simple.py",
      "new_id": "2688d4b64b33fe95735867ddcd0cf1378da2e9f5",
      "new_mode": 33188,
      "new_path": "scripts/tracetool/backend/simple.py"
    }
  ]
}
