From: Thiemo Seufer <ths@networkno.de>
To: andrzej zaborowski <balrogg@gmail.com>
Cc: Paul Brook <paul@codesourcery.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC] Ensure SIGALRM causes a cpu_loop_exit
Date: Sun, 2 Dec 2007 16:42:05 +0000 [thread overview]
Message-ID: <20071202164204.GD617@networkno.de> (raw)
In-Reply-To: <fb249edb0711241513t16a6074ekb472850a14dd30a5@mail.gmail.com>
andrzej zaborowski wrote:
> On 24/11/2007, Paul Brook <paul@codesourcery.com> wrote:
> > > There is a chance that when using "unix" or "dynticks" clock, the
> > > signal arrives when no cpu is executing.
>
> How about this version, this one touches vl.c only:
Any reason why this isn't in CVS?
Thiemo
> --- a/vl.c
> +++ b/vl.c
> @@ -236,6 +236,10 @@ const char *prom_envs[MAX_PROM_ENVS];
> struct bt_piconet_s *local_piconet;
> struct modem_ops_s modem_ops;
>
> +static CPUState *cur_cpu;
> +static CPUState *next_cpu;
> +static int event_pending;
> +
> #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
>
> /***********************************************************/
> @@ -1183,16 +1187,16 @@ static void host_alarm_handler(int host_signum)
> struct qemu_alarm_win32 *data = ((struct
> qemu_alarm_timer*)dwUser)->priv;
> SetEvent(data->host_alarm);
> #endif
> - CPUState *env = cpu_single_env;
> - if (env) {
> - /* stop the currently executing cpu because a timer occured */
> - cpu_interrupt(env, CPU_INTERRUPT_EXIT);
> + CPUState *env = next_cpu;
> +
> + /* stop the currently executing cpu because a timer occured */
> + cpu_interrupt(env, CPU_INTERRUPT_EXIT);
> #ifdef USE_KQEMU
> - if (env->kqemu_enabled) {
> - kqemu_cpu_interrupt(env);
> - }
> -#endif
> + if (env->kqemu_enabled) {
> + kqemu_cpu_interrupt(env);
> }
> +#endif
> + event_pending = 1;
> }
> }
>
> @@ -7168,8 +7172,6 @@ void main_loop_wait(int timeout)
>
> }
>
> -static CPUState *cur_cpu;
> -
> static int main_loop(void)
> {
> int ret, timeout;
> @@ -7179,15 +7181,13 @@ static int main_loop(void)
> CPUState *env;
>
> cur_cpu = first_cpu;
> + next_cpu = cur_cpu->next_cpu ?: first_cpu;
> for(;;) {
> if (vm_running) {
>
> - env = cur_cpu;
> for(;;) {
> /* get next cpu */
> - env = env->next_cpu;
> - if (!env)
> - env = first_cpu;
> + env = next_cpu;
> #ifdef CONFIG_PROFILER
> ti = profile_getclock();
> #endif
> @@ -7195,6 +7195,12 @@ static int main_loop(void)
> #ifdef CONFIG_PROFILER
> qemu_time += profile_getclock() - ti;
> #endif
> + next_cpu = env->next_cpu ?: first_cpu;
> + if (event_pending) {
> + ret = EXCP_INTERRUPT;
> + event_pending = 0;
> + break;
> + }
> if (ret == EXCP_HLT) {
> /* Give the next CPU a chance to run. */
> cur_cpu = env;
>
>
>
next prev parent reply other threads:[~2007-12-02 16:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-23 22:50 [Qemu-devel] [RFC] Ensure SIGALRM causes a cpu_loop_exit andrzej zaborowski
2007-11-23 23:43 ` Paul Brook
2007-11-24 23:13 ` andrzej zaborowski
2007-12-02 16:42 ` Thiemo Seufer [this message]
2007-12-03 3:06 ` andrzej zaborowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071202164204.GD617@networkno.de \
--to=ths@networkno.de \
--cc=balrogg@gmail.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.