From patchwork Wed Apr 28 02:52:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jun Koi X-Patchwork-Id: 51143 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 8C050B7D40 for ; Wed, 28 Apr 2010 12:54:02 +1000 (EST) Received: from localhost ([127.0.0.1]:34861 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6xOv-0005fP-NV for incoming@patchwork.ozlabs.org; Tue, 27 Apr 2010 22:53:25 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6xOT-0005fA-Kr for qemu-devel@nongnu.org; Tue, 27 Apr 2010 22:52:57 -0400 Received: from [140.186.70.92] (port=38151 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6xOS-0005eY-BS for qemu-devel@nongnu.org; Tue, 27 Apr 2010 22:52:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6xON-0006Sp-7j for qemu-devel@nongnu.org; Tue, 27 Apr 2010 22:52:56 -0400 Received: from mail-iw0-f192.google.com ([209.85.223.192]:35587) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6xON-0006SY-4W for qemu-devel@nongnu.org; Tue, 27 Apr 2010 22:52:51 -0400 Received: by iwn30 with SMTP id 30so2841623iwn.28 for ; Tue, 27 Apr 2010 19:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=ltyZfjKhH2RffyykI87aAS6QJ2lGu4H+RwQSfapkEB4=; b=pSwGEqo7WpsEJManrVZrHu2FtZIBP39YtM/ZMmBUDD5e6PXzK10Mg1GYZrlwc9ZhBO eGze0QDYtNlNyK2ZJM23WzNd94jLXBwV3ffNTH3l/ZQKgOf3JWqoSsDUdjBkfXQqF5jd 55h/IZA3BbegR1MFlAOUCIFtzFE4sl99nIJUw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=vjpmbHp0fm9J2bc4Rtu4RKxkRbuLHjdLYz4exOykxDJXwdjIMJsnMZpw6UvM533fZf oRg3o9xygjU3PUuzzMaFOznzyP556GJ9/A8btRM8MKKUIH0yKu5p/G35knZGWc0eiNTR vYA2+vfGBGHK+ZJmAP2DkN2yNw2q9sU/7d/3s= Received: by 10.231.183.130 with SMTP id cg2mr2160335ibb.92.1272423170095; Tue, 27 Apr 2010 19:52:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.148.208 with HTTP; Tue, 27 Apr 2010 19:52:30 -0700 (PDT) In-Reply-To: References: <4BD72E96.8050406@web.de> From: Jun Koi Date: Wed, 28 Apr 2010 11:52:30 +0900 Message-ID: To: Jan Kiszka X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] Re: [PATCH] A bit optimization for tlb_set_page() 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 Wed, Apr 28, 2010 at 8:48 AM, Jun Koi wrote: > On Wed, Apr 28, 2010 at 3:36 AM, Jan Kiszka wrote: >> Jun Koi wrote: >>> It is not necessary to continue searching for watchpoint when we >>> already found one and setup for handling watchpoint in a search loop >>> in tlb_set_page(). >>> This patch breaks that search loop on then. >> >> Acked-by: Jan Kiszka >> >>> >>> Signed-off-by: Jun Koi >>> >>> diff --git a/exec.c b/exec.c >>> index 14d1fd7..6329775 100644 >>> --- a/exec.c >>> +++ b/exec.c >>> @@ -2240,6 +2240,7 @@ void tlb_set_page(CPUState *env, target_ulong vaddr, >>>              /* TODO: The memory case can be optimized by not trapping >>>                 reads of pages with a write breakpoint.  */ >> >> PS: Don't you also want to address this todo while you are at it? :) >> Do you have any comment on below patch? Thanks, J Dont handle write watchpoints on read-only memory access. This patch also breaks the searching loop for watchpoint once the setup facilities for handling watchpoint later is done. Signed-off-by: Jun Koi diff --git a/exec.c b/exec.c index 14d1fd7..3f2d9ed 100644 --- a/exec.c +++ b/exec.c @@ -2236,10 +2236,12 @@ void tlb_set_page(CPUState *env, target_ulong vaddr, watchpoint trap routines. */ QTAILQ_FOREACH(wp, &env->watchpoints, entry) { if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) { - iotlb = io_mem_watch + paddr; - /* TODO: The memory case can be optimized by not trapping - reads of pages with a write breakpoint. */ - address |= TLB_MMIO; + /* Avoid trapping reads of pages with a write breakpoint. */ + if (!((prot & PAGE_WRITE == 0) && (wp->flags & BP_MEM_WRITE != 0))) { + iotlb = io_mem_watch + paddr; + address |= TLB_MMIO; + break; + } } }