Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1450925ybg; Tue, 2 Jun 2020 10:16:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEC2pA44RV0iIMvY/4qynhKTO5ES3MIZWZvLvN/FPDlEBzLWfNFzkIaoyy4JdR0CZjbXfy X-Received: by 2002:a50:ed08:: with SMTP id j8mr2844287eds.58.1591118176595; Tue, 02 Jun 2020 10:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591118176; cv=none; d=google.com; s=arc-20160816; b=PiCzqRjKAlP95rKrmX5+7S4ADt8p93HJDMVWmilTGJZGjU6FQSWAGoPJ1ijhkYneWv Ek/laYZGhDx5AWTqlPHIejwxfk4gxvtSZGzc+ryfn5dOICN5gyERHexIEf3eOYzg9pCZ yUukWwmBiqWpUzxJbQIVuVHi2G4qdzhg3rpMjEKKIldvatMNCL/zHyCcXld8sOCmLlDw Ad+tY8zEIWjpW1uCC2cdfBDLBn0nG6f+3fTZ53tiSGjGEGqhA1sn3JkafoAV8azPDaPD p1eyyDBo8eyJJL+qJquTKC2a46x3UJnJAOtW/H3vdPQ3V8I35B66ZQ3dr9UUC1IvNI4t TwFQ== 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=8e2Gw3+gD/c5655lhdabVXfFNIYSNlheqZb7vjhlk2Y=; b=a7bXc9QERjGjmlRUnHSyMsp7M2Wov0LubblhNhkrRNNbNj2c/61s8kAHNqxh6XQDPJ 48cqimetk2KBagH5jBdueV5kYZIoUJxEWZI8I1tlF+Szm7j03V5/xEoZCmS2Etlz3AAL luBpj8g/pxy41LDChEkvMoaQWjdmS4H2HgalWu+8dLoZpc/7TOFHr/TS9abjaTTkgTfR lZgl2pUCZab7PSGhWeM3a21xGguw9zPl7aiMv7K72N63U/whuUQr3gMq3snX7lkLOUgb sNeGcdvpJt8Cq396oR8zmhQGV/dowttF6C61CfUPihcNt0CTMppllf0tonJG6NF3UyKr GYZg== 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 b17si1857332edt.100.2020.06.02.10.15.06; Tue, 02 Jun 2020 10:16:16 -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 S1726162AbgFBRNM (ORCPT + 99 others); Tue, 2 Jun 2020 13:13:12 -0400 Received: from mga07.intel.com ([134.134.136.100]:56835 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725969AbgFBRNM (ORCPT ); Tue, 2 Jun 2020 13:13:12 -0400 IronPort-SDR: Rj2Xd5ek/uE0Ck68dyw9UHtVTRTIyJwvMO4c8imnouG9v0YhzOIp4Pnp3dqo/vaj5NKjdMXOoy VeaID6oTy36A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2020 10:13:11 -0700 IronPort-SDR: GGgrdG1oywjifHY4TWR/usPDuJswkayqUThgmvQsbFdUdVZ5puPuft2cpTllbpkzGAKc4xNJLP YhD0zGH36cJA== X-IronPort-AV: E=Sophos;i="5.73,465,1583222400"; d="scan'208";a="272431786" 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 10:13:11 -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> From: Reinette Chatre Message-ID: <63f23edd-39d3-0577-6e00-21066ddfe57f@intel.com> Date: Tue, 2 Jun 2020 10:13:10 -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: <159105232628.48268.7763865625735367523.stgit@naples-babu.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/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? Reinette