Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp423059ybf; Sat, 29 Feb 2020 06:45:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyUPXYG4dY+i9F7CahIaWng6vdjq25dRh3ZtnSZhJhq7eoSA6kL2mehhAPWuIntyPk6YD0q X-Received: by 2002:a9d:7b4e:: with SMTP id f14mr7031737oto.355.1582987519242; Sat, 29 Feb 2020 06:45:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582987519; cv=none; d=google.com; s=arc-20160816; b=Uj1slcTEizNJHvIP0M5SUwnvMd2cvwJoyVT1cS5JB3mDuFD2EmxFIgsRtoRB4aLPE/ 75ki91CAQYvuDD+mU7B1RCkLIBdEvaJkKQUlNWHfsAzzuckJmMl1iaVk8bMHpz6AT04z GJnrQT58NWJSj0PKaXgZqM3uhhNIW65k54X+ezN/1qq1YkxpSdGgIyb2C1LaW99glUHf 5FH+a6wOV2oN9Zjh+0Jno+/ZYcU23ewHKwFNdQYa6bZgvbJvWgzckQuLxL6dgAGgXhc8 BoMUtviuVRX1qmqRt3ZQccpV2v9vdKzzjt6pu2QUvXbJiUTFe85pOIxCA0PY5hU4A6x/ OHig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from; bh=yKz9hvJwNOMDgS3Z87P/F4Q0s6GPOJxH9M+j3B4Bia0=; b=WekjG+Uh/u9Dru7Qcm7+55Rmi/p4dPDolbMlvPxQt8HXVCW84efGlbVY/v83npeL6G NJv3SuoKPUY7dW+CIgq3is9ERq2zSeDo02d7sQwIODab8Z/4EAzXKWU0nbhZB5KoQUS8 jLZHZYocaehiJj7Wi9t/sUWZ2/dIxRH+UZW8zM74XBv6s4gYm60X/SU4zwvQJ6Ds72qH M6kE2IKjKt4zgyUWrREfZfCa6LBbVrWrVVOUWnElguSWYVE8k4vNgjNY6sBwiCy8a+Sq /iIOVSTk4J54li85hDCtbQxkkcwY8lqJNjrikj/Ol3sxqjSKLtjtfmSinYCNHXYA20uY 9Ggg== ARC-Authentication-Results: i=1; mx.google.com; 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 19si3599565oip.93.2020.02.29.06.45.06; Sat, 29 Feb 2020 06:45:19 -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; 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 S1727093AbgB2Ooc convert rfc822-to-8bit (ORCPT + 99 others); Sat, 29 Feb 2020 09:44:32 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:39158 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbgB2Ooc (ORCPT ); Sat, 29 Feb 2020 09:44:32 -0500 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1j83Lg-0001NN-S8; Sat, 29 Feb 2020 15:44:13 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id E0FCF1012C4; Sat, 29 Feb 2020 15:44:10 +0100 (CET) From: Thomas Gleixner To: Andy Lutomirski , Peter Zijlstra Cc: Andy Lutomirski , LKML , x86@kernel.org, Steven Rostedt , Brian Gerst , Juergen Gross , Paolo Bonzini , Arnd Bergmann , "Paul E. McKenney" Subject: Re: [patch 4/8] x86/entry: Move irq tracing on syscall entry to C-code In-Reply-To: <87sgixb00q.fsf@nanos.tec.linutronix.de> References: <20200226081726.GQ18400@hirez.programming.kicks-ass.net> <83D8A083-792A-4A82-985C-CAC33BC702DB@amacapital.net> <87sgixb00q.fsf@nanos.tec.linutronix.de> Date: Sat, 29 Feb 2020 15:44:10 +0100 Message-ID: <87lfolfo79.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thomas Gleixner writes: > Andy Lutomirski writes: >>> On Feb 26, 2020, at 12:17 AM, Peter Zijlstra wrote: >>> On Tue, Feb 25, 2020 at 09:43:46PM -0800, Andy Lutomirski wrote: >>>> 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. >> >> Indeed. I’m fine with this patch, but I still don’t understand what >> the changelog is about. > > Yeah, the changelog is not really helpful. Let me fix that. > >> And I’m still rather baffled by most of the notrace annotations in the >> series. > > As discussed on IRC, this might be too broad, but then I rather have the > actual C-entry points neither traceable nor probable in general and > relax this by calling functions which can be traced and probed. > > My rationale for this decision was that enter_from_user_mode() is marked > notrace/noprobe as well, so I kept the protection scope the same as we > had in the ASM maze which is marked noprobe already. I have second thoughts vs. tracing in this context. While the tracer itself seems to handle this correctly, what about things like BPF programs which can be attached to tracepoints and function trace entries? Is that really safe _before_ context tracking has updated RCU state? Thanks, tglx