From patchwork Thu Apr 13 07:22:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaopeng Tan X-Patchwork-Id: 8114 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp853543vqo; Thu, 13 Apr 2023 00:40:12 -0700 (PDT) X-Google-Smtp-Source: AKy350ascKbcPr7oMR8Vch8XaggaAQYRlEJPTBENDRPa6ySLSlUI6A9lgp4Ijb2rWg2WjzzVFcBF X-Received: by 2002:aa7:d352:0:b0:4fd:2140:5cc6 with SMTP id m18-20020aa7d352000000b004fd21405cc6mr1386690edr.17.1681371612122; Thu, 13 Apr 2023 00:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681371612; cv=none; d=google.com; s=arc-20160816; b=Uhnu6YCDZ2ivqa4utAkRy47dC/kysu8ETxtH0I6BtGXvaj8Zj/a6ZAgosNPpSReK0b kbyqdJisItkcxz+0puCERzcqf9ZgX6E8IiE8dcQT+e3vr1JSMGTqoNHfaEYVvSu14XZd ampqWejclrtHo7wtxaBYE9U7JasU668JZMFjfLSPNDUEhzwnxo0vcWHh+iAP+lO2vF8j xEzsHT8GqxWCXCrTplClMJ7GIJ9D2EeSYcuK25sChr+ugs5cHn0JAj9U+8qNJKTCAWaC cHMRYlFtt/imHvLuHRc5/2xpDQHTKPhkGuo04xiWPPH8xBXnW0YU1fyZ5DB4+F8DZKdB BRCg== 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 :message-id:date:subject:cc:to:from; bh=PNCOReB4YwKY0654q7rB/LEsIMt/52TIH7ZpCQmq+rs=; b=OFNFyxPAaimdPcFFhVEeKUR53v86Hb9xK+FcGFzQgBC49pORPPmDePRfjrEeeYGelz xL0WEwu8N3mvLqLEiqDGHSk+pJaDaRAANvP2A0wHskl4m8Ivau6mY1oBBhEh25k1O+a2 mIwKExECMILwEAV8WGd3OqJ4eXWRxABbcpCC1aKN7TQIxYO8svOwjsCQYoIf7s3K5lZX 5bLtAhImdZWu3eIKU0yse7ivAIVwSTCNJGm5me0KdGeGMij6axSRL6yKgu2yRBqaBPaz Wzp22qNXXiD7jHH3UMfU9iUUd0qrw8c8EfKRyD0J1L28PZL1SUrVqFtCdEvyO1IJ6G5P nU+g== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020aa7d5cb000000b0050492e2c3casi1231302eds.416.2023.04.13.00.39.48; Thu, 13 Apr 2023 00:40:12 -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 S229831AbjDMHXF (ORCPT + 99 others); Thu, 13 Apr 2023 03:23:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjDMHXE (ORCPT ); Thu, 13 Apr 2023 03:23:04 -0400 Received: from esa8.hc1455-7.c3s2.iphmx.com (esa8.hc1455-7.c3s2.iphmx.com [139.138.61.253]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53CFA9F; Thu, 13 Apr 2023 00:23:02 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="101351006" X-IronPort-AV: E=Sophos;i="5.98,339,1673881200"; d="scan'208";a="101351006" Received: from unknown (HELO yto-r1.gw.nic.fujitsu.com) ([218.44.52.217]) by esa8.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 16:22:59 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 94D69D66A5; Thu, 13 Apr 2023 16:22:57 +0900 (JST) Received: from yto-om3.fujitsu.com (yto-om3.o.css.fujitsu.com [10.128.89.164]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id E2071D35F5; Thu, 13 Apr 2023 16:22:56 +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 AA28A40007204; Thu, 13 Apr 2023 16:22:56 +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 Subject: [PATCH v9 0/6] Some improvements of resctrl selftest Date: Thu, 13 Apr 2023 16:22:53 +0900 Message-Id: <20230413072259.2089348-1-tan.shaopeng@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763045919400684672?= X-GMAIL-MSGID: =?utf-8?q?1763045919400684672?= Hello Reinette, The aim of this patch series is to improve the resctrl selftest. Without these fixes, some unnecessary processing will be executed and test results will be confusing. There is no behavior change in test themselves. [patch 1] Make write_schemata() run to set up shemata with 100% allocation on first run in MBM test. [patch 2] The MBA test result message is always output as "ok", make output message to be "not ok" if MBA check result is failed. [patch 3] When a child process is created by fork(), the buffer of the parent process is also copied. Flush the buffer before executing fork(). [patch 4] An error occurs whether in parents process or child process, the parents process always kills child process and runs umount_resctrlfs(), and the child process always waits to be killed by the parent process. [patch 5] If a signal received, to cleanup properly before exiting the parent process, commonize the signal handler registered for CMT/MBM/MBA tests and reuse it in CAT, also unregister the signal handler at the end of each test. [patch 6] Before exiting each test CMT/CAT/MBM/MBA, clear test result files function cat/cmt/mbm/mba_test_cleanup() are called twice. Delete once. This patch series is based on based on the "next" branch of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git Pervious versions of this series: [v1] https://lore.kernel.org/lkml/20220914015147.3071025-1-tan.shaopeng@jp.fujitsu.com/ [v2] https://lore.kernel.org/lkml/20221005013933.1486054-1-tan.shaopeng@jp.fujitsu.com/ [v3] https://lore.kernel.org/lkml/20221101094341.3383073-1-tan.shaopeng@jp.fujitsu.com/ [v4] https://lore.kernel.org/lkml/20221117010541.1014481-1-tan.shaopeng@jp.fujitsu.com/ [v5] https://lore.kernel.org/lkml/20230111075802.3556803-1-tan.shaopeng@jp.fujitsu.com/ [v6] https://lore.kernel.org/lkml/20230131054655.396270-1-tan.shaopeng@jp.fujitsu.com/ [v7] https://lore.kernel.org/lkml/20230213062428.1721572-1-tan.shaopeng@jp.fujitsu.com/ [v8] https://lore.kernel.org/lkml/20230215083230.3155897-1-tan.shaopeng@jp.fujitsu.com/ Shaopeng Tan (6): selftests/resctrl: Fix set up schemata with 100% allocation on first run in MBM test selftests/resctrl: Return MBA check result and make it to output message selftests/resctrl: Flush stdout file buffer before executing fork() selftests/resctrl: Cleanup properly when an error occurs in CAT test selftests/resctrl: Commonize the signal handler register/unregister for all tests selftests/resctrl: Remove duplicate codes that clear each test result file tools/testing/selftests/resctrl/cat_test.c | 29 ++++---- tools/testing/selftests/resctrl/cmt_test.c | 7 +- tools/testing/selftests/resctrl/fill_buf.c | 14 ---- tools/testing/selftests/resctrl/mba_test.c | 23 +++---- tools/testing/selftests/resctrl/mbm_test.c | 20 +++--- tools/testing/selftests/resctrl/resctrl.h | 2 + .../testing/selftests/resctrl/resctrl_tests.c | 4 -- tools/testing/selftests/resctrl/resctrl_val.c | 67 ++++++++++++++----- tools/testing/selftests/resctrl/resctrlfs.c | 5 +- 9 files changed, 96 insertions(+), 75 deletions(-)