Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2837937rda; Wed, 25 Oct 2023 13:55:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPlKT9hkNyzP7sXpzCzSt/AV+k/l1GR8exQsPW3SRdAZbdjJGU5cbK7POF5F3xP9HQCUBF X-Received: by 2002:a05:690c:f8d:b0:5a7:b9b1:c0bd with SMTP id df13-20020a05690c0f8d00b005a7b9b1c0bdmr19414320ywb.11.1698267347013; Wed, 25 Oct 2023 13:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698267346; cv=none; d=google.com; s=arc-20160816; b=QZoMSB/fZ9cRBv95gsY7aut2zv8ACJmeB2Z5mtHj6Zcbgd+SnlnO9e9Darg0dTlZ2t ccqjnkSVAr+mgxL1F4Tv44LpAx3JaI0ohApfyqtbOIetXww7kNetnINa/6AgPw3YOU7d X3mikthR5LSpJJ5dvS+XzHAvPEZTAw3mInutuA0c9FB8hr0wzb1IDB/iaaAkw5f+JZZE WNL97S9qYjcy2JdRyLeytFBmJxzOw359TbktgAHaDEL0zLpFgRihYpKBbwCqVeh1DeQh EwmbUxIiOTN8mWrpa15K07ex+AixGdFighiEzDqpVhcsQsbA93HVGsKkca6JF961D0bM P9+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LCFrIdpynpfWVTPGub+BIC3dy1aetnY/RzfyPrBX6lY=; fh=Yc3ZoqY56KcgLGF8bEhWqZGrBAh6HJCOZM/+/jGTZTI=; b=exquLrX5foA9fv1fD22rajxjHsi3qwXWfUBawS+y0Cv6iz3EFp8LEW4utvGLpq2aF4 9CZaRxzB+rv58MBf5yXKgXax14a6339cPj4/0OfXLtAA9vvK/AuXclGgLBwSaXtptLEp iWsTe1VKlEkhEYWWc61lrjh4AGzzgUXpZ4pZbvPJ4g38umhuD7yNpdMasDycc1CyTT6a Ot+jBKaESBCf/yVeKzs/fVJDwjYk0VNV8lVFwi62TLJM5JY/HHxtcmljHR9zBg491Ve6 9n8Os6C4jzVQfxx/aEWBxRi3C9QcgDYFe6hAX/93K333vy0EtBL9ScuxXeAor0r2zmkG RICQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TGq8NBDO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id m85-20020a0dca58000000b0059f5772c1f3si11058488ywd.129.2023.10.25.13.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 13:55:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TGq8NBDO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2F1098076035; Wed, 25 Oct 2023 13:53:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229583AbjJYUwo (ORCPT + 99 others); Wed, 25 Oct 2023 16:52:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjJYUwn (ORCPT ); Wed, 25 Oct 2023 16:52:43 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC81136; Wed, 25 Oct 2023 13:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698267160; x=1729803160; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=XTbrElkU1MbX6ZrhPb1QYOzV1U9Co1VHsj67ZR6GG3g=; b=TGq8NBDOml6EemXEi9z6ISE3nVI291MD184rYq3x5nMy8II6Rtc3wLc8 dqzEzUlUyooxAfoTwlze/vcXw3VWYMETeDKLtijq7NTkm6hl/QPhzbcjc H6Hmjsz19ZJZsEvazEQPvGQiuDB7SXQ63bJA3hfQwD3itZiF62lv323gi t8NhIT1/qb0aJW/U4ClFOeM6kbhzTvYwUD/FyFKAbOdiX+3cbYsx2UPB+ 9InzzXxYCOsvVfU+cgZWNEx3MPzlvrhSJ2tkNDmmD+2IGTJVge7uK5CaU /z5bc536Sa/KoiQdt6MrrMAwQC7I/qpqagxbX0LEiQLrV7ZZWoWO908K6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="387222339" X-IronPort-AV: E=Sophos;i="6.03,250,1694761200"; d="scan'208";a="387222339" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2023 13:52:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="708817429" X-IronPort-AV: E=Sophos;i="6.03,250,1694761200"; d="scan'208";a="708817429" Received: from agluck-desk3.sc.intel.com (HELO agluck-desk3) ([172.25.222.74]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2023 13:52:38 -0700 Date: Wed, 25 Oct 2023 13:52:37 -0700 From: Tony Luck To: "Moger, Babu" Cc: Peter Newman , Fenghua Yu , Reinette Chatre , Jonathan Corbet , Shuah Khan , x86@kernel.org, Shaopeng Tan , James Morse , Jamie Iles , Randy Dunlap , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev Subject: Re: [PATCH] x86/resctrl: mba_MBps: Fall back to total b/w if local b/w unavailable Message-ID: References: <20231024181600.8270-1-tony.luck@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 25 Oct 2023 13:53:17 -0700 (PDT) On Wed, Oct 25, 2023 at 03:42:14PM -0500, Moger, Babu wrote: > I meant, I was thinking bit different. > > > > > You need these changes in only two functions, mbm_bw_count and > > update_mba_bw. You decide which event you want to use based on availability, > > > > Something like this. I updated mbm_bw_count. > > > > diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c > > b/arch/x86/kernel/cpu/resctrl/monitor.c > > index 0ad23475fe16..302993e4fbc3 100644 > > --- a/arch/x86/kernel/cpu/resctrl/monitor.c > > +++ b/arch/x86/kernel/cpu/resctrl/monitor.c > > @@ -436,8 +436,16 @@ static int __mon_event_count(u32 rmid, struct > > rmid_read *rr) > > */ > > static void mbm_bw_count(u32 rmid, struct rmid_read *rr) > > { > > - struct mbm_state *m = &rr->d->mbm_local[rmid]; > > u64 cur_bw, bytes, cur_bytes; > > + struct mbm_state *m; > > + int evtid; > > + > > + if (is_mbm_local_enabled()) > > + evtid = QOS_L3_MBM_LOCAL_EVENT_ID; > > + else > > + evtid = QOS_L3_MBM_TOTAL_EVENT_ID; > > + > > + m = get_mbm_state(rr->d, rmid, evtid); Ok. Yes. That seems simpler. Maybe I should just set a global "mbm_evtid" at mount time. No need to check every time to see if is_mbm_local_enabled() somehow changed and local b/w measurements were suddenly available! -Tony