mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-22 09:42:32 +00:00
Add a message type to the time-travel protocol to broadcast a small (64-bit) value to all participants in a simulation. The main use case is to have an identical message come to all participants in a simulation, e.g. to separate out logs for different tests running in a single simulation. Down in the guts of time_travel_handle_message() we can't use printk() and not even printk_deferred(), so just store the message and print it at the start of the userspace() function. Unfortunately this means that other prints in the kernel can actually bypass the message, but in most cases where this is used, for example to separate test logs, userspace will be involved. Also, even if we could use printk_deferred(), we'd still need to flush it out in the userspace() function since otherwise userspace messages might cross it. As a result, this is a reasonable compromise, there's no need to have any core changes and it solves the main use case we have for it. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Link: https://patch.msgid.link/20240702192118.c4093bc5b15e.I2ca8d006b67feeb866ac2017af7b741c9e06445a@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
32 lines
758 B
C
32 lines
758 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2019-2021 Intel Corporation
|
|
*/
|
|
#ifndef _UM_TIME_TRAVEL_H_
|
|
#define _UM_TIME_TRAVEL_H_
|
|
|
|
enum time_travel_mode {
|
|
TT_MODE_OFF,
|
|
TT_MODE_BASIC,
|
|
TT_MODE_INFCPU,
|
|
TT_MODE_EXTERNAL,
|
|
};
|
|
|
|
#if defined(UML_CONFIG_UML_TIME_TRAVEL_SUPPORT) || \
|
|
defined(CONFIG_UML_TIME_TRAVEL_SUPPORT)
|
|
extern enum time_travel_mode time_travel_mode;
|
|
extern int time_travel_should_print_bc_msg;
|
|
#else
|
|
#define time_travel_mode TT_MODE_OFF
|
|
#define time_travel_should_print_bc_msg 0
|
|
#endif /* (UML_)CONFIG_UML_TIME_TRAVEL_SUPPORT */
|
|
|
|
void _time_travel_print_bc_msg(void);
|
|
static inline void time_travel_print_bc_msg(void)
|
|
{
|
|
if (time_travel_should_print_bc_msg)
|
|
_time_travel_print_bc_msg();
|
|
}
|
|
|
|
#endif /* _UM_TIME_TRAVEL_H_ */
|