#include #include #include #include #include "llvm.h" #include "tests.h" #include "debug.h" #include "util.h" #ifdef HAVE_LIBBPF_SUPPORT static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz) { struct bpf_object *obj; obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, NULL); if (IS_ERR(obj)) return TEST_FAIL; bpf_object__close(obj); return TEST_OK; } #else static int test__bpf_parsing(void *obj_buf __maybe_unused, size_t obj_buf_sz __maybe_unused) { pr_debug("Skip bpf parsing\n"); return TEST_OK; } #endif static struct { const char *source; const char *desc; bool should_load_fail; } bpf_source_table[__LLVM_TESTCASE_MAX] = { [LLVM_TESTCASE_BASE] = { .source = test_llvm__bpf_base_prog, .desc = "Basic BPF llvm compile", }, [LLVM_TESTCASE_KBUILD] = { .source = test_llvm__bpf_test_kbuild_prog, .desc = "kbuild searching", }, [LLVM_TESTCASE_BPF_PROLOGUE] = { .source = test_llvm__bpf_test_prologue_prog, .desc = "Compile source for BPF prologue generation", }, [LLVM_TESTCASE_BPF_RELOCATION] = { .source = test_llvm__bpf_test_relocation, .desc = "Compile source for BPF relocation", .should_load_fail = true, }, }; int test_llvm__fetch_bpf_obj(void **p_obj_buf, size_t *p_obj_buf_sz, enum test_llvm__testcase idx, bool force, bool *should_load_fail) { const char *source; const char *desc; const char *tmpl_old, *clang_opt_old; char *tmpl_new = NULL, *clang_opt_new = NULL; int err, old_verbose, ret = TEST_FAIL; if (idx >= __LLVM_TESTCASE_MAX) return TEST_FAIL; source = bpf_source_table[idx].source; desc = bpf_source_table[idx].desc; if (should_load_fail) *should_load_fail = bpf_source_table[idx].should_load_fail; /* * Skip this test if user's .perfconfig doesn't set [llvm] section * and clang is not found in $PATH, and this is not perf test -v */ if (!force && (verbose == 0 && !llvm_param.user_set_param && llvm__search_clang())) { pr_debug("No clang and no verbosive, skip this test\n"); return TEST_SKIP; } /* * llvm is verbosity when error. Suppress all error output if * not 'perf test -v'. */ old_verbose = verbose; if (verbose == 0) verbose = -1; *p_obj_buf = NULL; *p_obj_buf_sz = 0; if (!llvm_param.clang_bpf_cmd_template) goto out; if (!llvm_param.clang_opt) llvm_param.clang_opt = strdup(""); err = asprintf(&tmpl_new, "echo '%s' | %s%s", source, llvm_param.clang_bpf_cmd_template, old_verbose ? "" : " 2>/dev/null"); if (err < 0) goto out; err = asprintf(&clang_opt_new, "-xc %s", llvm_param.clang_opt); if (err < 0) goto out; tmpl_old = llvm_param.clang_bpf_cmd_template; llvm_param.clang_bpf_cmd_template = tmpl_new; clang_opt_old = llvm_param.clang_opt; llvm_param.clang_opt = clang_opt_new; err = llvm__compile_bpf("-", p_obj_buf, p_obj_buf_sz); llvm_param.clang_bpf_cmd_template = tmpl_old; llvm_param.clang_opt = clang_opt_old; verbose = old_verbose; if (err) goto out; ret = TEST_OK; out: free(tmpl_new); free(clang_opt_new); if (ret != TEST_OK) pr_debug("Failed to compile test case: '%s'\n", desc); return ret; } int test__llvm(int subtest) { int ret; void *obj_buf = NULL; size_t obj_buf_sz = 0; bool should_load_fail = false; if ((subtest < 0) || (subtest >= __LLVM_TESTCASE_MAX)) return TEST_FAIL; ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz, subtest, false, &should_load_fail); if (ret == TEST_OK && !should_load_fail) { ret = test__bpf_parsing(obj_buf, obj_buf_sz); if (ret != TEST_OK) { pr_debug("Failed to parse test case '%s'\n", bpf_source_table[subtest].desc); } } free(obj_buf); return ret; } int test__llvm_subtest_get_nr(void) { return __LLVM_TESTCASE_MAX; } const char *test__llvm_subtest_get_desc(int subtest) { if ((subtest < 0) || (subtest >= __LLVM_TESTCASE_MAX)) return NULL; return bpf_source_table[subtest].desc; } '>8space:mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 12:54:16 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 12:54:16 -0800
commit1b1bc42c1692e9b62756323c675a44cb1a1f9dbd (patch)
treed514a2d8512fc52c15747841e2368f8f99a50787 /sound/isa/sb
parent3365135d43f861003555c963b309672d053a2228 (diff)
parent950eabbd6ddedc1b08350b9169a6a51b130ebaaf (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) GTP fixes from Andreas Schultz (missing genl module alias, clear IP DF on transmit). 2) Netfilter needs to reflect the fwmark when sending resets, from Pau Espin Pedrol. 3) nftable dump OOPS fix from Liping Zhang. 4) Fix erroneous setting of VIRTIO_NET_HDR_F_DATA_VALID on transmit, from Rolf Neugebauer. 5) Fix build error of ipt_CLUSTERIP when procfs is disabled, from Arnd Bergmann. 6) Fix regression in handling of NETIF_F_SG in harmonize_features(), from Eric Dumazet. 7) Fix RTNL deadlock wrt. lwtunnel module loading, from David Ahern. 8) tcp_fastopen_create_child() needs to setup tp->max_window, from Alexey Kodanev. 9) Missing kmemdup() failure check in ipv6 segment routing code, from Eric Dumazet. 10) Don't execute unix_bind() under the bindlock, otherwise we deadlock with splice. From WANG Cong. 11) ip6_tnl_parse_tlv_enc_lim() potentially reallocates the skb buffer, therefore callers must reload cached header pointers into that skb. Fix from Eric Dumazet. 12) Fix various bugs in legacy IRQ fallback handling in alx driver, from Tobias Regnery. 13) Do not allow lwtunnel drivers to be unloaded while they are referenced by active instances, from Robert Shearman. 14) Fix truncated PHY LED trigger names, from Geert Uytterhoeven. 15) Fix a few regressions from virtio_net XDP support, from John Fastabend and Jakub Kicinski. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (102 commits) ISDN: eicon: silence misleading array-bounds warning net: phy: micrel: add support for KSZ8795 gtp: fix cross netns recv on gtp socket gtp: clear DF bit on GTP packet tx gtp: add genl family modules alias tcp: don't annotate mark on control socket from tcp_v6_send_response() ravb: unmap descriptors when freeing rings virtio_net: reject XDP programs using header adjustment virtio_net: use dev_kfree_skb for small buffer XDP receive r8152: check rx after napi is enabled r8152: re-schedule napi for tx r8152: avoid start_xmit to schedule napi when napi is disabled r8152: avoid start_xmit to call napi_schedule during autosuspend net: dsa: Bring back device detaching in dsa_slave_suspend() net: phy: leds: Fix truncated LED trigger names net: phy: leds: Break dependency of phy.h on phy_led_triggers.h net: phy: leds: Clear phy_num_led_triggers on failure to avoid crash net-next: ethernet: mediatek: change the compatible string Documentation: devicetree: change the mediatek ethernet compatible string bnxt_en: Fix RTNL lock usage on bnxt_get_port_module_status(). ...
Diffstat (limited to 'sound/isa/sb')