Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3241992imu; Mon, 19 Nov 2018 12:50:32 -0800 (PST) X-Google-Smtp-Source: AJdET5eHRahalEbarPIQdvWYzyrZkc46cX+S6+foPdTmzZ/qqJmanLCED5lexRc2ZVcyhoCOfTVb X-Received: by 2002:a62:a1a:: with SMTP id s26mr3255105pfi.31.1542660632746; Mon, 19 Nov 2018 12:50:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542660632; cv=none; d=google.com; s=arc-20160816; b=t4wFNAp9C6b9duhVyRh9zj73JKn1aDzzYawOex7v0dw/GzZRAA1xhDpzjN/Wm6kQ7R lK1WdAlrUUa28z0Q4aU2XhScou08WLuzrVhPX9YteI66psWxwqD0naCwRH8ch//hg8GG AJz5w4zXuSgboiAG3T7hGF+gB8RkrmW+ZAqlIW3Y8CGQ+b7LLD7XNumML2d+7xyyGEDs QsVERxlxpjyjylK+uEGJNyw5oyDrSvb97EXPTmftwn14L1fhE8Nf7gu0Of+7nwqNDABH mBzyAhJgymHts3tGFgIq4pUgZEirI5kfePjcLC092igwUQsFLI1jVZBeYidPhspEzRfe wb8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date; bh=sviaVQdq5QGl9b7YCC3DDfxXQ8uZsU+6YHPyBIsMha0=; b=UdAGRpfAhv09vT07rjKzhdDvhsW4EaCIR1pxe+cW/bBEXHJz/Z3RB+c795xFmdb8bm 9LQAJuhrz54ykJp39flq1enRiudOsxpBmhxvlL2+WBTywfQRcUlSVFsapoVXqCyoshbx yzrhU6C93Zaogv1/TzFIduYXTDSBg97dQ824yaascuIvjMwws2jjm950EYMhbI1MiEET D/HUbwxKDIgrK6StomHowu8g00Cx9MRz5Ycjc8CjUDGi4Q8eJgrYHW3XOIBEkid5Dnwu dlr5xv+xIQyniXxfcgROsj4Hy1RAT3RY/7hIh8qCoiinuAxVCmL0PVeV2EgZPHUuXR2n 0VcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn20si37371165plb.273.2018.11.19.12.50.18; Mon, 19 Nov 2018 12:50:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730861AbeKTHO1 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Nov 2018 02:14:27 -0500 Received: from terminus.zytor.com ([198.137.202.136]:36205 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730797AbeKTHO1 (ORCPT ); Tue, 20 Nov 2018 02:14:27 -0500 Received: from wld62.hos.anvin.org (c-24-5-245-234.hsd1.ca.comcast.net [24.5.245.234] (may be forged)) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id wAJKmu5I2716553 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 19 Nov 2018 12:48:56 -0800 Date: Mon, 19 Nov 2018 12:48:49 -0800 User-Agent: K-9 Mail for Android In-Reply-To: <20181119204025.GL14688@zn.tnic> References: <20181119184556.11479-1-bp@alien8.de> <20181119204025.GL14688@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: [PATCH] x86/TSC: Use RDTSCP To: Borislav Petkov CC: Andy Lutomirski , X86 ML , LKML , John Stultz , Tom Lendacky From: hpa@zytor.com Message-ID: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On November 19, 2018 12:40:25 PM PST, Borislav Petkov wrote: >On Mon, Nov 19, 2018 at 12:17:35PM -0800, H. Peter Anvin wrote: >> On 11/19/18 11:52 AM, Andy Lutomirski wrote: >> > >> > I thought I benchmarked this on Intel at some point and found the >> > LFENCE;RDTSC variant to be slightly faster. But I believe you, so: >> > >> > Acked-by: Andy Lutomirski >> > >> >> As long as the difference isn't significant, the simplicity would >seem to be a >> win. > >Right, I think by simplicity you mean RDTSCP. :) > >Also in the sense that you have a single instruction which gives you >that barrier of waiting for all older insns to retire before reading >the >TSC vs two where you don't necessarily know what happens on the uarch >level. I mean, nothing probably happens but RDTSCP is still simpler :) > >Also, hpa, isn't LFENCE; RDTSC and RDTSCP equivalent on Intel? In the >sense that RDTSCP microcode practically adds an LFENCE before reading >the TSC? > >Because SDM says: > >"The RDTSCP instruction is not a serializing instruction, but it does >wait until all previous instructions have executed and all previous >loads are globally visible." > >which sounds pretty much like an LFENCE to me: > >"LFENCE does not execute until all prior instructions have completed >locally, and no later instruction begins execution until LFENCE >completes." I don't know the exact sequence of fencing operations it is equivalent to, but it is probably something quite similar. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.