* [PATCH] icount: fix shift=auto for record/replay
@ 2020-05-06 7:52 Pavel Dovgalyuk
2020-05-18 10:58 ` Pavel Dovgalyuk
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Pavel Dovgalyuk @ 2020-05-06 7:52 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, dovgaluk, pavel.dovgaluk, rth
This patch fixes shift=auto when record/replay is enabled.
Now user does not need to guess the best shift value.
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
---
cpus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 5670c96bcf..dfb9f4717f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -379,7 +379,8 @@ static void icount_adjust(void)
seqlock_write_lock(&timers_state.vm_clock_seqlock,
&timers_state.vm_clock_lock);
- cur_time = cpu_get_clock_locked();
+ cur_time = REPLAY_CLOCK_LOCKED(REPLAY_CLOCK_VIRTUAL_RT,
+ cpu_get_clock_locked());
cur_icount = cpu_get_icount_locked();
delta = cur_icount - cur_time;
@@ -685,6 +686,7 @@ static const VMStateDescription icount_vmstate_timers = {
.fields = (VMStateField[]) {
VMSTATE_INT64(qemu_icount_bias, TimersState),
VMSTATE_INT64(qemu_icount, TimersState),
+ VMSTATE_INT16(icount_time_shift, TimersState),
VMSTATE_END_OF_LIST()
},
.subsections = (const VMStateDescription*[]) {
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] icount: fix shift=auto for record/replay
2020-05-06 7:52 [PATCH] icount: fix shift=auto for record/replay Pavel Dovgalyuk
@ 2020-05-18 10:58 ` Pavel Dovgalyuk
2020-05-18 11:24 ` Philippe Mathieu-Daudé
2020-05-18 16:14 ` Alex Bennée
2 siblings, 0 replies; 7+ messages in thread
From: Pavel Dovgalyuk @ 2020-05-18 10:58 UTC (permalink / raw)
To: Pavel Dovgalyuk, qemu-devel; +Cc: pbonzini, pavel.dovgaluk, rth
ping
On 06.05.2020 10:52, Pavel Dovgalyuk wrote:
> This patch fixes shift=auto when record/replay is enabled.
> Now user does not need to guess the best shift value.
>
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
> ---
> cpus.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/cpus.c b/cpus.c
> index 5670c96bcf..dfb9f4717f 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -379,7 +379,8 @@ static void icount_adjust(void)
>
> seqlock_write_lock(&timers_state.vm_clock_seqlock,
> &timers_state.vm_clock_lock);
> - cur_time = cpu_get_clock_locked();
> + cur_time = REPLAY_CLOCK_LOCKED(REPLAY_CLOCK_VIRTUAL_RT,
> + cpu_get_clock_locked());
> cur_icount = cpu_get_icount_locked();
>
> delta = cur_icount - cur_time;
> @@ -685,6 +686,7 @@ static const VMStateDescription icount_vmstate_timers = {
> .fields = (VMStateField[]) {
> VMSTATE_INT64(qemu_icount_bias, TimersState),
> VMSTATE_INT64(qemu_icount, TimersState),
> + VMSTATE_INT16(icount_time_shift, TimersState),
> VMSTATE_END_OF_LIST()
> },
> .subsections = (const VMStateDescription*[]) {
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] icount: fix shift=auto for record/replay
2020-05-06 7:52 [PATCH] icount: fix shift=auto for record/replay Pavel Dovgalyuk
2020-05-18 10:58 ` Pavel Dovgalyuk
@ 2020-05-18 11:24 ` Philippe Mathieu-Daudé
2020-05-18 16:14 ` Alex Bennée
2 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-18 11:24 UTC (permalink / raw)
To: Pavel Dovgalyuk, qemu-devel
Cc: Alex Bennée, pbonzini, dovgaluk, pavel.dovgaluk, rth
+Alex
On 5/6/20 9:52 AM, Pavel Dovgalyuk wrote:
> This patch fixes shift=auto when record/replay is enabled.
> Now user does not need to guess the best shift value.
>
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
> ---
> cpus.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/cpus.c b/cpus.c
> index 5670c96bcf..dfb9f4717f 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -379,7 +379,8 @@ static void icount_adjust(void)
>
> seqlock_write_lock(&timers_state.vm_clock_seqlock,
> &timers_state.vm_clock_lock);
> - cur_time = cpu_get_clock_locked();
> + cur_time = REPLAY_CLOCK_LOCKED(REPLAY_CLOCK_VIRTUAL_RT,
> + cpu_get_clock_locked());
> cur_icount = cpu_get_icount_locked();
>
> delta = cur_icount - cur_time;
> @@ -685,6 +686,7 @@ static const VMStateDescription icount_vmstate_timers = {
> .fields = (VMStateField[]) {
> VMSTATE_INT64(qemu_icount_bias, TimersState),
> VMSTATE_INT64(qemu_icount, TimersState),
> + VMSTATE_INT16(icount_time_shift, TimersState),
> VMSTATE_END_OF_LIST()
> },
> .subsections = (const VMStateDescription*[]) {
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] icount: fix shift=auto for record/replay
2020-05-06 7:52 [PATCH] icount: fix shift=auto for record/replay Pavel Dovgalyuk
2020-05-18 10:58 ` Pavel Dovgalyuk
2020-05-18 11:24 ` Philippe Mathieu-Daudé
@ 2020-05-18 16:14 ` Alex Bennée
2020-05-19 5:40 ` Pavel Dovgalyuk
2 siblings, 1 reply; 7+ messages in thread
From: Alex Bennée @ 2020-05-18 16:14 UTC (permalink / raw)
To: Pavel Dovgalyuk; +Cc: pbonzini, dovgaluk, qemu-devel, pavel.dovgaluk, rth
Pavel Dovgalyuk <Pavel.Dovgaluk@gmail.com> writes:
> This patch fixes shift=auto when record/replay is enabled.
> Now user does not need to guess the best shift value.
>
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
> ---
> cpus.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/cpus.c b/cpus.c
> index 5670c96bcf..dfb9f4717f 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -379,7 +379,8 @@ static void icount_adjust(void)
>
> seqlock_write_lock(&timers_state.vm_clock_seqlock,
> &timers_state.vm_clock_lock);
> - cur_time = cpu_get_clock_locked();
> + cur_time = REPLAY_CLOCK_LOCKED(REPLAY_CLOCK_VIRTUAL_RT,
> + cpu_get_clock_locked());
> cur_icount = cpu_get_icount_locked();
>
> delta = cur_icount - cur_time;
> @@ -685,6 +686,7 @@ static const VMStateDescription icount_vmstate_timers = {
> .fields = (VMStateField[]) {
> VMSTATE_INT64(qemu_icount_bias, TimersState),
> VMSTATE_INT64(qemu_icount, TimersState),
> + VMSTATE_INT16(icount_time_shift, TimersState),
Surely we should be bumping .version_id/.minimum_version_id here so we
error out gracefully. No recordings pre this change would work right?
> VMSTATE_END_OF_LIST()
> },
> .subsections = (const VMStateDescription*[]) {
--
Alex Bennée
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] icount: fix shift=auto for record/replay
2020-05-18 16:14 ` Alex Bennée
@ 2020-05-19 5:40 ` Pavel Dovgalyuk
0 siblings, 0 replies; 7+ messages in thread
From: Pavel Dovgalyuk @ 2020-05-19 5:40 UTC (permalink / raw)
To: Alex Bennée, Pavel Dovgalyuk
Cc: pbonzini, qemu-devel, pavel.dovgaluk, rth
On 18.05.2020 19:14, Alex Bennée wrote:
> Pavel Dovgalyuk <Pavel.Dovgaluk@gmail.com> writes:
>
>> This patch fixes shift=auto when record/replay is enabled.
>> Now user does not need to guess the best shift value.
>>
>> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
>> ---
>> cpus.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/cpus.c b/cpus.c
>> index 5670c96bcf..dfb9f4717f 100644
>> --- a/cpus.c
>> +++ b/cpus.c
>> @@ -379,7 +379,8 @@ static void icount_adjust(void)
>>
>> seqlock_write_lock(&timers_state.vm_clock_seqlock,
>> &timers_state.vm_clock_lock);
>> - cur_time = cpu_get_clock_locked();
>> + cur_time = REPLAY_CLOCK_LOCKED(REPLAY_CLOCK_VIRTUAL_RT,
>> + cpu_get_clock_locked());
>> cur_icount = cpu_get_icount_locked();
>>
>> delta = cur_icount - cur_time;
>> @@ -685,6 +686,7 @@ static const VMStateDescription icount_vmstate_timers = {
>> .fields = (VMStateField[]) {
>> VMSTATE_INT64(qemu_icount_bias, TimersState),
>> VMSTATE_INT64(qemu_icount, TimersState),
>> + VMSTATE_INT16(icount_time_shift, TimersState),
> Surely we should be bumping .version_id/.minimum_version_id here so we
> error out gracefully. No recordings pre this change would work right?
You're right. But before this patch shift=auto doesn't work for RR at
all. Therefore no recordings should exist.
I think, for other icount use cases would be better to move
icount_time_shift to subsection and use it only when auto is enabled.
>
>> VMSTATE_END_OF_LIST()
>> },
>> .subsections = (const VMStateDescription*[]) {
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] icount: fix shift=auto for record/replay
@ 2020-05-19 10:43 Pavel Dovgalyuk
2020-05-21 13:47 ` Paolo Bonzini
0 siblings, 1 reply; 7+ messages in thread
From: Pavel Dovgalyuk @ 2020-05-19 10:43 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, rth, alex.bennee, pavel.dovgaluk, dovgaluk
This patch fixes shift=auto when record/replay is enabled.
Now user does not need to guess the best shift value.
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
--
v2:
moved icount_time_shift to vmstate subsection
---
cpus.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 5670c96bcf..7ce0d569b3 100644
--- a/cpus.c
+++ b/cpus.c
@@ -379,7 +379,8 @@ static void icount_adjust(void)
seqlock_write_lock(&timers_state.vm_clock_seqlock,
&timers_state.vm_clock_lock);
- cur_time = cpu_get_clock_locked();
+ cur_time = REPLAY_CLOCK_LOCKED(REPLAY_CLOCK_VIRTUAL_RT,
+ cpu_get_clock_locked());
cur_icount = cpu_get_icount_locked();
delta = cur_icount - cur_time;
@@ -647,6 +648,11 @@ static bool adjust_timers_state_needed(void *opaque)
return s->icount_rt_timer != NULL;
}
+static bool shift_state_needed(void *opaque)
+{
+ return use_icount == 2;
+}
+
/*
* Subsection for warp timer migration is optional, because may not be created
*/
@@ -674,6 +680,17 @@ static const VMStateDescription icount_vmstate_adjust_timers = {
}
};
+static const VMStateDescription icount_vmstate_shift = {
+ .name = "timer/icount/shift",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = shift_state_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_INT16(icount_time_shift, TimersState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
/*
* This is a subsection for icount migration.
*/
@@ -690,6 +707,7 @@ static const VMStateDescription icount_vmstate_timers = {
.subsections = (const VMStateDescription*[]) {
&icount_vmstate_warp_timer,
&icount_vmstate_adjust_timers,
+ &icount_vmstate_shift,
NULL
}
};
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] icount: fix shift=auto for record/replay
2020-05-19 10:43 Pavel Dovgalyuk
@ 2020-05-21 13:47 ` Paolo Bonzini
0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2020-05-21 13:47 UTC (permalink / raw)
To: Pavel Dovgalyuk, qemu-devel; +Cc: dovgaluk, alex.bennee, pavel.dovgaluk, rth
On 19/05/20 12:43, Pavel Dovgalyuk wrote:
> This patch fixes shift=auto when record/replay is enabled.
> Now user does not need to guess the best shift value.
>
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Queued, thanks!
Paolo
> --
>
> v2:
> moved icount_time_shift to vmstate subsection
> ---
> cpus.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/cpus.c b/cpus.c
> index 5670c96bcf..7ce0d569b3 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -379,7 +379,8 @@ static void icount_adjust(void)
>
> seqlock_write_lock(&timers_state.vm_clock_seqlock,
> &timers_state.vm_clock_lock);
> - cur_time = cpu_get_clock_locked();
> + cur_time = REPLAY_CLOCK_LOCKED(REPLAY_CLOCK_VIRTUAL_RT,
> + cpu_get_clock_locked());
> cur_icount = cpu_get_icount_locked();
>
> delta = cur_icount - cur_time;
> @@ -647,6 +648,11 @@ static bool adjust_timers_state_needed(void *opaque)
> return s->icount_rt_timer != NULL;
> }
>
> +static bool shift_state_needed(void *opaque)
> +{
> + return use_icount == 2;
> +}
> +
> /*
> * Subsection for warp timer migration is optional, because may not be created
> */
> @@ -674,6 +680,17 @@ static const VMStateDescription icount_vmstate_adjust_timers = {
> }
> };
>
> +static const VMStateDescription icount_vmstate_shift = {
> + .name = "timer/icount/shift",
> + .version_id = 1,
> + .minimum_version_id = 1,
> + .needed = shift_state_needed,
> + .fields = (VMStateField[]) {
> + VMSTATE_INT16(icount_time_shift, TimersState),
> + VMSTATE_END_OF_LIST()
> + }
> +};
> +
> /*
> * This is a subsection for icount migration.
> */
> @@ -690,6 +707,7 @@ static const VMStateDescription icount_vmstate_timers = {
> .subsections = (const VMStateDescription*[]) {
> &icount_vmstate_warp_timer,
> &icount_vmstate_adjust_timers,
> + &icount_vmstate_shift,
> NULL
> }
> };
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-05-21 13:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 7:52 [PATCH] icount: fix shift=auto for record/replay Pavel Dovgalyuk
2020-05-18 10:58 ` Pavel Dovgalyuk
2020-05-18 11:24 ` Philippe Mathieu-Daudé
2020-05-18 16:14 ` Alex Bennée
2020-05-19 5:40 ` Pavel Dovgalyuk
2020-05-19 10:43 Pavel Dovgalyuk
2020-05-21 13:47 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.