From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:40784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjoRw-0005qW-Ju for qemu-devel@nongnu.org; Wed, 16 Jan 2019 11:53:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjoRv-0006bt-L0 for qemu-devel@nongnu.org; Wed, 16 Jan 2019 11:53:56 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:41685) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjoRv-0006ah-7B for qemu-devel@nongnu.org; Wed, 16 Jan 2019 11:53:55 -0500 Date: Wed, 16 Jan 2019 11:53:50 -0500 From: "Emilio G. Cota" Message-ID: <20190116165350.GA21932@flamenco> References: <20190114165017.27298-1-cota@braap.org> <20190114165017.27298-2-cota@braap.org> <87fttszydz.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87fttszydz.fsf@linaro.org> Subject: Re: [Qemu-devel] [PATCH v6 1/3] cputlb: do not evict empty entries to the vtlb List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex =?iso-8859-1?Q?Benn=E9e?= Cc: qemu-devel@nongnu.org, Richard Henderson On Wed, Jan 16, 2019 at 10:32:08 +0000, Alex Bennée wrote: > > Emilio G. Cota writes: > > > Currently we evict an entry to the victim TLB when it doesn't match > > the current address. But it could be that there's no match because > > the current entry is empty (i.e. all -1's, for instance via tlb_flush). > > Do not evict the entry to the vtlb in that case. > > > > This change will help us keep track of the TLB's use rate, which > > we'll use to implement a policy for dynamic TLB sizing. > > > > Reviewed-by: Alex Bennée > > Reviewed-by: Richard Henderson > > Signed-off-by: Emilio G. Cota > > --- > > include/exec/cpu-all.h | 9 +++++++++ > > accel/tcg/cputlb.c | 2 +- > > 2 files changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h > > index 117d2fbbca..e21140049b 100644 > > --- a/include/exec/cpu-all.h > > +++ b/include/exec/cpu-all.h > > @@ -362,6 +362,15 @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr) > > return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK); > > } > > > > +/** > > + * tlb_entry_is_empty - return true if the entry is not in use > > + * @te: pointer to CPUTLBEntry > > + */ > > +static inline bool tlb_entry_is_empty(const CPUTLBEntry *te) > > +{ > > + return te->addr_read == -1 && te->addr_write == -1 && te->addr_code == -1; > > +} > > + > > This breaks on a --disable-tcg build. I think the whole block needs to > be in a: > > #if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG) > > now. Good catch, thanks! I'll send a v7 with this fixed. Thanks, E.