Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4863173rwb; Tue, 6 Sep 2022 14:05:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR56wvbcrifzjduSMGq2OfxR/pGnYek/SM+COphdnXK9XGoMhOfiCT2x11lWYPoVcIN5/+o/ X-Received: by 2002:a17:906:2bc7:b0:72f:dc70:a3c6 with SMTP id n7-20020a1709062bc700b0072fdc70a3c6mr223638ejg.645.1662498354401; Tue, 06 Sep 2022 14:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662498354; cv=none; d=google.com; s=arc-20160816; b=AlMXGOv926sYEe/Tca6htACdw64uHuOez5QPrSxjVLkHgVn6mc9bTI4x/bi7qP+mLx IMkgWzWZrAcLxZAK3nzJ1+QUQyGZdrbWC3InHl5JsaOKP6W840+n7TirWOvdn3B5HDh7 3J9c1S2gRcaocqeYA6TyjnjrEP8QOiL3ERX4K2/Ezqgf/CgQccEq/QcO79ut9sZS+06a +28vcMimL4nfHHFlCYe9kI3s0RkQNEdPlEdKoGz36l54bFCL3yb1o02ehHOe96OJat4K t8Ej9jv7J/PnRpjI4FLl3xAqcJhWJZVq8AINvTRQTBZXwTwX9aYpGMxH+fS0kq/bx+MH lP7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:user-agent:subject:cc:to:from :date:dkim-signature; bh=JLKbHHTVrfhdQxKJcLepz8hjtNrJiGDZhh85/uIQM0Q=; b=N7ukLizN5CAeuvaHt1aD+/rHRkt6oh3rc8KJRB7ClwkQkT7h/Ruk4RyF9iXlL7gBoX qMVW1EfWBBSYOdTA4BbFyYa3AR++ie7gIW3RMSvHc9d/i5METPbNw/kV8eYQp+5XbD3h gS6Y8RvVL4Fdn3zI8gqXy43D4OsnPFu4Krolm+s00T37uprMR8UyIPc5FDzzmGn9CzO4 upPN5Fj3dr7RGrM5JPO2BeqLcmlFyRx6AvlIhLOzN2qQ7kV6HuTo6mbkGW7+FWfXWnEa MLA/0623C/bIge2HrE6gsu3BamsDJuYltqyxiIv0MLPdw6cXWWhpoVXktesJhtH4W4Ad 025A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=I7Jn10Ir; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a50c38f000000b0044a6d024050si1260551edf.384.2022.09.06.14.05.25; Tue, 06 Sep 2022 14:05:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=I7Jn10Ir; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231425AbiIFU5F (ORCPT + 99 others); Tue, 6 Sep 2022 16:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbiIFU4s (ORCPT ); Tue, 6 Sep 2022 16:56:48 -0400 Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FD8399247; Tue, 6 Sep 2022 13:56:45 -0700 (PDT) Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-127dca21a7dso3942602fac.12; Tue, 06 Sep 2022 13:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:from:to:cc:subject :date; bh=JLKbHHTVrfhdQxKJcLepz8hjtNrJiGDZhh85/uIQM0Q=; b=I7Jn10IrZ3Kl5W47zzd+T28Pm+YKxVY0TzhwWFXt8BajHUReYryLrAEr1mjjxEDy7w DTpei9wXbmLYYkesYjGslbe/+5znIlaGIALl9Q5OM6GCofsJJBcF8JTJR54agGL4k01k JTZqxX0YBTYyMvSj+svEkErrrprgkhBQE/7zB/a4N0YI84sNwAkYUUYKRocqN+FYawns /Xh9TsoVx5fE8OlGuSD/I1dD6ba7B2WVPem5bsbdhQ+hjmfjEZ5qgnDL5ApzHwpyNEW+ TwzwZpo2g6m8CxPIzEmkqEq6oJNaPz3W9PouzLVl4pfULNqTjBdy2RaNhSinU5qYmRyR LcYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date; bh=JLKbHHTVrfhdQxKJcLepz8hjtNrJiGDZhh85/uIQM0Q=; b=HbsBKy/J1cEzPlRfOUbelba4tb9+QkaaeUP0c6fx3QIQASqOMfTlILEf5W2LQtGb9h i5eoDu/9vACNVQS9n6uXvklGVxZdpdRxwWvfejk8p1eyfklrBaVugwYmCfW28vg232iW VHlamVytqvBA6veaB+Eaevr64MpLEPYId1nudVA8IIY0IPNJKe9VnybFIORUy959TV06 rgTjVAykeyOdKpbuIAxjJbf/l5WMYHp6z+afR5bWBbO+N6GC5faoskAfxxBhXhvEbuVf kKyzRjJKcaXAeHQK7jP2ARwVF3I/986/JiplRUx7WyAOI+zXRbRAQ5iEA5g1YLOmr3yj R8IA== X-Gm-Message-State: ACgBeo0G0EV7k/qDi4crwePA5A1UZjo0PAWKb/DmqpfprIijxLQqp4FO CaM8hklOLFQbhIlYb8TeOwailUEGJ/g= X-Received: by 2002:a05:6870:59d:b0:f3:627:e2b0 with SMTP id m29-20020a056870059d00b000f30627e2b0mr79456oap.47.1662497804367; Tue, 06 Sep 2022 13:56:44 -0700 (PDT) Received: from [127.0.0.1] ([187.19.239.21]) by smtp.gmail.com with ESMTPSA id d8-20020a056870e24800b0011e4c574dfcsm7606906oac.40.2022.09.06.13.56.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Sep 2022 13:56:43 -0700 (PDT) Date: Tue, 06 Sep 2022 17:56:37 -0300 From: Arnaldo Carvalho de Melo To: Marco Elver , Namhyung Kim CC: Arnaldo Carvalho de Melo , Jiri Olsa , Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , linux-perf-users Subject: Re: [PATCH] perf test: Skip sigtrap test on old kernels User-Agent: K-9 Mail for Android In-Reply-To: References: <20220903000210.1112014-1-namhyung@kernel.org> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On September 6, 2022 5:50:05 PM GMT-03:00, Marco Elver wrote: >On Tue, 6 Sept 2022 at 20:31, Namhyung Kim wrote: >> >> On Tue, Sep 6, 2022 at 5:45 AM Arnaldo Carvalho de Melo wrote: >> > >> > Em Sat, Sep 03, 2022 at 08:52:01AM +0200, Marco Elver escreveu: >> > > On Sat, 3 Sept 2022 at 02:02, Namhyung Kim = wrote: >> > > > >> > > > If it runs on an old kernel, perf_event_open would fail because o= f the >> > > > new fields sigtrap and sig_data=2E Just skip the test if it fail= ed=2E >> > > > >> > > > Cc: Marco Elver >> > > > Signed-off-by: Namhyung Kim >> > > > --- >> > > > tools/perf/tests/sigtrap=2Ec | 1 + >> > > > 1 file changed, 1 insertion(+) >> > > > >> > > > diff --git a/tools/perf/tests/sigtrap=2Ec b/tools/perf/tests/sigt= rap=2Ec >> > > > index e32ece90e164=2E=2E7057566e6ae4 100644 >> > > > --- a/tools/perf/tests/sigtrap=2Ec >> > > > +++ b/tools/perf/tests/sigtrap=2Ec >> > > > @@ -140,6 +140,7 @@ static int test__sigtrap(struct test_suite *t= est __maybe_unused, int subtest __m >> > > > fd =3D sys_perf_event_open(&attr, 0, -1, -1, perf_event_o= pen_cloexec_flag()); >> > > > if (fd < 0) { >> > > > pr_debug("FAILED sys_perf_event_open(): %s\n", st= r_error_r(errno, sbuf, sizeof(sbuf))); >> > > > + ret =3D TEST_SKIP; >> > > >> > > Wouldn't we be interested if perf_event_open() fails because it cou= ld >> > > actually be a bug? By skipping we'll be more likely to miss the fac= t >> > > there's a real problem=2E >> > > >> > > That's my naive thinking at least - what do other perf tests usuall= y >> > > do in this case? >> > >> > Yeah, I was going to try and check if this is the only way that, with >> > the given arguments, perf_event_open would fail, but its better to at >> > least check errno against -EINVAL or something? >> >> EINVAL would be too generic and the kernel returns it in many places=2E >> I really wish we could have a better error reporting mechanism=2E >> >> Maybe we could retry perf_event_open with sigtrap and sig_data cleared= =2E >> If it succeeded, then we can skip the test=2E If it still failed, then= report >> the error=2E But it still couldn't find a bug in the sigtrap code=2E >> What do you think? > >Yes, that's what I meant, that it could point out an issue with >sigtrap perf_event_open()=2E > >If there's no clear way to determine if it's just not supported or a >bug, it'd be better to leave it as-is=2E perf could go fancy and try to add a probe using a source file+line where = older kernels would fail 8-) Anyway, perf already does all sorts of kernel capability checks, perhaps t= his is one of can for sure detect it's something available :-/ One new way could be to look at BTF? > >Some other options: > >1=2E Provide a way to disable certain tests, if it's known they will >fail for otherwise benign reasons i=2Ee=2E no support=2E > >2=2E Provide a command line option to skip instead of fail tests where >perf_event_open() returns some particular errnos=2E The default will be >fail, but you can then choose to trust that failure of >perf_event_open() means no support, and pass the option=2E