All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] invalid runstate transition: 'prelaunch' -> 'prelaunch'
@ 2016-07-27 19:40 Liviu Ionescu
  2016-07-28 10:22 ` Markus Armbruster
  2016-07-28 10:59 ` Liviu Ionescu
  0 siblings, 2 replies; 3+ messages in thread
From: Liviu Ionescu @ 2016-07-27 19:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

Hi,

I just upgraded GNU ARM Eclipse QEMU to 2.6.0 and ran into a problem.

The console reads:

```
GNU ARM Eclipse 64-bits QEMU v2.6.0 (qemu-system-gnuarmeclipse).
Board: 'STM32F4-Discovery' (ST Discovery kit for STM32F407/417 lines).
Device: 'STM32F407VG' (Cortex-M4 r0p0, MPU), Flash: 1024 kB, RAM: 128 kB.
Command line: 'test' (4 bytes).
Cortex-M4 r0p0 core initialised.
GDB Server listening on: 'tcp::1234'...
Cortex-M4 r0p0 core reset.
... connection accepted from 127.0.0.1.

Execute 'mon system_reset'.

Cortex-M4 r0p0 core reset.
qemu-system-gnuarmeclipse: invalid runstate transition: 'prelaunch' -> 'prelaunch'
```

QEMU is started as a GDB server, and when the GDB client connects (from an Eclipse session), it issues a 'system_reset' command.

The problem occurs in:

```
void runstate_set(RunState new_state)
{
    assert(new_state < RUN_STATE__MAX);

    if (!runstate_valid_transitions[current_run_state][new_state]) {
        error_report("invalid runstate transition: '%s' -> '%s'",
                     RunState_lookup[current_run_state],
                     RunState_lookup[new_state]);
        abort();
    }
    trace_runstate_set(new_state);
    current_run_state = new_state;
}
```

when called from `main_loop_should_exit(void)`:

```
    if (qemu_reset_requested()) {
        pause_all_vcpus();
        qemu_system_reset(VMRESET_REPORT);
        resume_all_vcpus();
        if (!runstate_check(RUN_STATE_RUNNING) &&
                !runstate_check(RUN_STATE_INMIGRATE)) {
            runstate_set(RUN_STATE_PRELAUNCH);
        }
    }
```

I fixed the problem by adding a new transition in the `runstate_transitions_def[]` array:

```
#if defined(CONFIG_GNU_ARM_ECLIPSE)
    { RUN_STATE_PRELAUNCH, RUN_STATE_PRELAUNCH },
#endif /* defined(CONFIG_GNU_ARM_ECLIPSE) */
```

I don't know what these transition states are, but the above missing line might affect other users too.


For completeness, I'm referring to the source files tagged with v2.6.0.


Regards,

Liviu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] invalid runstate transition: 'prelaunch' -> 'prelaunch'
  2016-07-27 19:40 [Qemu-devel] invalid runstate transition: 'prelaunch' -> 'prelaunch' Liviu Ionescu
@ 2016-07-28 10:22 ` Markus Armbruster
  2016-07-28 10:59 ` Liviu Ionescu
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2016-07-28 10:22 UTC (permalink / raw)
  To: Liviu Ionescu; +Cc: qemu-devel, Peter Maydell

Liviu Ionescu <ilg@livius.net> writes:

> Hi,
>
> I just upgraded GNU ARM Eclipse QEMU to 2.6.0 and ran into a problem.
>
> The console reads:
>
> ```
> GNU ARM Eclipse 64-bits QEMU v2.6.0 (qemu-system-gnuarmeclipse).
> Board: 'STM32F4-Discovery' (ST Discovery kit for STM32F407/417 lines).
> Device: 'STM32F407VG' (Cortex-M4 r0p0, MPU), Flash: 1024 kB, RAM: 128 kB.
> Command line: 'test' (4 bytes).
> Cortex-M4 r0p0 core initialised.
> GDB Server listening on: 'tcp::1234'...
> Cortex-M4 r0p0 core reset.
> ... connection accepted from 127.0.0.1.
>
> Execute 'mon system_reset'.
>
> Cortex-M4 r0p0 core reset.
> qemu-system-gnuarmeclipse: invalid runstate transition: 'prelaunch' -> 'prelaunch'
[...]

Looks like you need this one:

commit e92a2d9cb3d8f589c9fe5d2eacc83d8dddea0e16
Author: Li Zhijian <lizhijian@cn.fujitsu.com>
Date:   Thu Apr 14 11:25:52 2016 +0800

    vl: change runstate only if new state is different from current state
    
    Previously, qemu will abort at following scenario:
    (qemu) stop
    (qemu) system_reset
    (qemu) system_reset
    (qemu) 2016-04-13T20:54:38.979158Z qemu-system-x86_64: invalid runstate transition: 'prelaunch' -> 'prelaunch'
    
    Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
    Acked-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-Id: <1460604352-18630-1-git-send-email-lizhijian@cn.fujitsu.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] invalid runstate transition: 'prelaunch' -> 'prelaunch'
  2016-07-27 19:40 [Qemu-devel] invalid runstate transition: 'prelaunch' -> 'prelaunch' Liviu Ionescu
  2016-07-28 10:22 ` Markus Armbruster
@ 2016-07-28 10:59 ` Liviu Ionescu
  1 sibling, 0 replies; 3+ messages in thread
From: Liviu Ionescu @ 2016-07-28 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

Peter,

Can you confirm that adding a new transition definition is ok for the context I'm using it?

I had no problems so far, just wanted to be sure.


Thank you,

Liviu


> On 27 Jul 2016, at 22:40, Liviu Ionescu <ilg@livius.net> wrote:
> 
> Hi,
> 
> I just upgraded GNU ARM Eclipse QEMU to 2.6.0 and ran into a problem.
> 
> The console reads:
> 
> ```
> GNU ARM Eclipse 64-bits QEMU v2.6.0 (qemu-system-gnuarmeclipse).
> Board: 'STM32F4-Discovery' (ST Discovery kit for STM32F407/417 lines).
> Device: 'STM32F407VG' (Cortex-M4 r0p0, MPU), Flash: 1024 kB, RAM: 128 kB.
> Command line: 'test' (4 bytes).
> Cortex-M4 r0p0 core initialised.
> GDB Server listening on: 'tcp::1234'...
> Cortex-M4 r0p0 core reset.
> ... connection accepted from 127.0.0.1.
> 
> Execute 'mon system_reset'.
> 
> Cortex-M4 r0p0 core reset.
> qemu-system-gnuarmeclipse: invalid runstate transition: 'prelaunch' -> 'prelaunch'
> ```
> 
> QEMU is started as a GDB server, and when the GDB client connects (from an Eclipse session), it issues a 'system_reset' command.
> 
> The problem occurs in:
> 
> ```
> void runstate_set(RunState new_state)
> {
>    assert(new_state < RUN_STATE__MAX);
> 
>    if (!runstate_valid_transitions[current_run_state][new_state]) {
>        error_report("invalid runstate transition: '%s' -> '%s'",
>                     RunState_lookup[current_run_state],
>                     RunState_lookup[new_state]);
>        abort();
>    }
>    trace_runstate_set(new_state);
>    current_run_state = new_state;
> }
> ```
> 
> when called from `main_loop_should_exit(void)`:
> 
> ```
>    if (qemu_reset_requested()) {
>        pause_all_vcpus();
>        qemu_system_reset(VMRESET_REPORT);
>        resume_all_vcpus();
>        if (!runstate_check(RUN_STATE_RUNNING) &&
>                !runstate_check(RUN_STATE_INMIGRATE)) {
>            runstate_set(RUN_STATE_PRELAUNCH);
>        }
>    }
> ```
> 
> I fixed the problem by adding a new transition in the `runstate_transitions_def[]` array:
> 
> ```
> #if defined(CONFIG_GNU_ARM_ECLIPSE)
>    { RUN_STATE_PRELAUNCH, RUN_STATE_PRELAUNCH },
> #endif /* defined(CONFIG_GNU_ARM_ECLIPSE) */
> ```
> 
> I don't know what these transition states are, but the above missing line might affect other users too.
> 
> 
> For completeness, I'm referring to the source files tagged with v2.6.0.
> 
> 
> Regards,
> 
> Liviu
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-28 10:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-27 19:40 [Qemu-devel] invalid runstate transition: 'prelaunch' -> 'prelaunch' Liviu Ionescu
2016-07-28 10:22 ` Markus Armbruster
2016-07-28 10:59 ` Liviu Ionescu

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.