From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227jB7WTeYuj6zUTuUq+5H3p3x8g7wYYjN2wbDApFH7AFCbfJI+NzMp+yajmMBVED9chiAQ9 ARC-Seal: i=1; a=rsa-sha256; t=1517250411; cv=none; d=google.com; s=arc-20160816; b=EYBPmlkq3ruHQMLoRHMFiTxuGPbhA5cDOhGbTaXhyzyR8QN3PHD5vV3kWdyO5A8UwD jXD0hHyGMPr9ZDTuVr7GTNYJ8/qvxhs1D+1GRiFiFn+Brp2VnqbK/CTsC7rOmGqUep1r gDHIWZ8UbtKKfNY5L8H2Wl6U1x12bCmx1d8QzcuHYCi+8o7VoNn9+MXSjKp786gqJwg6 1OeTi6qDj0PS2S5qcvijVzYMHvPbcQTkrE5Kmzn+dmoO6H5HSQO4o1PhMXw4p6XPX4Vz nIH1yOz3u1w6OVgkxT9l4I+MAgykDfs4gi1eIDVyFQh5+dk9QYuigMI5WTF6HWbsf+Xo lcQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=lY7sNsxyyvuodYLSJJbI8JvzrcUNgC/Ne9PFrfqCb2c=; b=X3W9Zk88B8i3MyxcPl1MAtLGZxh5SBCDHNOSiGBPF2wTvjvM0ynXJ2A8ZwCimEhRxH QxXj44BPF8MDE4GFUDXnZ4ReMD7JYgNyNxhE4U9LST1k1jdIh+C9scIF6JKOa4NUL037 bfutwkI6wzCRALQVzVesHlyJf5GxOOSaMqtg3jWR1XX+ArNBZlWjA/uI/UhXJVnR/Z7P vJuN3ghmkTclSoo13gXtqlmJjdyMbDU/uibx04GiUgK5kbdVdJCJH5H1+ms+7ftoHA96 P7e8t+3mBVqjNvsohhnq9oVXu9FAvZZ1A7fg3A0IGB+vPNor/yoHUQNRrOjMnRnCbGA0 F8lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Ka7HiQUK; spf=pass (google.com: best guess record for domain of linux-kselftest-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kselftest-owner@vger.kernel.org Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Ka7HiQUK; spf=pass (google.com: best guess record for domain of linux-kselftest-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kselftest-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbeA2S0u (ORCPT ); Mon, 29 Jan 2018 13:26:50 -0500 Received: from mail-pg0-f41.google.com ([74.125.83.41]:38600 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257AbeA2S0u (ORCPT ); Mon, 29 Jan 2018 13:26:50 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: selftests/x86/fsgsbase_64 test problem From: Andy Lutomirski X-Mailer: iPhone Mail (15C202) In-Reply-To: <624b9e67-14ee-6882-e55e-f337ec2471d3@zytor.com> Date: Mon, 29 Jan 2018 10:26:44 -0800 Cc: Andy Lutomirski , Borislav Petkov , Dan Rue , Shuah Khan , Ingo Molnar , Dmitry Safonov , "open list:KERNEL SELFTEST FRAMEWORK" , LKML Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180126153631.ha7yc33fj5uhitjo@xps> <46328204-e363-e517-f30c-c8c94ac1442c@zytor.com> <624b9e67-14ee-6882-e55e-f337ec2471d3@zytor.com> To: "H. Peter Anvin" Sender: linux-kselftest-owner@vger.kernel.org X-Mailing-List: linux-kselftest@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590669876861238825?= X-GMAIL-MSGID: =?utf-8?q?1590952367424126407?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: > On Jan 29, 2018, at 10:12 AM, H. Peter Anvin wrote: >=20 >> On 01/29/18 08:37, Andy Lutomirski wrote: >>=20 >> That's what I thought, too, and the SDM does say that, but the SDM >> says all kinds of not-quite-correct things about segmentation. >>=20 >>> It is pretty much scratch space (I have >>> suggested using it for the gsbase once all those issues get sorted out, >>> because it lets the paranoid code do something like: >>>=20 >>> rdgsbase %rax >>> push %rax /* Save old gsbase */ >>> push %rax /* Reserve space on stack */ >>> sgdt -2(%rsp) /* We don't care about the limit */ >>> pop %rax /* %rax <- gdtbase */ >>> mov (%rax),%rax /* GDT[0] holds the gsbase for this cpu */ >>> wrgsbase %rax >>=20 >> That will utterly suck on non-UMIP machines that have >> hypervisor-provided UMIP emulation. >>=20 >=20 > Is that a valid thing to optimize for, especially given that paranoid > entries aren't the most common anyway? >=20 A bunch of people seem to care about NMI performance for perf. And the curr= ent patch set works without this trick. FWIW, if we switch all entries to the entry text trampoline, we get direct p= ercpu access for free.=