Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1352403pxb; Fri, 1 Oct 2021 08:52:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK3tk+2ReHblRjR+16PKQSiab3BQYwbvC28PtbEkkecGF6CRaBQszi61d1Wjw/naI4B4zD X-Received: by 2002:aa7:8891:0:b0:44c:255d:391f with SMTP id z17-20020aa78891000000b0044c255d391fmr557710pfe.26.1633103540511; Fri, 01 Oct 2021 08:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633103540; cv=none; d=google.com; s=arc-20160816; b=kYFhQ+vj43np7j/xDdsVL+b5IE9zYkEXpJIfNTYlkeBHE1xXUNmSOFz4169nq1D4yv 8aRoKpfULjwy6pGzPJYbyP/sE+o5wE+l/+3V4f+394+pR9S5hmqjpEZdoFnsk74rGf7m iytOpY5PxRZNlDnfPLGlCcp0/3l3TtJ7ARdIuzTfxdaI9UIz3rNgbgd7MgPRoQbNesOx mvgaGYWO5rIfmX08LQ9oldeQKfy4AVlVuewnj0/GPI3QsI/oRg7rNSPNROWKqbmhnD/F v3gpqIxZ+PUkjmK7D0KAe9IfXZzjZe+j4lTtFrwzzVTMAvZAEq/6TDGXD0p1G2bmlD9P 22KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=5OYmL8JsTh62JE1sZQP92Eb1+8ePanIs7P1lJmaXQ50=; b=UJojZHuVnW6GeyeqGpirPBRb7uSXTavbxkoLtnO6WddxMh0mLwitKI8b8JGMIzqUyn FMvs/VwSUbffTUCR+1yf5Gso1lxDOJVxtDVTi4poDDb2cjsIgpz1cdOCFd2tfwPaDvFM b3H9bh7ACq7YyxjHwfOQQuT3qLe7CE31ZsSl8fZYPQ+oNB0KhOMWSUcHu5iGaQ/cPnGx eRO/bgO1mmlW3Lv/XI8eelxD7yC+kCBic5cqojR595V++8ziRrCTHNaE/IM9FMFsjls8 hUXK80AGFOtfd0uX9K9Z9aFHgLL5Lmnw4aIAYm8Lqgp0PbqI5M2I5jQy3gbZOY0HGL1g ND7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@anyfinetworks-com.20210112.gappssmtp.com header.s=20210112 header.b=Zv5e0gqC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b9si8164669pfp.311.2021.10.01.08.52.07; Fri, 01 Oct 2021 08:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@anyfinetworks-com.20210112.gappssmtp.com header.s=20210112 header.b=Zv5e0gqC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231590AbhJANxL (ORCPT + 99 others); Fri, 1 Oct 2021 09:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231543AbhJANxL (ORCPT ); Fri, 1 Oct 2021 09:53:11 -0400 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8B21C06177C for ; Fri, 1 Oct 2021 06:51:26 -0700 (PDT) Received: by mail-yb1-xb2d.google.com with SMTP id s4so4241507ybs.8 for ; Fri, 01 Oct 2021 06:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anyfinetworks-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5OYmL8JsTh62JE1sZQP92Eb1+8ePanIs7P1lJmaXQ50=; b=Zv5e0gqChaS9QuJ0veasmSAsT16UyrrpHwt6/VrYPjNAvUnUOu8R6T5cWeVbLb2DtV DGBlh/SbBS51eOTIuQy+RdYE2TX7sI0OOUM0MJ9+aLqGmEq+Oajo5xbJXCmnSvvO4lOU cVwN2IoNHLDFj3S1dFhaVv35on+R7IYDpoCbNrwvK6p8lLDI27S3lZFqhqkDX65WPpSD ZuZfH8sCTOOa2UXVO+CuxsNnVRDd7hi6Mp5q+LuHnr8KwDU9aQmNnu77fe1BmpOWD5j9 G2bPwmq6kvE98m3VsiWfZFcQgyvHd3DfBL3hX3J2iIhEHGXIN2q7aFG075kVo1Qhm1Rz JVSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5OYmL8JsTh62JE1sZQP92Eb1+8ePanIs7P1lJmaXQ50=; b=yugzO/U8XS04xJ0KUEPAm0FydoFen+vb9C/CLEOz9muPGAhxYwurS2pTh2g5gwghN4 tcwtSPVvRl0/B+Kph+VuK3qPFYyIcd/msno4HwNjRHqgUuUAfLGvedBoVdnIWrb/6s+v ROxLa9MCLCtrh/WfM0wpsJl+zJQ3Us6HbftJayuy/OewIuPoCsZkdawNEpRG8hbMy8E9 eXXLKrQwipUvYH7oofVVTnWbsNoK1suDmaQJ0MIKupeaJD3Tfh/HybEeA7XrsJZEgFks Tg53Msc3WcKwGBWK5tOk1uBFt488M+hoNOkhZiJTcwN7BuLhEJ+POMrpkHQZRveR02JP wTPA== X-Gm-Message-State: AOAM533IWHfVt6DU7CGi3xB0E7ejyL+7O0bRXARPza8SYPggXukBxlnk F9MgqwJhx9YgB2i/C9rzwS77q0Zvkq9U9YqkHG1dNA== X-Received: by 2002:a25:520b:: with SMTP id g11mr6485423ybb.268.1633096286107; Fri, 01 Oct 2021 06:51:26 -0700 (PDT) MIME-Version: 1.0 References: <1632999672-10757-1-git-send-email-yangtiezhu@loongson.cn> In-Reply-To: <1632999672-10757-1-git-send-email-yangtiezhu@loongson.cn> From: Johan Almbladh Date: Fri, 1 Oct 2021 15:51:14 +0200 Message-ID: Subject: Re: [PATCH bpf-next] test_bpf: add module parameter test_type To: Tiezhu Yang Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Networking , bpf , linux-kernel@vger.kernel.org, Xuefeng Li Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tiezhu, Your v2 is base64-encoded. Please use plain-text for patch submissions. On Thu, Sep 30, 2021 at 1:01 PM Tiezhu Yang wrote: > > After commit 9298e63eafea ("bpf/tests: Add exhaustive tests of ALU > operand magnitudes"), when modprobe test_bpf.ko with jit on mips64, > there exists segment fault due to fhe following reason: > > test_bpf: #616 ALU64_MOV_X: all register value magnitudes jited:1 > Break instruction in kernel code[#1] > > It seems that the related jit implementations of some test cases > in test_bpf() have problems. At this moment, I do not care about > the segment fault while I just want to verify the test cases of > tail calls. Don't put too much effort into the current MIPS64 JIT. I have been working on a significant upgrade of the MIPS JIT, which adds MIPS32 support and full eBPF ISA support, among other things. All the new JIT tests in test_bpf.ko I submitted are essentially a side effect of that work. I am currently testing the new JIT on different setups, and I hope to be able to submit the patch set next week. A side note, as you seem to work at Loongson. It would be great if you could verify the CPU errata workarounds I implemented for Loongson-2F and 3, once I get the patch set out for review. > > Based on the above background and motivation, add the following > module parameter test_type to the test_bpf.ko: > test_type=: only the specified type will be run, the string > can be "test_bpf", "test_tail_calls" or "test_skb_segment". > > This is useful to only test the corresponding test type when specify > the valid test_type string. I agree that it is good to be able to choose a particular test suite to run. There are also the test_id and test_range parameters. If we add a test suite selector, it would be nice if the test range/id selection applied to that test suite, instead of being ignored for all suites except test_bpf. > > Any invalid test type will result in -EINVAL being returned and no > tests being run. If the test_type is not specified or specified as > empty string, it does not change the current logic, all of the test > cases will be run. > > Signed-off-by: Tiezhu Yang > --- > lib/test_bpf.c | 48 +++++++++++++++++++++++++++++++++--------------- > 1 file changed, 33 insertions(+), 15 deletions(-) > > diff --git a/lib/test_bpf.c b/lib/test_bpf.c > index 21ea1ab..9428fec 100644 > --- a/lib/test_bpf.c > +++ b/lib/test_bpf.c > @@ -11866,6 +11866,9 @@ module_param(test_id, int, 0); > static int test_range[2] = { 0, ARRAY_SIZE(tests) - 1 }; > module_param_array(test_range, int, NULL, 0); > > +static char test_type[32]; > +module_param_string(test_type, test_type, sizeof(test_type), 0); > + > static __init int find_test_index(const char *test_name) > { > int i; > @@ -12518,24 +12521,39 @@ static int __init test_bpf_init(void) > struct bpf_array *progs = NULL; > int ret; > > - ret = prepare_bpf_tests(); > - if (ret < 0) > - return ret; > + if (strlen(test_type) && > + strcmp(test_type, "test_bpf") && > + strcmp(test_type, "test_tail_calls") && > + strcmp(test_type, "test_skb_segment")) { > + pr_err("test_bpf: invalid test_type '%s' specified.\n", test_type); > + return -EINVAL; > + } > + > + if (!strlen(test_type) || !strcmp(test_type, "test_bpf")) { > + ret = prepare_bpf_tests(); > + if (ret < 0) > + return ret; > + > + ret = test_bpf(); > + destroy_bpf_tests(); > + if (ret) > + return ret; > + } > > - ret = test_bpf(); > - destroy_bpf_tests(); > - if (ret) > - return ret; > + if (!strlen(test_type) || !strcmp(test_type, "test_tail_calls")) { > + ret = prepare_tail_call_tests(&progs); > + if (ret) > + return ret; > + ret = test_tail_calls(progs); > + destroy_tail_call_tests(progs); > + if (ret) > + return ret; > + } > > - ret = prepare_tail_call_tests(&progs); > - if (ret) > - return ret; > - ret = test_tail_calls(progs); > - destroy_tail_call_tests(progs); > - if (ret) > - return ret; > + if (!strlen(test_type) || !strcmp(test_type, "test_skb_segment")) > + return test_skb_segment(); > > - return test_skb_segment(); > + return 0; > } > > static void __exit test_bpf_exit(void) > -- > 2.1.0 >