Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3756278img; Mon, 25 Mar 2019 17:40:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGf5KFDwIctO+yNvZhhXBMNvfrnLrY6z1WZvM3M9zZ6iBMF82qeBi7WrjeQLQJz2r1rKE4 X-Received: by 2002:a63:490f:: with SMTP id w15mr24681887pga.247.1553560809079; Mon, 25 Mar 2019 17:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553560809; cv=none; d=google.com; s=arc-20160816; b=S7qpxFNwdezWY5hOo1kOq08v5u52Ok4BTMQDyrJowvJ85kjGNrg08gimGeAzHd9NrP FM+lr6BXkiFcL35s/Zz1MBVy71a7a7C/agryu2P61CGRyLG1aO3Yyn/MXs2J0tor4Wn1 fyPBh0kJJVJ1L6T42ni7f2geTlOeGWtTXVxQkSel6sYTaWuDxFWnhNVpdmCioeRf5Xvi u9jcmKgQd07+K1zjJeKRrmc4MAeXegLIZib0k0rnXKgVyAnbNee4VehZg/12QYt4wMi1 udsMQ6g+OXUT0NbIcJDYpe9x297RQ9VP9k7H0GOjGRqVjb3UsMYPeQLtAeArXd89kPlK +5jQ== 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; bh=GfRxCizEkMZq/UfFQT3yyarqBSCkhKBnUxNxZ2LSb2g=; b=K0pAiWToNHZbmIUae2FzL3YRH+0hTSjEG66ovJrJClVQJ2Sj6ObkFK3fp+/eQLUV5S UsJlTjdxKyrFiN9Pn5fpRhgokCGuJEB86gyo23MLJxnCOxSTV7ZKbiFRwMCbTaVz5JHf J0s3qljiR0m2o3xD4v6jm1jcc05Mhz6PhZLFy5PTc/CU/A7/zbZ/TKyojIOqgtLaszFQ mGZAVOGXueLbd/7dNYaDhgLnpKXi0YmcpznqVdcte3s5GBrp4LgQ64AiESaEETKZFIhr aj0VN9AzSw1v9rLSaMSnGrXeOkSvZmtraLblV4XN0/x8nGFs1sXvTIXDBXYDVDwajPZU 4d0w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si15202197plt.394.2019.03.25.17.39.54; Mon, 25 Mar 2019 17:40:09 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727506AbfCZAiF (ORCPT + 99 others); Mon, 25 Mar 2019 20:38:05 -0400 Received: from mga14.intel.com ([192.55.52.115]:50923 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727092AbfCZAiE (ORCPT ); Mon, 25 Mar 2019 20:38:04 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 17:38:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,270,1549958400"; d="scan'208";a="137240692" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by orsmga003.jf.intel.com with ESMTP; 25 Mar 2019 17:38:04 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 1BB0D301C16; Mon, 25 Mar 2019 17:38:04 -0700 (PDT) Date: Mon, 25 Mar 2019 17:38:04 -0700 From: Andi Kleen To: Thomas Gleixner Cc: "Chang S. Bae" , Ingo Molnar , Andy Lutomirski , "H . Peter Anvin" , Ravi Shankar , LKML , Andrew Cooper , x86@kernel.org Subject: Re: [RESEND PATCH v6 04/12] x86/fsgsbase/64: Enable FSGSBASE instructions in the helper functions Message-ID: <20190326003804.GK18020@tassilo.jf.intel.com> References: <1552680405-5265-1-git-send-email-chang.seok.bae@intel.com> <1552680405-5265-5-git-send-email-chang.seok.bae@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > So on user space to kernel space transitions swapping in kernel GS should > simply do: > userGS = RDGSBASE() > WRGSBASE(kernelGS) This would also need to find kernelGS first, by doing RDPID and then reading it from memory in the right index (which might be a full cache miss if you're unlucky) SWAPGS will be a lot faster, especially in these rare worst cases because it has all its state inside the CPU. -Andi BTW you managed to only review after Chang went on a long vacation. I don't understand why it takes that long to review these changes It's one of the largest performance improvements for the context switch and the NMI in many years plus gives a new free register to user space, but it only makes progress at a glacial pace. The original patches for this were posted in 2016.