Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp412842lqp; Wed, 12 Jun 2024 05:43:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKZnayy15g6+/pyHomPPHYJlisJnK9P6cze59K3a8hqx0QRUoOuwL8XpVUiDFbRFbD85wAHjxm5Ikf0ozo7ZHnT9vrn9kbpPnRPaHTwQ== X-Google-Smtp-Source: AGHT+IEsTLdKpLHeT0/aDgOpNWWPYCiTGMHBIs009yds8zp+OHYs6POVFX+u3OXgUnKAlYEQzVKA X-Received: by 2002:ac8:5a0b:0:b0:441:4057:84c0 with SMTP id d75a77b69052e-4415ac84414mr15389721cf.68.1718196212222; Wed, 12 Jun 2024 05:43:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718196212; cv=pass; d=google.com; s=arc-20160816; b=Rb/VjFuLfFv3zxAhQEZ0Y313xkSc5b7GJcsDDtivmbAHYC6Qej9mZTZcQGEhqFniX4 D4QgHs+uBfyATOtd46JtEaqL+aqQkkSePdPKjV4dd1dp/dTksTfsCeY92Xt3CoT8G/79 /+Dml/rrye+422uuVbg4ISyBFyIofktyC+G18M1r1Yud/CltO0Nui2fso31hFZVmy/JD mSfkY2uj0hLustwhKt9PnlZwRSwcVvUbvpvTXDoSF2IfCvLc4DC7aD/mLc35iMoN/xsr KOo9qzQiZngWeR2plhwWc4vQLSLB4gCRjW0j2PrtPdKjutlH7dPVWBzAfDKwu2R3Z9JK ajSA== 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=AptM+pEK1ULGUbp/Pz+D6F0SuPrSB5lyKV5ot7eytxg=; fh=GvUo/5QrV/I6dW9IVkjPZ5a0eFtt/yOteJMA/K4kyfw=; b=SD/hf5s/IE9X5Z5cJWVBQk3uZRKzV5oKekCCl0GR+WPlWbUVy2PlNG5+iIzDI0QTGn hMTWs5agLspPD524Ko5qf3WAFBjOJ6jlc1Al+ogMiOmdLknPLfbq8VLMADWC0Ze+H/UH CfYXQO2DTgav85U1e47504+/a6q/gKcrsSiyvkByk42XUQwFWY8yQ6LkvOtTNiW6XLsN Jnb+9KHWrf1XRf1UqVf6g3agkr3QGrb/K+CWck2EYSXzMj8oyijXflQBUHcMIfsLsLqO b9w3cU2/7TSWgf4RFvYGj9xYeHMOX0kSpZ8wN1KTkQ904X5qeUG33F0BkVW62xRgcRm7 EjhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HfSjfjhc; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-211080-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211080-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-4413394595fsi46063191cf.731.2024.06.12.05.43.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 05:43:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211080-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HfSjfjhc; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-211080-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211080-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D101E1C222A9 for ; Wed, 12 Jun 2024 07:33:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C79616937B; Wed, 12 Jun 2024 07:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HfSjfjhc" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 A7B9329413; Wed, 12 Jun 2024 07:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718177621; cv=none; b=i7R7qm/CMt5/66Vi6EWSjON8jsxY9d4HePLeihrvHURZGncP0Zzf+72UY8/tseLT29L7Hx+6Lqby66/MsDYWSnXDJsg1k8R+c2SIy5TOL8Kj0ePvg63fGgBgpSYKcLnWCtSbYA03nxyNvgiN3lOoXofRXV3cDuJ59038vt2Bfw4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718177621; c=relaxed/simple; bh=SUfIAtDi5cgpBLZQB/Du7Hs4SYoZugQDNHll79iQU7w=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=jmXPkwSbygxyNiVJH6Pa/k6akS1G70H7k/ZFShoZoU7v1u2pmtWatsqTHtyJDZO2nRhlqq7I0/rk58z4SnExA4jvPEkj0mSqror6X3rqpAhIxqrFyJ9xuYuuZ1igvTXh8caNZDLWvOWX+ves5MqPXZhrZSqcRX5SATL/t8WTGfQ= 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=HfSjfjhc; arc=none smtp.client-ip=198.175.65.13 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=1718177620; x=1749713620; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=SUfIAtDi5cgpBLZQB/Du7Hs4SYoZugQDNHll79iQU7w=; b=HfSjfjhc0idvtlaYA3dBl9llfvSkBfshB8IsEXJo0yFgWQNhOYonCpQu W25shQcUg0x+UQ4aIIRcxtwFJhqkQT/bmMYYuBoo61japlCrGrbIr0SPs BGxTJ1SW6dnQM3rxY18AYgvqqTXSZgdaPxDo5Jh1LcPiYmdtFXbbj3Mts gK4931YgDtXKVFTqvn5XUy6FVoM7iRnTYMm4XVOWfwXm476Wv321zYsTi JKo3S9UJrapyfqDN2L4uj7jggzn6/SVeQD4+W2yCXHFUcyXTjWMD/Rmmw qsm/ZcaV08NFj7Wl3dH1NRjsFdOzXftGs8i8LLmqY8GZEnckW90A81NQZ Q==; X-CSE-ConnectionGUID: dA/g+31YQQmoJC0NEyep4A== X-CSE-MsgGUID: 2HWeL1TvQ4qIjLfxaBRCVA== X-IronPort-AV: E=McAfee;i="6600,9927,11100"; a="26041609" X-IronPort-AV: E=Sophos;i="6.08,232,1712646000"; d="scan'208";a="26041609" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 00:33:39 -0700 X-CSE-ConnectionGUID: RgCrLq4xQ6C3yjzVbbQBkQ== X-CSE-MsgGUID: Sp4CeumZRcu/J86gUJIRZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,232,1712646000"; d="scan'208";a="39592979" Received: from unknown (HELO localhost) ([10.245.247.204]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 00:33:35 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Wed, 12 Jun 2024 10:33:30 +0300 (EEST) To: Babu Moger cc: fenghua.yu@intel.com, Reinette Chatre , shuah@kernel.org, LKML , linux-kselftest@vger.kernel.org, =?ISO-8859-15?Q?Maciej_Wiecz=F3r-Retman?= , peternewman@google.com, eranian@google.com Subject: Re: [PATCH v3] selftests/resctrl: Fix non-contiguous CBM for AMD In-Reply-To: <96d276c11e69cfb1e29d50a12c8043555c06b404.1718144237.git.babu.moger@amd.com> Message-ID: References: <3a6c9dd9dc6bda6e2582db049bfe853cd836139f.1717622080.git.babu.moger@amd.com> <96d276c11e69cfb1e29d50a12c8043555c06b404.1718144237.git.babu.moger@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323328-1864459413-1718177611=:1312" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1864459413-1718177611=:1312 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 11 Jun 2024, Babu Moger wrote: > The non-contiguous CBM test fails on AMD with: > Starting L3_NONCONT_CAT test ... > Mounting resctrl to "/sys/fs/resctrl" > CPUID output doesn't match 'sparse_masks' file content! > not ok 5 L3_NONCONT_CAT: test >=20 > AMD always supports non-contiguous CBM but does not report it via CPUID. >=20 > Fix the non-contiguous CBM test to use CPUID to discover non-contiguous > CBM support only on Intel. >=20 > Fixes: ae638551ab64 ("selftests/resctrl: Add non-contiguous CBMs CAT test= ") > Signed-off-by: Babu Moger > Reviewed-by: Reinette Chatre Thanks. Reviewed-by: Ilpo J=E4rvinen --=20 i. > --- > v3: Reworked changelong. >=20 > v2: Moved the non-contiguous CBM verification to a new function > arch_supports_noncont_cat. >=20 > v1: This was part of the series > https://lore.kernel.org/lkml/cover.1708637563.git.babu.moger@amd.com/ > Sending this as a separate fix per review comments. > --- > tools/testing/selftests/resctrl/cat_test.c | 32 +++++++++++++++------- > 1 file changed, 22 insertions(+), 10 deletions(-) >=20 > diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/s= elftests/resctrl/cat_test.c > index d4dffc934bc3..742782438ca3 100644 > --- a/tools/testing/selftests/resctrl/cat_test.c > +++ b/tools/testing/selftests/resctrl/cat_test.c > @@ -288,11 +288,30 @@ static int cat_run_test(const struct resctrl_test *= test, const struct user_param > =09return ret; > } > =20 > +static bool arch_supports_noncont_cat(const struct resctrl_test *test) > +{ > +=09unsigned int eax, ebx, ecx, edx; > + > +=09/* AMD always supports non-contiguous CBM. */ > +=09if (get_vendor() =3D=3D ARCH_AMD) > +=09=09return true; > + > +=09/* Intel support for non-contiguous CBM needs to be discovered. */ > +=09if (!strcmp(test->resource, "L3")) > +=09=09__cpuid_count(0x10, 1, eax, ebx, ecx, edx); > +=09else if (!strcmp(test->resource, "L2")) > +=09=09__cpuid_count(0x10, 2, eax, ebx, ecx, edx); > +=09else > +=09=09return false; > + > +=09return ((ecx >> 3) & 1); > +} > + > static int noncont_cat_run_test(const struct resctrl_test *test, > =09=09=09=09const struct user_params *uparams) > { > =09unsigned long full_cache_mask, cont_mask, noncont_mask; > -=09unsigned int eax, ebx, ecx, edx, sparse_masks; > +=09unsigned int sparse_masks; > =09int bit_center, ret; > =09char schemata[64]; > =20 > @@ -301,15 +320,8 @@ static int noncont_cat_run_test(const struct resctrl= _test *test, > =09if (ret) > =09=09return ret; > =20 > -=09if (!strcmp(test->resource, "L3")) > -=09=09__cpuid_count(0x10, 1, eax, ebx, ecx, edx); > -=09else if (!strcmp(test->resource, "L2")) > -=09=09__cpuid_count(0x10, 2, eax, ebx, ecx, edx); > -=09else > -=09=09return -EINVAL; > - > -=09if (sparse_masks !=3D ((ecx >> 3) & 1)) { > -=09=09ksft_print_msg("CPUID output doesn't match 'sparse_masks' file con= tent!\n"); > +=09if (arch_supports_noncont_cat(test) !=3D sparse_masks) { > +=09=09ksft_print_msg("Hardware and kernel differ on non-contiguous CBM s= upport!\n"); > =09=09return 1; > =09} > =20 >=20 --8323328-1864459413-1718177611=:1312--