Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2318034pxp; Fri, 18 Mar 2022 08:06:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrYy2B4/jKt0C6yegzaioacvfOGef+/+Y/TW6AX1UnKcgPx6GN1Eu4pJWF3zXT01//LTWG X-Received: by 2002:a17:902:a501:b0:153:f956:29f0 with SMTP id s1-20020a170902a50100b00153f95629f0mr7310821plq.120.1647615975084; Fri, 18 Mar 2022 08:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647615975; cv=none; d=google.com; s=arc-20160816; b=uR4yhpHYDtzfuHukgCgi3ElbN1f75dOCBwcbD2L2+5Pp/I15zhDNVtIGexu8sEy4hp VAIPzt7XjU2/3loWInAKlV/LzBSKQ8ylc0WKX4/ajSDKWBcgYbH62CDFlg0qVhH9+krc vT5ADECscR5h4I1TvDaLSxr0OCRBanZDwsyVkbGsKBzCvyN1M9tNKmT8nHr90S2IVK8T r0ThRh5+MByJKRpjdIDb6KdPUxPJHsQd7D89x5QLPJ4+vEZKENu6bEPn3H4xYYPVParJ uxHkTzSjs5rsXwKya/wZLi1lrnjI9lMyC4IQLu/fB4zxXLDWDOT+bKbOCE12QwrS1odM ZM6Q== 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; bh=NQK70tTickKrDO1fNXGbgaNlemtuZgVkap31nA0NQiM=; b=hIudktrvOuPEo5mgNkHxujY432MjPE4iuBycqkwHM1s5gjmqhd40yQEAD6pixlQ3je RUevRzH5lXJmiUU9vmiWYCVPhYgxlkP4vlPn09Lx3W0/fxoiu4ySxvxyfz2aCjIS0JlW fe01Vk7VofgjD9Q+GkD4Hh27BVBt16Isav9NOYaKNnO4ukQnluDJ7QMpgkGV0iFMcfDj 3yanXfLiqF3GPFF0DFbEMRZPLHR00xUOchg0E8RFwn5MsAR4r9cHslGNhNITZWUXxYI+ fbOIbnggELwhkFfa49S1MoM8tjKMteCNaI0RsbuAee5A+muFbLtE2lyWY+JZns/b6Q/X CU5A== 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=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d17-20020a63ed11000000b003816043ee34si5419745pgi.41.2022.03.18.08.05.53; Fri, 18 Mar 2022 08:06:15 -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=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233425AbiCRIAo (ORCPT + 99 others); Fri, 18 Mar 2022 04:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231319AbiCRIAj (ORCPT ); Fri, 18 Mar 2022 04:00:39 -0400 Received: from esa3.hc1455-7.c3s2.iphmx.com (esa3.hc1455-7.c3s2.iphmx.com [207.54.90.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F60F175879; Fri, 18 Mar 2022 00:59:21 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6200,9189,10289"; a="66729508" X-IronPort-AV: E=Sophos;i="5.90,191,1643641200"; d="scan'208";a="66729508" Received: from unknown (HELO yto-r1.gw.nic.fujitsu.com) ([218.44.52.217]) by esa3.hc1455-7.c3s2.iphmx.com with ESMTP; 18 Mar 2022 16:59:19 +0900 Received: from yto-m1.gw.nic.fujitsu.com (yto-nat-yto-m1.gw.nic.fujitsu.com [192.168.83.64]) by yto-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 77D9BE0628; Fri, 18 Mar 2022 16:59:18 +0900 (JST) Received: from yto-om3.fujitsu.com (yto-om3.o.css.fujitsu.com [10.128.89.164]) by yto-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id BF28BCFB6D; Fri, 18 Mar 2022 16:59:17 +0900 (JST) Received: from cn-r05-10.example.com (n3235113.np.ts.nmh.cs.fujitsu.co.jp [10.123.235.113]) by yto-om3.fujitsu.com (Postfix) with ESMTP id 76B9440060542; Fri, 18 Mar 2022 16:59:17 +0900 (JST) From: Shaopeng Tan To: Fenghua Yu , Reinette Chatre , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tan.shaopeng@jp.fujitsu.com, Shuah Khan Subject: [PATCH v6 1/6] selftests/resctrl: Kill child process before parent process terminates if SIGTERM is received Date: Fri, 18 Mar 2022 16:58:02 +0900 Message-Id: <20220318075807.2921063-2-tan.shaopeng@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220318075807.2921063-1-tan.shaopeng@jp.fujitsu.com> References: <20220318075807.2921063-1-tan.shaopeng@jp.fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,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 In kselftest framework, a sub test is run using the timeout utility and it will send SIGTERM to the test upon timeout. In resctrl_tests, a child process is created by fork() to run benchmark but SIGTERM is not set in sigaction(). If SIGTERM signal is received, the parent process will be killed, but the child process still exists. kill child process before parent process terminates if SIGTERM signal is received. Reviewed-by: Shuah Khan Reviewed-by: Reinette Chatre Signed-off-by: Shaopeng Tan --- tools/testing/selftests/resctrl/resctrl_val.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c index 95224345c78e..b32b96356ec7 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -678,6 +678,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param) sigemptyset(&sigact.sa_mask); sigact.sa_flags = SA_SIGINFO; if (sigaction(SIGINT, &sigact, NULL) || + sigaction(SIGTERM, &sigact, NULL) || sigaction(SIGHUP, &sigact, NULL)) { perror("# sigaction"); ret = errno; -- 2.27.0