From patchwork Tue Oct 20 23:51:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fenghua Yu X-Patchwork-Id: 285870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 429D4C4363D for ; Tue, 20 Oct 2020 23:52:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0675721D6C for ; Tue, 20 Oct 2020 23:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439548AbgJTXwf (ORCPT ); Tue, 20 Oct 2020 19:52:35 -0400 Received: from mga04.intel.com ([192.55.52.120]:54960 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410704AbgJTXvb (ORCPT ); Tue, 20 Oct 2020 19:51:31 -0400 IronPort-SDR: WR3OaAjctSIo3+lZYN4FAnxOCm5a4/aDqkcRWhE5UxMfXqVgKp/GV9kRzjA3gSCdweimjzhChv OrReHFeT3pmw== X-IronPort-AV: E=McAfee;i="6000,8403,9780"; a="164686724" X-IronPort-AV: E=Sophos;i="5.77,399,1596524400"; d="scan'208";a="164686724" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2020 16:51:30 -0700 IronPort-SDR: oCDWqnbn4hZu67teHVFiI2gNbZpAMO586O16h+arE9CwuDqkuexHlPtoLBcEqr+dO2TDdxYOlY MpzQrLjCMdZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,399,1596524400"; d="scan'208";a="320833829" Received: from otcwcpicx6.sc.intel.com ([172.25.55.29]) by orsmga006.jf.intel.com with ESMTP; 20 Oct 2020 16:51:30 -0700 From: Fenghua Yu To: "Shuah Khan" , "Reinette Chatre" , "Tony Luck" , "Babu Moger" , "James Morse" , "Borislav Petkov" , "Thomas Gleixner" , "Ravi V Shankar" Cc: "linux-kselftest" , "linux-kernel" , Fenghua Yu Subject: [PATCH v3 06/21] selftests/resctrl: Check for resctrl mount point only if resctrl FS is supported Date: Tue, 20 Oct 2020 23:51:11 +0000 Message-Id: <20201020235126.1871815-7-fenghua.yu@intel.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20201020235126.1871815-1-fenghua.yu@intel.com> References: <20201020235126.1871815-1-fenghua.yu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org check_resctrlfs_support() does the following 1. Checks if the platform supports resctrl file system or not by looking for resctrl in /proc/filesystems 2. Calls opendir() on default resctrl file system path (i.e. /sys/fs/resctrl) 3. Checks if resctrl file system is mounted or not by looking at /proc/mounts Steps 2 and 3 will fail if the platform does not support resctrl file system. So, there is no need to check for them if step 1 fails. Fix this by returning immediately if the platform does not support resctrl file system. Fixes: ecdbb911f22d ("selftests/resctrl: Add MBM test") Signed-off-by: Fenghua Yu --- tools/testing/selftests/resctrl/resctrlfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index 727e667e2cc9..e43ddebd1aa4 100644 --- a/tools/testing/selftests/resctrl/resctrlfs.c +++ b/tools/testing/selftests/resctrl/resctrlfs.c @@ -581,6 +581,9 @@ bool check_resctrlfs_support(void) printf("%sok kernel supports resctrl filesystem\n", ret ? "" : "not "); tests_run++; + if (!ret) + return ret; + dp = opendir(RESCTRL_PATH); printf("%sok resctrl mountpoint \"%s\" exists\n", dp ? "" : "not ", RESCTRL_PATH);