)]}'
{
  "commit": "7f62740112ef7260d399a340e210f3a49bc4177e",
  "tree": "42db73f6961e5e36983b22c7319bf5edeaec2ea9",
  "parents": [
    "626b817511347708422334445b6a10f8716cdecb"
  ],
  "author": {
    "name": "Todd Kjos",
    "email": "tkjos@google.com",
    "time": "Fri Apr 24 10:12:38 2020 -0700"
  },
  "committer": {
    "name": "Todd Kjos",
    "email": "tkjos@google.com",
    "time": "Tue May 12 19:47:44 2020 +0000"
  },
  "message": "ANDROID: add support for vendor hooks\n\nAdd support for vendor hooks. Adds include/trace/hooks\ndirectory for trace definition headers where hooks\ncan be defined and vendor_hook.c for instantiating\nand exporting them for vendor modules.\n\nThere are two variants of vendor hooks, both based\non tracepoints:\n\nNormal: this uses the DECLARE_HOOK macro\nto create a tracepoint function with the name trace_\u003cname\u003e\nwhere \u003cname\u003e is the unique identifier for the trace.\n\nRestricted: restricted hooks are needed for cases like\nscheduler hooks where the attached function must be\ncalled even if the cpu is offline or requires a\nnon-atomic context. Restricted vendor hooks cannot\nbe detached, so modules that attach to a restricted\nhook can never unload. Also, only 1 attachment is\nallowed (any other attempts to attach will fail with\n-EBUSY).\n\nFor either case, modules attach to the hook by using\nregister_trace_\u003cname\u003e(func_ptr, NULL).\n\nNew hooks should be defined in headers in the\ninclude/trace/hooks/ directory using the\nDECLARE_HOOK() or DECLARE_RESTRICTED_HOOK()\nmacros.\n\nNew files added to include/trace/hooks should\nbe #include\u0027d from drivers/android/vendor_hooks.c.\nThe EXPORT_TRACEPOINT_SYMBOL_GPL() should be\nalso added to drivers/android/vendor_hooks.c.\n\nFor example, if a new hook, \u0027android_vh_foo(int \u0026ret)\u0027\nis added in do_exit() in exit.c, these changes are\nneeded:\n\n1. create a new header file include/trace/hooks/foo.h\nwhich contains:\n\t#include \u003ctrace/hooks/vendor_hooks.h\u003e\n\t...\n \tDECLARE_HOOK(android_vh_foo,\n\t\t     TP_PROTO(int *retp),\n\t\t     TP_ARGS(retp);\n\n2. in exit.c, add\n\t#include \u003ctrace/hooks/foo.h\u003e\n\t...\n  \tint ret \u003d 0;\n\t...\n  \tandroid_vh_foo(\u0026ret);\n  \tif (ret)\n    \t\treturn ret;\n\t...\n\n3. in drivers/android/vendor_hooks.c, add\n\t#include \u003ctrace/hooks/foo.h\u003e\n\t...\n\tEXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_foo);\n\nThe hook can then be attached by adding the registration code\nto the module:\n\n\t#include \u003ctrace/hooks/sched.h\u003e\n\t...\n\tstatic void my_foo(int *retp)\n\t{\n\t\t*retp \u003d 0;\n\t}\n\t...\n\trc \u003d register_trace_android_vh_sched_exit(my_foo, NULL);\n\nBug: 156285741\nSigned-off-by: Todd Kjos \u003ctkjos@google.com\u003e\nChange-Id: I6a7d1c8919dae91c965e2a0450df50eac2d282db\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "7ca44534f863df2156bc44b0a0200d12d95a027d",
      "old_mode": 33188,
      "old_path": "arch/arm64/configs/gki_defconfig",
      "new_id": "961597b927b1c3d0e557310b4048b58cd4deafe4",
      "new_mode": 33188,
      "new_path": "arch/arm64/configs/gki_defconfig"
    },
    {
      "type": "modify",
      "old_id": "fb93ef7f709dde23ffe8feaa1692a67228bd9b1c",
      "old_mode": 33188,
      "old_path": "arch/x86/configs/gki_defconfig",
      "new_id": "77fdd259b5f1918269b00854fb8dad52ea6f9af3",
      "new_mode": 33188,
      "new_path": "arch/x86/configs/gki_defconfig"
    },
    {
      "type": "modify",
      "old_id": "6fdf2abe4598ab30e8f8155e9ab86ca164557f5a",
      "old_mode": 33188,
      "old_path": "drivers/android/Kconfig",
      "new_id": "392564cfe6c3e1cdd4cc11ca69f3526a9bff260b",
      "new_mode": 33188,
      "new_path": "drivers/android/Kconfig"
    },
    {
      "type": "modify",
      "old_id": "c9d3d0c99c25717a4bf6867c10732e5eb9022ad1",
      "old_mode": 33188,
      "old_path": "drivers/android/Makefile",
      "new_id": "d488047415a0aa7cc88dea531b9edc27b357ad4d",
      "new_mode": 33188,
      "new_path": "drivers/android/Makefile"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "4a403a81eed3f5b9188c7e191b38d302157c0234",
      "new_mode": 33188,
      "new_path": "drivers/android/vendor_hooks.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "9d9ae21895dd9a98a988bce352ab2ceddd3dd846",
      "new_mode": 33188,
      "new_path": "include/trace/hooks/vendor_hooks.h"
    }
  ]
}
