Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp16988ybg; Tue, 2 Jun 2020 15:02:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAV/fwhS8DWonkrjngNqKkXAuzY+3RxYCITl/AiaY93r5obD6ECQkQWKWfO47vczNstT6+ X-Received: by 2002:a17:907:1118:: with SMTP id qu24mr17950132ejb.287.1591135368250; Tue, 02 Jun 2020 15:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591135368; cv=none; d=google.com; s=arc-20160816; b=P+A93DoVuAId8Nh6vM6ryKTj1EYWbRVaMbVfRS0uZos8Z2hbGrYvdzAXq2+8QkFCgt KAHBss9iaWiqq8lEGjgKqYHgQMoOpXx45A2vOc5Z2koOkFACnYRpSwzm1QMtc5W0Uvui eNAyvFu6fwD5PQVka84QsLtBG3Rm8l8o6UcI/nycDVA6vJKIWGsSkJOrOROUH8q3EOy2 OCTNwA1k6pseqEVM+ZQ9ZPMpXiMo6OgS/eLZlRN0WrLZuzyITOVv+Hm33xxLrPueZIt8 gKE3Dtbr9uA8TVkOc7bN9gXqncZfItOg8yv27LTyTFT8hi/iyZsw+zcjikUMhZXBs/K9 6I5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:ironport-sdr:ironport-sdr; bh=ut3a6xDkYTdTWpNGWTdwrWKgWASFBszv8f59mtDmQSI=; b=X8q6GdqqDx56mOV9Tc35yQfIIJ9j8rMGn7VY3rmemk+bke6FKztQxyQ3vp6mHjW/sd Uu4NgZFnCTxS0iQeb+LsjTsWOJgGKAtsAdAg1ZhlMh4zACeIFycbx4cIblbm+8WxCo59 fR6TJ1ZjPiS9eFtvOgvgPO31HY1+TJq3iqwwOnbSCtIowaZiTZ2NBoVZeZUFYeojhv2D o7KdScHlhQjqG4K3rUQhHsfRVihYngUPIAxi2Eoq8AWd3f51xvJP6aEarUCGfrx7RY1W 6LHyvaX7q4q0mTk32fN/wnd406SedkYqoaeStIhKseWgrG87hs0s6iorGoLWc1KirIr8 JLOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v23si83563eju.572.2020.06.02.15.02.23; Tue, 02 Jun 2020 15:02:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728304AbgFBV7O (ORCPT + 99 others); Tue, 2 Jun 2020 17:59:14 -0400 Received: from mga18.intel.com ([134.134.136.126]:43242 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbgFBV7O (ORCPT ); Tue, 2 Jun 2020 17:59:14 -0400 IronPort-SDR: dElcAWi28Km6PAC3X0ditRsmhEtJ8DZFh/OayJdrg3pjTzEKfcHJhc6Fjpyr8DubFQhEZPKh57 L+UgGM+WFFUA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2020 14:59:13 -0700 IronPort-SDR: 30HUT4a4/VLihBK1M/xda1FpWKZkaHuth5wT7BgMsTRfoOaPtcGwmRiKZl3H/7sOptuvRbh0QW kSrCixErHZtg== X-IronPort-AV: E=Sophos;i="5.73,466,1583222400"; d="scan'208";a="272513315" Received: from rchatre-mobl.amr.corp.intel.com (HELO [10.209.123.248]) ([10.209.123.248]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2020 14:59:13 -0700 Subject: Re: [PATCH] x86/resctrl: Fix memory bandwidth counter width for AMD To: Babu Moger , fenghua.yu@intel.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org References: <159105232628.48268.7763865625735367523.stgit@naples-babu.amd.com> <63f23edd-39d3-0577-6e00-21066ddfe57f@intel.com> <05e11ddd-ca0b-e454-0152-6c83e7b7d719@amd.com> From: Reinette Chatre Message-ID: <296417cc-584f-158c-7d09-0c30a95f0192@intel.com> Date: Tue, 2 Jun 2020 14:59:12 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <05e11ddd-ca0b-e454-0152-6c83e7b7d719@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Babu, On 6/2/2020 10:33 AM, Babu Moger wrote: > > > On 6/2/20 12:13 PM, Reinette Chatre wrote: >> On 6/1/2020 4:00 PM, Babu Moger wrote: >>> Memory bandwidth is calculated reading the monitoring counter >>> at two intervals and calculating the delta. It is the software’s >>> responsibility to read the count often enough to avoid having >>> the count roll over _twice_ between reads. >>> >>> The current code hardcodes the bandwidth monitoring counter's width >>> to 24 bits for AMD. This is due to default base counter width which >>> is 24. Currently, AMD does not implement the CPUID 0xF.[ECX=1]:EAX >>> to adjust the counter width. But, the AMD hardware supports much >>> wider bandwidth counter with the default width of 44 bits. >>> >>> Kernel reads these monitoring counters every 1 second and adjusts the >>> counter value for overflow. With 24 bits and scale value of 64 for AMD, >>> it can only measure up to 1GB/s without overflowing. For the rates >>> above 1GB/s this will fail to measure the bandwidth. >>> >>> Fix the issue setting the default width to 44 bits by adjusting the >>> offset. >>> >>> AMD future products will implement the CPUID 0xF.[ECX=1]:EAX. >>> >>> Signed-off-by: Babu Moger >> >> There is no fixes tag but if I understand correctly this issue has been >> present since AMD support was added to resctrl. This fix builds on top >> of a recent feature addition and would thus not work for earlier >> kernels. Are you planning to create a different fix for earlier kernels? > > Yes. This was there from day one. I am going to back port to older kernels > once we arrive on the final patch. Do we need fixes tag here? > Yes, this needs a fixes tag. This would help the teams understand which kernels should be fixed. Reinette