From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754145Ab3KAPVL (ORCPT ); Fri, 1 Nov 2013 11:21:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34525 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753397Ab3KAPVK (ORCPT ); Fri, 1 Nov 2013 11:21:10 -0400 Date: Fri, 1 Nov 2013 16:22:32 +0100 From: Oleg Nesterov To: Namhyung Kim Cc: Steven Rostedt , Namhyung Kim , Masami Hiramatsu , Hyeoncheol Lee , Hemant Kumar , LKML , Srikar Dronamraju , "zhangwei(Jovi)" , Arnaldo Carvalho de Melo Subject: Re: [PATCH 10/13] tracing/uprobes: Fetch args before reserving a ring buffer Message-ID: <20131101152232.GA2703@redhat.com> References: <1383029621-7384-1-git-send-email-namhyung@kernel.org> <1383029621-7384-11-git-send-email-namhyung@kernel.org> <20131101150910.GA18278@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131101150910.GA18278@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/01, Oleg Nesterov wrote: > > Hi Namhyung, > > Sorry if this was already discussed. But I can't really understand > the idea of this per-cpu buffer... > > On 10/29, Namhyung Kim wrote: > > > > Fetching from user space should be done in a non-atomic context. So > > use a per-cpu buffer and copy its content to the ring buffer > > atomically. Note that we can migrate during accessing user memory > > thus use a per-cpu mutex to protect concurrent accesses. > > And if the task migrates or just sleeps in page fault, another task > which hits another uprobe on the same CPU should wait. > > Why we can't simply add trace_uprobe->buffer instead? Only to save > some memory? But every uprobe is very expensive in this sense anyway. Ah, please ignore... handler_chain() is not self-serialized, so tu->buffer needs locking/waiting too. Oleg.