Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753350AbbBYSUh (ORCPT ); Wed, 25 Feb 2015 13:20:37 -0500 Received: from one.firstfloor.org ([193.170.194.197]:60571 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752735AbbBYSUg (ORCPT ); Wed, 25 Feb 2015 13:20:36 -0500 Date: Wed, 25 Feb 2015 19:20:32 +0100 From: Andi Kleen To: Peter Zijlstra Cc: Andi Kleen , Andi Kleen , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] x86: Move msr accesses out of line Message-ID: <20150225182032.GD823@two.firstfloor.org> References: <1424482737-958-1-git-send-email-andi@firstfloor.org> <20150223170436.GC5029@twins.programming.kicks-ass.net> <20150223174340.GD27767@tassilo.jf.intel.com> <20150225122701.GK5029@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150225122701.GK5029@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1150 Lines: 32 > Still, I wondered, so I ran me a little test. Note that I used a > serializing instruction (LOCK XCHG) because WRMSR is too. WRMSR has a lot of uops internally unlike LOCK XCHG, so I expect it will mostly overlap with what it does. I'll run some benchmarks on this today. Also we do quite a few RDMSRs, which are not necessarily serializing. > I see a ~14 cycle difference between the inline and noinline version. > > If I substitute the LOCK XCHG with XADD, I get to 1,5 cycles in > difference, so clearly there is some magic happening, but serializing > instructions wreck it. > > Anybody can explain how such RSP deps get magiced away? On Intel Core (since Yonah), the CPU frontend has a special stack tracker that avoids these dependencies. See 2.3.2.5 in the optimization manual Also BTW just from tracing MSRs there is a lot of optimization potential. Will send some patches later. -Andi -- 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/