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]
Message-ID: <alpine.DEB.2.21.1811020922240.1642@nanos.tec.linutronix.de>
Date:   Sat, 3 Nov 2018 11:04:10 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Daniel Vacek <neelx@...hat.com>
cc:     x86@...nel.org, Ingo Molnar <mingo@...hat.com>,
        Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH] tsc: make calibration refinement more robust

Daniel,

On Fri, 2 Nov 2018, Daniel Vacek wrote:
> On Thu, Nov 1, 2018 at 4:34 PM, Thomas Gleixner <tglx@...utronix.de> wrote:
> >> -#define MAX_RETRIES     5
> >> -#define SMI_TRESHOLD    50000
> >> +#define MAX_RETRIES  5
> >> +#define TSC_THRESHOLD        (tsc_khz >> 5)
> >
> > This breaks pit_hpet_ptimer_calibrate_cpu() because at that point tsc_hkz is 0.
> 
> That did not show up with my testing, sorry. I guess
> pit_calibrate_tsc() never failed for me. Hmm, actually it looks like
> quick_pit_calibrate() does the job for me so
> pit_hpet_ptimer_calibrate_cpu() is likely not even called.

Right. It's only called when quick calibration fails. Testing does not
replace code inspection :)

> Would this:
> 
> #define TSC_THRESHOLD   (tsc_khz? tsc_khz >> 5: 0x20000)
> 
> work for you instead? Or alternatively at some point when chasing this
> down I used:
> 
> #define TSC_THRESHOLD (0x10000 + (tsc_khz >> 6))
> 
> The first one seems better though. I can send v2 next week if you like it.

Can you please avoid hiding the logic in a macro? Just use a local
variable:

	u64 thresh = tsc_khz ? tsc_khz >> 5 : TSC_DEFAULT_THRESHOLD;

and use that in the comparison.

Thanks,

	tglx



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ