From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbHEF-0006MP-8z for qemu-devel@nongnu.org; Tue, 29 Oct 2013 17:53:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbHE9-0000rJ-32 for qemu-devel@nongnu.org; Tue, 29 Oct 2013 17:53:35 -0400 Received: from www11.your-server.de ([213.133.104.11]:46526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbHE8-0000r9-SY for qemu-devel@nongnu.org; Tue, 29 Oct 2013 17:53:28 -0400 Message-ID: <52702E54.5030801@macke.de> Date: Tue, 29 Oct 2013 14:53:24 -0700 From: Sebastian Macke MIME-Version: 1.0 References: <1383073495-5332-1-git-send-email-sebastian@macke.de> <1383073495-5332-7-git-send-email-sebastian@macke.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 06/13] target-openrisc: Remove TLB flush from l.rfe instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Filippov Cc: openrisc@lists.openrisc.net, openrisc@lists.opencores.org, qemu-devel , Ethan Hunt On 29/10/2013 2:01 PM, Max Filippov wrote: > On Tue, Oct 29, 2013 at 11:04 PM, Sebastian Macke wrote: >> At the moment there are two TLBs. The OpenRISC TLB followed >> by the QEMU's own TLB. >> At the end of the TLB miss handler a tlb_flush of QEMUs TLB >> is executed which is exactly what we want to avoid. >> As long as there is no context switch we don't have to flush the TLB. > So this flush was needed in order to clean QEMU TLB in case > DTLB/ITLB translation was enabled/disabled, right? But since you > already have mmu index for nommu operation, wouldn't it be easier > to indicate mmu index correctly for data and code access and drop > this flush? > The mmu index is already set correctly and this patch removes the flush. 1. Problem The problem is if there is a context switch. OpenRISC clears its own small tlb page by page. But this does mean it flushes all pages in the big QEMU TLB. This is the reason why l.rfe instruction clears the tlb which is the instruction used to return to user mode But according to the specification this is wrong. 2. Problem which is the case you mentioned. Your are right, this is one solution and its written in the patchnotes as point 1. But this would not solve the problem No 1. I mentioned in this email. Confused? I am :) Easy: l.rfe is not supposed to clear the tlb. It can but it shouldn't. With this patch I remove the flush and solve all problems by assuming a global tlb flush if you invalidate the first entry of the small OpenRISC TLB.