Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2766449rdb; Wed, 4 Oct 2023 10:43:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnfCjn6KS2R/jFvGBN5tY3FmVxkgWmgNRlHIzLWXH2LekM+zFfaneIm1pIWHKi/2M1/1jL X-Received: by 2002:a05:6a20:6a0a:b0:15f:b5:bfee with SMTP id p10-20020a056a206a0a00b0015f00b5bfeemr3581969pzk.5.1696441402606; Wed, 04 Oct 2023 10:43:22 -0700 (PDT) Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bs191-20020a6328c8000000b00585463c36fbsi3903550pgb.44.2023.10.04.10.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 10:43:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="J/S8Wyxo"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id DA034801B43E; Wed, 4 Oct 2023 10:43:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233826AbjJDRnS (ORCPT + 99 others); Wed, 4 Oct 2023 13:43:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233817AbjJDRnR (ORCPT ); Wed, 4 Oct 2023 13:43:17 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D94AB8; Wed, 4 Oct 2023 10:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696441392; x=1727977392; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=wusBh9D5/dwIr4VShsVPhbHzM/ThsQwHdFWuOQGmq1g=; b=J/S8WyxobaAm5F+i5w3SI0zFBAIef4TgMdmEND1FlJcLb/oMinqdAyuh HIBTlnpLvUJ9im9zre0aMAZE4DU7yUsE1FDyVUGkV2f+vq/mJYtL8BF4k IIVhX2tG6S7+Br6tEdtRQtBCAZJGQ8IGWD6iX7FW+JKX1je5wLvDgyLRp CCZCcaCcnx4afoQ2w9h2B2rfObdRNUUUrDG7w4FldRohD03zht6qCz1la CvKsVSgcxVa5/dOdN7Gm9U8sShCLY7Vrhb6tGed7F3Ua0nmP43I0Db2Ug Fu8J8NQpQdUXnBRGiU36FvoolW4FStqEX+NLyRLXiWab6o9dAMZA1034l Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="386075726" X-IronPort-AV: E=Sophos;i="6.03,200,1694761200"; d="scan'208";a="386075726" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 10:43:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="745076022" X-IronPort-AV: E=Sophos;i="6.03,200,1694761200"; d="scan'208";a="745076022" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga007.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 04 Oct 2023 10:43:11 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Wed, 4 Oct 2023 10:43:11 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Wed, 4 Oct 2023 10:43:10 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Wed, 4 Oct 2023 10:43:10 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.107) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Wed, 4 Oct 2023 10:43:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bnBiZfc3ucQ86VeOAz5fPtYZAkcVIOVJX9ILv70efH+X925nHqVIogss3ip7DeEVAhi8KPII9NaW0i+sJ3SiSahUPaDBEsn1YYd8YEXqud1RzjUEcaaDQWYeTO79/Tz5BO5iuZdcxYAdaYJmtpocNbx2d8an20kUFqJ+cTeGCv8yDBi3W/yVcMAWaJnxAu3vK77u0X615Sk07VlUU319K6eu/pmoyzmhxZ93bOizTowuoq/B/IYCytFl1EUQ6JCf4sqLuMJmhT5OPyKoHczE7/2yLFTBkD9q+x6Bd3vClGMvSUmbT/K6UmAxojS429hJ2abrUvSdkJ+crV6OlbpDhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PRQLfonJiS4Q7WUEqR4CaoXo3DBqEU4oYuH08nlsVrI=; b=b5rWArY+d4tNe+5AJ8Kq8C35iLkOuWdxbIbT+5IqMV6T4jU4hRk6M/1PTFrPkJqy4pBuOphsjjtXwuI+CCd30FFeEnEqJGvLNuQcrj9h+QVO5vFjpvzbwXFs7acHL7IFYs9LJFYcqD+t/Z1zZ4Ia+W1wuzPa7yp//8dYED83u6K/oHa4qy6gODB6VaFSqMd+V+ZUYJefiGKFZoM2UCHs78aMAI8YlxzE2WUXBn6fkYKnS7MAy/d8gHNHiBziwqr75O/ivd641NlTGMztqCZ78YCwHYlYfEn4JEa0naMbYS2ovO6uxJFgq+BeDj9+/DUvQHDnysWULOAs5xa6HVeKyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ2PR11MB7573.namprd11.prod.outlook.com (2603:10b6:a03:4d2::10) by DM4PR11MB7254.namprd11.prod.outlook.com (2603:10b6:8:10e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Wed, 4 Oct 2023 17:43:08 +0000 Received: from SJ2PR11MB7573.namprd11.prod.outlook.com ([fe80::bd70:f215:4a97:c84e]) by SJ2PR11MB7573.namprd11.prod.outlook.com ([fe80::bd70:f215:4a97:c84e%6]) with mapi id 15.20.6838.033; Wed, 4 Oct 2023 17:43:08 +0000 Message-ID: <0033ee44-5383-4e69-b85d-ed88592bee94@intel.com> Date: Wed, 4 Oct 2023 10:43:04 -0700 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/6] selftests/resctrl: Extend signal handler coverage to unmount on receiving signal Content-Language: en-US To: "Shaopeng Tan (Fujitsu)" , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Shuah Khan , Shuah Khan , "linux-kselftest@vger.kernel.org" , =?UTF-8?Q?Maciej_Wiecz=C3=B3r-Retman?= CC: LKML , "stable@vger.kernel.org" References: <20230915154438.82931-1-ilpo.jarvinen@linux.intel.com> <20230915154438.82931-2-ilpo.jarvinen@linux.intel.com> From: Reinette Chatre In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MW4PR03CA0330.namprd03.prod.outlook.com (2603:10b6:303:dd::35) To SJ2PR11MB7573.namprd11.prod.outlook.com (2603:10b6:a03:4d2::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR11MB7573:EE_|DM4PR11MB7254:EE_ X-MS-Office365-Filtering-Correlation-Id: 24f0b0be-e640-4c68-b086-08dbc5015ed9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B+Fo5G8COUTHxN+U4eUvPU8wBC8wcSA4H3WdasYnpMQpmf0hwxF+HCvvyreF83JbKfnoYMpi9NcyimKDjMmCK9a0jS3DacuPpAmMelbQrls7rl0VK1C5Rhm/xaC9vScyfYB0pkqGPrIIIZAz/CVvKMtBATKLeqIwA0JoL6gX+zMqy5bndhAMQkA4PofgHgp8uAHVELwxvpvrAPJ1OWTb86sTyWJdJj3TGmluV+wJ5d85ycvldiTMtKMEvvBZucRqQhTE4l1npUapw424QWMCk3VYREZ87CSbfAcwQCS4T0t8A4AgygQhr3U8k8BwymP9JuVt2VWU79RZxHHi4Ndarq2cwrbCgJmGWJy+b8lqksmsUOvk/YQAvqdnnm9F1gyki/4GHvzc0U3Xcu2wzWDRXojbPVw8dzTIsq4tmdflBSEP6H3yHo1zpB18Kpo5FgHzJ0KTTxkwEkhjqCXZATFbv1dWTMYIZNpLhTQ84J4X0EitEO/xKKovHzP8pjEwn3VaFaQoDGTHa1w3HNeZvZgJpMLrTE/C8j1mnObSe3+PCBhY5yhCYU/XDbM4Ye48RMqV/mApHSx+lo5tQIS5CqFQ+8ydn6SZmGT7p6NAOHByYKbZmNi96lqDIdn1eRGpnWDx5rEsNrgxTGO8CJjSNfFI/Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ2PR11MB7573.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(39860400002)(366004)(396003)(376002)(136003)(230922051799003)(1800799009)(186009)(64100799003)(451199024)(53546011)(6486002)(6506007)(6666004)(478600001)(83380400001)(6512007)(26005)(2906002)(110136005)(41300700001)(316002)(6636002)(66946007)(66476007)(54906003)(8936002)(5660300002)(66556008)(4326008)(44832011)(8676002)(38100700002)(36756003)(66574015)(82960400001)(86362001)(31696002)(2616005)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZkxCRmJDUjZMRVVaNkJacXczcXJ0TEx0YUMyaVhvSDUwNFFPbWZVam55Y1JK?= =?utf-8?B?bFRZSW4zRnl1VTk4OU81bW9Sc0hYakFUeUdaaGM0V1V2SU0yMWxwbXFtdjJI?= =?utf-8?B?V0NSMWtha1BSV0o0R1lMWUtUYkU3b3EvVmtPNW5MQW8rT24waG5JdlREeWhs?= =?utf-8?B?a0pDQk5SUnh1aFAzMU9PWjUwRndiMXB3cnc1ZXdYM3Z4RG5Za2h4Sm9SYlUw?= =?utf-8?B?YTBIYTNhR1RFMDVRZlhMejA5OEozV0dsQkdEV0FZTS8vaVIvTUNQS0lQZXhz?= =?utf-8?B?amQycWNncWxROTRFYlo3eGlHOE1qL0FydUI1dkZmV0RsdTlaV3RXL3p1eU9t?= =?utf-8?B?Zkhv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9oM1dmQUpzazRMc2JKcENV?= =?utf-8?B?enc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 24f0b0be-e640-4c68-b086-08dbc5015ed9 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR11MB7573.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 17:43:08.1885 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kf8eAsUsntbNOr90fnxZsWi0ZRp0DczfWg+zUltBUaZlxYKDBZiRxd4fUwpONY5Shkme0NH+UzsvhsALQilmrR2VVgGuiG3AMwMVea1Pfto= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB7254 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 10:43:22 -0700 (PDT) Hi Shaopeng, On 9/28/2023 1:10 AM, Shaopeng Tan (Fujitsu) wrote: >> On 9/15/2023 8:44 AM, Ilpo Järvinen wrote: ... >>> +static void run_mbm_test(const char * const *benchmark_cmd, int >>> +cpu_no) { >>> + int res; >>> + >>> + ksft_print_msg("Starting MBM BW change ...\n"); >>> + >>> + if (test_prepare()) >>> + return; >>> >> >> I am not sure about this. With this exit the kselftest machinery is not aware of >> the test passing or failing. I wonder if there should not rather be a "goto" here >> that triggers ksft_test_result()? This needs some more thought though. First, >> with this change test_prepare() officially gains responsibility to determine if a >> failure is transient (just a single test >> fails) or permanent (no use trying any other tests if this fails). For the former it >> would then be up to the caller to call ksft_test_result() and for the latter >> test_prepare() will call ksft_exit_fail_msg(). >> Second, that SNC warning may be an inconvenience with a new goto. Here it >> may be ok to print that message before the test failure? > > If a failure may be permanent, it may be best to detect it before running all tests, rather than in test_prepare(). > Now some detections are completed before running all tests. For example: > 273 if (geteuid() != 0) > 274 return ksft_exit_skip("Not running as root. Skipping...\n"); > 275 > 276 if (!check_resctrlfs_support()) > 277 return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n"); > 278 > 279 if (umount_resctrlfs()) > 280 return ksft_exit_skip("resctrl FS unmount failed.\n"); > You are correct that the tests should aim to detect as early as possible if no test has a chance of succeeding. This is covered in the checks you mention. The purpose of test_prepare()/test_cleanup() pair is to perform actions that should be done for every test. For example, resctrl is mounted before each test and unmounted after each test. Since these actions are required to be done for every test it cannot be a single call before all tests are run. It may be possible to add a test_prepare() directly followed by a test_cleanup() before any test is run to be more explicit about early detection but that does not seem necessary considering the checks would be done anyway when the first test is run. Even when doing so it would not eliminate the need for test_prepare()/test_cleanup() to form part of every test run and needing to exit if, for example, a previous test triggered a fault preventing resctrl from being mounted. Reinette