From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28523 invoked by alias); 5 Jan 2006 11:27:03 -0000 Received: (qmail 28517 invoked by uid 22791); 5 Jan 2006 11:27:02 -0000 X-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_50,DNS_FROM_RFC_ABUSE,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from e3.ny.us.ibm.com (HELO e3.ny.us.ibm.com) (32.97.182.143) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 05 Jan 2006 11:27:01 +0000 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e3.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id k05BQwur028531 for ; Thu, 5 Jan 2006 06:26:58 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.12.10/NCO/VERS6.8) with ESMTP id k05BQwbx056556 for ; Thu, 5 Jan 2006 06:26:58 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11/8.13.3) with ESMTP id k05BQwYu014511 for ; Thu, 5 Jan 2006 06:26:58 -0500 Received: from newton.in.ibm.com (wks126559wss.in.ibm.com [9.182.15.3] (may be forged)) by d01av02.pok.ibm.com (8.12.11/8.12.11) with ESMTP id k05BQul6014478; Thu, 5 Jan 2006 06:26:57 -0500 Received: by newton.in.ibm.com (Postfix, from userid 500) id 2DD91CE3; Thu, 5 Jan 2006 17:00:29 +0530 (IST) Date: Thu, 05 Jan 2006 11:27:00 -0000 From: Prasanna S Panchamukhi To: "Zhang, Yanmin" Cc: systemtap@sources.redhat.com, "Keshavamurthy, Anil S" , "Mao, Bibo" Subject: Re: Review patches of user space kprobe Message-ID: <20060105113029.GF30216@in.ibm.com> Reply-To: prasanna@in.ibm.com References: <8126E4F969BA254AB43EA03C59F44E840464BA59@pdsmsx404> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8126E4F969BA254AB43EA03C59F44E840464BA59@pdsmsx404> User-Agent: Mutt/1.4.1i X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q1/txt/msg00018.txt.bz2 > The 4th patch is to avoid probes misses in smp environment. I just have > some initial comments because the patch is not complete. > > >>+ > >>+ if (vma->vm_flags & VM_GROWSDOWN) { > >>+ page_addr = PAGE_ALIGN(stack_addr); > It's wrong to use PAGE_ALIGN here. I think mostly page_addr is bigger > than stack_addr. Pls. use stack_addr&PAGE_MASK. This will be fixed in the next release. > > > >>+ if (((stack_addr - sizeof(long long)) - page_addr) > > size) { > Pay attention to the type of stack_add and page_addr. They are unsigned > long. So it's better to change it to: > if ((stack_addr - sizeof(long long)) > (size + page_addr)) { > > And why consider a sizeof(long long) here? > For the safety reasons, some space is left below the stack pointer, so that the probed instruction may use this space while single stepping. > >> { > >>@@ -140,10 +178,13 @@ static inline void prepare_singlestep(st > >> if (p->opcode == BREAKPOINT_INSTRUCTION) > >> regs->eip = (unsigned long)p->addr; > >> else { > >>- if (!kernel_text_address((unsigned long)p->addr)) { > >>- arch_disarm_uprobe(current_uprobe); > >>- regs->eip = (unsigned long)uprobe_addr; > >>- } else > >>+ if (!kernel_text_address((unsigned long)p->addr)) > >>+ uprobe_single_step(current_uprobe, regs); > 1) If uprobe_single_step returns -EFAULT, how does the thread go ahead? > Note the first byte of the original instruction is break now, so the > instruction from the second byte is wrong. As of now it is not be handled but, it can be handled by allowing the page fault to succeed or expanding the stack space or replacing the original instruction if nothing can be done. > 2) If prepare_singlestep succeeds, but later the real instruction of > single step might cause a fatal error, for example, to access illegal > address, then the process will be killed. Would the current > kprobe(uprobe) environment be restored clearly? Such like kprobe_cpu, > kprobe_status and so on. > If its an illegal instruction, kprobe_fault_handler() is given control, so that it can take care of restoring it cleanly. Thanks Prasanna -- Prasanna S Panchamukhi Linux Technology Center India Software Labs, IBM Bangalore Email: prasanna@in.ibm.com Ph: 91-80-25044636