Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1188539imu; Tue, 11 Dec 2018 14:25:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/VSaf++nrqyKnXASxYKADCzQnqQ/okce25T7jLV9nSWQGJGYL3vFDATWY7+JgGEzE9HsnoF X-Received: by 2002:a17:902:b112:: with SMTP id q18mr17717468plr.255.1544567138487; Tue, 11 Dec 2018 14:25:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544567138; cv=none; d=google.com; s=arc-20160816; b=hrCb8EIUAOf/lxRDu7Z9LUMXIUGsWEmclMOE40MwJaUJMHREf16lpduWhU+1kqt353 SOBePHtPw29d6vjkpieiVkN7/CFhC9p4cAA65jfeyuXESjO2vJs6J/hSzbMZic0DteaF ggiPAhZapkJyFxnCxNzRhGtnsIhohV4JJp0G2MuNDzgaTuNfzLgsAeKffaSWNLRldgM9 SZ/ctVI3xeKLHHBcnnMxlZUHAAfIKrCAAUe18uJUAB8VWdStsvUCCi6VPYlV258knkrx 4cPjGTEXUNob9ruI0WBMcbgxWTGrTpJiUmUas3oeZpCCwlKmgZw4wIMSuiYNz26GnoxS Tkog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NepjSrwz7tIgGSX+WREUqCyXKWdbmsO/EBYrdgOEKTo=; b=OlhqCS0FX47KPdAaoQaJIqmpA60JUlG7lmdpQq8/zKm9ScsRocp6pcuhzeO3yuptSW xEvyfXJOimFtdnFk59lsTM2t6Hk6lsSB3bXxsOMhncdL7Z7IiEYnoyritCBqo16178+i D0b962ViWOpv4SnlVXXl8nzfAF43fu9475wk6FcGDQxFmw0y/Ehge4aIywyVOTnyNyUv iZ9Uan+4jZ20s/takTys/gqU1BVFTrhAi4Xa03gtsbEN5LNT7vjPAkulV/b+eFDf/+9F Cn2Ce+tlVRwxJ2DHBinjUheB7DagN0ikoSiHSr2n1WsJharj/pRKEJVGotGYIFZlhOy/ WNow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=qcu61Nzv; 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 t16si15034406pfk.139.2018.12.11.14.25.24; Tue, 11 Dec 2018 14:25:38 -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=qcu61Nzv; 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 S1726331AbeLKWXa (ORCPT + 99 others); Tue, 11 Dec 2018 17:23:30 -0500 Received: from mail.skyhub.de ([5.9.137.197]:46182 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbeLKWXa (ORCPT ); Tue, 11 Dec 2018 17:23:30 -0500 Received: from zn.tnic (p200300EC2BCD2B0010F6E1EC68D6BA6C.dip0.t-ipconnect.de [IPv6:2003:ec:2bcd:2b00:10f6:e1ec:68d6:ba6c]) (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 634041EC0B6D; Tue, 11 Dec 2018 23:23:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1544567009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=NepjSrwz7tIgGSX+WREUqCyXKWdbmsO/EBYrdgOEKTo=; b=qcu61NzvcdiOzKoU5iFAhJzK40mzFOaIhzFGO/snEG6l2ueDGZ9dmSGdYSMfXnuww+oWGu Rk0Q0tcwMVvmP0FJXJXyF2zV0epT9jI5Fy+YmgKxX+IKyrLhRDLbsMBD5vEXYj9Hc3MqSJ 3lgsjGZ0FSkEqDeehdgNM7YThx56Z6w= From: Borislav Petkov To: LKML Cc: X86 ML , Andy Lutomirski , "H. Peter Anvin" , Josh Poimboeuf , Peter Zijlstra , Tom Lendacky Subject: [RFC PATCH 0/4] x86/alternative: Add ALTERNATIVE_3 Date: Tue, 11 Dec 2018 23:23:22 +0100 Message-Id: <20181211222326.14581-1-bp@alien8.de> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Hi, here's a patchset which adds an ALTERNATIVE_3() macro so that we can finally do RDTSCP in rdtsc_ordered() but also not break all the possible qemu CPU models out there like some old pentium which doesn't have even MFENCE. Which is the reason for the three-insn alternative macro, btw. The stuff works here on all machines I've tested it on but since we're too close to the merge window, I'll hold on to it for another round and let it soak slowly into 2019. Thus the RFC tag. In the meantime, it'll collect your comments and ideas. :-) Thanks! Borislav Petkov (4): x86/alternatives: Add macro comments x86/alternatives: Print containing function x86/alternatives: Add an ALTERNATIVE_3() macro x86/TSC: Use RDTSCP arch/x86/include/asm/alternative.h | 39 ++++++++++++++++++++++++------ arch/x86/include/asm/msr.h | 16 ++++++++++-- arch/x86/kernel/alternative.c | 4 +-- 3 files changed, 48 insertions(+), 11 deletions(-) -- 2.19.1