[PATCH RFC 11/11] um: Remove all TSC flags when using Time Travel Mode

Anton Ivanov anton.ivanov at cambridgegreys.com
Fri Nov 3 11:45:30 PDT 2023


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 at 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 at cambridgegreys.com>

-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/




More information about the linux-um mailing list