From nobody Thu Nov 28 12:51:07 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 CD5A91BBBC5 for ; Tue, 1 Oct 2024 05:23:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727760217; cv=none; b=EBe/ysKJ6ktPrBI/eDXlggbOx/QCc5IGEldrv1s117yBNjffyc59BcFs++OufyASxZ+aa+VrCilk+8Ed0dKVLGtfLLWYvdvhfOP7ET9Z566WjhYykwvlmu5XV5JFtGNsTXZkQGQvtwXeG8v1uwf1tg1peP4vyCPBnc+kq5cDpLA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727760217; c=relaxed/simple; bh=ZUl/ydmmbgHj875SzIndORvnGh+y4tgIfETJAN0I7XI=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=XeAH4q1aqHq5EThyjUzLFx7ky298qmQyjUu1SLfEE7exwJoSEYhN8OeIpIMrwAddULnw2XXbF23IXcm6soEl9O/+7PJFwftbmjfFnwT5pGcMsCYRskFB8lEfR/fM1mkDF4RgTthKV4n67Tbo4FjZ8pjP+5VARq90XTHCTVqSScw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ulbduHJ/; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ulbduHJ/" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e251ba2243so45336207b3.1 for ; Mon, 30 Sep 2024 22:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727760215; x=1728365015; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=pDg21Rij+IIeZQVgaa8iBgfJqI0jYu+y1eH5S/MzuI4=; b=ulbduHJ/YD3gYenUUioMqMmR4cekFVaQV1Uf6FCxQkke5xPWADyWfI4ut6MpciTb5f EU8SFCfqGFPL6FE2YW+D7OPtw8UL4+cNloNkffZdnS659RE78dCLukcZswSYuDEVkr5I 5BEXO26RPUu+2KcqRpmJ7NicQS7f/udwCbggW/hNK+0SR3x4MHXgiIrmv2WXyYbWsQsy GhQcA+QoTF40Il9GduV29QReZ6MeKKUw68miDByEVo64szcw+AXyZ99l5C0EfyZsB3oP aHsB0TgDz0wX0vUtH/1XjPQjIaCwhG7uZHeYSo/ito7AjOHcFXqQAX86X62KuMC/EZss oS+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727760215; x=1728365015; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pDg21Rij+IIeZQVgaa8iBgfJqI0jYu+y1eH5S/MzuI4=; b=jfIKUQ+CKSokB4xpCW7IHQ1lZhHZHFeWkXZePetTBrtOQQGjZcQAjKFP0EfC9cFGB0 eHlnPBTFwWX6zbrUQQAezAj7L2CD75CbrPUcZ6ypS7rS1/e+e+8SR/Q6Xad11TJAOpyZ VwmdqLuoClT8vnCR8r3Ebb8vXgvxyzJt1zI1eUq6d0PoGGlkjON8HGZwz58XDviQp4vC vNLAhr0rQW3PVFVK9wjLxyXv7FNbRPSQMBg93w+M1ME9xpUrV//ds+2bRAmi864MWik6 V2mOrja7t+EdXtUICtDjtasyEXhMu7YOz4ne/FUFRiqeYDA58glM6cjhSF7Tw80k3IuA LKwg== X-Forwarded-Encrypted: i=1; AJvYcCW3fnfH8wVgIkW6IbtXJ3OMu1/rXVKoo38nODAyaMHQDxY22p8yjtHVIIGP8B6EuW30vo7ym4/izBcfzas=@vger.kernel.org X-Gm-Message-State: AOJu0YyVaNy0dbFz7NnChwRC/nnLO2oZ4y6e6RdQckLWJeoCcI51SgCe iHtiaB3N+iYKTkPT/nkvX6UqRIGdRjP3vxBNdH1yEBuaTqhzadohIuVAYMpLsOFr+4nHIuwNel1 5ymOMyg== X-Google-Smtp-Source: AGHT+IEePI86EHzO2lKFHMUhhhibUrr1ifCWaWS9m6yGJmNtyzlTdWvIyNugozYcmICy9rbCctLESW+kX90s X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:f420:67c7:1eea:bb12]) (user=irogers job=sendgmr) by 2002:a05:690c:23c2:b0:6db:d365:19c0 with SMTP id 00721157ae682-6e290eb5dd2mr581447b3.5.1727760214866; Mon, 30 Sep 2024 22:23:34 -0700 (PDT) Date: Mon, 30 Sep 2024 22:23:24 -0700 In-Reply-To: <20241001052327.7052-1-irogers@google.com> Message-Id: <20241001052327.7052-2-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241001052327.7052-1-irogers@google.com> X-Mailer: git-send-email 2.46.1.824.gd892dcdcdd-goog Subject: [PATCH v2 1/4] perf stat: Fix affinity memory leaks on error path From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Missed cleanup when an error occurs. Fixes: 49de179577e7 ("perf stat: No need to setup affinities when starting = a workload") Signed-off-by: Ian Rogers --- tools/perf/builtin-stat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 1521b6df2606..3e6b9f216e80 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -827,6 +827,7 @@ static int __run_perf_stat(int argc, const char **argv,= int run_idx) } } affinity__cleanup(affinity); + affinity =3D NULL; =20 evlist__for_each_entry(evsel_list, counter) { if (!counter->supported) { @@ -965,6 +966,7 @@ static int __run_perf_stat(int argc, const char **argv,= int run_idx) if (forks) evlist__cancel_workload(evsel_list); =20 + affinity__cleanup(affinity); return err; } =20 --=20 2.46.1.824.gd892dcdcdd-goog From nobody Thu Nov 28 12:51:07 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 3395C1BBBF4 for ; Tue, 1 Oct 2024 05:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727760219; cv=none; b=k0vEC8QKll1n3yPtP3kgKqCfPnBEfo/rwQZVDXbMzSkX/9jb8GGQWgltCeWJaBCium35EQb7hrWKq/U2Sa8gC27i57RHe5/PWvhegvSXCwjvFqImQ4vpS4+Lj4vWXh+IDiUaDh48bS24WFO0MP7gDYP5PPvKrAW7f3u1koDketU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727760219; c=relaxed/simple; bh=3sJTix9+hVyh80kzwiZoBEnIVXZyPC2rJ0LryrXs4fY=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Xv+FemG7wrt74zb1vkNv+ezRUiXelC8kOymI1dN2PMm9+tuyIjBymWjpGFxTRWEb52KLxToX/+2McDJytzhapDXUhVEX8+7kcbXHS4xZRI0i+4ZdGQk6pzTdgNDzd7MAZhbza/P945irnCRdX+BLt96sl2CCGfzZTporBqkdQlY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=SMnMk1sm; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="SMnMk1sm" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e2608234531so5603326276.1 for ; Mon, 30 Sep 2024 22:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727760217; x=1728365017; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=EQMGtk6GwbaXhFywRtPjz9CEeNpxRP/qdOj8Kk4AmBM=; b=SMnMk1smLogyOYM242/SVzs2VobsyNZJTEKFsFqkG8gFtf2SnfiGSBSAozec8RYtre 5YfvnsBUDpHfohldhl0l+tFBsyKYeDpVqnc38zoNrkgp2a83Re3pRmp/OMrHK/YRalTW WbsaiICN+ZrGfEiREx2zdMlw1WwmWlSShyab/xbVET2HcXhhPbGF4vhlZ9x5QnrIgHVv d29Sy3H+djfQvwU3dUyHiLIy6kUkkN5xuRIKLq04LecoIFkJu+/+xs1gyzjAo5O8o8+f lF7Wgu4NHytUTlRfH76hAmOSLdaiczcmgRDeOSXu2J9TlVf3EbsVNpneSr299rfqtzyP 3IzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727760217; x=1728365017; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EQMGtk6GwbaXhFywRtPjz9CEeNpxRP/qdOj8Kk4AmBM=; b=fL9jmZLo/0ggWp1WUJte/8Jg0phGGqbTPCSiosNimdCjGshXkWhCdfBLH7gZvzmY/v YObFssYZo4NRc/jQKj2kDDJLNYsD1H3Vox3B7+3q0XhZpIk92qnMbX1s2gr2zO7mpOi+ UyxiMAUvcwhV/zOUqtIbL46oH6H21mnA6MD7ERyth0PDKSiZw5R+7lphWktT8ZmXc8rk t3sbRxveIv1yKQNmGW6SnmAFkGQOLu33qIwvrtsNhT2UJRKQHguFEjV61tq4vkulw/i7 heF9FsA6vRQz64NXpEGibgs5CelPTfwnck4I0zAPyAJM+Ai+kUuUm2L9jS7AJGMIelXd 3tsw== X-Forwarded-Encrypted: i=1; AJvYcCUBhQDdyYF0nFLFBephg9gqwGYrbPY9iFNCQZsVhom1FwKeBSZyiuUZvlApSYoM3Z9LFVHkmqLcmT261uQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+L0WgiuDuIOl+3/5o1htKX2ouxWO0gDl/uYPNAmCwK7JAho1N flhowYGAp4/aDdma7Kew4w95EwoyrgqqEZtt+TOAeYA9e5sz7g3WKpf17e8WK57S8eI1qv2fjDu 7y48sAg== X-Google-Smtp-Source: AGHT+IEtJ5iHDU4WG7YqVYSBmkd2+4f6hQoz49uFn7BXq4j2kS3RcFmOmtpe5Dixo6yM80mfjOYYyRnT+UeT X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:f420:67c7:1eea:bb12]) (user=irogers job=sendgmr) by 2002:a5b:f0e:0:b0:e11:5f87:1e3c with SMTP id 3f1490d57ef6-e2604c8b9d5mr55878276.11.1727760217150; Mon, 30 Sep 2024 22:23:37 -0700 (PDT) Date: Mon, 30 Sep 2024 22:23:25 -0700 In-Reply-To: <20241001052327.7052-1-irogers@google.com> Message-Id: <20241001052327.7052-3-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241001052327.7052-1-irogers@google.com> X-Mailer: git-send-email 2.46.1.824.gd892dcdcdd-goog Subject: [PATCH v2 2/4] perf test: Fix memory leaks on event-times error paths From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" These error paths occur without sufficient permissions. Fix the memory leaks to make leak sanitizer happier. Signed-off-by: Ian Rogers --- tools/perf/tests/event-times.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c index e155f0e0e04d..deefe5003bfc 100644 --- a/tools/perf/tests/event-times.c +++ b/tools/perf/tests/event-times.c @@ -126,6 +126,7 @@ static int attach__cpu_disabled(struct evlist *evlist) evsel->core.attr.disabled =3D 1; =20 err =3D evsel__open_per_cpu(evsel, cpus, -1); + perf_cpu_map__put(cpus); if (err) { if (err =3D=3D -EACCES) return TEST_SKIP; @@ -134,7 +135,6 @@ static int attach__cpu_disabled(struct evlist *evlist) return err; } =20 - perf_cpu_map__put(cpus); return evsel__enable(evsel); } =20 @@ -153,10 +153,10 @@ static int attach__cpu_enabled(struct evlist *evlist) } =20 err =3D evsel__open_per_cpu(evsel, cpus, -1); + perf_cpu_map__put(cpus); if (err =3D=3D -EACCES) return TEST_SKIP; =20 - perf_cpu_map__put(cpus); return err ? TEST_FAIL : TEST_OK; } =20 @@ -188,6 +188,7 @@ static int test_times(int (attach)(struct evlist *), err =3D attach(evlist); if (err =3D=3D TEST_SKIP) { pr_debug(" SKIP : not enough rights\n"); + evlist__delete(evlist); return err; } =20 --=20 2.46.1.824.gd892dcdcdd-goog From nobody Thu Nov 28 12:51:07 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 EA45E1BC084 for ; Tue, 1 Oct 2024 05:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727760222; cv=none; b=RVEf+/U2eyTjU9ANJ1fuecRbZVUnUjZIYKzkd+hHH2xhz1nQo0BlJKK7N/tDSZhKzgW3Rxjffqej1QG5ILlKLyHVvFUPpo1dnd5JyuiC2VKUP/elbsLg09QcFvRN1Np0ZQYFoog1+qcq4sQF7XW3+tDc+9mTnZ5Kkee/s3L7OqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727760222; c=relaxed/simple; bh=Ok+FhDXN/bUiz9+kds8fM6XMayPQjAdr+t4YJVsFhlo=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Gzkc+Aq3m/nIjdfuvpgQcEuMwlW4K4sXiv7l24eqM6uiCGW4q2Nt/kxQeQHSoj8NbNAYNiM9oMCYeGRRriuweavdoHw630saV77EOfu2SlriABJpGqH3VAMK73pbDi9UVKFbhJN+LZHB1PS9S71scSOIp5HZ49ywfePIkNdDBAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=NyXNjkRF; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="NyXNjkRF" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e294f38bddso5508197b3.3 for ; Mon, 30 Sep 2024 22:23:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727760220; x=1728365020; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=ta5YpSmga+h02rO1c/RFOYlnk/Em15j2RCfsC0qW0X4=; b=NyXNjkRFn40amU8m5lpohCQynDaXqE3wAP96/xxMPiYwHptLu6i+8P/rIKHhMjD74B oPlqs9j3uZFo8/Eb8M6pu22zmPpOjiHZbo8uItV0YSmwC71zoYvt5ayuAJQJm4BaEIgy C20laGkYM827qqiidGv+yi7m/kWa/5w3QZiiarkSBY1rW8QtDlu5WzGDPshO6AplKsf+ 1dYEKnqDcz77dw+5LjgKQFk2w46QxwZ8/TkPpQW66HTeKON+kYhSLBjXIDBVDGegZ24E mOCxtDlCPYXph/rEfRbNa3wp6Le0wV2rY/YfFXf5EPYnU+pj8Ylyxtxmw7ZR56CaI0Dc D3cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727760220; x=1728365020; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ta5YpSmga+h02rO1c/RFOYlnk/Em15j2RCfsC0qW0X4=; b=mn5bm3ns4Lr//JhThjKCl+9eoOCC3bBHvrpGegRgTWR0CWjQh12JNOAZprV1eXTseN lmSqHqdgWrz5D6uct0DZ81LkxP3/IxV45mlK7hkcQq6gAMg1usk2yTIDn9dSvYDF0s92 F4eoJHT9an6/13k84kPgQIs16/k6XeScZQS6k2F6ZY46mGWuVxsb+YlI10+q8oc0eRBX +UAr6DC3DXrQpOBGy3YyVZ7jzTgMD9MPVeLoVpnNOsflxfw3ni1xJuUigcXeb3cbJpNY Gh11RPyv6gZXi7Qi2OYXk+eonzKyBWd/Cx129OjTunp26GqWsytrN7Bv9X8l0GoqbskW TpTQ== X-Forwarded-Encrypted: i=1; AJvYcCWwZq4owwqtkr+hQNjfBN4C/uncC0PMCtitnZ1B35resSPGJOM3bDNpbD3hC93txqxPhqYcsSX8EYaKXB0=@vger.kernel.org X-Gm-Message-State: AOJu0Yxbt/UtTd+mWsnYceT8NwzPTfcUMJcE3XL9NLiwin/HVKegqq5D +C5x2DIfeeL3ju6tFb7dnxmFQN7SVK0g5xIPFzHUTil9GHffQ6YGvohCOG9aYMkIpTRNvNJtf1F 5DChQrw== X-Google-Smtp-Source: AGHT+IE9nO+iqokkfm82bAK4mbVT5Uil7PWvBrDlRgIQGKqFunhB43WFpJO35+IDQx+/3jg5ffcPAKWvZ3vt X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:f420:67c7:1eea:bb12]) (user=irogers job=sendgmr) by 2002:a05:690c:2c11:b0:6dd:dcf5:28ad with SMTP id 00721157ae682-6e247399192mr840327b3.0.1727760219780; Mon, 30 Sep 2024 22:23:39 -0700 (PDT) Date: Mon, 30 Sep 2024 22:23:26 -0700 In-Reply-To: <20241001052327.7052-1-irogers@google.com> Message-Id: <20241001052327.7052-4-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241001052327.7052-1-irogers@google.com> X-Mailer: git-send-email 2.46.1.824.gd892dcdcdd-goog Subject: [PATCH v2 3/4] perf test: Skip not fail tp fields test when insufficient permissions From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Clean up return value to be TEST_* rather than unspecific integer. Add test case skip reason. Skip test if EACCES comes back from evsel__newtp. Signed-off-by: Ian Rogers --- tools/perf/tests/evsel-tp-sched.c | 40 +++++++++++++++++++------------ 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-= sched.c index cf4da3d748c2..3da6a76eac38 100644 --- a/tools/perf/tests/evsel-tp-sched.c +++ b/tools/perf/tests/evsel-tp-sched.c @@ -36,33 +36,33 @@ static int test__perf_evsel__tp_sched_test(struct test_= suite *test __maybe_unuse int subtest __maybe_unused) { struct evsel *evsel =3D evsel__newtp("sched", "sched_switch"); - int ret =3D 0; + int ret =3D TEST_OK; =20 if (IS_ERR(evsel)) { pr_debug("evsel__newtp failed with %ld\n", PTR_ERR(evsel)); - return -1; + return PTR_ERR(evsel) =3D=3D -EACCES ? TEST_SKIP : TEST_FAIL; } =20 if (evsel__test_field(evsel, "prev_comm", 16, false)) - ret =3D -1; + ret =3D TEST_FAIL; =20 if (evsel__test_field(evsel, "prev_pid", 4, true)) - ret =3D -1; + ret =3D TEST_FAIL; =20 if (evsel__test_field(evsel, "prev_prio", 4, true)) - ret =3D -1; + ret =3D TEST_FAIL; =20 if (evsel__test_field(evsel, "prev_state", sizeof(long), true)) - ret =3D -1; + ret =3D TEST_FAIL; =20 if (evsel__test_field(evsel, "next_comm", 16, false)) - ret =3D -1; + ret =3D TEST_FAIL; =20 if (evsel__test_field(evsel, "next_pid", 4, true)) - ret =3D -1; + ret =3D TEST_FAIL; =20 if (evsel__test_field(evsel, "next_prio", 4, true)) - ret =3D -1; + ret =3D TEST_FAIL; =20 evsel__delete(evsel); =20 @@ -70,23 +70,33 @@ static int test__perf_evsel__tp_sched_test(struct test_= suite *test __maybe_unuse =20 if (IS_ERR(evsel)) { pr_debug("evsel__newtp failed with %ld\n", PTR_ERR(evsel)); - return -1; + return TEST_FAIL; } =20 if (evsel__test_field(evsel, "comm", 16, false)) - ret =3D -1; + ret =3D TEST_FAIL; =20 if (evsel__test_field(evsel, "pid", 4, true)) - ret =3D -1; + ret =3D TEST_FAIL; =20 if (evsel__test_field(evsel, "prio", 4, true)) - ret =3D -1; + ret =3D TEST_FAIL; =20 if (evsel__test_field(evsel, "target_cpu", 4, true)) - ret =3D -1; + ret =3D TEST_FAIL; =20 evsel__delete(evsel); return ret; } =20 -DEFINE_SUITE("Parse sched tracepoints fields", perf_evsel__tp_sched_test); +static struct test_case tests__perf_evsel__tp_sched_test[] =3D { + TEST_CASE_REASON("Parse sched tracepoints fields", + perf_evsel__tp_sched_test, + "permissions"), + { .name =3D NULL, } +}; + +struct test_suite suite__perf_evsel__tp_sched_test =3D { + .desc =3D "Parse sched tracepoints fields", + .test_cases =3D tests__perf_evsel__tp_sched_test, +}; --=20 2.46.1.824.gd892dcdcdd-goog From nobody Thu Nov 28 12:51:07 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 3E6E71BC9ED for ; Tue, 1 Oct 2024 05:23:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727760224; cv=none; b=gFgLqSWwSTMREW4y5jGp4189laZ9O8Z1AgLM+DUzZBi5jHq52Zt/kpowf74bJ2jBeUXUC7cpKLcS3p2jWbZPgQEFO9nJCjM8Ckzzi5R6dGMpe1o/KYMBCaxWgjAUUT4zSPCBJu+2vQ2wf+NI168DxI7q/xv2ZK8HcgNTPmK7XcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727760224; c=relaxed/simple; bh=HlaJPf1DpkhIcVfUnD58FBwEx20zYRsFkrETe/cFLkU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=uePK62omdFfQKf+k3up/KoZnn3uQpxpn3HhVq89akNOyELasIWtb4sdSv5+bt67mEQlKmua3oqo9LNclhzqmmOzJQ5Z35uoNpr8Xm8AmCS0UA2gSG+LNOoHDebR328Kz1o+q4b2N8IuxL7SS2YBB98ploYaNNOooAtfCwEAWW04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=juoDUpam; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="juoDUpam" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e2364f45a4so55041587b3.2 for ; Mon, 30 Sep 2024 22:23:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727760222; x=1728365022; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=FSpyv/AFjmfCtapMZ23chCRHMXjbu/7COuZjKrd4Qfk=; b=juoDUpamF7UF6rFT9yyark8XE+ageMESuAvoescAbFB2MNgcBEPj0ZBf4MZsbLgxaj IHR/IHrmCtYsAhT1xtzVZv9I+T4nitjiLsaOeBZPXc87vdNL8nv4aLppobokcqGCIANI c1nNnIOKZb+jiUwOxVOarYsBWp7yNpCW4og864bwsd4QzOrMlqspMe9x8+JuC8QV7oXp 35naNd0a47FgkZNq15jxTjr+3uEPeVAujIIvPw+zcfz9lLP9R6JQaJcbW2f1NoJVXHN4 bq5je00m5VZ2pmGiSBjxFsCLbBUngGIPlifZX1UMSS/Uyb6x8dKQzK8THhAIV/jrzSqM lyDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727760222; x=1728365022; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FSpyv/AFjmfCtapMZ23chCRHMXjbu/7COuZjKrd4Qfk=; b=QI5QxNo3uSQARp4T6x/PVWgLvBP+KtVo7+VLyrxgmB3ocXZrJtEcJT1tY6LyAVLN7a 0pXXS0gZcThYw24Ekph/ZVEyVhaE95/PSaVwk/fBU3WtbUbLLnnVMAVArX1Ytz5Eac4m sLSQtvlh6V4SQGIyVxEsJbAwbZ+CeFcOY8KY8UX8uy0ozRFtkYZl12iANRDxgO9/MMMj wB6am+MikNIAb43lpVAx99eRMpwDWYV45BJ+nlnEh2KSOpMrjWstYDr9KJdQ8tHYRVdd r8e2nxvX4ySXju+GfwkV8GVU5RbHaF0PMzh9aOrIDa79s0fF6rjf/Qa2ZnfUt4No8uW8 LQOA== X-Forwarded-Encrypted: i=1; AJvYcCWagS1kNC4pweRcQRiXFbuEWwzbFN8eIZbvMCfqgIAslJQMWWOQa2mOtZq8f87xzS2qOrEcOSegqKbWlRw=@vger.kernel.org X-Gm-Message-State: AOJu0YwsSmimmr/5Mf5wk9sz0fw9PfPUTQp90CXz2iENaXv6KPBjNZLy OQIySyqYNwYVuRQvDYz5ggKxxGdTQUKKpQvBhIW7Bq1vNQXx7fYywvf1CRZ5PuQmWo+7+AAGL7R xPpJWQw== X-Google-Smtp-Source: AGHT+IHVW0m7mS9IM+OEPcKA7PRFyrcmcKWvkbN5Gk4Zr0KfEbqS7bbdaJzOmzXtgquqf7+Qzi0FPyxKe+AE X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:f420:67c7:1eea:bb12]) (user=irogers job=sendgmr) by 2002:a05:690c:3005:b0:6e2:120b:be57 with SMTP id 00721157ae682-6e247604e65mr2217147b3.5.1727760222250; Mon, 30 Sep 2024 22:23:42 -0700 (PDT) Date: Mon, 30 Sep 2024 22:23:27 -0700 In-Reply-To: <20241001052327.7052-1-irogers@google.com> Message-Id: <20241001052327.7052-5-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241001052327.7052-1-irogers@google.com> X-Mailer: git-send-email 2.46.1.824.gd892dcdcdd-goog Subject: [PATCH v2 4/4] perf test: Skip not fail syscall tp fields test when insufficient permissions From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Clean up return value to be TEST_* rather than unspecific integer. Add test case skip reason. Skip test if EACCES comes back from evsel__newtp. Signed-off-by: Ian Rogers --- tools/perf/tests/openat-syscall-tp-fields.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests= /openat-syscall-tp-fields.c index 888df8eca981..3943da441979 100644 --- a/tools/perf/tests/openat-syscall-tp-fields.c +++ b/tools/perf/tests/openat-syscall-tp-fields.c @@ -40,7 +40,7 @@ static int test__syscall_openat_tp_fields(struct test_sui= te *test __maybe_unused int flags =3D O_RDONLY | O_DIRECTORY; struct evlist *evlist =3D evlist__new(); struct evsel *evsel; - int err =3D -1, i, nr_events =3D 0, nr_polls =3D 0; + int ret =3D TEST_FAIL, err, i, nr_events =3D 0, nr_polls =3D 0; char sbuf[STRERR_BUFSIZE]; =20 if (evlist =3D=3D NULL) { @@ -51,6 +51,7 @@ static int test__syscall_openat_tp_fields(struct test_sui= te *test __maybe_unused evsel =3D evsel__newtp("syscalls", "sys_enter_openat"); if (IS_ERR(evsel)) { pr_debug("%s: evsel__newtp\n", __func__); + ret =3D PTR_ERR(evsel) =3D=3D -EACCES ? TEST_SKIP : TEST_FAIL; goto out_delete_evlist; } =20 @@ -138,11 +139,21 @@ static int test__syscall_openat_tp_fields(struct test= _suite *test __maybe_unused } } out_ok: - err =3D 0; + ret =3D TEST_OK; out_delete_evlist: evlist__delete(evlist); out: - return err; + return ret; } =20 -DEFINE_SUITE("syscalls:sys_enter_openat event fields", syscall_openat_tp_f= ields); +static struct test_case tests__syscall_openat_tp_fields[] =3D { + TEST_CASE_REASON("syscalls:sys_enter_openat event fields", + syscall_openat_tp_fields, + "permissions"), + { .name =3D NULL, } +}; + +struct test_suite suite__syscall_openat_tp_fields =3D { + .desc =3D "syscalls:sys_enter_openat event fields", + .test_cases =3D tests__syscall_openat_tp_fields, +}; --=20 2.46.1.824.gd892dcdcdd-goog