Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5107284imm; Sun, 22 Jul 2018 13:22:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcul137Z0WBbn8KYvr7sntGrnVmPgr3SVh0Nse9VIiV6Thr0X3guWy0VUD+YBTu+6CPFuIZ X-Received: by 2002:a17:902:9695:: with SMTP id n21-v6mr10350760plp.6.1532290965153; Sun, 22 Jul 2018 13:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532290965; cv=none; d=google.com; s=arc-20160816; b=HFKa0BsbWN/hWpL2AROdxgdkvOZ0WSYiwdK7IAacWUF/ubOa219mkO5V917fbUieUR ALxCcHX3tBZBKnTC/Y4buYcscSckfBObseobd3v8wSyxyeOWEVhuvITwnvpTUHdwnpcL lcYO+g0q0L+LCH6ANJYrKHyKSegSDmEP5WywCIEguik1FHZrI54b5em8QbhLB548cmqt q0Xw3OFeaVS0+FH6qq2pZZjbNm/7w0Kj7vZM09y7LnEwtm4+A3T9nNR+/o2/L5hqKztx hFfqM6u/1mWI8XcUJQSZRwMNxROKrL1gYvNm/sqWbWWfzHRoMD3lERfReFZ5PZpK+w/s 1jBg== 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:arc-authentication-results; bh=yxFqKJmBLU7LysIYI7sU5qGwJrsfWPn/EpUY+hm/F5A=; b=FUFTvVwKwnITNUa1GKksoCCtCzA9DnwN68BoBa4i75R7GlU9v1GTAsBvC8KLZCa4z7 xFxkwSZ9FhruFxEH6ttMSBc4YHB3a/xpRdBQhYhXdZHK5tm0cBevKMRC8+VWqg3mZD2z XCZhHo/SWBwPjU67R52zghJgHCDcbQUhoqm88rmsuSYjJ9IDUhfslNOtjRHyebd0E5Rz w01nn1GOkXwAr4YoAV+L+MnGrl5X4SN1uvcTIXgQ4nqi0v0fuIWhZWMu5+rvmvgLlmJ0 MnHSlSqAER6V4YOBI616WE50eBYgzKq68vKgEPiqpeeImr9evo9VvU7K84A9xQ7zWGO0 2e6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jDGdLqBt; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2-v6si6947645pgh.565.2018.07.22.13.22.04; Sun, 22 Jul 2018 13:22:45 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=jDGdLqBt; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730913AbeGVVRk (ORCPT + 99 others); Sun, 22 Jul 2018 17:17:40 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:44702 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730687AbeGVVRk (ORCPT ); Sun, 22 Jul 2018 17:17:40 -0400 Received: by mail-wr1-f67.google.com with SMTP id r16-v6so15862323wrt.11 for ; Sun, 22 Jul 2018 13:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yxFqKJmBLU7LysIYI7sU5qGwJrsfWPn/EpUY+hm/F5A=; b=jDGdLqBtNB2R1Z/78AK1Wpuq9QCisIwo3KRZr8R8qej4I9WXWkche6LUtFkrxbCKso adfqET4Vgu3d/sSZp3NtKSD3asDHUr5LSYdeuVcU7EXE3rZrSOZmCJvTDV2Q0HlUZ8le Q2X84zpjR7GdhFRYdffMeAJExc+40xF56noVS2h7MLo6gfpRkW9XRdVCLdScDii1dAWQ J1bokC/H6sDEHxLUx952lCY2hy5HvAWPgBQtGU4WWyBAAe/ghvq4qgBKAJw9jDGryI+A pDzSP93RuhStpWPYUM5Lw97CBkGvepEJW+uQcEEIEG7NLcRo0PFxeq32wtnaI0Wqvbue 9iAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=yxFqKJmBLU7LysIYI7sU5qGwJrsfWPn/EpUY+hm/F5A=; b=uoZDf73uqymHINMCWByaAaaZidDQo/3f9Lr9DF5ARJa2RhPcVihI9Zk8LTUsOxCuzn /KVm/+sZU5DyKPPQ2ovCmNDroh0+1r2S+Ijmjc0e7Gl7Pmm/SHg7LuktYwKiMZmvAty8 3Eb/maQwwq+zWAuvxBUoJui1bvWNyroXSC2ZzszyBv2VQQsHBt3/O2DYPP6Xp8fkzS5R OKyFnThMAZ/JKx5dqa8jrU4nBGZ1depuZZjuAsZbLGe6c7AebcBUut/Xmqgk2Bf/sy8x 2bl+L/bOtffRC5lVU0O8Mq3l7+f405dzjzWSE+fRoZawGdn7u/UGuNfCMyNNnvMZsdgY cOxQ== X-Gm-Message-State: AOUpUlHuaodPSGqjg1oYzfXYyP/qMdbjMhdIKuvhZduao4DFfmPyXbG2 m+CwqRrMk1mvFHD9liBv4xA= X-Received: by 2002:adf:fe42:: with SMTP id m2-v6mr6421563wrs.171.1532290334533; Sun, 22 Jul 2018 13:12:14 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id j9-v6sm20257744wrv.5.2018.07.22.13.12.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Jul 2018 13:12:13 -0700 (PDT) Date: Sun, 22 Jul 2018 22:12:11 +0200 From: Ingo Molnar To: Andy Lutomirski Cc: x86@kernel.org, LKML , Borislav Petkov , Linus Torvalds , Dave Hansen Subject: Re: [RFC 1/2] x86/entry/64: Use the TSS sp2 slot for rsp_scratch Message-ID: <20180722201211.GA30923@gmail.com> References: <38b5a24f3c9f519dd7dc98171eb3a3c669fff48c.1532281180.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <38b5a24f3c9f519dd7dc98171eb3a3c669fff48c.1532281180.git.luto@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski wrote: > In the non-trampoline SYSCALL64 path, we use a percpu variable to > temporarily store the user RSP value. Instead of a separate > variable, use the otherwise unused sp2 slot in the TSS. This will > improve cache locality, as the sp1 slot is already used in the same > code to find the kernel stack. It will also simplify a future > change to make the non-trampoline path work in PTI mode. > > Signed-off-by: Andy Lutomirski > --- > arch/x86/include/asm/processor.h | 5 +++++ > arch/x86/include/asm/thread_info.h | 1 + > arch/x86/kernel/asm-offsets_64.c | 1 + > arch/x86/kernel/process_64.c | 2 -- > 4 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index cfd29ee8c3da..2ef4c39ded45 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -308,7 +308,12 @@ struct x86_hw_tss { > */ > u64 sp1; > > + /* > + * sp2 is scratch space used by the SYSCALL64 handler. Linux does > + * not use rung 2, so sp2 is not otherwise needed. > + */ > u64 sp2; s/rung/ring Thanks, Ingo