public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Nicolas Iooss <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: dave.hansen@linux.intel.com, nicolas.iooss_linux@m4x.org,
	linux-kernel@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de,
	mingo@kernel.org
Subject: [tip:mm/pkeys] x86/mm/pkeys: Do not skip PKRU register if debug registers are not used
Date: Tue, 13 Sep 2016 06:16:03 -0700	[thread overview]
Message-ID: <tip-19ab2b679c4af895ac0f3e79eea14952a6b2b2ce@git.kernel.org> (raw)
In-Reply-To: <20160910183045.4618-1-nicolas.iooss_linux@m4x.org>

Commit-ID:  19ab2b679c4af895ac0f3e79eea14952a6b2b2ce
Gitweb:     http://git.kernel.org/tip/19ab2b679c4af895ac0f3e79eea14952a6b2b2ce
Author:     Nicolas Iooss <nicolas.iooss_linux@m4x.org>
AuthorDate: Sat, 10 Sep 2016 20:30:45 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 13 Sep 2016 15:12:17 +0200

x86/mm/pkeys: Do not skip PKRU register if debug registers are not used

__show_regs() fails to dump the PKRU state when the debug registers are in
their default state because there is a return statement on the debug
register state.

Change the logic to report PKRU value even when debug registers are in
their default state.

[ tglx: Switch to pr_default() while at it ]

Fixes:c0b17b5bd4b7 ("x86/mm/pkeys: Dump PKRU with other kernel registers")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: http://lkml.kernel.org/r/20160910183045.4618-1-nicolas.iooss_linux@m4x.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/kernel/process_64.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 63236d8..130c4eb 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -95,12 +95,11 @@ void __show_regs(struct pt_regs *regs, int all)
 	cr3 = read_cr3();
 	cr4 = __read_cr4();
 
-	printk(KERN_DEFAULT "FS:  %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
-	       fs, fsindex, gs, gsindex, shadowgs);
-	printk(KERN_DEFAULT "CS:  %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds,
-			es, cr0);
-	printk(KERN_DEFAULT "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3,
-			cr4);
+	pr_default("FS:  %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
+		   fs, fsindex, gs, gsindex, shadowgs);
+	pr_default("CS:  %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds,
+		   es, cr0);
+	pr_default("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4);
 
 	get_debugreg(d0, 0);
 	get_debugreg(d1, 1);
@@ -110,15 +109,14 @@ void __show_regs(struct pt_regs *regs, int all)
 	get_debugreg(d7, 7);
 
 	/* Only print out debug registers if they are in their non-default state. */
-	if ((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) &&
-	    (d6 == DR6_RESERVED) && (d7 == 0x400))
-		return;
-
-	printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
-	printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
+	if (!((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) &&
+	    (d6 == DR6_RESERVED) && (d7 == 0x400))) {
+		pr_default("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
+		pr_default("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
+	}
 
 	if (boot_cpu_has(X86_FEATURE_OSPKE))
-		printk(KERN_DEFAULT "PKRU: %08x\n", read_pkru());
+		pr_default("PKRU: %08x\n", read_pkru());
 }
 
 void release_thread(struct task_struct *dead_task)

  parent reply	other threads:[~2016-09-13 13:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-10 18:30 [PATCH 1/1] x86: do not skip PKRU register if debug registers are not used Nicolas Iooss
2016-09-12 16:49 ` Dave Hansen
2016-09-13 13:16 ` tip-bot for Nicolas Iooss [this message]
2016-09-13 14:07 ` [tip:mm/pkeys] x86/mm/pkeys: Do " tip-bot for Nicolas Iooss

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-19ab2b679c4af895ac0f3e79eea14952a6b2b2ce@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nicolas.iooss_linux@m4x.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