Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4634147ybv; Wed, 26 Feb 2020 00:18:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzliPfrSIX5p+/z1mwv72yreeC8Jrz9JHKC5LFiAXeGQwd/ssxxegsoKchm83qDXG+wZDf9 X-Received: by 2002:aca:330b:: with SMTP id z11mr2037562oiz.96.1582705126406; Wed, 26 Feb 2020 00:18:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582705126; cv=none; d=google.com; s=arc-20160816; b=sGuPe4Vvpe9g2bZI0vtxjKyQaSAplih9dGxXZBM9wwtWT5x78lbCiK4KTD3q4JA1Ic SSFfIE8347Lk1C9gXsx91qpGxWnjCKdrRnWcWfJrzzTBiwtz3zmJiokE/TnriYShT0sH LHWQlnrjmxEJr7k0p4PEGe80HOnXQYIOxvLZ5Lb5Z9Evo4yryzIIn47NMNYWKyMo1zW1 0TLtVJX/+xL2xqV30X1bJlpr5FpZwg8eFFUuLM2Rpx+83xjcM1vyFOVwDusFKcaGY0Gg QtYKnDsUWZjmpEG7TXQ1EHTuwpofp92+yKX5dD8nJvdv1FyxzqmQmhGB0DIYb3iETYe5 3QoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2MwOqkNX2qPgKsky0vnBn63NQXbYgA+3jDCa4bEWSLA=; b=Rm8Eu6NcDZAlxn1Bfv5oDMIFQckhbJcn3AVkGZwx7KExbDEZcMqRrPPMAHpKNeIiBJ 2A3ma1m1eTW0h0+AIerIxTmzBhvTt0efH1a3o2Al9zGzw1xm+0Qaesh0pzvBdklvb6Cs D9WheTXa+Z081NDbGt2FoYI39xkazOrz/iFqVna9yvTxi5+WvclzybRFwrzI5yOx8QJJ aHKGzZu3mlRrK/Vr/3oh7uwA58TBObae855F+wqgdpGjMqWPujPEkXdigMDSjafZzUZZ KNycCZCg8xV0Yvc83nZyfuUShs2R+xszSATxk3RFN4SzOBlXx7uzyMdQpw9zQtXqJww0 UsSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="U/pW6XQU"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l5si839987otf.37.2020.02.26.00.18.34; Wed, 26 Feb 2020 00:18:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="U/pW6XQU"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727335AbgBZIRi (ORCPT + 99 others); Wed, 26 Feb 2020 03:17:38 -0500 Received: from merlin.infradead.org ([205.233.59.134]:40934 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727247AbgBZIRi (ORCPT ); Wed, 26 Feb 2020 03:17:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=2MwOqkNX2qPgKsky0vnBn63NQXbYgA+3jDCa4bEWSLA=; b=U/pW6XQUfiLQEMgz0/wSHoufYv EVDeAAnLao33RfLssNi6hTTuKi4khIGdhNORXZz+klZNoxgsUs1S78UffMNrld1iw32wETQQj33Tu 0IxA9+f3XNzkCVPzF0rSdGhVqNOP/d+BnE//GY5VDOmVrYiulbXarXSgiRSpwMdzl3rom5qrRlrId 4VF7jbqb1O2JrYWzp0ws/EVpjk3GKRyUZZcLI54gotJiMj0DvJ94uqwdNVPgZieNyG3MxsjsSmyOU X/Tio/auZreshbks/HFGuSlGvB4Fg7zU5Av8FIcaWCrJ1d7g+N7Fk4aag/oa0/ZGUCL8SAUIOF2L7 dEPAFpTA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1j6rsl-0007Yd-Uv; Wed, 26 Feb 2020 08:17:28 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1A33F300478; Wed, 26 Feb 2020 09:15:30 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5AA91203CBB5F; Wed, 26 Feb 2020 09:17:26 +0100 (CET) Date: Wed, 26 Feb 2020 09:17:26 +0100 From: Peter Zijlstra To: Andy Lutomirski Cc: Thomas Gleixner , LKML , x86@kernel.org, Steven Rostedt , Brian Gerst , Juergen Gross , Paolo Bonzini , Arnd Bergmann Subject: Re: [patch 4/8] x86/entry: Move irq tracing on syscall entry to C-code Message-ID: <20200226081726.GQ18400@hirez.programming.kicks-ass.net> References: <20200225220801.571835584@linutronix.de> <20200225221305.605144982@linutronix.de> <6c4188c7-558e-b225-5a41-2ffaa5fa120e@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6c4188c7-558e-b225-5a41-2ffaa5fa120e@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 25, 2020 at 09:43:46PM -0800, Andy Lutomirski wrote: > On 2/25/20 2:08 PM, Thomas Gleixner wrote: > > Now that the C entry points are safe, move the irq flags tracing code into > > the entry helper. > > I'm so confused. > > > > > Signed-off-by: Thomas Gleixner > > --- > > arch/x86/entry/common.c | 5 +++++ > > arch/x86/entry/entry_32.S | 12 ------------ > > arch/x86/entry/entry_64.S | 2 -- > > arch/x86/entry/entry_64_compat.S | 18 ------------------ > > 4 files changed, 5 insertions(+), 32 deletions(-) > > > > --- a/arch/x86/entry/common.c > > +++ b/arch/x86/entry/common.c > > @@ -57,6 +57,11 @@ static inline void enter_from_user_mode( > > */ > > static __always_inline void syscall_entry_fixups(void) > > { > > + /* > > + * Usermode is traced as interrupts enabled, but the syscall entry > > + * mechanisms disable interrupts. Tell the tracer. > > + */ > > + trace_hardirqs_off(); > > Your earlier patches suggest quite strongly that tracing isn't safe > until enter_from_user_mode(). But trace_hardirqs_off() calls > trace_irq_disable_rcuidle(), which looks [0] like a tracepoint. > > Did you perhaps mean to do this *after* enter_from_user_mode()? aside from the fact that enter_from_user_mode() itself also has a tracepoint, the crucial detail is that we must not trace/kprobe the function calling this. Specifically for #PF, because we need read_cr2() before this. See later patches.