Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1244844imu; Tue, 11 Dec 2018 15:41:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wa7caUlfMWTOf3FRZsbVAtKklS20KUVwh78XDy0cPQga/5/fXkLkmH273oH3X0BrILzwzt X-Received: by 2002:a62:9913:: with SMTP id d19mr18179629pfe.107.1544571714161; Tue, 11 Dec 2018 15:41:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544571714; cv=none; d=google.com; s=arc-20160816; b=NXsv6EByxDNxgpaFwmag1tq4mQpotre3FmOT+l8xihyLCD1M0EaKhcFRMz4zJkl1nQ qNOzMa4VQTQ6nK8YMv+lMcMz9YHCj00C9KodK+VEMG1GerHYifFwiWl+v3dNXRM4rsVZ NFC3TK4yvHBds0V196izov/QV4/w+++NXQjk1/H8b7DuwSQ+umtKSviD3dMbWRR5bQ+k peFblwggxvZADCnBVWnQhW/OoCOebIaZZRIdG0TuKRJIOvYykx7UWzn0lWm6mAO7/A+4 O8LImMFIW1WdJI3x8P3OXbpMSQq8yk9QyE0saLFOTWqE/uNP/KTPcdYwCOfqRaN/v9JQ tqPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Xm4Id4SaDx5pWNmf51GHmJrj64kOKzugh2n3epQICKQ=; b=U1Z1nT1F2Gpu+FIDoRLhcT1FyH6j8MGPyd5OQOJmlSazzMxEsxKFPazFdoUZfACxXF +hLgnJlU8/Q6VIPUrjhioR26MQzCKYIVVUvWc/kTd8oYw+mfUB4EBXYVw+GWbrEWQrd3 MIiLvWfsGkJVAZQbEqCuno47p1NEyEonQ4ezFxPRb2hW6DGjQGnbK2yLU+ilLyuxU3TH a2F6vMf+SgSlOhdf9ErvtlR0L1p4WFt+o3nFR9OVm3C+ZTsAavWbTOwvN/t45ALqX6o5 XdADhnXHjm+DDc62khKOIH1uTvde9Ub00Le2UoZgTW4cIxaKOFoDsTLPCqFN8Yi1Bz0b 01EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=TTsn3w2w; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si1139135pgi.354.2018.12.11.15.41.16; Tue, 11 Dec 2018 15:41:54 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=TTsn3w2w; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726272AbeLKXjK (ORCPT + 99 others); Tue, 11 Dec 2018 18:39:10 -0500 Received: from mail.skyhub.de ([5.9.137.197]:57000 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726225AbeLKXjK (ORCPT ); Tue, 11 Dec 2018 18:39:10 -0500 Received: from zn.tnic (p200300EC2BCD2B002DC08A63FFF8C6E5.dip0.t-ipconnect.de [IPv6:2003:ec:2bcd:2b00:2dc0:8a63:fff8:c6e5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id E320F1EC0BC5; Wed, 12 Dec 2018 00:39:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1544571549; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=Xm4Id4SaDx5pWNmf51GHmJrj64kOKzugh2n3epQICKQ=; b=TTsn3w2wwE6YaYH3TQS4s1gk760VidlPKaNOsa6FuymDia2fj3z0ML3MXIfexBBU4od0De DNN/mN9RCtPeRGkDrNYcHFuvWm0c6u1p3n15EOzzCXOkl0HBbS5b41hifMy9p+HWro70T9 4tkqERZNcibXACZs1arLv1RnnfhreiQ= Date: Wed, 12 Dec 2018 00:39:01 +0100 From: Borislav Petkov To: "Lendacky, Thomas" Cc: Andy Lutomirski , LKML , X86 ML , "H. Peter Anvin" , Josh Poimboeuf , Peter Zijlstra , John Stultz Subject: Re: [RFC PATCH 4/4] x86/TSC: Use RDTSCP Message-ID: <20181211233901.GV27375@zn.tnic> References: <20181211222326.14581-1-bp@alien8.de> <20181211222326.14581-5-bp@alien8.de> <59aad362-4a5b-dd8b-642f-0dc3f83cf7ee@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <59aad362-4a5b-dd8b-642f-0dc3f83cf7ee@amd.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 11, 2018 at 11:12:41PM +0000, Lendacky, Thomas wrote: > It does seem overloaded in that sense, but the feature means that LFENCE > is serializing and so can be used in rdtsc_ordered. In the same sense, > barrier_nospec is looking for whether LFENCE is serializing and preferring > that over MFENCE since it is lighter weight. > > In light of how they're being used now, they could probably stand to be > renamed in some way. Actually, come to think of it, what really matters here is whether LFENCE is serializing or not. Because if so, you wanna replace with LFENCE as it is lighter. And in that case a single alternative() - not _2() - should suffice. BUT(!), that still is not good enough if you do some qemu CPU models like pentium or so which don't even have MFENCE and cause stuff like this: https://lkml.kernel.org/r/20181123200307.GA6223@roeck-us.net Which means, that you *do* have to alternate between * no insn at all * MFENCE * LFENCE, if it is serializing so barrier_nospec() does the right thing, AFAICS. And this is why we need an ALTERNATIVE_3() to add RDTSCP into the mix too. WRT renaming, I guess we can do something like: * X86_FEATURE_MFENCE_RDTSC -> X86_FEATURE_MFENCE - to mean that CPU has MFENCE support. and * X86_FEATURE_LFENCE_RDTSC -> X86_FEATURE_LFENCE_SERIALIZING Or something to that effect. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.