mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Denys Vlasenko <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com,
	jolsa@redhat.com, dvlasenk@redhat.com, paulus@samba.org,
	a.p.zijlstra@chello.nl, acme@kernel.org, tglx@linutronix.de
Subject: [tip:x86/asm] perf/x86/64: Simplify regs_user-> abi setting code in get_regs_user()
Date: Sun, 12 Apr 2015 10:26:37 -0700	[thread overview]
Message-ID: <tip-32caa06091cc59651222cdc971dc21eaab36b097@git.kernel.org> (raw)
In-Reply-To: <1428671219-29341-3-git-send-email-dvlasenk@redhat.com>

Commit-ID:  32caa06091cc59651222cdc971dc21eaab36b097
Gitweb:     http://git.kernel.org/tip/32caa06091cc59651222cdc971dc21eaab36b097
Author:     Denys Vlasenko <dvlasenk@redhat.com>
AuthorDate: Fri, 10 Apr 2015 15:06:58 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 11 Apr 2015 13:08:53 +0200

perf/x86/64: Simplify regs_user->abi setting code in get_regs_user()

user_64bit_mode(regs) basically checks regs->cs to point to a
64-bit segment. This check used to be unreliable here because
regs->cs was not always correct in syscalls.

Now regs->cs is always correct: in syscalls, in interrupts, in
exceptions. No need to emply heuristics here.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1428671219-29341-3-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/perf_regs.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/arch/x86/kernel/perf_regs.c b/arch/x86/kernel/perf_regs.c
index a8d4e48..8157d39 100644
--- a/arch/x86/kernel/perf_regs.c
+++ b/arch/x86/kernel/perf_regs.c
@@ -166,22 +166,8 @@ void perf_get_regs_user(struct perf_regs *regs_user,
 	 * be careful not to look at any other percpu variables that might
 	 * change during context switches.
 	 */
-	if (IS_ENABLED(CONFIG_IA32_EMULATION) &&
-	    task_thread_info(current)->status & TS_COMPAT) {
-		/* Easy case: we're in a compat syscall. */
-		regs_user->abi = PERF_SAMPLE_REGS_ABI_32;
-	} else if (user_regs->orig_ax != -1) {
-		/*
-		 * We're probably in a 64-bit syscall.
-		 * Warning: this code is severely racy.  At least it's better
-		 * than just blindly copying user_regs.
-		 */
-		regs_user->abi = PERF_SAMPLE_REGS_ABI_64;
-	} else {
-		/* We're probably in an interrupt or exception. */
-		regs_user->abi = user_64bit_mode(user_regs) ?
-			PERF_SAMPLE_REGS_ABI_64 : PERF_SAMPLE_REGS_ABI_32;
-	}
+	regs_user->abi = user_64bit_mode(user_regs) ?
+		PERF_SAMPLE_REGS_ABI_64 : PERF_SAMPLE_REGS_ABI_32;
 
 	regs_user->regs = regs_user_copy;
 }

  reply	other threads:[~2015-04-12 17:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10 13:06 [PATCH 1/4] perf/x86_64: get_regs_user: Do not guess user_regs->cs,ss,sp Denys Vlasenko
2015-04-10 13:06 ` [PATCH 2/4] perf/x86_64: get_regs_user: Do report user_regs->cx while we are in syscall Denys Vlasenko
2015-04-12 17:26   ` [tip:x86/asm] perf/x86/64: Do report user_regs-> cx while we are in syscall, in get_regs_user() tip-bot for Denys Vlasenko
2015-04-10 13:06 ` [PATCH 3/4] perf/x86_64: get_regs_user: Simplify regs_user->abi setting code Denys Vlasenko
2015-04-12 17:26   ` tip-bot for Denys Vlasenko [this message]
2015-04-10 13:06 ` [PATCH 4/4] perf/x86_64: get_regs_user: Report regs_user->ax too Denys Vlasenko
2015-04-12 17:26   ` [tip:x86/asm] perf/x86/64: Report regs_user-> ax too in get_regs_user() tip-bot for Denys Vlasenko
2015-04-12 17:26 ` [tip:x86/asm] perf/x86/64: Do not guess user_regs->cs, ss, sp " tip-bot for Denys Vlasenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-32caa06091cc59651222cdc971dc21eaab36b097@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome