qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove
@ 2012-11-20 23:52 陳韋任 (Wei-Ren Chen)
  2012-11-21  8:03 ` Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: 陳韋任 (Wei-Ren Chen) @ 2012-11-20 23:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Evgeny Voevodin

  When tb_remove was first commited at fd6ce8f6, there were three different
calls pass different names to offsetof. In current codebase, the other two
calls are replaced with tb_page_remove. There is no need to have a general
tb_remove. Omit passing the third parameter and using tb1->phys_hash_next
directly.

Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
---

v2: Address Peter's comment.
    - place comment used belong tb_remove above tb_phys_invalidate.
    - remove unnecessary bracket.

 exec.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/exec.c b/exec.c
index 8435de0..6343838 100644
--- a/exec.c
+++ b/exec.c
@@ -862,18 +862,16 @@ static void tb_page_check(void)
 
 #endif
 
-/* invalidate one TB */
-static inline void tb_remove(TranslationBlock **ptb, TranslationBlock *tb,
-                             int next_offset)
+static inline void tb_hash_remove(TranslationBlock **ptb, TranslationBlock *tb)
 {
     TranslationBlock *tb1;
     for(;;) {
         tb1 = *ptb;
         if (tb1 == tb) {
-            *ptb = *(TranslationBlock **)((char *)tb1 + next_offset);
+            *ptb = tb1->phys_hash_next;
             break;
         }
-        ptb = (TranslationBlock **)((char *)tb1 + next_offset);
+        ptb = &tb1->phys_hash_next;
     }
 }
 
@@ -929,6 +927,7 @@ static inline void tb_reset_jump(TranslationBlock *tb, int n)
     tb_set_jmp_target(tb, n, (uintptr_t)(tb->tc_ptr + tb->tb_next_offset[n]));
 }
 
+/* invalidate one TB */
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
 {
     CPUArchState *env;
@@ -940,8 +939,7 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
     /* remove the TB from the hash list */
     phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
     h = tb_phys_hash_func(phys_pc);
-    tb_remove(&tb_phys_hash[h], tb,
-              offsetof(TranslationBlock, phys_hash_next));
+    tb_hash_remove(&tb_phys_hash[h], tb);
 
     /* remove the TB from the page list */
     if (tb->page_addr[0] != page_addr) {
-- 
1.7.3.4


-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

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

* Re: [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove
  2012-11-20 23:52 [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove 陳韋任 (Wei-Ren Chen)
@ 2012-11-21  8:03 ` Peter Maydell
  2012-12-10 13:54 ` 陳韋任 (Wei-Ren Chen)
  2012-12-18 16:37 ` Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2012-11-21  8:03 UTC (permalink / raw)
  To: 陳韋任 (Wei-Ren Chen); +Cc: qemu-devel, Evgeny Voevodin

On 20 November 2012 23:52, 陳韋任 (Wei-Ren Chen) <chenwj@iis.sinica.edu.tw> wrote:
>   When tb_remove was first commited at fd6ce8f6, there were three different
> calls pass different names to offsetof. In current codebase, the other two
> calls are replaced with tb_page_remove. There is no need to have a general
> tb_remove. Omit passing the third parameter and using tb1->phys_hash_next
> directly.
>
> Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

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

* Re: [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove
  2012-11-20 23:52 [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove 陳韋任 (Wei-Ren Chen)
  2012-11-21  8:03 ` Peter Maydell
@ 2012-12-10 13:54 ` 陳韋任 (Wei-Ren Chen)
  2012-12-18 16:37 ` Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: 陳韋任 (Wei-Ren Chen) @ 2012-12-10 13:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Peter Maydell, Evgeny Voevodin

  [CC'ed qemu-trivial]

  ping?

On Wed, Nov 21, 2012 at 07:52:48AM +0800, 陳韋任 (Wei-Ren Chen) wrote:
>   When tb_remove was first commited at fd6ce8f6, there were three different
> calls pass different names to offsetof. In current codebase, the other two
> calls are replaced with tb_page_remove. There is no need to have a general
> tb_remove. Omit passing the third parameter and using tb1->phys_hash_next
> directly.
> 
> Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
> ---
> 
> v2: Address Peter's comment.
>     - place comment used belong tb_remove above tb_phys_invalidate.
>     - remove unnecessary bracket.
> 
>  exec.c |   12 +++++-------
>  1 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index 8435de0..6343838 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -862,18 +862,16 @@ static void tb_page_check(void)
>  
>  #endif
>  
> -/* invalidate one TB */
> -static inline void tb_remove(TranslationBlock **ptb, TranslationBlock *tb,
> -                             int next_offset)
> +static inline void tb_hash_remove(TranslationBlock **ptb, TranslationBlock *tb)
>  {
>      TranslationBlock *tb1;
>      for(;;) {
>          tb1 = *ptb;
>          if (tb1 == tb) {
> -            *ptb = *(TranslationBlock **)((char *)tb1 + next_offset);
> +            *ptb = tb1->phys_hash_next;
>              break;
>          }
> -        ptb = (TranslationBlock **)((char *)tb1 + next_offset);
> +        ptb = &tb1->phys_hash_next;
>      }
>  }
>  
> @@ -929,6 +927,7 @@ static inline void tb_reset_jump(TranslationBlock *tb, int n)
>      tb_set_jmp_target(tb, n, (uintptr_t)(tb->tc_ptr + tb->tb_next_offset[n]));
>  }
>  
> +/* invalidate one TB */
>  void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
>  {
>      CPUArchState *env;
> @@ -940,8 +939,7 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
>      /* remove the TB from the hash list */
>      phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
>      h = tb_phys_hash_func(phys_pc);
> -    tb_remove(&tb_phys_hash[h], tb,
> -              offsetof(TranslationBlock, phys_hash_next));
> +    tb_hash_remove(&tb_phys_hash[h], tb);
>  
>      /* remove the TB from the page list */
>      if (tb->page_addr[0] != page_addr) {
> -- 
> 1.7.3.4
> 
> 
> -- 
> Wei-Ren Chen (陳韋任)
> Computer Systems Lab, Institute of Information Science,
> Academia Sinica, Taiwan (R.O.C.)
> Tel:886-2-2788-3799 #1667
> Homepage: http://people.cs.nctu.edu.tw/~chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

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

* Re: [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove
  2012-11-20 23:52 [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove 陳韋任 (Wei-Ren Chen)
  2012-11-21  8:03 ` Peter Maydell
  2012-12-10 13:54 ` 陳韋任 (Wei-Ren Chen)
@ 2012-12-18 16:37 ` Stefan Hajnoczi
  2012-12-20  1:39   ` 陳韋任 (Wei-Ren Chen)
  2 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2012-12-18 16:37 UTC (permalink / raw)
  To: 陳韋任 (Wei-Ren Chen)
  Cc: Peter Maydell, qemu-devel, Evgeny Voevodin

On Wed, Nov 21, 2012 at 07:52:48AM +0800, 陳韋任 (Wei-Ren Chen) wrote:
>   When tb_remove was first commited at fd6ce8f6, there were three different
> calls pass different names to offsetof. In current codebase, the other two
> calls are replaced with tb_page_remove. There is no need to have a general
> tb_remove. Omit passing the third parameter and using tb1->phys_hash_next
> directly.
> 
> Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
> ---
> 
> v2: Address Peter's comment.
>     - place comment used belong tb_remove above tb_phys_invalidate.
>     - remove unnecessary bracket.
> 
>  exec.c |   12 +++++-------
>  1 files changed, 5 insertions(+), 7 deletions(-)

Please rebase onto qemu.git/master.

Stefan

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

* Re: [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove
  2012-12-18 16:37 ` Stefan Hajnoczi
@ 2012-12-20  1:39   ` 陳韋任 (Wei-Ren Chen)
  0 siblings, 0 replies; 5+ messages in thread
From: 陳韋任 (Wei-Ren Chen) @ 2012-12-20  1:39 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Peter Maydell, Evgeny Voevodin, qemu-devel,
	陳韋任 (Wei-Ren Chen)

On Tue, Dec 18, 2012 at 05:37:53PM +0100, Stefan Hajnoczi wrote:
> On Wed, Nov 21, 2012 at 07:52:48AM +0800, 陳韋任 (Wei-Ren Chen) wrote:
> >   When tb_remove was first commited at fd6ce8f6, there were three different
> > calls pass different names to offsetof. In current codebase, the other two
> > calls are replaced with tb_page_remove. There is no need to have a general
> > tb_remove. Omit passing the third parameter and using tb1->phys_hash_next
> > directly.
> > 
> > Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
> > ---
> > 
> > v2: Address Peter's comment.
> >     - place comment used belong tb_remove above tb_phys_invalidate.
> >     - remove unnecessary bracket.
> > 
> >  exec.c |   12 +++++-------
> >  1 files changed, 5 insertions(+), 7 deletions(-)
> 
> Please rebase onto qemu.git/master.

  done. I sent to qemu-trivial this time. :)

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

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

end of thread, other threads:[~2012-12-20  1:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-20 23:52 [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove 陳韋任 (Wei-Ren Chen)
2012-11-21  8:03 ` Peter Maydell
2012-12-10 13:54 ` 陳韋任 (Wei-Ren Chen)
2012-12-18 16:37 ` Stefan Hajnoczi
2012-12-20  1:39   ` 陳韋任 (Wei-Ren Chen)

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).