Received: by 2002:a05:7412:b112:b0:f9:3106:f1c0 with SMTP id az18csp36541rdb; Sun, 17 Dec 2023 19:56:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKsnwJkHNCGkw6P1QHjtuVGkQDjTMoDFd6yvJ0Qba5qwsPTVZT/XYYeYrI/SuEL4wEe4hY X-Received: by 2002:a05:6a20:daa7:b0:192:f11b:d660 with SMTP id iy39-20020a056a20daa700b00192f11bd660mr6700502pzb.14.1702871802438; Sun, 17 Dec 2023 19:56:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702871802; cv=none; d=google.com; s=arc-20160816; b=nlzjqjSU0IIFDOLRjdjXT6bTAyA/UP4aEg8NtMe2OvPx74DlYB4eFkNQh7MPFkFajm Zxx4fnZD9bpnVwdrPhSVjKrRLkNv5D8QTMWTrwvwzmt5JwKRt4XFP4qpF2Vn50WoS+5Z P6aN0x9zie26LC36v8xE4UzeH7lmRLOUlnJxUV/6ehe/Ic7TwdofzfEJNShRO9wU7yNU ydYcKTLynjfJ1g1CyJ4sBewBDyDRpFaDdg6Xn8TvvXC6fS9eNQT9pR+XiaNwKudnvXUy 3Ks6JLJ109o0L+Onm9rq1EHS3WFmNYRWWv6NR806CIPE8xtauUaWE5pPiQrxPC2nHFRZ NUrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=IAXpZwPFWYTh7NYI9cITpDm8WNXyOT7XhEo/q9GXWHo=; fh=pe2tnkNsBNiuyDhE1Ih0993S0gZyH/YD2hDdwlUugd4=; b=EeeFVK8ztUoaCTJrwQ6D3gB1m3lVPqgqw3aeciunkflePpnOBId3yhzbjOFiefanGC 0Oo8vVRBhd4V3P+8/Xj9YT8JShUu6oMiEXw+eBYHizVeQIOR+bWzy5FiN4a+l39G2Jhr 7+xoErzko0K9LLSIbppoo0TynIA6JOwq/WWEEIWap75bfNIlxO5N8qUkxMFfWtu1qOvA p3DlThOthNIuW+Alpe3+3acnhcH6+zpZ+6ouAvis211jNgQrpfP00Uus/XvII4lrTSBT J7XdVY6uAhMiDEu1Dkq3tTavataR9Q3CXFxbyqc/e2xUDAF/M003WSQ0/VDYQGUNp8Yp 2Cjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=e3QDVa1W; spf=pass (google.com: domain of linux-kernel+bounces-2977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b20-20020a056a000a9400b006ce9e6cbdf5si16984819pfl.351.2023.12.17.19.56.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 19:56:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=e3QDVa1W; spf=pass (google.com: domain of linux-kernel+bounces-2977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 17497282816 for ; Mon, 18 Dec 2023 03:56:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8916F53AE; Mon, 18 Dec 2023 03:56:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e3QDVa1W" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EAF2538B; Mon, 18 Dec 2023 03:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f65.google.com with SMTP id 46e09a7af769-6d9fdbcec6eso2158521a34.1; Sun, 17 Dec 2023 19:56:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702871790; x=1703476590; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IAXpZwPFWYTh7NYI9cITpDm8WNXyOT7XhEo/q9GXWHo=; b=e3QDVa1WRby/aBsxaTlKmbybUsSMNscE4NGD1WiAZofOXu+5cLkCOokpRPU/ZxjSvG cwrtqJ6C0VOKGkGYLMwrlSCzTZ12q1o2RtolFY51CbePTw4RsOQl9BmOlU7kF6GtEMHd 1clLvPwL1sfBQyTsFsnY0bUk2lrVGvnAY6w4wkRsLlhDVyYZoueMF89+Z/0+aaGLlpzS Ojk6708qOiVOvx8diE8lkylqhfu5EPE4RvhX6ejiSquub11Qez4XYKjIF3nxlMtP+vqS XOrPANAHVmVqxsyEzNSepcb0+VA3xJfyLCzqPTt7v5nzp0fDY8aU1xvqPnE3T1omyoa4 uh2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702871790; x=1703476590; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IAXpZwPFWYTh7NYI9cITpDm8WNXyOT7XhEo/q9GXWHo=; b=r+euyC7PMvp+5WOP8Ae6rhxVEfFmXokywGfts41/+vcU4GTEE85ikr6WRp+/jn8Rig uCc1+ZL7F7+CisqWL7+teQsOaJyGEejZYAZbmMCJl+tu9c+MiS/atczX2Y90ozMeluEF RzxsizozFsEAgyBq3e3OBrEEtI3X4J89BEQJj+s2R5KfUyqQIla9EZ8Si8epXH8Z8jun Eg/S1EDBk3/zroeousR51s6QR6UZMzXj8iEh8t0frq8/1d17GTTXIYgcnCqJ1wJsmn4I JCyQNotfOLrBfxcS0fkaxv183x2Y+6F0XoTHqitMTWA78FpfRS93lzPgR7LuC6/nVedQ eT3g== X-Gm-Message-State: AOJu0Yz2vxrdO5CUSJDPf+LUBQxFJkElSFijAek86hb9Hb6E28ecIeVs TpWavBjYyyDQI58GU6kYE5pdEbNm9Oa+u9d9/3g= X-Received: by 2002:a05:6808:1443:b0:3b9:cca7:2f33 with SMTP id x3-20020a056808144300b003b9cca72f33mr16554996oiv.72.1702871790196; Sun, 17 Dec 2023 19:56:30 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231217131716.830290-1-menglong8.dong@gmail.com> <20231217131716.830290-3-menglong8.dong@gmail.com> In-Reply-To: From: Menglong Dong Date: Mon, 18 Dec 2023 11:56:18 +0800 Message-ID: Subject: Re: [PATCH bpf-next v4 2/3] selftests/bpf: activate the OP_NE login in range_cond() To: Alexei Starovoitov Cc: Andrii Nakryiko , Eddy Z , Yonghong Song , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Martin KaFai Lau , Song Liu , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Dec 18, 2023 at 2:20=E2=80=AFAM Alexei Starovoitov wrote: > > On Sun, Dec 17, 2023 at 5:18=E2=80=AFAM Menglong Dong wrote: > > > > The edge range checking for the registers is supported by the verifier > > now, so we can activate the extended login in > > tools/testing/selftests/bpf/prog_tests/reg_bounds.c/range_cond() to tes= t > > such logic. > > > > Besides, I added some cases to the "crafted_cases" array for this logic= . > > These cases are mainly used to test the edge of the src reg and dst reg= . > > > > All reg bounds testings has passed in the SLOW_TESTS mode: > > > > $ export SLOW_TESTS=3D1 && ./test_progs -t reg_bounds -j > > Summary: 65/18959832 PASSED, 0 SKIPPED, 0 FAILED > > > > Signed-off-by: Menglong Dong > > --- > > v3: > > - do some adjustment to the crafted cases that we added > > v2: > > - add some cases to the "crafted_cases" > > --- > > .../selftests/bpf/prog_tests/reg_bounds.c | 20 +++++++++++++------ > > 1 file changed, 14 insertions(+), 6 deletions(-) > > > > diff --git a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c b/tool= s/testing/selftests/bpf/prog_tests/reg_bounds.c > > index 0c9abd279e18..c9dc9fe73211 100644 > > --- a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > > +++ b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > > @@ -590,12 +590,7 @@ static void range_cond(enum num_t t, struct range = x, struct range y, > > *newy =3D range(t, max_t(t, x.a, y.a), min_t(t, x.b, y.= b)); > > break; > > case OP_NE: > > - /* generic case, can't derive more information */ > > - *newx =3D range(t, x.a, x.b); > > - *newy =3D range(t, y.a, y.b); > > - break; > > - > > - /* below extended logic is not supported by verifier ju= st yet */ > > + /* below logic is supported by the verifier now */ > > if (x.a =3D=3D x.b && x.a =3D=3D y.a) { > > /* X is a constant matching left side of Y */ > > *newx =3D range(t, x.a, x.b); > > @@ -2101,6 +2096,19 @@ static struct subtest_case crafted_cases[] =3D { > > {S32, S64, {(u32)(s32)S32_MIN, (u32)(s32)-255}, {(u32)(s32)-2, = 0}}, > > {S32, S64, {0, 1}, {(u32)(s32)S32_MIN, (u32)(s32)S32_MIN}}, > > {S32, U32, {(u32)(s32)S32_MIN, (u32)(s32)S32_MIN}, {(u32)(s32)S= 32_MIN, (u32)(s32)S32_MIN}}, > > + > > + /* edge overlap testings for BPF_NE, skipped some cases that al= ready > > + * exist above. > > + */ > > + {U64, U64, {0, U64_MAX}, {U64_MAX, U64_MAX}}, > > + {U64, U64, {0, U64_MAX}, {0, 0}}, > > + {S64, U64, {S64_MIN, 0}, {S64_MIN, S64_MIN}}, > > + {S64, U64, {S64_MIN, 0}, {0, 0}}, > > + {S64, U64, {S64_MIN, S64_MAX}, {S64_MAX, S64_MAX}}, > > + {U32, U32, {0, U32_MAX}, {0, 0}}, > > + {S32, U32, {(u32)(s32)S32_MIN, 0}, {0, 0}}, > > + {S32, U32, {(u32)(s32)S32_MIN, 0}, {(u32)(s32)S32_MIN, (u32)(s3= 2)S32_MIN}}, > > + {S32, U32, {(u32)(s32)S32_MIN, S32_MAX}, {S32_MAX, S32_MAX}}, > > I think you're copying the style of the casts from few lines above, > but (s32)S32_MIN is unnecessary. S32_MIN includes the cast already. > Please remove and fix the above lines too. Enn...yes, I simulated the usage of S32_MIN from the lines above. You are right, the s32 casting is unnecessary, I'll just keep the u32 casting. I'll wait a while before sending the next version to see if someone else any comments on this series. Thanks! Menglong Dong