Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2176190pxm; Fri, 4 Mar 2022 10:46:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyn7sN8hddOIXQ9GcF9VaEkFIuWaFDI6a83kKeyO9pZ112jPJaIhVJCEX5E2KfzYEewUZd5 X-Received: by 2002:a63:465b:0:b0:374:642c:ab62 with SMTP id v27-20020a63465b000000b00374642cab62mr35669465pgk.187.1646419569719; Fri, 04 Mar 2022 10:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646419569; cv=none; d=google.com; s=arc-20160816; b=CZupnt3yUsShNuFL2Z8n0yesVgWyA/fUBiuCZzrjNVJJjjGOwjAV0oY2nNhuWB+npP KUjizk2o4LF7WOLrSu6VoDRbkj9JQ6EH1GGPDTm1LvwC426XL1GWkTqy58cfS5a1vKyk megyO0SvMkonNPJpc0JsxfnMpv5Kx9ZGmcJRQV3u2alDhBGy34OZqjPwXelDALLGqeP5 JiDEc70DQ81MK+MCcetM3vTeT/2noMHNQpQyxv7YhbsC1CPvnGtV22HLhhnO5X0lWy1z 2+cGdPLRL5uN4pXiXm2SHtd/sQkb7mysVzVfgSJmMhtnAFmIEMHY9tiZsihCRk3Bw7e8 Si1w== 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 :ironport-sdr; bh=U/GVlq69LMXyi397MzR2rqZ8yfnz+TPLjeBUgNPAVdg=; b=EqhX4ZE68W05jMFtAhoae92mqR+w0escnmvOMrzFg4UIHlU3p7O15r/+9HoyUyuBZk 1ssxmet3QVzZQ1SVJIigPEDmaFWPQ5kE1qwTZ/WSQEgpB3Ll7QEdVDwx9hyvA72dtg5z WrGn7aQqtrPVhmPvupxFnZOwhhi4X5UH8uiroGMRbpL4dH9I68jiC16vMwd9S4mOb7JV QklYxrPwTDwP3IlgkVqoUGpKCjVAmofvL+0RhkMr+KhLSw54Y2F2fuYo0TsrW/9w7Ui/ uFawl/lHVsr82zM0dnxJwYDvKnzuBiOrQKasmrwPRGUo5YO8URqm+wij6C6BlBbQ6Rgc Ikqg== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u134-20020a63798c000000b00378907d22f0si5423420pgc.210.2022.03.04.10.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 10:46:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AD0585FAF; Fri, 4 Mar 2022 10:45:40 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236218AbiCDKkX (ORCPT + 99 others); Fri, 4 Mar 2022 05:40:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236165AbiCDKkS (ORCPT ); Fri, 4 Mar 2022 05:40:18 -0500 Received: from esa11.hc1455-7.c3s2.iphmx.com (esa11.hc1455-7.c3s2.iphmx.com [207.54.90.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B120117ED9B; Fri, 4 Mar 2022 02:39:29 -0800 (PST) IronPort-SDR: 99OgVtSJNOWFx2gCepKjFLs5kcjH1fJ6ZO63J02raI5ccdKOqseXVitSmv/sgnPa+R688bXjH3 P9/JMZKPg1S9TTRWW+171oSUishiu6cUg8XfD1CxPOGgravV77kfeOyw5WNFM0jQwCzWkxdbBw IgqimyPzYRgWbo4J0JWF4oFUzQgTqanyx4iq5vGzb5Fh2soHbXNQG1ubZKEIIXV43mnBXb3LCc 55jGpVsqciT7EE1Bgd+zd9/6CVdV5iw8KC/sH0hlnDR0PcWrT6OfzkoVABz4K8xqu7IIthFN1n y0V5aDqgcfpJ8XwfqwSC/YO6 X-IronPort-AV: E=McAfee;i="6200,9189,10275"; a="44657797" X-IronPort-AV: E=Sophos;i="5.90,154,1643641200"; d="scan'208";a="44657797" Received: from unknown (HELO yto-r4.gw.nic.fujitsu.com) ([218.44.52.220]) by esa11.hc1455-7.c3s2.iphmx.com with ESMTP; 04 Mar 2022 19:39:26 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 13263D7704; Fri, 4 Mar 2022 19:39:26 +0900 (JST) Received: from oym-om4.fujitsu.com (oym-om4.o.css.fujitsu.com [10.85.58.164]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id A55DF1ED62F; Fri, 4 Mar 2022 19:39:24 +0900 (JST) Received: from cn-r05-10.example.com (n3235113.np.ts.nmh.cs.fujitsu.co.jp [10.123.235.113]) by oym-om4.fujitsu.com (Postfix) with ESMTP id 6797340450F6A; Fri, 4 Mar 2022 19:39:24 +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 v4 1/6] selftests/resctrl: Kill child process before parent process terminates if SIGTERM is received Date: Fri, 4 Mar 2022 19:38:29 +0900 Message-Id: <20220304103834.486892-2-tan.shaopeng@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220304103834.486892-1-tan.shaopeng@jp.fujitsu.com> References: <20220304103834.486892-1-tan.shaopeng@jp.fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,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 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 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