Message ID | 20231120111340.7805-2-ilpo.jarvinen@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp2124065vqn; Mon, 20 Nov 2023 03:14:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtZOfBM2clOD3o34agY++k5rMbUQCf3o5n9+1A9Ec1iFwISwjN0Q9btayd1xTTkr58W1TM X-Received: by 2002:a17:903:32ca:b0:1ce:6198:1097 with SMTP id i10-20020a17090332ca00b001ce61981097mr5997303plr.18.1700478857670; Mon, 20 Nov 2023 03:14:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700478857; cv=none; d=google.com; s=arc-20160816; b=j4hHDcTtwxai8/kVfWHRnJhMNr5KePevRR9suP7rfZy7ARCGkdfUrxck8upfOCx5dS WgxrKB4HohGWmlMokjw5Jbx5MvjDI0ODujyGvfMIox5AdWsMF/oEi62mHI52zm/MFBTm wlkjTwq9KpqHFLw1yUIgYQfvcapYzuFk2HRE8zaTnQIUMDboEYWPHAK7kOb5KAN6pgow KWBHPoi/8HQTIvYPUhxPZ/4uI2IKmwCgPpLlhfmgmWEYSNr3DXzqyRBYSNcBCIaqUdgd sDIG1DuHAqBVjKQss5iWFqzDKvI/Cb25TJDZ59ek2o1Ill2i6zjNc20Nn+YH9gN4yCVI I4PQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OztKHELiVVLElvz0LLYOyVW7QSUSGj+sW/v5IZMMAks=; fh=gPQ6jqLSfsDb5bE3yrtO+AlT5R4d75RXkjC5xckz7Dk=; b=IZ0G5zvYHXTlIc11NgoiDKtTw8dLjqmlYJfSDdHuIvMP2RrUBLV4g22y1NTqIX82q3 la6IVIa5LHme94iTIf+RIASYPGxmKXQXH3meU1hcVOLwstb5V0IxNM8UBo+2USXb87DW AvuLRZ7hkMioXey+Eyx4eVR6JQzK+24FK0vh8l7WJaK9Rmkf2852Pd0AOr5yFZ76XnXm 4OMI0O3ljDrEA/MtuDZlLcyJGmJslS4TBxCid9l2LZb0FAz/jbrQjMWhi7lyfwmo95AD TeGebQ0LNHp9KagiiAFe9VZiCpYZwzVH2miYHie3iIzKxabmOLDQCo5Hi7czHXPlLSyN 7+Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ggdidZGC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id m7-20020a170902db0700b001cf5c997609si2551518plx.569.2023.11.20.03.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 03:14:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ggdidZGC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 634A8807C6FF; Mon, 20 Nov 2023 03:14:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232866AbjKTLOH (ORCPT <rfc822;heyuhang3455@gmail.com> + 27 others); Mon, 20 Nov 2023 06:14:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232789AbjKTLOG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Nov 2023 06:14:06 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A053BEB; Mon, 20 Nov 2023 03:14:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700478842; x=1732014842; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tzPsjJjcfyDfgR8LTQ4WEtUUvgvOSZlRwS0QORtco8Y=; b=ggdidZGCs8fcKCH6HV//1Z8wKabJBRM8JOKusu6CQlg8ELJOVmE+Gcu8 ao2hZjNDcQX2H9uH+KWVGZ46Wn3yGeczmyHVritUwMCeorUOcl26YFMH2 Dq9QY+iXwsePJSHPgYCNva8cHmROU7P5HpafgFhP1T3vAmlIwvJo0lY95 7FtZWe5xiIFbSeCwBbPTKxyQPBPojyRie8kh4pyPzJH8XxrOO7AeJIE+I oHiPHmrBcblM7OrSNBf9cK9Crn6iL7S+fBtaSr3FfJOAT3Y6pEGZoshXC KN27SOrKR6K3LGbSh2wmwaBVSgATYnUf8cCQWbyntkjILmH/j8TmPD4LY g==; X-IronPort-AV: E=McAfee;i="6600,9927,10899"; a="390457334" X-IronPort-AV: E=Sophos;i="6.04,213,1695711600"; d="scan'208";a="390457334" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 03:14:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10899"; a="801126899" X-IronPort-AV: E=Sophos;i="6.04,213,1695711600"; d="scan'208";a="801126899" Received: from sc9itsct4906.amr.corp.intel.com (HELO localhost) ([10.249.46.107]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 03:13:58 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> To: linux-kselftest@vger.kernel.org, Reinette Chatre <reinette.chatre@intel.com>, Shuah Khan <shuah@kernel.org>, Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>, =?utf-8?q?Maciej_Wiecz=C3=B3r-R?= =?utf-8?q?etman?= <maciej.wieczor-retman@intel.com>, Fenghua Yu <fenghua.yu@intel.com> Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> Subject: [PATCH v2 01/26] selftests/resctrl: Don't use ctrlc_handler() outside signal handling Date: Mon, 20 Nov 2023 13:13:15 +0200 Message-Id: <20231120111340.7805-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231120111340.7805-1-ilpo.jarvinen@linux.intel.com> References: <20231120111340.7805-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 20 Nov 2023 03:14:15 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783081318573933258 X-GMAIL-MSGID: 1783081318573933258 |
Series |
selftests/resctrl: CAT test improvements & generalized test framework
|
|
Commit Message
Ilpo Järvinen
Nov. 20, 2023, 11:13 a.m. UTC
perf_event_open_llc_miss() calls ctrlc_handler() to cleanup if
perf_event_open() returns an error. Those cleanups, however, are not
the responsability of perf_event_open_llc_miss() and it thus interferes
unnecessarily with the usual cleanup pattern. Worse yet,
ctrlc_handler() calls exit() in the end preventing the ordinary cleanup
done in the calling function from executing.
ctrlc_handler() should only be used as a signal handler, not during
normal error handling.
Remove call to ctrlc_handler() from perf_event_open_llc_miss(). As
unmounting resctrlfs and test cleanup are already handled properly
by error rollbacks in the calling functions, no other changes are
necessary.
Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
tools/testing/selftests/resctrl/cache.c | 1 -
1 file changed, 1 deletion(-)
Comments
Hi Ilpo, On 11/20/2023 3:13 AM, Ilpo Järvinen wrote: > perf_event_open_llc_miss() calls ctrlc_handler() to cleanup if > perf_event_open() returns an error. Those cleanups, however, are not > the responsability of perf_event_open_llc_miss() and it thus interferes responsibility > unnecessarily with the usual cleanup pattern. Worse yet, > ctrlc_handler() calls exit() in the end preventing the ordinary cleanup > done in the calling function from executing. > > ctrlc_handler() should only be used as a signal handler, not during > normal error handling. > > Remove call to ctrlc_handler() from perf_event_open_llc_miss(). As > unmounting resctrlfs and test cleanup are already handled properly > by error rollbacks in the calling functions, no other changes are > necessary. > > Suggested-by: Reinette Chatre <reinette.chatre@intel.com> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reinette
diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c index bcbca356d56a..8aa6d67db978 100644 --- a/tools/testing/selftests/resctrl/cache.c +++ b/tools/testing/selftests/resctrl/cache.c @@ -41,7 +41,6 @@ static int perf_event_open_llc_miss(pid_t pid, int cpu_no) PERF_FLAG_FD_CLOEXEC); if (fd_lm == -1) { perror("Error opening leader"); - ctrlc_handler(0, NULL, NULL); return -1; }