From patchwork Thu Oct 7 11:07:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 67033 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AA489B6F10 for ; Thu, 7 Oct 2010 22:09:25 +1100 (EST) Received: from localhost ([127.0.0.1]:43170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3oLh-0006Lp-CR for incoming@patchwork.ozlabs.org; Thu, 07 Oct 2010 07:09:21 -0400 Received: from [140.186.70.92] (port=52189 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3oJk-0005lM-Ge for qemu-devel@nongnu.org; Thu, 07 Oct 2010 07:07:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P3oJi-0004ft-M4 for qemu-devel@nongnu.org; Thu, 07 Oct 2010 07:07:20 -0400 Received: from mail-ew0-f45.google.com ([209.85.215.45]:61718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P3oJi-0004fT-ES for qemu-devel@nongnu.org; Thu, 07 Oct 2010 07:07:18 -0400 Received: by ewy19 with SMTP id 19so113168ewy.4 for ; Thu, 07 Oct 2010 04:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=O/YUgRd4nT6YogTuEzOMDOBXkaf0cAqeIwj4oLJKI6w=; b=fPCj8gAov1UXIXpuZrI7aGvh9Y6clJVzNrAZ0bpi4YXJE235sitlXw9rnI2ZkraG5v fBXZyBfQn89hmuNE/4meX7eWN+G1/eGoU2N4sKtmN7rWCBs1RFBAE6JTeMgLsoI1OL+9 pEhjsuWrT/bs32JR2aAq+z0eGNfiMfhgNF4dU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=fd7U+mp/Wrjecm8tJ43GoVkd6b5wguYyJcx0SQ3XWw9b3aO3HGGgX+pizv70R8dWZ8 uGG6zzkHxHXhW+4ulHq4TMlnON1jLxEwwk6dy/85olxhsfY41EEmv3TZX8gMUQmwF483 4ExP/SOyJ0c5rdhP4aE3YN9mVDqetVDYottJw= Received: by 10.213.19.74 with SMTP id z10mr350477eba.37.1286449636958; Thu, 07 Oct 2010 04:07:16 -0700 (PDT) Received: from localhost (h59ec3266.selukar.dyn.perspektivbredband.net [89.236.50.102]) by mx.google.com with ESMTPS id u9sm3247501eeh.17.2010.10.07.04.07.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 07 Oct 2010 04:07:15 -0700 (PDT) Date: Thu, 7 Oct 2010 13:07:13 +0200 From: "Edgar E. Iglesias" To: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 07/11] cris: avoid write only variables Message-ID: <20101007110713.GE16104@laped.lan> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Blue Swirl , qemu-devel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Thu, Oct 07, 2010 at 12:08:05PM +0200, Markus Armbruster wrote: > Blue Swirl writes: > > > Compiling with GCC 4.6.0 20100925 produced warnings: > > /src/qemu/target-cris/op_helper.c: In function 'helper_movl_sreg_reg': > > /src/qemu/target-cris/op_helper.c:145:8: error: variable 'tlb_v' set > > but not used [-Werror=unused-but-set-variable] > > In file included from /src/qemu/target-cris/translate.c:3154:0: > > /src/qemu/target-cris/translate_v10.c: In function 'dec10_prep_move_m': > > /src/qemu/target-cris/translate_v10.c:111:22: error: variable 'rd' set > > but not used [-Werror=unused-but-set-variable] > > > > Fix by making the variable declarations and their uses also conditional > > to debug definition, delete rd. > > > > Signed-off-by: Blue Swirl > > --- > > target-cris/op_helper.c | 6 ++++++ > > target-cris/translate_v10.c | 5 ++--- > > 2 files changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c > > index a60da94..28c79b1 100644 > > --- a/target-cris/op_helper.c > > +++ b/target-cris/op_helper.c > > @@ -142,7 +142,9 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) > > uint32_t idx; > > uint32_t lo, hi; > > uint32_t vaddr; > > +#ifdef CRIS_OP_HELPER_DEBUG > > int tlb_v; > > +#endif > > > > idx = set = env->sregs[SFR_RW_MM_TLB_SEL]; > > set >>= 4; > > @@ -157,13 +159,17 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) > > vaddr = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].hi, > > 13, 31); > > vaddr <<= TARGET_PAGE_BITS; > > +#ifdef CRIS_OP_HELPER_DEBUG > > tlb_v = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo, > > 3, 3); > > +#endif > > env->tlbsets[srs - 1][set][idx].lo = lo; > > env->tlbsets[srs - 1][set][idx].hi = hi; > > > > +#ifdef CRIS_OP_HELPER_DEBUG > > D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", > > vaddr, tlb_v, env->pc); > > +#endif > > tlb_flush_page(env, vaddr); > > } > > } > > Could we eliminate the bothersome variable instead? > > diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c > index a60da94..94e3e27 100644 > --- a/target-cris/op_helper.c > +++ b/target-cris/op_helper.c > @@ -142,7 +142,6 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) > uint32_t idx; > uint32_t lo, hi; > uint32_t vaddr; > - int tlb_v; > > idx = set = env->sregs[SFR_RW_MM_TLB_SEL]; > set >>= 4; > @@ -157,13 +156,14 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) > vaddr = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].hi, > 13, 31); > vaddr <<= TARGET_PAGE_BITS; > - tlb_v = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo, > + D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", > + vaddr, > + EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo, > 3, 3); > + env->pc); > env->tlbsets[srs - 1][set][idx].lo = lo; > env->tlbsets[srs - 1][set][idx].hi = hi; > > - D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", > - vaddr, tlb_v, env->pc); > tlb_flush_page(env, vaddr); > } > } Hi, Sorry for the late answer. Markus, I agree that removing tlb_v would have been better than ifdefs, but i think that the intent I originally had in mind was that there should not be a need to flush the entry from the QEMU TLB if the old guest entry was not valid. The following patch works on my side: The target-cris/translate_v10.c hunk looks good. Blue, can you incorporate the tlb_v change in your patch set? Or if you prefer, I can commit that part on my side. Cheers diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c index a60da94..be9eb06 100644 --- a/target-cris/op_helper.c +++ b/target-cris/op_helper.c @@ -164,7 +164,9 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", vaddr, tlb_v, env->pc); - tlb_flush_page(env, vaddr); + if (tlb_v) { + tlb_flush_page(env, vaddr); + } } } #endif