From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751555AbcEKHX5 (ORCPT ); Wed, 11 May 2016 03:23:57 -0400 Received: from merlin.infradead.org ([205.233.59.134]:59344 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751320AbcEKHX4 (ORCPT ); Wed, 11 May 2016 03:23:56 -0400 Date: Wed, 11 May 2016 09:23:47 +0200 From: Peter Zijlstra To: "Luck, Tony" Cc: Vikas Shivappa , "Shivappa, Vikas" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "hpa@zytor.com" , "tglx@linutronix.de" , "mingo@kernel.org" , "Shankar, Ravi V" , "Yu, Fenghua" , "davidcc@google.com" , "Stephane Eranian (eranian@google.com)" Subject: Re: [PATCH 2/3] perf/x86/mbm: Fix mbm counting for RMID reuse Message-ID: <20160511072347.GF3193@twins.programming.kicks-ass.net> References: <1462578255-5858-1-git-send-email-vikas.shivappa@linux.intel.com> <1462578255-5858-3-git-send-email-vikas.shivappa@linux.intel.com> <20160510121538.GA3193@twins.programming.kicks-ass.net> <3908561D78D1C84285E8C5FCA982C28F3A0C496C@ORSMSX114.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F3A0C496C@ORSMSX114.amr.corp.intel.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 10, 2016 at 04:39:39PM +0000, Luck, Tony wrote: > >> (3) Also we may not want to count at every sched_in and sched_out > >> because the MSR reads involve quite a bit of overhead. > > > > Every single other PMU driver just does this; why are you special? > > They just have to read a register. We have to write the IA32_EM_EVT_SEL MSR > and then read from the IA32_QM_CTR MSR ... if we are tracking both local > and total bandwidth, we have to do repeat and wrmr/rdmsr again to get the > other counter. That seems like it will noticeably affect the system if we do it > on every sched_in and sched_out. Right; but Vikas didn't say that did he ;-), he just mentioned msr-read. Also; I don't think you actually have to do it on every sched event, only when the event<->rmid association changes. As long as the event<->rmid association doesn't change, you can forgo updates. > But the more we make this complicated, the more I think that we should not > go through the pain of stealing/recycling RMIDs and just limit the number of > things that can be simultaneously monitored. If someone tries to monitor one > more thing when all the RMIDs are in use, we should just error out with > -ERUNOUTOFRMIDSTRYAGAINLATER (maybe -EAGAIN???) Possibly; but I would like to minimize churn at this point to let the Google guys get their patches in shape. They seem to have definite ideas about that as well :-)