Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5718509rwr; Mon, 24 Apr 2023 08:05:26 -0700 (PDT) X-Google-Smtp-Source: AKy350auu99EctNF9XWPimC+jPP8Ya1N7+NJubnKFd+WAddEgH0muJprpxWYa120dLydv//uNYAG X-Received: by 2002:a17:902:d510:b0:1a9:631b:7d68 with SMTP id b16-20020a170902d51000b001a9631b7d68mr8599828plg.8.1682348726432; Mon, 24 Apr 2023 08:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682348726; cv=none; d=google.com; s=arc-20160816; b=R9yef/Olp3lHOE4mXj4vLJC/SVIWilQhmqX8pcIgEULEhyLlQO9MIlhCmoWJ6ZM6nU S7oUkfP/vcAc763uDm/Rp1PWzeDIGsIP4YYQQd5g7PD210yzrcpZxvl+OPOxZEg5+lg2 wwKoTclHQE4jgfxFPfpc3X7/9BryIyN56HCP/scMS8y+cxD5jQn/iPxz1oDxihm2ZQn/ uJ//Rx2ik0bf6KCY043yTHz/UlpFoMr+W6nGZOSyYq56C4z0ub+FOKfwMtZRr2wM7R7K 41WcXE02jHqf3/D+3PLFmNcj7RNAKppH8sqhiMGqYcNSSMyQvo8EIv3Wvox7De2gfolz M7sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-id:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=uhnvj5s7ItPNwRoKq/xiBL/+AEz+j7Kn7nqKyoyiHvk=; b=RnLqMKdCNEaLshxbYTV8FQtuvMMuugKruAh0A1DUWXHamhBpLJs0dwAUw4C+bnbnaZ 8SS5fuTdBIOcJ42SCtImUU5+S5NKBy2IJhxB9Ujcctx0WO4ftPNU6g1k3Is4PvGE0oaI dvvz042ytY8cTYgTijD18H2qrEOzp7aeRAsVVQ8UDrSG0uQw2Yd0SbO6SEK3GgYgEGH4 MvLpqYB8ToCf44olGcbNsElNMQR+0GQLLHJ5pqcwGpBFXck4oFK/MU0cYc2P2r1GB5fQ U7qHYoIauPBvwOQqquosqZOerHwIEWTriHfoHj65N7KeFXbAHgeKlOxTCM/ijM0SjB/6 dtBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iqKeGJxY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a170903240900b001a6ee332903si11231606plo.347.2023.04.24.08.05.03; Mon, 24 Apr 2023 08:05:26 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=iqKeGJxY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231922AbjDXO6m (ORCPT + 99 others); Mon, 24 Apr 2023 10:58:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbjDXO6l (ORCPT ); Mon, 24 Apr 2023 10:58:41 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F89D7680; Mon, 24 Apr 2023 07:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682348320; x=1713884320; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version:content-id; bh=yDWaktabYWFGQaXIwUoOQB61kNKDGmTqY21HhUuRI5Q=; b=iqKeGJxYGnqDUNU8LEj9nAcZKniSTPlhkWLDJqf5e7voTaHYoxETLk9P oxh8VXcD/hPN6p2bfXIa/igtyB6MVJOxT2kOQZuXpWf0L4czO0rvVhc2t Nowo5ztdtOxRCiKg4BdyDll7T2H1Or1wA6nhSa/PfXu/l+eJabNiTSbh4 Ycqkj7TeWtU7kThAnM7SSbcsE94GhhnlO6i07S+40i9N/YTNK2qIZ/Wpl RtLg/IYtJ3PRCox7hT55reJF/Kvi4RMz8hCIOJvcgZDRq8IssfjF3WVSu M6E4trJ7yBfXJjrym30mIc8UW/DSogzeO3q60vgvE0FdFdoVXmGUdm00k A==; X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="326082453" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="326082453" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 07:58:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="693106347" X-IronPort-AV: E=Sophos;i="5.99,223,1677571200"; d="scan'208";a="693106347" Received: from wlwpo-8.amr.corp.intel.com ([10.251.215.143]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 07:58:36 -0700 Date: Mon, 24 Apr 2023 17:58:34 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Reinette Chatre cc: linux-kselftest@vger.kernel.org, Fenghua Yu , Shuah Khan , Sai Praneeth Prakhya , Babu Moger , LKML , Shaopeng Tan Subject: Re: [PATCH v2 03/24] selftests/resctrl: Move resctrl FS mount/umount to higher level In-Reply-To: <74cab34d-767c-aa10-807d-3cbab7907ca9@intel.com> Message-ID: <85166db-cf39-5ddd-ba9c-add78e6144e9@linux.intel.com> References: <20230418114506.46788-1-ilpo.jarvinen@linux.intel.com> <20230418114506.46788-4-ilpo.jarvinen@linux.intel.com> <74cab34d-767c-aa10-807d-3cbab7907ca9@intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1579805254-1682334295=:2038" Content-ID: X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE,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 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1579805254-1682334295=:2038 Content-Type: text/plain; CHARSET=ISO-8859-15 Content-Transfer-Encoding: 8BIT Content-ID: On Fri, 21 Apr 2023, Reinette Chatre wrote: > On 4/18/2023 4:44 AM, Ilpo J?rvinen wrote: > > A few places currently lack umounting resctrl FS on error paths. > > You mention "A few places" (plural). In the patch I do see that > cmt_resctrl_val() is missing an unmount. Where are the other places? - cmt_resctrl_val() has multiple error paths with direct return. - cat_perf_miss_val() has multiple error paths with direct return. In addition, validate_resctrl_feature_request() is called by run_mbm_test() and run_mba_test(). Neither MBA nor MBM test tries to umount resctrl FS. I improved the changelog accordingly. While doing this, I took a more careful look into how it can result in problems and I think the only way is through PARENT_EXIT() because main has the umount in the end (and the remounting trickery kinda seems to work even if it was hard to track). Fixing the PARENT_EXIT() problem required yet another change which I add in v3. As the only failure I could think of is because of PARENT_EXIT(), I removed Fixes tags from this change and put one into the PARENT_EXIT() umount fix. So this change will just be part of the move towards more tractable resctrl FS handling, not a fix anymore. In the end, after some reshuffling, I ended up having 5 changes related to this: selftests/resctrl: Remove mum_resctrlfs from struct resctrl_val_param selftests/resctrl: Refactor remount_resctrl(bool mum_resctrlfs) to mount_resctrl() selftests/resctrl: Move resctrl FS mount/umount to higher level selftests/resctrl: Unmount resctrl FS before starting the first test selftests/resctrl: Unmount resctrl FS if child fails to run benchmark > > diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c > > index af71b2141271..426d11189a99 100644 > > --- a/tools/testing/selftests/resctrl/cmt_test.c > > +++ b/tools/testing/selftests/resctrl/cmt_test.c > > @@ -86,10 +86,6 @@ int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd) > > > > cache_size = 0; > > > > - ret = remount_resctrlfs(true); > > - if (ret) > > - return ret; > > - > > if (!validate_resctrl_feature_request(CMT_STR)) > > return -1; > > > > diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c > > index 9b9751206e1c..5c9ed52b69f2 100644 > > --- a/tools/testing/selftests/resctrl/resctrl_tests.c > > +++ b/tools/testing/selftests/resctrl/resctrl_tests.c > > @@ -77,9 +77,15 @@ static void run_mbm_test(bool has_ben, char **benchmark_cmd, int span, > > > > ksft_print_msg("Starting MBM BW change ...\n"); > > > > + res = remount_resctrlfs(false); > > I think that should be remount_resctrlfs(true). > Please note that any of the tests could be > run separately from the command line and thus each test need to ensure a clean > environment, it cannot assume that (a) user space provided it with a > clean and/or unmounted resctrl or (b) that any test was run before it. I think I got tripped by the level of complexity here and trying to split patch to minimal parts. I was somehow thinking that remount_resctrlfs(false) would return error if resctrl fs is already mounted. I've now changed this to pass true instead even if the argument is removed by the other change. -- i. --8323329-1579805254-1682334295=:2038--