From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25361 invoked by alias); 24 Nov 2009 16:03:53 -0000 Received: (qmail 25224 invoked by uid 22791); 24 Nov 2009 16:03:51 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Nov 2009 16:03:43 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAOG3frm019225 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 24 Nov 2009 11:03:41 -0500 Received: from [10.11.10.221] (vpn-10-221.rdu.redhat.com [10.11.10.221]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAOG3YH0028293; Tue, 24 Nov 2009 11:03:35 -0500 Message-ID: <4B0C0469.2020903@redhat.com> Date: Tue, 24 Nov 2009 16:03:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-2.7.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: Ingo Molnar CC: Frederic Weisbecker , Ananth N Mavinakayanahalli , lkml , "H. Peter Anvin" , Jim Keniston , Srikar Dronamraju , Christoph Hellwig , Steven Rostedt , Anders Kaseorg , Tim Abbott , Andi Kleen , Jason Baron , Mathieu Desnoyers , systemtap , DLE Subject: Re: [PATCH -tip v5 00/10] kprobes: Kprobes jump optimization support References: <20091123232115.22071.71558.stgit@dhcp-100-2-132.bos.redhat.com> <20091124020315.GA6221@nowhere> <20091124032008.GD6752@nowhere> <20091124075249.GC21991@elte.hu> In-Reply-To: <20091124075249.GC21991@elte.hu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00664.txt.bz2 Ingo Molnar wrote: > > * Frederic Weisbecker wrote: > >> On Tue, Nov 24, 2009 at 03:03:19AM +0100, Frederic Weisbecker wrote: >>> On Mon, Nov 23, 2009 at 06:21:16PM -0500, Masami Hiramatsu wrote: >>>> When the optimized-kprobe is hit before optimization, its handler >>>> changes IP(instruction pointer) to copied code and exits. So, the >>>> instructions which were copied to detour buffer are executed on the detour >>>> buffer. >>> >>> >>> >>> Hm, why is it playing such hybrid game there? >>> If I understand well, we have executed int 3, executed the >>> handler and we jump back to the detour buffer? >>> >> >> I got it, I think. We have instructions to patch. And the above turn >> this area into dead code, safe to patch. >> >> But still, stop_machine() seem to make it not necessary anymore. > > i think 'sending an IPI to all online CPUs' might be an adequate > sequence to make sure patching effects have propagated. I.e. an > smp_call_function() with a dummy function? Hmm, I assume that you mean waiting for all int3 handler. We have to separate below issues: - int3-based multi-bytes code replacement - multi-instruction replacement with int3-detour code The former is implemented on patch 9/10 and 10/10. As you can see, these patches are RFC status, because I'd like to wait for official reply of safeness from processor architects. And it may be able to use a dummy IPI for 2nd IPI because it just for waiting int3 interrupts. But again, it is just estimated that replacing with/recovering from int3 is automatically synchronized... However, at least stop_machine() method is officially described at "7.1.3 Handling Self- and Cross-Modifying Code" on the intel's software developer's manual 3A . So currently we can use it. For the latter issue, as I explained on previous reply, we need to wait all running interrupts including hardware interrupts. Thus I used synchronize_sched(). Thank you, -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: mhiramat@redhat.com