Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1338510imm; Wed, 20 Jun 2018 16:19:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIqxLFR0N8jDDhUlhzott4Ap+5H6nwfR8OBxgmIbtTHkA34y7/KKqjG5cYcGUEmVPheZDHm X-Received: by 2002:a65:4545:: with SMTP id x5-v6mr20354677pgr.4.1529536762425; Wed, 20 Jun 2018 16:19:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529536762; cv=none; d=google.com; s=arc-20160816; b=LQu7TlR3wzPHC4UWUuzfjvJxmw//jxEw+E//E4QmEmTplyZ/69vrVcYVKK/9YGMIXi 2sE35diu26Xt60Af78JtURVRPnnRhTtG0i6ig/bTxeJiQZ8lxTh3xMFmEQAggkU1gQ1d AMTZDHh+/1Iw5wp+8jbZ5133BplBaNxnx5kozCGDUCqJgB5ImB3VRJ0I7RpRufjXZlr3 9wMKKVyHzFMhVoM3f3s2C1s1Vltd3vIarlD/NAriMlhLX9N9f08DihdLvVh38Bia6EoV uBnynsPKKvQI+IK2/zlejzZmw8ooUBwLM8P/wZ2PmcNgqSoxNQ46SJM8cmPQ5bCKvjix DY6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=cdjjnO3MY8xL4D5xMhBP0OobmPZGZdYRDT/wTZevvEk=; b=aSCWFxS8ya8/fwFox8qFcJFzKMsYtQLfsqFNsuLMS3fKNBd+zZG7Sn/amNRgJchrfd 1SBepDRK7uQgD/FzKb9PiaSpbOR2qivyw8dhk2GUgD1g1bVF6n1nUBgthlwh8GKpu0SX gO2TMkrKMCoMQm5B8YruoqjYq5HshwkBFmjkd4owvYrEuECs2SgoP4P05XCS95Z82zv7 cs3a49IUaYRfCyBT9inEYHFERppFMotSNwd+Gil2tyeJNeY31jgALOBh5dYgTprr7mds 6K+PvbwqTPdA+QG9UJrHPlaO/0JbHJrA6D2RtVIMQJ+c/41w4FhADt2m/UV05vPCncbl AKEw== 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 i5-v6si3035887pfe.27.2018.06.20.16.19.08; Wed, 20 Jun 2018 16:19:22 -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 S932847AbeFTXQt (ORCPT + 99 others); Wed, 20 Jun 2018 19:16:49 -0400 Received: from mga09.intel.com ([134.134.136.24]:29835 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754318AbeFTXP2 (ORCPT ); Wed, 20 Jun 2018 19:15:28 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2018 16:15:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,249,1526367600"; d="scan'208";a="66325213" Received: from chang-linux-2.sc.intel.com ([10.3.52.139]) by orsmga001.jf.intel.com with ESMTP; 20 Jun 2018 16:15:25 -0700 From: "Chang S. Bae" To: Andy Lutomirski , "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar Cc: Andi Kleen , Dave Hansen , Markus T Metzger , Ravi Shankar , "Chang S . Bae" , LKML Subject: [PATCH v4 3/7] x86/fsgsbase/64: Use FS/GS base helpers in core dump Date: Wed, 20 Jun 2018 16:15:02 -0700 Message-Id: <1529536506-26237-4-git-send-email-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529536506-26237-1-git-send-email-chang.seok.bae@intel.com> References: <1529536506-26237-1-git-send-email-chang.seok.bae@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When new FSGSBASE instructions enabled, this read will become faster. Based-on-code-from: Andy Lutomirski Signed-off-by: Chang S. Bae Reviewed-by: Andi Kleen Cc: H. Peter Anvin Cc: Dave Hansen Cc: Thomas Gleixner Cc: Ingo Molnar Reviewed-by: Andy Lutomirski --- arch/x86/include/asm/elf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index 0d157d2..49acefb 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -10,6 +10,7 @@ #include #include #include +#include typedef unsigned long elf_greg_t; @@ -205,7 +206,6 @@ void set_personality_ia32(bool); #define ELF_CORE_COPY_REGS(pr_reg, regs) \ do { \ - unsigned long base; \ unsigned v; \ (pr_reg)[0] = (regs)->r15; \ (pr_reg)[1] = (regs)->r14; \ @@ -228,8 +228,8 @@ do { \ (pr_reg)[18] = (regs)->flags; \ (pr_reg)[19] = (regs)->sp; \ (pr_reg)[20] = (regs)->ss; \ - rdmsrl(MSR_FS_BASE, base); (pr_reg)[21] = base; \ - rdmsrl(MSR_KERNEL_GS_BASE, base); (pr_reg)[22] = base; \ + (pr_reg)[21] = read_fsbase(); \ + (pr_reg)[22] = read_inactive_gsbase(); \ asm("movl %%ds,%0" : "=r" (v)); (pr_reg)[23] = v; \ asm("movl %%es,%0" : "=r" (v)); (pr_reg)[24] = v; \ asm("movl %%fs,%0" : "=r" (v)); (pr_reg)[25] = v; \ -- 2.7.4