Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1159606imm; Wed, 6 Jun 2018 11:22:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJGkNRAUvUEZXms/1yvCopP1VPv8wFdrTudAOFzJ1CWhgKIzojVSwiRmCtpObqjh5jrEJqH X-Received: by 2002:a17:902:24e:: with SMTP id 72-v6mr4239366plc.87.1528309331987; Wed, 06 Jun 2018 11:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528309331; cv=none; d=google.com; s=arc-20160816; b=BOtGVaH7yHF7lDN+mKc9PWi2Opv86Wbj5So7GX2ogwIAbJzJt1wAS1Cu0IikBf4yQa CKe0O3+JfgBxito6z8fOiLmt4tQONP4YkoMql1Fi6MgcubLA37Os3ukdITz6rVW+TY54 s0tS7H/9EXChywiqJ2uJdSOvgw+pZQRe5w0PLVmznYxiq14NkOmieQCaz1M8ss1vaq2u VBL6MP21QrIOw1MBINiL+fS9sFyxFheW9X/Q5sPmH/6r0akqBYJycNCG8gBz5LDnoftT x2/MEF/Rrj6B7mY9PziDT7eAL7xw7iDTFJFP3TSW/lc2rMFLW3dqesWUZ1tckgEy5H2/ LbVQ== 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=07XntQQEVA7vtXt80bIqEeY/jJOqxdAX5XpqTj3kbdb+E0UAzxYFGoXDJAx9xvO6PZ qGrBkimJyaWS1GOuCGQn99o9AKysqJQ9L/5Dzym2qnGrYkGZZyXYQCX+xGTroe/8nQG/ Om4sBaDsMBkJ685llikWYavLLH7dF6SIffZ4y7gNWVY6C+p8VCUBlM8ODqk9Olqt+Mup kTrWLrOCfx5J2p3WLCctA7ezMB4wQnQ+OeKyH+MPkllD9k0hVpAb1n2ZijUIyW0Q7hS1 sJyT2m4fCCgjBNaVC8vLIuYIBXc9JF5oGXHyXHuScbX2CAxrGYK2ZX5QG8hSnOYjnI0t ozeA== 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 q9-v6si16173539pll.370.2018.06.06.11.21.57; Wed, 06 Jun 2018 11:22:11 -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 S932973AbeFFQYj (ORCPT + 99 others); Wed, 6 Jun 2018 12:24:39 -0400 Received: from mga17.intel.com ([192.55.52.151]:61007 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753415AbeFFQXd (ORCPT ); Wed, 6 Jun 2018 12:23:33 -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 fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2018 09:23:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,483,1520924400"; d="scan'208";a="62323466" Received: from chang-linux-2.sc.intel.com ([10.3.52.139]) by orsmga001.jf.intel.com with ESMTP; 06 Jun 2018 09:23:32 -0700 From: "Chang S. Bae" To: Andy Lutomirski , "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar Cc: Andi Kleen , Dave Hansen , Markus T Metzger , "Ravi V . Shankar" , "Chang S . Bae" , LKML Subject: [PATCH v2 3/8] x86/fsgsbase/64: Use FS/GS base helpers in core dump Date: Wed, 6 Jun 2018 09:23:14 -0700 Message-Id: <1528302199-29619-4-git-send-email-chang.seok.bae@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528302199-29619-1-git-send-email-chang.seok.bae@intel.com> References: <1528302199-29619-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