Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2368994rdb; Mon, 5 Feb 2024 04:41:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcwv0s0Vqwcxc/XtUed608fwsuKhbhDTU4nRrLL+C0YLhoRTee4846RWZsy23VkSW3HMvw X-Received: by 2002:a17:906:2102:b0:a37:b590:c15b with SMTP id 2-20020a170906210200b00a37b590c15bmr1719881ejt.65.1707136907158; Mon, 05 Feb 2024 04:41:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707136907; cv=pass; d=google.com; s=arc-20160816; b=i8hLdxA7S2Iylrc79OjvK+b9Jnqb/VRkAkA69Pji3zIIAT0FRNuj6cFIJ1Hg+WOBHk /j71LYgz65c4u4wICmF4FDS34hCXVpSI7sZbZAGe0QY2e6fBLNZ2VWA1FJ12CJrtFI3Z SZaHP4ydkWfeh0udox3MTnaZhy5e7xh0JlgOvzVuuoU88Y5qlG0/JTK+6ZGsSJ4o0JsX 4d+gpphO+1/0tCMqTXeogkDNxICcAbEO2NKPjpr21HGPIzzk256uZc7bGOl4KbQBWb7d QlhswbSha1WE/KUhjMn4UzhISTf4F2Td1Mhqv0Xnk5lbRrS9+Q7JB2RL6Roh4Ee6Q+eK B41Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:date:from :dkim-signature; bh=oS47M1r+q/b41tE8iRXy6gcc7ck0DXr+x/sC+03I+NA=; fh=cl8ZqXk9iag7niD/odEPvBkgzcEGCzRhisULobJ0/oY=; b=EwufhKoZ64rUuiWiEEYC3VCcWBF3lxmOhK51DeSGMv2496FJzbI30GcnNwKpKsqtK5 qtcJgWkS0w5J+kI3IwPFEh6PcIuGwcrMsGtDyESXymEMUzVdnyqnO0yl7IQ+yHfDwb4k MPsy3QPJQZoExLkI3NWHIAJ3hr836SgK/2Jzajafh3QjR0vJ/sm4xLZT3DRMtLpPyQEO tZ/YbdaDvUX0dDz9nGJuLr3xMSf/bqfwlGxfVFI8NrhtTK2UxIk65vwoKlWQoU0klrzI kfHOszKTdkYlvIdrGO/O/QXkLtmSdh03ebLO0t+nU3xtYJnlWmFEmB7jcuvQ/UDHUxGk Dlgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jBSfJBxR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-52626-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52626-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCVOiw1q2kyy2DH31wt5tq99xgryXezUkYTXi6dAz4c2HjGyhPQOZifF3r3H7nP83tfQavYpthDWj+TVM7a0g11/xF6rMl0F9DDfMmmeyA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n23-20020a170906379700b00a3655d68679si3848377ejc.24.2024.02.05.04.41.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 04:41:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52626-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jBSfJBxR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-52626-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52626-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CA57D1F219E5 for ; Mon, 5 Feb 2024 12:41:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC2C91BC2C; Mon, 5 Feb 2024 12:41:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jBSfJBxR" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82A641BC31; Mon, 5 Feb 2024 12:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707136900; cv=none; b=g9tyknqmqWGzGMrEEoSDYYC5dNeIrgwUKheB1IX03zBFs4wlS2tXPCRYFvhNp1/7QUg1iiFsKmuPD7A3dPnoqS3ngQ6lSlSQBXU12JTfTt0ab9VMaZfVOQya3kdkxI0TuaLAW3CknJ2rDvDlCr9EHarOX0tmqeB8MR7BecSLmJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707136900; c=relaxed/simple; bh=Kl+5KCmX8M7WabogHGRVyda0jOyd6xLIsooNnB7kZoY=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=EZuYaa8phbkYEhoXFLpo/WY7ZMpwTraFceEHwOlXeIzLH94fo53JKbH9nmLriFZCGMZNg+bYw79KanDxpnSzYCI6GwXJ6LwOE0XSR7ycYAHU/Er3lO1LahJ3dVamx0KdjGqi3aHyn8u7fqParzyZL9Kx1deprgBDRy36J+Al0Is= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jBSfJBxR; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707136898; x=1738672898; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=Kl+5KCmX8M7WabogHGRVyda0jOyd6xLIsooNnB7kZoY=; b=jBSfJBxRQm9Cs+A4xwUombsF1onrxQu1RfwhovKt46/Ux6PwzckymzfU 1/pAahESRhnUTB5zGtA1VV9Q8TCZiJMjMtzeL11l0vCxV/pXwugMd+oDI PVUxM6T4V3MgYaSqBzEown6Jc5C/EtjyFgfXazEynPbExd4wAn3Jg806e ddel+XuBEjSpMlxJi3BVl3oWuHrTe4Rxzn43cJ73udb8G4R2QfeMPYSKp lx23Bdk16trrMsxQmKMN2GEYGjIx979lEkdA9dAns98KS/Upek7kLdkB2 sfhxkz0bAY8wefXWJ650uzxPVpDb2LP3uGGZGvSM68OYG30sQ5EdLc4h3 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10974"; a="11159970" X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="11159970" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 04:41:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="1003532" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.246.35.237]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 04:41:35 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Mon, 5 Feb 2024 14:41:30 +0200 (EET) To: Maciej Wieczor-Retman cc: fenghua.yu@intel.com, Reinette Chatre , shuah@kernel.org, linux-kselftest@vger.kernel.org, LKML Subject: Re: [PATCH v4 3/5] selftests/resctrl: Split validate_resctrl_feature_request() In-Reply-To: Message-ID: <65652533-8333-064a-c446-95232c7da76c@linux.intel.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Mon, 5 Feb 2024, Maciej Wieczor-Retman wrote: > validate_resctrl_feature_request() is used to test both if a resource is > present in the info directory, and if a passed monitoring feature is > present in the mon_features file. > > Refactor validate_resctrl_feature_request() into two smaller functions > that each accomplish one check to give feature checking more > granularity: > - Resource directory presence in the /sys/fs/resctrl/info directory. > - Feature name presence in the /sys/fs/resctrl/info/L3_MON/mon_features > file. > > Signed-off-by: Maciej Wieczor-Retman > --- > Changelog v4: > - Roll back to using test_resource_feature_check() for CMT and MBA. > (Ilpo). > > Changelog v3: > - Move new function to a separate patch. (Reinette) > - Rewrite resctrl_mon_feature_exists() only for L3_MON. > > Changelog v2: > - Add this patch. > > tools/testing/selftests/resctrl/cmt_test.c | 2 +- > tools/testing/selftests/resctrl/mba_test.c | 2 +- > tools/testing/selftests/resctrl/mbm_test.c | 6 ++-- > tools/testing/selftests/resctrl/resctrl.h | 3 +- > tools/testing/selftests/resctrl/resctrlfs.c | 33 +++++++++++++-------- > 5 files changed, 28 insertions(+), 18 deletions(-) > > diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c > index dd5ca343c469..c1157917a814 100644 > --- a/tools/testing/selftests/resctrl/cmt_test.c > +++ b/tools/testing/selftests/resctrl/cmt_test.c > @@ -170,7 +170,7 @@ static int cmt_run_test(const struct resctrl_test *test, const struct user_param > static bool cmt_feature_check(const struct resctrl_test *test) > { > return test_resource_feature_check(test) && > - validate_resctrl_feature_request("L3_MON", "llc_occupancy"); > + resctrl_resource_exists("L3"); This not correctly transformed. > +/* > + * resctrl_mon_feature_exists - Check if requested monitoring L3_MON feature is valid. > + * @feature: Required monitor feature (in mon_features file). > + * > + * Return: True if the feature is supported, else false. > + */ > +bool resctrl_mon_feature_exists(const char *feature) > +{ > + char *res; > + FILE *inf; > + > if (!feature) > - return true; > + return false; > > - snprintf(res_path, sizeof(res_path), "%s/%s/mon_features", INFO_PATH, resource); > - inf = fopen(res_path, "r"); > + inf = fopen("/sys/fs/resctrl/info/L3_MON/mon_features", "r"); This became less generic? Could there be other MON resource besides L3 one? Perhaps there aren't today but why remove the ability give it as a parameter? -- i.