From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM guest: prevent tracing recursion with kvmclock Date: Tue, 15 Nov 2011 15:45:34 +0200 Message-ID: <4EC26CFE.8010406@redhat.com> References: <1321362075-27115-1-git-send-email-avi@redhat.com> <1321364308.4181.7.camel@frodo> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Gleb Natapov To: Steven Rostedt Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1029 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755711Ab1KONpi (ORCPT ); Tue, 15 Nov 2011 08:45:38 -0500 In-Reply-To: <1321364308.4181.7.camel@frodo> Sender: kvm-owner@vger.kernel.org List-ID: On 11/15/2011 03:38 PM, Steven Rostedt wrote: > On Tue, 2011-11-15 at 15:01 +0200, Avi Kivity wrote: > > Stop tracing when we read the clock, since tracing will also > > want to read the clock, and recurse indefinitely. > > I would rephrase the above. You don't actually stop tracing, you just > don't trace the preempt disable. I would reword that to something like: > > Prevent tracing of preempt_disable() in get_cpu_var() in > kvm_clock_read(). When CONFIG_DEBUG_PREEMPT is enabled, > preempt_disable/enable() are traced and this causes the function_graph > tracer to go into an infinite recursion. By open coding the > preempt_disable() around the get_cpu_var(), we can use the notrace > version which prevents preempt_disable/enable() from being traced and > prevents the recursion. > > Something like the above. Thanks, I adopted your wording. > > > > Based on a similar patch for Xen from Jeremy Fitzhardinge. > > > > Signed-off-by: Avi Kivity > > This was exactly my first thought, but I was thinking it may be better > to have a get_cpu_var_notrace() than to have to open code this stuff. > Maybe there's not that many users that open code is not an issue. I'll > still want to add that recursion protection with the warn on though. > What about function traces? Will any noninlined calls cause the same problem? -- error compiling committee.c: too many arguments to function