qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Glauber Costa" <glommer@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 5/6] isolate mmu code in arch-specific function
Date: Tue, 27 May 2008 12:42:16 -0300	[thread overview]
Message-ID: <5d6222a80805270842i47dbd77eh22d7f8867e41ba34@mail.gmail.com> (raw)
In-Reply-To: <483C291C.2040809@bellard.org>

On Tue, May 27, 2008 at 12:30 PM, Fabrice Bellard <fabrice@bellard.org> wrote:
> This is not the right solution for two reasons:
> - This part of the code is speed critical, so the function must be at least
> static inline.
> - The related code is never used.
>
> So just removing the piece of code is the right solution :-)

If it can really be safely removed, this sounds like the best solution
to me by far.

> Fabrice.
>
> Glauber Costa wrote:
>>
>> Simplify cpu_exec by removing a TARGET_I386 block, responsible
>> for conditionally resetting the mmu, and enclosing it inside
>> a function.
>> ---
>>  cpu-exec.c            |   17 +----------------
>>  exec-all.h            |    1 +
>>  target-alpha/helper.c |    1 +
>>  target-arm/helper.c   |    1 +
>>  target-cris/helper.c  |    1 +
>>  target-i386/helper.c  |   19 +++++++++++++++++++
>>  target-m68k/helper.c  |    2 ++
>>  target-mips/helper.c  |    1 +
>>  target-ppc/helper.c   |    1 +
>>  target-sh4/helper.c   |    1 +
>>  target-sparc/helper.c |    2 ++
>>  11 files changed, 31 insertions(+), 16 deletions(-)
>>
>> Index: qemu/cpu-exec.c
>> ===================================================================
>> --- qemu.orig/cpu-exec.c
>> +++ qemu/cpu-exec.c
>> @@ -432,15 +432,7 @@ int cpu_exec(CPUState *env1)
>>  #endif
>>                 next_tb = tcg_qemu_tb_exec(tc_ptr);
>>                 env->current_tb = NULL;
>> -                /* reset soft MMU for next block (it can currently
>> -                   only be set by a memory fault) */
>> -#if defined(TARGET_I386) && !defined(CONFIG_SOFTMMU)
>> -                if (env->hflags & HF_SOFTMMU_MASK) {
>> -                    env->hflags &= ~HF_SOFTMMU_MASK;
>> -                    /* do not allow linking to another block */
>> -                    next_tb = 0;
>> -                }
>> -#endif
>> +                cpu_reset_mmu(env);
>>  #if defined(USE_KQEMU)
>>  #define MIN_CYCLE_BEFORE_SWITCH (100 * 1000)
>>                 if (kqemu_is_ok(env) &&
>> @@ -448,6 +440,7 @@ int cpu_exec(CPUState *env1)
>>                     cpu_loop_exit();
>>                 }
>>  #endif
>> +
>>             } /* for(;;) */
>>         } else {
>>             env_to_regs();
>> Index: qemu/exec-all.h
>> ===================================================================
>> --- qemu.orig/exec-all.h
>> +++ qemu/exec-all.h
>> @@ -93,6 +93,7 @@ void reset_tb(void);
>>   void cpu_load_flags(CPUState *env);
>>  void cpu_put_flags(CPUState *env);
>> +void cpu_reset_mmu(CPUState *env);
>>   int page_unprotect(target_ulong address, unsigned long pc, void *puc);
>>  void tb_invalidate_phys_page_range(target_phys_addr_t start,
>> target_phys_addr_t end,
>> Index: qemu/target-alpha/helper.c
>> ===================================================================
>> --- qemu.orig/target-alpha/helper.c
>> +++ qemu/target-alpha/helper.c
>> @@ -456,6 +456,7 @@ void cpu_dump_EA (target_ulong EA)
>>  int cpu_info_ip(CPUState *env, char *buf) { return 0; }
>>  void cpu_load_flags(CPUState *env) {}
>>  void cpu_put_flags(CPUState *env) {}
>> +void cpu_reset_mmu(CPUState *env) {}
>>   void arch_handle_interrupt_request(CPUState *env)
>>  {
>> Index: qemu/target-arm/helper.c
>> ===================================================================
>> --- qemu.orig/target-arm/helper.c
>> +++ qemu/target-arm/helper.c
>> @@ -2527,6 +2527,7 @@ int cpu_info_ip(CPUState *env, char *buf
>>  void cpu_load_flags(CPUState *env) { }
>>  /* XXX: Save/restore host fpu exception state?.  */
>>  void cpu_put_flags(CPUState *env) { }
>> +void cpu_reset_mmu(CPUState *env) {}
>>   void arch_handle_interrupt_request(CPUState *env)
>>  {
>> Index: qemu/target-cris/helper.c
>> ===================================================================
>> --- qemu.orig/target-cris/helper.c
>> +++ qemu/target-cris/helper.c
>> @@ -187,6 +187,7 @@ target_phys_addr_t cpu_get_phys_page_deb
>>  int  cpu_info_ip(CPUState *env, char *buf) { return 0; }
>>  void cpu_load_flags(CPUState *env) {}
>>  void cpu_put_flags(CPUState *env) {}
>> +void cpu_reset_mmu(CPUState *env) {}
>>   void arch_handle_interrupt_request(CPUState *env)
>>  {
>> Index: qemu/target-i386/helper.c
>> ===================================================================
>> --- qemu.orig/target-i386/helper.c
>> +++ qemu/target-i386/helper.c
>> @@ -4755,6 +4755,18 @@ void cpu_put_flags(CPUState *env)
>>     env->eflags = env->eflags | cc_table[CC_OP].compute_all() | (DF &
>> DF_MASK);
>>  }
>>  +void cpu_reset_mmu(CPUState *env)
>> +{
>> +    /* reset soft MMU for next block (it can currently
>> +       only be set by a memory fault) */
>> +#if !defined(CONFIG_SOFTMMU)
>> +    if (env->hflags & HF_SOFTMMU_MASK) {
>> +        env->hflags &= ~HF_SOFTMMU_MASK;
>> +        /* do not allow linking to another block */
>> +        reset_tb();
>> +    }
>> +#endif
>> +}
>>  #if defined(CONFIG_USER_ONLY)
>>   void helper_vmrun(void) Index: qemu/target-m68k/helper.c
>> ===================================================================
>> --- qemu.orig/target-m68k/helper.c
>> +++ qemu/target-m68k/helper.c
>> @@ -355,6 +355,8 @@ void cpu_put_flags(CPUState *env)
>>               | env->cc_dest | (env->cc_x << 4);
>>  }
>>  +void cpu_reset_mmu(CPUState *env) {}
>> +
>>  void arch_handle_interrupt_request(CPUState *env)
>>  {
>>     if (env->interrupt_request & CPU_INTERRUPT_HARD
>> Index: qemu/target-mips/helper.c
>> ===================================================================
>> --- qemu.orig/target-mips/helper.c
>> +++ qemu/target-mips/helper.c
>> @@ -645,6 +645,7 @@ int cpu_info_ip(CPUState *env, char *buf
>>   void cpu_put_flags(CPUState *env) { }
>>  void cpu_load_flags(CPUState *env) { }
>> +void cpu_reset_mmu(CPUState *env) { }
>>   void arch_handle_interrupt_request(CPUState *env)
>>  {
>> Index: qemu/target-ppc/helper.c
>> ===================================================================
>> --- qemu.orig/target-ppc/helper.c
>> +++ qemu/target-ppc/helper.c
>> @@ -2997,6 +2997,7 @@ int cpu_info_ip(CPUState *env, char *buf
>>   void cpu_load_flags(CPUState *env) { }
>>  void cpu_put_flags(CPUState *env) { }
>> +void cpu_reset_mmu(CPUState *env) { }
>>   void arch_handle_interrupt_request(CPUState *env)
>>  {
>> Index: qemu/target-sh4/helper.c
>> ===================================================================
>> --- qemu.orig/target-sh4/helper.c
>> +++ qemu/target-sh4/helper.c
>> @@ -538,6 +538,7 @@ void cpu_load_tlb(CPUState * env)
>>  int  cpu_info_ip(CPUState *env, char *buf) { return 0; }
>>  void cpu_load_flags(CPUState *env) {}
>>  void cpu_put_flags(CPUState *env) {}
>> +void cpu_reset_mmu(CPUState *env) {}
>>   void arch_handle_interrupt_request(CPUState *env)
>>  {
>> Index: qemu/target-sparc/helper.c
>> ===================================================================
>> --- qemu.orig/target-sparc/helper.c
>> +++ qemu/target-sparc/helper.c
>> @@ -1340,6 +1340,8 @@ void cpu_put_flags(CPUState *env)
>>  #endif
>>  }
>>  +void cpu_reset_mmu(CPUState *env) {}
>> +
>>  #ifdef TARGET_SPARC64
>>  #if !defined(CONFIG_USER_ONLY)
>>  #include "qemu-common.h"
>>
>>
>>
>
>
>
>



-- 
Glauber Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

  reply	other threads:[~2008-05-27 15:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-27 15:18 [Qemu-devel] [PATCH 0/6] simplify cpu-exec new spin Glauber Costa
2008-05-27 15:18 ` [Qemu-devel] [PATCH 1/6] simplify cpu_exec Glauber Costa
2008-05-27 15:18   ` [Qemu-devel] [PATCH 2/6] Push common interrupt variables to cpu-defs.h Glauber Costa
2008-05-27 15:18     ` [Qemu-devel] [PATCH 3/6] use halted attribute for i386 too Glauber Costa
2008-05-27 15:18       ` [Qemu-devel] [PATCH 4/6] simply cpu_exec further Glauber Costa
2008-05-27 15:18         ` [Qemu-devel] [PATCH 5/6] isolate mmu code in arch-specific function Glauber Costa
2008-05-27 15:18           ` [Qemu-devel] [PATCH 6/6] cpu-exec-dump Glauber Costa
2008-05-27 15:38             ` Paul Brook
2008-05-27 15:30           ` [Qemu-devel] [PATCH 5/6] isolate mmu code in arch-specific function Fabrice Bellard
2008-05-27 15:42             ` Glauber Costa [this message]
2008-05-27 15:36           ` Paul Brook
2008-05-27 16:18         ` [Qemu-devel] [PATCH 4/6] simply cpu_exec further Blue Swirl
2008-05-27 16:27           ` Glauber Costa
2008-05-27 15:34       ` [Qemu-devel] [PATCH 3/6] use halted attribute for i386 too Fabrice Bellard
2008-05-27 16:10         ` Blue Swirl
2008-05-27 21:49           ` Glauber Costa
2008-05-27 16:25         ` Glauber Costa
2008-05-27 21:21           ` Fabrice Bellard
2008-05-27 15:39     ` [Qemu-devel] [PATCH 2/6] Push common interrupt variables to cpu-defs.h Fabrice Bellard
2008-05-27 15:33   ` [Qemu-devel] [PATCH 1/6] simplify cpu_exec Paul Brook
2008-05-27 16:05     ` Blue Swirl
2008-05-27 15:37   ` Fabrice Bellard

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=5d6222a80805270842i47dbd77eh22d7f8867e41ba34@mail.gmail.com \
    --to=glommer@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).