Received: from eggs.gnu.org ([208.118.235.92]:59597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ti3oZ-0000AW-Hf for qemu-devel@nongnu.org; Mon, 10 Dec 2012 08:54:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ti3oV-00089A-S7 for qemu-devel@nongnu.org; Mon, 10 Dec 2012 08:54:35 -0500 Date: Mon, 10 Dec 2012 21:54:29 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Message-ID: <20121210135429.GA40858@cs.nctu.edu.tw> References: <20121120235248.GA24638@cs.nctu.edu.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20121120235248.GA24638@cs.nctu.edu.tw> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] exec.c: Use tb1->phys_hash_next directly in tb_remove List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Peter Maydell , Evgeny Voevodin [CC'ed qemu-trivial] ping? On Wed, Nov 21, 2012 at 07:52:48AM +0800, =E9=99=B3=E9=9F=8B=E4=BB=BB (We= i-Ren Chen) wrote: > When tb_remove was first commited at fd6ce8f6, there were three diffe= rent > 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 gene= ral > tb_remove. Omit passing the third parameter and using tb1->phys_hash_ne= xt > directly. >=20 > Signed-off-by: Chen Wei-Ren > --- >=20 > v2: Address Peter's comment. > - place comment used belong tb_remove above tb_phys_invalidate. > - remove unnecessary bracket. >=20 > exec.c | 12 +++++------- > 1 files changed, 5 insertions(+), 7 deletions(-) >=20 > 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) > =20 > #endif > =20 > -/* invalidate one TB */ > -static inline void tb_remove(TranslationBlock **ptb, TranslationBlock = *tb, > - int next_offset) > +static inline void tb_hash_remove(TranslationBlock **ptb, TranslationB= lock *tb) > { > TranslationBlock *tb1; > for(;;) { > tb1 =3D *ptb; > if (tb1 =3D=3D tb) { > - *ptb =3D *(TranslationBlock **)((char *)tb1 + next_offset)= ; > + *ptb =3D tb1->phys_hash_next; > break; > } > - ptb =3D (TranslationBlock **)((char *)tb1 + next_offset); > + ptb =3D &tb1->phys_hash_next; > } > } > =20 > @@ -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_offs= et[n])); > } > =20 > +/* 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_pa= ge_addr_t page_addr) > /* remove the TB from the hash list */ > phys_pc =3D tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK); > h =3D 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); > =20 > /* remove the TB from the page list */ > if (tb->page_addr[0] !=3D page_addr) { > --=20 > 1.7.3.4 >=20 >=20 > --=20 > Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) > 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 --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) 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