From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933577AbdHYPMA (ORCPT ); Fri, 25 Aug 2017 11:12:00 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:42013 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932414AbdHYPL7 (ORCPT ); Fri, 25 Aug 2017 11:11:59 -0400 Date: Fri, 25 Aug 2017 17:11:57 +0200 (CEST) From: Thomas Gleixner To: Steven Rostedt cc: LKML , Ingo Molnar , Peter Anvin , Peter Zijlstra , Andy Lutomirski , Borislav Petkov Subject: Re: [patch 06/41] x86/traps: Simplify pagefault tracing logic In-Reply-To: <20170825111057.78cb2b10@gandalf.local.home> Message-ID: References: <20170825103103.287814238@linutronix.de> <20170825104413.434023371@linutronix.de> <20170825111057.78cb2b10@gandalf.local.home> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 Aug 2017, Steven Rostedt wrote: > On Fri, 25 Aug 2017 12:31:09 +0200 > Thomas Gleixner wrote: > > > dotraplinkage void notrace > > -trace_do_page_fault(struct pt_regs *regs, unsigned long error_code) > > +do_page_fault(struct pt_regs *regs, unsigned long error_code) > > { > > + unsigned long address = read_cr2(); /* Get the faulting address */ > > + enum ctx_state prev_state; > > + > > /* > > - * The exception_enter and tracepoint processing could > > - * trigger another page faults (user space callchain > > - * reading) and destroy the original cr2 value, so read > > - * the faulting address now. > > + * We must have this function tagged with __kprobes, notrace and call > > + * read_cr2() before calling anything else. To avoid calling any kind > > + * of tracing machinery before we've observed the CR2 value. > > + * > > + * exception_{enter,exit}() contain all sorts of tracepoints. > > */ > > - unsigned long address = read_cr2(); > > - enum ctx_state prev_state; > > + if (trace_irqvectors_enabled()) > > + trace_page_fault_entries(address, regs, error_code); > > > > prev_state = exception_enter(); > > - trace_page_fault_entries(address, regs, error_code); > > I believe you need to keep the tracing after the "exception_enter()", as > for NO_HZ_FULL, that enables RCU again, and the tracepoint needs RCU > enabled. Indeed. Thanks for spotting it.