Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4953560rwb; Tue, 6 Sep 2022 15:57:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6thnTYvDj15vZ+1iOyn9Objw75R9P5hBtt+KFXB5WxIsgKmNg4905LrJp+emeRxVVVe1D8 X-Received: by 2002:a17:902:a511:b0:172:97a7:6f5d with SMTP id s17-20020a170902a51100b0017297a76f5dmr554961plq.159.1662505056895; Tue, 06 Sep 2022 15:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662505056; cv=none; d=google.com; s=arc-20160816; b=AzhKHd5WSo6C0s7q+P++FIs9mkp4kd9rM73V1DRVwYInXAHWFcdUiawB6IqGhgIUJc qoRdvzAVkwkhH64EezFMhQsmilAIyMXoBOFuqxYCxH6iLvpshKaifPcALNnRtusj7EGq i6x8CFwaL7oEO+6W/D6WBw4XjDOzWGF6Yrnh8Yhhpv+XKFITJF1WQxX2yRaLmhQTWsyL z17WILASzp8TnET22nBhyEVkzmkcYnNvlEUpJy+yeUKai3wGJRUPdUrXrWhPe5JjqlbG rAWubSgaZDVSfNVP5u1es27u8L9Z1Ak5225JUX7jIybnpvRYeZVVGnp6BHBpTOXaOtjC NAvw== 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; bh=m9lRH378v02nM3+uAQbjodYmGXDtyYl3efgPvWYoaJw=; b=Sw7mj3YRlxgpxVJvoFREgDfzx7Vm9pECNWepq+eR5lRIJOSbPdE254QOxfBuQ1qNZ4 /m3qw/iKxmzXrTVznTz+NH03aKDHAvF8LiokmK8KnrrJNYOpzFTcc3MtE1GYOh+EHS5y 5pvANZabS5cSZziZLM/BfxTrbmQ9Wb/L8kVKNPQ+91Z+QD0hXRDJidNYcFQDydfTr+1I cUnSscNOyxPDhA7g/Mcb1LmzbHo6oiCykDiueXJJxIpw40/VFm9qMRaaPCbolIlBA1w/ km2Vkqdy+7MMdMA7WXxYz++KqkXrHb4NcfZqDcFm4dMNLAW+rvFYWGRJhUxROXauKRUq rsXw== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m3-20020a1709026bc300b00172f9a9df91si12714852plt.23.2022.09.06.15.57.23; Tue, 06 Sep 2022 15:57:36 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229541AbiIFWwS (ORCPT + 99 others); Tue, 6 Sep 2022 18:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbiIFWwR (ORCPT ); Tue, 6 Sep 2022 18:52:17 -0400 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39F1385FB7; Tue, 6 Sep 2022 15:52:16 -0700 (PDT) Received: by mail-ot1-f41.google.com with SMTP id v2-20020a056830090200b006397457afecso9045411ott.13; Tue, 06 Sep 2022 15:52:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=m9lRH378v02nM3+uAQbjodYmGXDtyYl3efgPvWYoaJw=; b=14imkXoi7XDyFpktufeVwBmKfFrNjUutP8v1ss7qquaM7rHvlz0XztYtbXd2ECj5Ui pAT1teSMzauLCb/cZ9RUKULDT/Q9MNCFHX6/V9nkk5qQiruf9m7xAN2gjBLo5v3oL3A5 hKoaNOp3cpmLL54eVAwUKuD09JCwHlJPbuWXabjOmdSLbEuKlrrxeIsvRGOqcPRGZ0rL ub+fERHLwP/wbaj370qqv4WNZSLUuqmqw+LSfEQpeXlepwZHumWATuhmrvDitn7qrU/M 0I8usP3CirfVML0iG+2mCEr4a23Mf88ZAIYIvLnfzJJDg7YrAkedynb9FlZHjCDrP0q5 9ETg== X-Gm-Message-State: ACgBeo2mJqIg3J+QfyCVJM/suR0jeURGPuyoC7FCsPwtK7hPu27eTFOY Qw0AVhUQwgZlOd/C5ErbRStfo9tP8ou7zA6pRaE= X-Received: by 2002:a9d:6a59:0:b0:638:92fd:d5b4 with SMTP id h25-20020a9d6a59000000b0063892fdd5b4mr311940otn.247.1662504735143; Tue, 06 Sep 2022 15:52:15 -0700 (PDT) MIME-Version: 1.0 References: <20220903000210.1112014-1-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Tue, 6 Sep 2022 15:52:04 -0700 Message-ID: Subject: Re: [PATCH] perf test: Skip sigtrap test on old kernels To: Arnaldo Carvalho de Melo Cc: Marco Elver , Arnaldo Carvalho de Melo , Jiri Olsa , Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , linux-perf-users Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, Sep 6, 2022 at 1:56 PM Arnaldo Carvalho de Melo wrote: > > > > 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 of the > >> > > > new fields sigtrap and sig_data. Just skip the test if it failed. > >> > > > > >> > > > Cc: Marco Elver > >> > > > Signed-off-by: Namhyung Kim > >> > > > --- > >> > > > tools/perf/tests/sigtrap.c | 1 + > >> > > > 1 file changed, 1 insertion(+) > >> > > > > >> > > > diff --git a/tools/perf/tests/sigtrap.c b/tools/perf/tests/sigtrap.c > >> > > > index e32ece90e164..7057566e6ae4 100644 > >> > > > --- a/tools/perf/tests/sigtrap.c > >> > > > +++ b/tools/perf/tests/sigtrap.c > >> > > > @@ -140,6 +140,7 @@ static int test__sigtrap(struct test_suite *test __maybe_unused, int subtest __m > >> > > > fd = sys_perf_event_open(&attr, 0, -1, -1, perf_event_open_cloexec_flag()); > >> > > > if (fd < 0) { > >> > > > pr_debug("FAILED sys_perf_event_open(): %s\n", str_error_r(errno, sbuf, sizeof(sbuf))); > >> > > > + ret = TEST_SKIP; > >> > > > >> > > Wouldn't we be interested if perf_event_open() fails because it could > >> > > actually be a bug? By skipping we'll be more likely to miss the fact > >> > > there's a real problem. > >> > > > >> > > That's my naive thinking at least - what do other perf tests usually > >> > > 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. > >> I really wish we could have a better error reporting mechanism. > >> > >> Maybe we could retry perf_event_open with sigtrap and sig_data cleared. > >> If it succeeded, then we can skip the test. If it still failed, then report > >> the error. But it still couldn't find a bug in the sigtrap code. > >> What do you think? > > > >Yes, that's what I meant, that it could point out an issue with > >sigtrap perf_event_open(). > > > >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. > > 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 this is one of can for sure detect it's something available :-/ > > One new way could be to look at BTF? Yeah, we could check BTF if it had the attr.sigtrap field and skip if not. Let me see how I can do that. :) Thanks, Namhyung