Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2044658rdb; Thu, 7 Dec 2023 17:09:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1A6sa7bgT9WvrpFw31hhgaphxl+Xa+r0uvACEWEzPih1RXvnkw1J2iM3EEQ4rPdA+sZa7 X-Received: by 2002:a05:6a20:4327:b0:18f:b899:8442 with SMTP id h39-20020a056a20432700b0018fb8998442mr171891pzk.6.1701997749800; Thu, 07 Dec 2023 17:09:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701997749; cv=none; d=google.com; s=arc-20160816; b=kSFVViSB8W8YETVO1Ag+/4qbwrB52UJFgbOtwncSPpOP3g5tkL0j4jLAUmLH8/vAQZ X5HdHAgRH9ZPm8csc9Jtgy+8Pa/atR+g/ONCPTdznhqCTmkQw1688cFHaED4FLWDTi9S 11mDiHu8LsnBXhXBkIo4BrxmWBR5DSN9C+w2OBfYohR9lND3PwuMqe22RJlpVnfJsNvj IwhZve2WZmz0TtsjQXFccdtbJ6U1aGgwYeBpyjbDs66GMW5QC+LAutUMgjfc+hwbHdl8 E8bQIpsIuxoXGJytnT3JY93TeMrxRyMO/2z9yWmQSw3ZfozWtv/jA3lfe5+C56hShJ02 CgIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VamHLYhm2WN9bmNhjuvgJGDIjabCdh/6ajHFYfLgx48=; fh=WzAYX1BrYqxG9MjuI21gcspRvynPRzyaMwMJx9hrWHA=; b=g8+/cS8RqF3z4qUi/uUIsbCtIyeNfHOue5/so7QJG/qK9AY7HdD1Uh736pnZSm7ght uaISTkFmGM5swGo7wqd013c3tiFO89fBjtBt+7jBgywVwM6eaE/CmoKTyeFWcbPaypX8 q8Tnjb+XlV7/nufiO2Q/9bxMfhCNAKrzrrJE3CjYlsm8WAR3vbUc2jJbiREXfsWDT/je eC7JN+23TerOmVqQAfLPL9up4JEkqZHWVtlMobvTbjIjLQ1I5SgtBTFAYOPmdX4Ky7Xv xz83FiiYIJbEXukeNXniou931kmqj/jJQT+ADn/saCg1Ni4SPy0kiCY+VSukHpyVGaGk Oe/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kylehuey.com header.s=google header.b=ejYjWszr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id 19-20020a631253000000b005c65b28ff0fsi607983pgs.99.2023.12.07.17.09.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 17:09:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kylehuey.com header.s=google header.b=ejYjWszr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3C249856165F; Thu, 7 Dec 2023 17:09:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbjLHBIw (ORCPT + 99 others); Thu, 7 Dec 2023 20:08:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbjLHBIv (ORCPT ); Thu, 7 Dec 2023 20:08:51 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 706001709 for ; Thu, 7 Dec 2023 17:08:49 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-54dca2a3f16so2456494a12.0 for ; Thu, 07 Dec 2023 17:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kylehuey.com; s=google; t=1701997728; x=1702602528; 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=VamHLYhm2WN9bmNhjuvgJGDIjabCdh/6ajHFYfLgx48=; b=ejYjWszroPKefIQq2C/zoAAx6MRQ2r9FgeGnRe4IW20UY3wad7kf2YyUJgYMSvG6ep UAqCPY+xzvI5W8w1+TCZ1Cnt4lXP7kDh5sZtX/kR8Mg7f1EfrlSzDlr9pcAilMum1edu biwqYAxa8aWZQPbu09pEgpJ2MKc9m44ev24ld04BFx/G7/oXfdc3+3J5YtiVeMTLJPjb DmtO9v1uXM7cZThTsgQoWxmbPICfMIrt8IK3AYpLXk9eu3tb3NbtmN2MqKiBBQU+RDhf B9DUeBrDIPPj/sMNwHdbOM3Be2WqL16BvgqOnVA2s2rLfF1Os8HgiFKC+HJWnhK2+pTw VVQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701997728; x=1702602528; 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=VamHLYhm2WN9bmNhjuvgJGDIjabCdh/6ajHFYfLgx48=; b=nlyJy1UOTIlJv9fNwkSQaNyuL1IssQkizXijrrY8w7PGgHnvd+nMAx8LRa9ACaKAtG vBpAy/Xzq4UVm0PaKaOGo6lJZQLBkSyLiK5cBVXkn6AXzbh5+IN5doP7byrSRl5tLlYY EE180kNtkAbm+A62xcCfavQ1TZ+VNoG3YJ8A7yYZJNjJ1EwNb6lBcJGGyQc9P/hdWRuz 9Fwiz9LE1gNJrEYOMDUn141Q3zZtRMK7oTzdWZ9s6tWJ3/hf6ISQeIiLU1VrJhrqiGyb cO9GDegumLhsPy6SM5Nyhgni6qRWp4vfEeN+WK4yddV2PRXjD05oPnAJMhFgzr9uCBzi Qe0g== X-Gm-Message-State: AOJu0YwxZmV8JDM+iHODxnGT/1tF24GZ+XETaZiiWPZDD/gK3aFnOFWd ry+UOPv0YVItqXNBKbRCLcRcQiIbd906gqD9BFmxlA== X-Received: by 2002:a17:906:1c1:b0:9a9:f0e6:904e with SMTP id 1-20020a17090601c100b009a9f0e6904emr90727ejj.16.1701997727789; Thu, 07 Dec 2023 17:08:47 -0800 (PST) MIME-Version: 1.0 References: <20231207163458.5554-1-khuey@kylehuey.com> <20231207163458.5554-4-khuey@kylehuey.com> In-Reply-To: From: Kyle Huey Date: Thu, 7 Dec 2023 17:08:35 -0800 Message-ID: Subject: Re: [PATCH v2 3/3] selftest/bpf: Test a perf bpf program that suppresses side effects. To: Marco Elver Cc: Andrii Nakryiko , Kyle Huey , linux-kernel@vger.kernel.org, Jiri Olsa , Namhyung Kim , Yonghong Song , "Robert O'Callahan" , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Mykola Lysenko , Shuah Khan , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 07 Dec 2023 17:09:07 -0800 (PST) On Thu, Dec 7, 2023 at 2:56=E2=80=AFPM Kyle Huey wrote: > > On Thu, Dec 7, 2023 at 11:20=E2=80=AFAM Marco Elver wr= ote: > > > > On Thu, 7 Dec 2023 at 20:12, Andrii Nakryiko wrote: > > > > > > On Thu, Dec 7, 2023 at 8:35=E2=80=AFAM Kyle Huey wr= ote: > > > > > > > > The test sets a hardware breakpoint and uses a bpf program to suppr= ess the > > > > side effects of a perf event sample, including I/O availability sig= nals, > > > > SIGTRAPs, and decrementing the event counter limit, if the ip match= es the > > > > expected value. Then the function with the breakpoint is executed m= ultiple > > > > times to test that all effects behave as expected. > > > > > > > > Signed-off-by: Kyle Huey > > > > --- > > > > .../selftests/bpf/prog_tests/perf_skip.c | 145 ++++++++++++++= ++++ > > > > .../selftests/bpf/progs/test_perf_skip.c | 15 ++ > > > > 2 files changed, 160 insertions(+) > > > > create mode 100644 tools/testing/selftests/bpf/prog_tests/perf_ski= p.c > > > > create mode 100644 tools/testing/selftests/bpf/progs/test_perf_ski= p.c > > > > > > > > diff --git a/tools/testing/selftests/bpf/prog_tests/perf_skip.c b/t= ools/testing/selftests/bpf/prog_tests/perf_skip.c > > > > new file mode 100644 > > > > index 000000000000..f6fa9bfd9efa > > > > --- /dev/null > > > > +++ b/tools/testing/selftests/bpf/prog_tests/perf_skip.c > > > > @@ -0,0 +1,145 @@ > > > > +// SPDX-License-Identifier: GPL-2.0 > > > > +#define _GNU_SOURCE > > > > + > > > > +/* We need the latest siginfo from the kernel repo. */ > > > > +#include > > > > > > selftests are built with UAPI headers' copies under tools/include, so > > > CI did catch a real issue, I think. Try copying > > > include/uapi/asm-generic/siginfo.h into > > > tools/include/uapi/asm-generic/siginfo.h ? > > > > I believe parts of this were inspired by > > tools/testing/selftests/perf_events/sigtrap_threads.c - getting the > > kernel headers is allowed, as long as $(KHDR_INCLUDES) is added to > > CFLAGS. See tools/testing/selftests/perf_events/Makefile. Not sure > > it's appropriate for this test though, if you don't want to add > > KHDR_INCLUDES for everything. > > Yes, that's right. Namhyung's commit message for 91c97b36bd69 leads me > to believe that I should copy siginfo.h over into tools/include and > fix the perf_events self tests too. > > - Kyle That doesn't really help (though perhaps it should be done anyway so the selftests aren't reaching into include/) because the glibc headers still redefine a ton of stuff in asm-generic/siginfo.h. - Kyle