Message ID | 20231103-bb-timetravel-patches-v1-11-e2c68efcf664@uni-rostock.de |
---|---|
State | Changes Requested |
Headers | show |
Series | Several Time Travel Mode Enhancements | expand |
On 03/11/2023 16:41, Benjamin Beichler wrote: > In time travel mode, the internal time is only advanced at discrete > synchronization points, while the TSC register continuously increases. > Although the TSC registers remain accessible, we remove the TSC flags to > indicate to programs that properly check the TSC flag before reading > that the CPU lacks a proper TSC register. > > This change is primarily cosmetic but may encourage some programs to use > gettimeofday and similar calls for time measurement. > > Signed-off-by: Benjamin Beichler <benjamin.beichler@uni-rostock.de> > --- > arch/um/kernel/um_arch.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c > index b1bfed0c8528..6bfd531b5f87 100644 > --- a/arch/um/kernel/um_arch.c > +++ b/arch/um/kernel/um_arch.c > @@ -30,6 +30,7 @@ > #include <kern_util.h> > #include <mem_user.h> > #include <os.h> > +#include <timetravel.h> > > #include "um_arch.h" > > @@ -284,7 +285,8 @@ static void parse_host_cpu_flags(char *line) > { > int i; > for (i = 0; i < 32*NCAPINTS; i++) { > - if ((x86_cap_flags[i] != NULL) && strstr(line, x86_cap_flags[i])) > + if ((x86_cap_flags[i] != NULL) && strstr(line, x86_cap_flags[i]) && > + !(time_travel_mode != TT_MODE_OFF && strstr("tsc", x86_cap_flags[i]))) > set_cpu_cap(&boot_cpu_data, i); > } > } > Acked-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
On Fri, 2023-11-03 at 16:41 +0000, Benjamin Beichler wrote: > In time travel mode, the internal time is only advanced at discrete > synchronization points, while the TSC register continuously increases. > Although the TSC registers remain accessible, we remove the TSC flags to > indicate to programs that properly check the TSC flag before reading > that the CPU lacks a proper TSC register. > > This change is primarily cosmetic but may encourage some programs to use > gettimeofday and similar calls for time measurement. > > Signed-off-by: Benjamin Beichler <benjamin.beichler@uni-rostock.de> > --- > arch/um/kernel/um_arch.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c > index b1bfed0c8528..6bfd531b5f87 100644 > --- a/arch/um/kernel/um_arch.c > +++ b/arch/um/kernel/um_arch.c > @@ -30,6 +30,7 @@ > #include <kern_util.h> > #include <mem_user.h> > #include <os.h> > +#include <timetravel.h> > > #include "um_arch.h" > > @@ -284,7 +285,8 @@ static void parse_host_cpu_flags(char *line) > { > int i; > for (i = 0; i < 32*NCAPINTS; i++) { > - if ((x86_cap_flags[i] != NULL) && strstr(line, x86_cap_flags[i])) > + if ((x86_cap_flags[i] != NULL) && strstr(line, x86_cap_flags[i]) && > + !(time_travel_mode != TT_MODE_OFF && strstr("tsc", x86_cap_flags[i]))) > set_cpu_cap(&boot_cpu_data, i); > Makes sense, but the code formatting is all wrong ;-) (indentation should only be to the logical level of the parentheses) johannes
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index b1bfed0c8528..6bfd531b5f87 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -30,6 +30,7 @@ #include <kern_util.h> #include <mem_user.h> #include <os.h> +#include <timetravel.h> #include "um_arch.h" @@ -284,7 +285,8 @@ static void parse_host_cpu_flags(char *line) { int i; for (i = 0; i < 32*NCAPINTS; i++) { - if ((x86_cap_flags[i] != NULL) && strstr(line, x86_cap_flags[i])) + if ((x86_cap_flags[i] != NULL) && strstr(line, x86_cap_flags[i]) && + !(time_travel_mode != TT_MODE_OFF && strstr("tsc", x86_cap_flags[i]))) set_cpu_cap(&boot_cpu_data, i); } }
In time travel mode, the internal time is only advanced at discrete synchronization points, while the TSC register continuously increases. Although the TSC registers remain accessible, we remove the TSC flags to indicate to programs that properly check the TSC flag before reading that the CPU lacks a proper TSC register. This change is primarily cosmetic but may encourage some programs to use gettimeofday and similar calls for time measurement. Signed-off-by: Benjamin Beichler <benjamin.beichler@uni-rostock.de> --- arch/um/kernel/um_arch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)