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: <CA+55aFxA522TJ8ROr0AJMusvYitm2RntBfBNXAK1eych3TP=dw@mail.gmail.com>
Date:	Sun, 4 May 2014 14:31:23 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	"H. Peter Anvin" <h.peter.anvin@...el.com>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Andy Lutomirski <luto@...capital.net>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	"the arch/x86 maintainers" <x86@...nel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [RFC/HACK] x86: Fast return to kernel

On Sun, May 4, 2014 at 12:59 PM, H. Peter Anvin <h.peter.anvin@...el.com> wrote:
>
> Maybe let userspace sit in a tight loop doing RDTSC, and look for data
> points too far apart to have been uninterrupted?

That won't work, since Andy's patch improves on the "interrupt
happened in kernel space", not on the user-space interrupt case.

But some variation on that with a kernel module that does something like

 - take over one CPU and force tons of timer interrupts on that CPU
using the local APIC

 - for (say) ten billion cycles, do something like this in that kernel module:

   #define TEN_BILLION (10000000000)

        unsigned long prev = 0, sum = 0, end = rdtsc() + TEN_BILLION;
        for (;;) {
                unsigned long tsc = rdtsc();
                if (tsc > end)
                        break;
                if (tsc < prev + 500) {
                        sum += tsc - prev;
                }
                prev = tsc;
        }

and see how big a fraction of the 10 billion cycles you capture in
'sum'.  The bigger the fraction, the less time the timer interrupts
stole from your CPU.

That "500" is just a random cut-off. Any interrupt will take more than
that many TSC cycles. So the above basically counts how much
uninterrupted time that thread gets.

Hmm?

                   Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ