From: David Daney Subject: Re: [PATCH 20/31] mips/kvm: Hook into TLB fault handlers. Date: Fri, 7 Jun 2013 17:15:27 -0700 Message-ID: <51B2779F.3030903@caviumnetworks.com> References: <1370646215-6543-1-git-send-email-ddaney.cavm@gmail.com> <1370646215-6543-21-git-send-email-ddaney.cavm@gmail.com> <51B26E02.8070802@cogentembedded.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: David Daney , , , , Sanjay Lal , , David Daney To: Sergei Shtylyov Return-path: In-Reply-To: <51B26E02.8070802@cogentembedded.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 06/07/2013 04:34 PM, Sergei Shtylyov wrote: > Hello. > > On 06/08/2013 03:03 AM, David Daney wrote: > >> From: David Daney >> >> If the CPU is operating in guest mode when a TLB related excpetion >> occurs, give KVM a chance to do emulation. >> >> Signed-off-by: David Daney >> --- >> arch/mips/mm/fault.c | 8 ++++++++ >> arch/mips/mm/tlbex-fault.S | 6 ++++++ >> 2 files changed, 14 insertions(+) >> >> diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c >> index 0fead53..9391da49 100644 >> --- a/arch/mips/mm/fault.c >> +++ b/arch/mips/mm/fault.c > [...] >> @@ -50,6 +51,13 @@ asmlinkage void __kprobes do_page_fault(struct >> pt_regs *regs, unsigned long writ >> field, regs->cp0_epc); >> #endif >> +#ifdef CONFIG_KVM_MIPSVZ >> + if (test_tsk_thread_flag(current, TIF_GUESTMODE)) { >> + if (mipsvz_page_fault(regs, write, address)) > > Any reason not to collapse these into single *if*? > It makes the conditional call to mipsvz_page_fault() less obvious. Certainly the same semantics can be achieved several different ways. David Daney >> + return; >> + } >> +#endif >> + >> > >