From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJfGw-0000Oi-PU for qemu-devel@nongnu.org; Thu, 14 Jan 2016 05:36:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJfGr-0003Ve-QC for qemu-devel@nongnu.org; Thu, 14 Jan 2016 05:36:54 -0500 Received: from out1134-211.mail.aliyun.com ([42.120.134.211]:62669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJfGr-0003VS-E0 for qemu-devel@nongnu.org; Thu, 14 Jan 2016 05:36:49 -0500 References: <1452751422-11624-1-git-send-email-chengang@emindsoft.com.cn> <569777CB.5060807@emindsoft.com.cn> From: Chen Gang Message-ID: <56977A39.8060405@emindsoft.com.cn> Date: Thu, 14 Jan 2016 18:36:41 +0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] translate-all.c: Remove writable protection feature for tb_alloc_page() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Richard Henderson , QEMU Developers , Peter Crosthwaite On 2016年01月14日 18:30, Peter Maydell wrote: > On 14 January 2016 at 10:26, Chen Gang wrote: >> On 2016年01月14日 18:05, Peter Maydell wrote: >>> If we don't mark the page as non-writeable when we generate a TB >>> from it, how do we detect when guest code later writes to that >>> page (which means we need to invalidate the TB) ? >>> >> >> For me, what you said above sounds reasonable, at present, that's really >> valuable to me :-) >> >> I guess, you also mean: our qemu will catch the host page fault signal >> and invalidate the TB. > > Yes, this is how it works for user-mode. (For softmmu we can catch > writes and send them via the slow path which does the check for > whether TBs need to be invalidated; for linux-user we have no > emulated MMU so we must rely on the host kernel sending us the > SIGSEGV.) The bit of code that does this is at the top of > handle_cpu_signal(): > > if (is_write && h2g_valid(address) > && page_unprotect(h2g(address), pc, puc)) { > return 1; > } > OK, thank you very much! :-) Thanks. -- Chen Gang (陈刚) Open, share, and attitude like air, water, and life which God blessed