Re: [PATCH 1/3] Add prctl commands PR_GET_TSC and PR_SET_TSC
From: Erik Bosman
Date: Sun Apr 13 2008 - 05:45:29 EST
On Sun, 13 Apr 2008, Andi Kleen wrote:
> Erik Bosman <ebn310@xxxxxxxxx> writes:
>
> > This patch adds prctl commands that make it possible
> > to deny the execution of timestamp counters in userspace.
> > If this is not implemented on a specific architecture,
> > prctl will return -EINVAL.
>
> You forgot to state why you need that?
>
> -Andi
>
I'm using it for deterministic replay. With this trap it is
possible to emulate the instruction using ptrace and knowing
the outcome. Deterministic replay can be useful, amongst other
things, for debugging and security (instructing your debugger
to undo instructions for example, to see what happened before
a fault.)
Not having this trap means emulation should be used to catch
the instruction, leading to bad performance.
Without the timestamp counter, the only instruction leading
to non-determinism (that I'm aware of) is the CPUID instruction
that returns on which core it runs, but that doesn't seem to
be used that much.
Erik Bosman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/