lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 27 Jun 2019 16:41:48 -0700
From:   tip-bot for Thomas Gleixner <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     tglx@...utronix.de, eranian@...gle.com,
        linux-kernel@...r.kernel.org, ravi.v.shankar@...el.com,
        andi.kleen@...el.com, Suravee.Suthikulpanit@....com,
        peterz@...radead.org, hpa@...or.com, mingo@...nel.org,
        ricardo.neri-calderon@...ux.intel.com, ashok.raj@...el.com
Subject: [tip:x86/timers] x86/hpet: Simplify counter validation

Commit-ID:  44b5be5733e119300115b98409cbcf9a45b8d3f1
Gitweb:     https://git.kernel.org/tip/44b5be5733e119300115b98409cbcf9a45b8d3f1
Author:     Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Sun, 23 Jun 2019 15:23:52 +0200
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Fri, 28 Jun 2019 00:57:19 +0200

x86/hpet: Simplify counter validation

There is no point to loop for 200k TSC cycles to check afterwards whether
the HPET counter is working. Read the counter inside of the loop and break
out when the counter value changed.

Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Ingo Molnar <mingo@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>
Cc: Ashok Raj <ashok.raj@...el.com>
Cc: Andi Kleen <andi.kleen@...el.com>
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@....com>
Cc: Stephane Eranian <eranian@...gle.com>
Cc: Ravi Shankar <ravi.v.shankar@...el.com>
Link: https://lkml.kernel.org/r/20190623132435.149535103@linutronix.de

---
 arch/x86/kernel/hpet.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 8c57dbf15e3b..74756c0a3a10 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -853,15 +853,13 @@ static bool __init hpet_counting(void)
 	 * 1 GHz == 200us
 	 */
 	do {
-		rep_nop();
+		if (t1 != hpet_readl(HPET_COUNTER))
+			return true;
 		now = rdtsc();
 	} while ((now - start) < 200000UL);
 
-	if (t1 == hpet_readl(HPET_COUNTER)) {
-		pr_warn("Counter not counting. HPET disabled\n");
-		return false;
-	}
-	return true;
+	pr_warn("Counter not counting. HPET disabled\n");
+	return false;
 }
 
 /**

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ