1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 2f8ebb0cdSNamhyung Kim #include "perf.h" 3f8ebb0cdSNamhyung Kim #include "tests.h" 4f8ebb0cdSNamhyung Kim #include "debug.h" 5f8ebb0cdSNamhyung Kim #include "symbol.h" 6f8ebb0cdSNamhyung Kim #include "sort.h" 7f8ebb0cdSNamhyung Kim #include "evsel.h" 8f8ebb0cdSNamhyung Kim #include "evlist.h" 9f8ebb0cdSNamhyung Kim #include "machine.h" 10f8ebb0cdSNamhyung Kim #include "thread.h" 11f8ebb0cdSNamhyung Kim #include "parse-events.h" 126e344a95SNamhyung Kim #include "hists_common.h" 13a43783aeSArnaldo Carvalho de Melo #include <errno.h> 14877a7a11SArnaldo Carvalho de Melo #include <linux/kernel.h> 15f8ebb0cdSNamhyung Kim 16f8ebb0cdSNamhyung Kim struct sample { 17f8ebb0cdSNamhyung Kim u32 pid; 18f8ebb0cdSNamhyung Kim u64 ip; 19f8ebb0cdSNamhyung Kim struct thread *thread; 20f8ebb0cdSNamhyung Kim struct map *map; 21f8ebb0cdSNamhyung Kim struct symbol *sym; 22f8ebb0cdSNamhyung Kim }; 23f8ebb0cdSNamhyung Kim 246e344a95SNamhyung Kim /* For the numbers, see hists_common.c */ 25f8ebb0cdSNamhyung Kim static struct sample fake_common_samples[] = { 26f8ebb0cdSNamhyung Kim /* perf [kernel] schedule() */ 27a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_KERNEL_SCHEDULE, }, 28f8ebb0cdSNamhyung Kim /* perf [perf] main() */ 29a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_MAIN, }, 30f8ebb0cdSNamhyung Kim /* perf [perf] cmd_record() */ 31a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_CMD_RECORD, }, 32f8ebb0cdSNamhyung Kim /* bash [bash] xmalloc() */ 33a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_BASH_XMALLOC, }, 34f8ebb0cdSNamhyung Kim /* bash [libc] malloc() */ 35a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_MALLOC, }, 36f8ebb0cdSNamhyung Kim }; 37f8ebb0cdSNamhyung Kim 38f8ebb0cdSNamhyung Kim static struct sample fake_samples[][5] = { 39f8ebb0cdSNamhyung Kim { 40f8ebb0cdSNamhyung Kim /* perf [perf] run_command() */ 41a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_PERF_RUN_COMMAND, }, 42f8ebb0cdSNamhyung Kim /* perf [libc] malloc() */ 43a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_LIBC_MALLOC, }, 44f8ebb0cdSNamhyung Kim /* perf [kernel] page_fault() */ 45a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF1, .ip = FAKE_IP_KERNEL_PAGE_FAULT, }, 46f8ebb0cdSNamhyung Kim /* perf [kernel] sys_perf_event_open() */ 47a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_KERNEL_SYS_PERF_EVENT_OPEN, }, 48f8ebb0cdSNamhyung Kim /* bash [libc] free() */ 49a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_FREE, }, 50f8ebb0cdSNamhyung Kim }, 51f8ebb0cdSNamhyung Kim { 52f8ebb0cdSNamhyung Kim /* perf [libc] free() */ 53a1891aa4SNamhyung Kim { .pid = FAKE_PID_PERF2, .ip = FAKE_IP_LIBC_FREE, }, 54f8ebb0cdSNamhyung Kim /* bash [libc] malloc() */ 55a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_MALLOC, }, /* will be merged */ 56f8ebb0cdSNamhyung Kim /* bash [bash] xfee() */ 57a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_BASH_XFREE, }, 58f8ebb0cdSNamhyung Kim /* bash [libc] realloc() */ 59a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_LIBC_REALLOC, }, 60f8ebb0cdSNamhyung Kim /* bash [kernel] page_fault() */ 61a1891aa4SNamhyung Kim { .pid = FAKE_PID_BASH, .ip = FAKE_IP_KERNEL_PAGE_FAULT, }, 62f8ebb0cdSNamhyung Kim }, 63f8ebb0cdSNamhyung Kim }; 64f8ebb0cdSNamhyung Kim 65f8ebb0cdSNamhyung Kim static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) 66f8ebb0cdSNamhyung Kim { 67f8ebb0cdSNamhyung Kim struct perf_evsel *evsel; 68f8ebb0cdSNamhyung Kim struct addr_location al; 69f8ebb0cdSNamhyung Kim struct hist_entry *he; 70fd36f3ddSNamhyung Kim struct perf_sample sample = { .period = 1, .weight = 1, }; 71f8ebb0cdSNamhyung Kim size_t i = 0, k; 72f8ebb0cdSNamhyung Kim 73f8ebb0cdSNamhyung Kim /* 74f8ebb0cdSNamhyung Kim * each evsel will have 10 samples - 5 common and 5 distinct. 75f8ebb0cdSNamhyung Kim * However the second evsel also has a collapsed entry for 76f8ebb0cdSNamhyung Kim * "bash [libc] malloc" so total 9 entries will be in the tree. 77f8ebb0cdSNamhyung Kim */ 78e5cadb93SArnaldo Carvalho de Melo evlist__for_each_entry(evlist, evsel) { 794ea062edSArnaldo Carvalho de Melo struct hists *hists = evsel__hists(evsel); 804ea062edSArnaldo Carvalho de Melo 81f8ebb0cdSNamhyung Kim for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { 82473398a2SArnaldo Carvalho de Melo sample.cpumode = PERF_RECORD_MISC_USER; 83ef89325fSAdrian Hunter sample.pid = fake_common_samples[k].pid; 8413ce34dfSNamhyung Kim sample.tid = fake_common_samples[k].pid; 85ef89325fSAdrian Hunter sample.ip = fake_common_samples[k].ip; 86bb3eb566SArnaldo Carvalho de Melo 87bb3eb566SArnaldo Carvalho de Melo if (machine__resolve(machine, &al, &sample) < 0) 88f8ebb0cdSNamhyung Kim goto out; 89f8ebb0cdSNamhyung Kim 900102ef3eSJiri Olsa he = hists__add_entry(hists, &al, NULL, 91fd36f3ddSNamhyung Kim NULL, NULL, &sample, true); 92b91fc39fSArnaldo Carvalho de Melo if (he == NULL) { 93b91fc39fSArnaldo Carvalho de Melo addr_location__put(&al); 94f8ebb0cdSNamhyung Kim goto out; 95b91fc39fSArnaldo Carvalho de Melo } 96f8ebb0cdSNamhyung Kim 97f8ebb0cdSNamhyung Kim fake_common_samples[k].thread = al.thread; 98f8ebb0cdSNamhyung Kim fake_common_samples[k].map = al.map; 99f8ebb0cdSNamhyung Kim fake_common_samples[k].sym = al.sym; 100f8ebb0cdSNamhyung Kim } 101f8ebb0cdSNamhyung Kim 102f8ebb0cdSNamhyung Kim for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) { 103ef89325fSAdrian Hunter sample.pid = fake_samples[i][k].pid; 10413ce34dfSNamhyung Kim sample.tid = fake_samples[i][k].pid; 105ef89325fSAdrian Hunter sample.ip = fake_samples[i][k].ip; 106bb3eb566SArnaldo Carvalho de Melo if (machine__resolve(machine, &al, &sample) < 0) 107f8ebb0cdSNamhyung Kim goto out; 108f8ebb0cdSNamhyung Kim 1090102ef3eSJiri Olsa he = hists__add_entry(hists, &al, NULL, 110fd36f3ddSNamhyung Kim NULL, NULL, &sample, true); 111b91fc39fSArnaldo Carvalho de Melo if (he == NULL) { 112b91fc39fSArnaldo Carvalho de Melo addr_location__put(&al); 113f8ebb0cdSNamhyung Kim goto out; 114b91fc39fSArnaldo Carvalho de Melo } 115f8ebb0cdSNamhyung Kim 116f8ebb0cdSNamhyung Kim fake_samples[i][k].thread = al.thread; 117f8ebb0cdSNamhyung Kim fake_samples[i][k].map = al.map; 118f8ebb0cdSNamhyung Kim fake_samples[i][k].sym = al.sym; 119f8ebb0cdSNamhyung Kim } 120f8ebb0cdSNamhyung Kim i++; 121f8ebb0cdSNamhyung Kim } 122f8ebb0cdSNamhyung Kim 123f8ebb0cdSNamhyung Kim return 0; 124f8ebb0cdSNamhyung Kim 125f8ebb0cdSNamhyung Kim out: 126f8ebb0cdSNamhyung Kim pr_debug("Not enough memory for adding a hist entry\n"); 127f8ebb0cdSNamhyung Kim return -1; 128f8ebb0cdSNamhyung Kim } 129f8ebb0cdSNamhyung Kim 130f8ebb0cdSNamhyung Kim static int find_sample(struct sample *samples, size_t nr_samples, 131f8ebb0cdSNamhyung Kim struct thread *t, struct map *m, struct symbol *s) 132f8ebb0cdSNamhyung Kim { 133f8ebb0cdSNamhyung Kim while (nr_samples--) { 134f8ebb0cdSNamhyung Kim if (samples->thread == t && samples->map == m && 135f8ebb0cdSNamhyung Kim samples->sym == s) 136f8ebb0cdSNamhyung Kim return 1; 137f8ebb0cdSNamhyung Kim samples++; 138f8ebb0cdSNamhyung Kim } 139f8ebb0cdSNamhyung Kim return 0; 140f8ebb0cdSNamhyung Kim } 141f8ebb0cdSNamhyung Kim 142f8ebb0cdSNamhyung Kim static int __validate_match(struct hists *hists) 143f8ebb0cdSNamhyung Kim { 144f8ebb0cdSNamhyung Kim size_t count = 0; 145*2eb3d689SDavidlohr Bueso struct rb_root_cached *root; 146f8ebb0cdSNamhyung Kim struct rb_node *node; 147f8ebb0cdSNamhyung Kim 148f8ebb0cdSNamhyung Kim /* 149f8ebb0cdSNamhyung Kim * Only entries from fake_common_samples should have a pair. 150f8ebb0cdSNamhyung Kim */ 15152225036SJiri Olsa if (hists__has(hists, need_collapse)) 152f8ebb0cdSNamhyung Kim root = &hists->entries_collapsed; 153f8ebb0cdSNamhyung Kim else 154f8ebb0cdSNamhyung Kim root = hists->entries_in; 155f8ebb0cdSNamhyung Kim 156*2eb3d689SDavidlohr Bueso node = rb_first_cached(root); 157f8ebb0cdSNamhyung Kim while (node) { 158f8ebb0cdSNamhyung Kim struct hist_entry *he; 159f8ebb0cdSNamhyung Kim 160f8ebb0cdSNamhyung Kim he = rb_entry(node, struct hist_entry, rb_node_in); 161f8ebb0cdSNamhyung Kim 162f8ebb0cdSNamhyung Kim if (hist_entry__has_pairs(he)) { 163f8ebb0cdSNamhyung Kim if (find_sample(fake_common_samples, 164f8ebb0cdSNamhyung Kim ARRAY_SIZE(fake_common_samples), 165f8ebb0cdSNamhyung Kim he->thread, he->ms.map, he->ms.sym)) { 166f8ebb0cdSNamhyung Kim count++; 167f8ebb0cdSNamhyung Kim } else { 168f8ebb0cdSNamhyung Kim pr_debug("Can't find the matched entry\n"); 169f8ebb0cdSNamhyung Kim return -1; 170f8ebb0cdSNamhyung Kim } 171f8ebb0cdSNamhyung Kim } 172f8ebb0cdSNamhyung Kim 173f8ebb0cdSNamhyung Kim node = rb_next(node); 174f8ebb0cdSNamhyung Kim } 175f8ebb0cdSNamhyung Kim 176f8ebb0cdSNamhyung Kim if (count != ARRAY_SIZE(fake_common_samples)) { 177f8ebb0cdSNamhyung Kim pr_debug("Invalid count for matched entries: %zd of %zd\n", 178f8ebb0cdSNamhyung Kim count, ARRAY_SIZE(fake_common_samples)); 179f8ebb0cdSNamhyung Kim return -1; 180f8ebb0cdSNamhyung Kim } 181f8ebb0cdSNamhyung Kim 182f8ebb0cdSNamhyung Kim return 0; 183f8ebb0cdSNamhyung Kim } 184f8ebb0cdSNamhyung Kim 185f8ebb0cdSNamhyung Kim static int validate_match(struct hists *leader, struct hists *other) 186f8ebb0cdSNamhyung Kim { 187f8ebb0cdSNamhyung Kim return __validate_match(leader) || __validate_match(other); 188f8ebb0cdSNamhyung Kim } 189f8ebb0cdSNamhyung Kim 190f8ebb0cdSNamhyung Kim static int __validate_link(struct hists *hists, int idx) 191f8ebb0cdSNamhyung Kim { 192f8ebb0cdSNamhyung Kim size_t count = 0; 193f8ebb0cdSNamhyung Kim size_t count_pair = 0; 194f8ebb0cdSNamhyung Kim size_t count_dummy = 0; 195*2eb3d689SDavidlohr Bueso struct rb_root_cached *root; 196f8ebb0cdSNamhyung Kim struct rb_node *node; 197f8ebb0cdSNamhyung Kim 198f8ebb0cdSNamhyung Kim /* 199f8ebb0cdSNamhyung Kim * Leader hists (idx = 0) will have dummy entries from other, 200f8ebb0cdSNamhyung Kim * and some entries will have no pair. However every entry 201f8ebb0cdSNamhyung Kim * in other hists should have (dummy) pair. 202f8ebb0cdSNamhyung Kim */ 20352225036SJiri Olsa if (hists__has(hists, need_collapse)) 204f8ebb0cdSNamhyung Kim root = &hists->entries_collapsed; 205f8ebb0cdSNamhyung Kim else 206f8ebb0cdSNamhyung Kim root = hists->entries_in; 207f8ebb0cdSNamhyung Kim 208*2eb3d689SDavidlohr Bueso node = rb_first_cached(root); 209f8ebb0cdSNamhyung Kim while (node) { 210f8ebb0cdSNamhyung Kim struct hist_entry *he; 211f8ebb0cdSNamhyung Kim 212f8ebb0cdSNamhyung Kim he = rb_entry(node, struct hist_entry, rb_node_in); 213f8ebb0cdSNamhyung Kim 214f8ebb0cdSNamhyung Kim if (hist_entry__has_pairs(he)) { 215f8ebb0cdSNamhyung Kim if (!find_sample(fake_common_samples, 216f8ebb0cdSNamhyung Kim ARRAY_SIZE(fake_common_samples), 217f8ebb0cdSNamhyung Kim he->thread, he->ms.map, he->ms.sym) && 218f8ebb0cdSNamhyung Kim !find_sample(fake_samples[idx], 219f8ebb0cdSNamhyung Kim ARRAY_SIZE(fake_samples[idx]), 220f8ebb0cdSNamhyung Kim he->thread, he->ms.map, he->ms.sym)) { 221f8ebb0cdSNamhyung Kim count_dummy++; 222f8ebb0cdSNamhyung Kim } 223f8ebb0cdSNamhyung Kim count_pair++; 224f8ebb0cdSNamhyung Kim } else if (idx) { 225f8ebb0cdSNamhyung Kim pr_debug("A entry from the other hists should have pair\n"); 226f8ebb0cdSNamhyung Kim return -1; 227f8ebb0cdSNamhyung Kim } 228f8ebb0cdSNamhyung Kim 229f8ebb0cdSNamhyung Kim count++; 230f8ebb0cdSNamhyung Kim node = rb_next(node); 231f8ebb0cdSNamhyung Kim } 232f8ebb0cdSNamhyung Kim 233f8ebb0cdSNamhyung Kim /* 234f8ebb0cdSNamhyung Kim * Note that we have a entry collapsed in the other (idx = 1) hists. 235f8ebb0cdSNamhyung Kim */ 236f8ebb0cdSNamhyung Kim if (idx == 0) { 237f8ebb0cdSNamhyung Kim if (count_dummy != ARRAY_SIZE(fake_samples[1]) - 1) { 238f8ebb0cdSNamhyung Kim pr_debug("Invalid count of dummy entries: %zd of %zd\n", 239f8ebb0cdSNamhyung Kim count_dummy, ARRAY_SIZE(fake_samples[1]) - 1); 240f8ebb0cdSNamhyung Kim return -1; 241f8ebb0cdSNamhyung Kim } 242f8ebb0cdSNamhyung Kim if (count != count_pair + ARRAY_SIZE(fake_samples[0])) { 243f8ebb0cdSNamhyung Kim pr_debug("Invalid count of total leader entries: %zd of %zd\n", 244f8ebb0cdSNamhyung Kim count, count_pair + ARRAY_SIZE(fake_samples[0])); 245f8ebb0cdSNamhyung Kim return -1; 246f8ebb0cdSNamhyung Kim } 247f8ebb0cdSNamhyung Kim } else { 248f8ebb0cdSNamhyung Kim if (count != count_pair) { 249f8ebb0cdSNamhyung Kim pr_debug("Invalid count of total other entries: %zd of %zd\n", 250f8ebb0cdSNamhyung Kim count, count_pair); 251f8ebb0cdSNamhyung Kim return -1; 252f8ebb0cdSNamhyung Kim } 253f8ebb0cdSNamhyung Kim if (count_dummy > 0) { 254f8ebb0cdSNamhyung Kim pr_debug("Other hists should not have dummy entries: %zd\n", 255f8ebb0cdSNamhyung Kim count_dummy); 256f8ebb0cdSNamhyung Kim return -1; 257f8ebb0cdSNamhyung Kim } 258f8ebb0cdSNamhyung Kim } 259f8ebb0cdSNamhyung Kim 260f8ebb0cdSNamhyung Kim return 0; 261f8ebb0cdSNamhyung Kim } 262f8ebb0cdSNamhyung Kim 263f8ebb0cdSNamhyung Kim static int validate_link(struct hists *leader, struct hists *other) 264f8ebb0cdSNamhyung Kim { 265f8ebb0cdSNamhyung Kim return __validate_link(leader, 0) || __validate_link(other, 1); 266f8ebb0cdSNamhyung Kim } 267f8ebb0cdSNamhyung Kim 26881f17c90SArnaldo Carvalho de Melo int test__hists_link(struct test *test __maybe_unused, int subtest __maybe_unused) 269f8ebb0cdSNamhyung Kim { 270f8ebb0cdSNamhyung Kim int err = -1; 2714ea062edSArnaldo Carvalho de Melo struct hists *hists, *first_hists; 272876650e6SArnaldo Carvalho de Melo struct machines machines; 273f8ebb0cdSNamhyung Kim struct machine *machine = NULL; 274f8ebb0cdSNamhyung Kim struct perf_evsel *evsel, *first; 275334fe7a3SNamhyung Kim struct perf_evlist *evlist = perf_evlist__new(); 276f8ebb0cdSNamhyung Kim 277f8ebb0cdSNamhyung Kim if (evlist == NULL) 278f8ebb0cdSNamhyung Kim return -ENOMEM; 279f8ebb0cdSNamhyung Kim 280b39b8393SJiri Olsa err = parse_events(evlist, "cpu-clock", NULL); 281f8ebb0cdSNamhyung Kim if (err) 282f8ebb0cdSNamhyung Kim goto out; 283b39b8393SJiri Olsa err = parse_events(evlist, "task-clock", NULL); 284f8ebb0cdSNamhyung Kim if (err) 285f8ebb0cdSNamhyung Kim goto out; 286f8ebb0cdSNamhyung Kim 287b0500c16SWang Nan err = TEST_FAIL; 288f8ebb0cdSNamhyung Kim /* default sort order (comm,dso,sym) will be used */ 28940184c46SNamhyung Kim if (setup_sorting(NULL) < 0) 29055309985SNamhyung Kim goto out; 291f8ebb0cdSNamhyung Kim 292876650e6SArnaldo Carvalho de Melo machines__init(&machines); 293876650e6SArnaldo Carvalho de Melo 294f8ebb0cdSNamhyung Kim /* setup threads/dso/map/symbols also */ 295876650e6SArnaldo Carvalho de Melo machine = setup_fake_machine(&machines); 296f8ebb0cdSNamhyung Kim if (!machine) 297f8ebb0cdSNamhyung Kim goto out; 298f8ebb0cdSNamhyung Kim 299f8ebb0cdSNamhyung Kim if (verbose > 1) 300f8ebb0cdSNamhyung Kim machine__fprintf(machine, stderr); 301f8ebb0cdSNamhyung Kim 302f8ebb0cdSNamhyung Kim /* process sample events */ 303f8ebb0cdSNamhyung Kim err = add_hist_entries(evlist, machine); 304f8ebb0cdSNamhyung Kim if (err < 0) 305f8ebb0cdSNamhyung Kim goto out; 306f8ebb0cdSNamhyung Kim 307e5cadb93SArnaldo Carvalho de Melo evlist__for_each_entry(evlist, evsel) { 3084ea062edSArnaldo Carvalho de Melo hists = evsel__hists(evsel); 3094ea062edSArnaldo Carvalho de Melo hists__collapse_resort(hists, NULL); 310f8ebb0cdSNamhyung Kim 311f8ebb0cdSNamhyung Kim if (verbose > 2) 3124ea062edSArnaldo Carvalho de Melo print_hists_in(hists); 313f8ebb0cdSNamhyung Kim } 314f8ebb0cdSNamhyung Kim 315f8ebb0cdSNamhyung Kim first = perf_evlist__first(evlist); 316f8ebb0cdSNamhyung Kim evsel = perf_evlist__last(evlist); 317f8ebb0cdSNamhyung Kim 3184ea062edSArnaldo Carvalho de Melo first_hists = evsel__hists(first); 3194ea062edSArnaldo Carvalho de Melo hists = evsel__hists(evsel); 3204ea062edSArnaldo Carvalho de Melo 321f8ebb0cdSNamhyung Kim /* match common entries */ 3224ea062edSArnaldo Carvalho de Melo hists__match(first_hists, hists); 3234ea062edSArnaldo Carvalho de Melo err = validate_match(first_hists, hists); 324f8ebb0cdSNamhyung Kim if (err) 325f8ebb0cdSNamhyung Kim goto out; 326f8ebb0cdSNamhyung Kim 327f8ebb0cdSNamhyung Kim /* link common and/or dummy entries */ 3284ea062edSArnaldo Carvalho de Melo hists__link(first_hists, hists); 3294ea062edSArnaldo Carvalho de Melo err = validate_link(first_hists, hists); 330f8ebb0cdSNamhyung Kim if (err) 331f8ebb0cdSNamhyung Kim goto out; 332f8ebb0cdSNamhyung Kim 333f8ebb0cdSNamhyung Kim err = 0; 334f8ebb0cdSNamhyung Kim 335f8ebb0cdSNamhyung Kim out: 336f8ebb0cdSNamhyung Kim /* tear down everything */ 337f8ebb0cdSNamhyung Kim perf_evlist__delete(evlist); 338f21d1815SNamhyung Kim reset_output_field(); 339876650e6SArnaldo Carvalho de Melo machines__exit(&machines); 340f8ebb0cdSNamhyung Kim 341f8ebb0cdSNamhyung Kim return err; 342f8ebb0cdSNamhyung Kim } 343