Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752397AbbBWRnw (ORCPT ); Mon, 23 Feb 2015 12:43:52 -0500 Received: from mga09.intel.com ([134.134.136.24]:35180 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752269AbbBWRnu (ORCPT ); Mon, 23 Feb 2015 12:43:50 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,631,1418112000"; d="scan'208";a="682120070" Date: Mon, 23 Feb 2015 09:43:40 -0800 From: Andi Kleen To: Peter Zijlstra Cc: Andi Kleen , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] x86: Move msr accesses out of line Message-ID: <20150223174340.GD27767@tassilo.jf.intel.com> References: <1424482737-958-1-git-send-email-andi@firstfloor.org> <20150223170436.GC5029@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150223170436.GC5029@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1185 Lines: 31 On Mon, Feb 23, 2015 at 06:04:36PM +0100, Peter Zijlstra wrote: > On Fri, Feb 20, 2015 at 05:38:55PM -0800, Andi Kleen wrote: > > > This patch moves the MSR functions out of line. A MSR access is typically > > 40-100 cycles or even slower, a call is a few cycles at best, so the > > additional function call is not really significant. > > If I look at the below PDF a CALL+PUSH EBP+MOV RSP,RBP+ ... +POP+RET > ends up being 5+1.5+0.5+ .. + 1.5+8 = 16.5 + .. cycles. You cannot just add up the latency cycles. The CPU runs all of this in parallel. Latency cycles would only be interesting if these instructions were on the critical path for computing the result, which they are not. It should be a few cycles overhead. BTW if you really worry about perf overhead you could gain far more (in some cases ms) by applying http://comments.gmane.org/gmane.linux.kernel/1805207 -Andi -- ak@linux.intel.com -- Speaking for myself only -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/