Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp627280ybf; Sat, 29 Feb 2020 11:35:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyo0Ngij1PnLH0/Y0Oy482Tw+ycinmeLxH/zCCWIkJ4S6IMFhB2ofY+tLrN4JLuKJmrmAa9 X-Received: by 2002:a9d:a01:: with SMTP id 1mr2268643otg.74.1583004949206; Sat, 29 Feb 2020 11:35:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583004949; cv=none; d=google.com; s=arc-20160816; b=Znj9fnaGdeNHhuFrmCp0epC7bbU0l6QFHz4FGcBhEkAoY/2AB0/eKCA7ua1alWUJe0 DKe0G05JZYf48mJ3e6bBvbCHMgzrqArQg414kuOVX07sH9QlR0vhFI8TR/O+Jw6n8On7 dQbIYdprq9zU0uJrQXJgYsC6M56mt4pz41oBqjsAGkV+i3qFhYC+2exIwJqy/kyzA7Ia r9LTLnPw+k18OUalh+b67naZYNiSllSI0dPa0MbfM8PZtEJ69vvu/DyGru1WtmtJ4S1v /SlgIj8dmk4fxwnyL9xqr2X90uw7L3nuWYDXPyfiekpQZ1I1zMKFrnCkXtX+pWaE7Qen ej0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=PyYfDnf43WH5ivv/PcQ/dGCHo4V7xLTHAot5fxh8eiw=; b=dPVe0Kdx2xdVuwQQdJkU0t3YW9efShf4Pg5bWK1E1L34FLi5vk3R5prnLeFLLZs835 if9hYz7hXoqfpfxgIF6R/TFIEoqBwveeyWajz0r84EhkrcSsjIGkplzixX7tm247dYRf IWvEUmO5E7TKQnY61/9aVYJ2qTSGy5cC8nME6vEWQsca+rsR0iaOhPPGVu+rB1SEo4ZZ RZ4aB67DVZatkPYXmlH477nhjmt0B2jMtZfOpbRGFtuFGi7sgXG9NxJCW+0P5NFIVH6i NeLrqk0omdXHw0I+DX1Os5S/gB023Ix5OwBuq9ddxMxRDY/+Xr4S9m91ClCytwIZJrVH ZRFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="xKU/JUdV"; 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 19si3880532oip.93.2020.02.29.11.35.37; Sat, 29 Feb 2020 11:35:49 -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=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="xKU/JUdV"; 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 S1727269AbgB2TZ2 (ORCPT + 99 others); Sat, 29 Feb 2020 14:25:28 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42859 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727102AbgB2TZ1 (ORCPT ); Sat, 29 Feb 2020 14:25:27 -0500 Received: by mail-pf1-f196.google.com with SMTP id 15so3474888pfo.9 for ; Sat, 29 Feb 2020 11:25:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=PyYfDnf43WH5ivv/PcQ/dGCHo4V7xLTHAot5fxh8eiw=; b=xKU/JUdVDgwA4QnwQf1+8vZcO1v8+rflnjGCKeibtWun3w/QXfckwhlMY1IW30AkXH MP3257WrLvupHHyoHYYJZM/t2avx9oTfefLaz5VLop9k4dX4Fr9QJDJogQQeQVrYLeCa YwW4ESxgUMSv9RC5tTkZC/IYfwWwkC7/VuRWqfWXtWEK5nktC1Uup20GsI7akBUZIMv3 iZ+FHsZxAEwW3ctmw87Eqlirk3yJY8jV6rxLK0aUwf0E78h1e08X9a6DLYsjdOyawIsZ UN8RDklBLxXuaadYKYJH5RJEoC8eC63XBZhXYkLYHIE7Kmgr7NivTNs1uqF+rCoB0Qgc rZVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=PyYfDnf43WH5ivv/PcQ/dGCHo4V7xLTHAot5fxh8eiw=; b=LTj+WR4JqjTWT30RiSUp2OSijY4UM79/dxOHvxQS123Xrdap9a0m6Jlwo3YqTY1G69 zPLkNYaiBQYhrjxO67i9VmeRABdH/xzyG+JT45HtbHfLJzDXAJIY+A6J18HcODuDWm6c 0OKPRVeDZ4bmi63tpysyy8YJBdeeW/zv4UeYtM8RcE9OXV9K7nIp+PbPIyTE347gW1t9 9ydf45qQm0kvqZ7yQ27Ym/qed6JOU8E40fzfrgo5ZPlYesoce1Pytq1Tw5CvbeEisJtV ykBEiroWrtTjEVHOE5t9S6gqv4tuv+galkkI9OpC7HJ6Yi6eQWxjTjozdG6BlqMUjzqD L2EA== X-Gm-Message-State: APjAAAXM/NIcVRXabZ3btMALoYjIbLUDRhyupeLqq+Z0ocrbPfMbc2jw JuZZAb0JT5gMIbfMbekJeYOsotq070s= X-Received: by 2002:a63:1051:: with SMTP id 17mr10480124pgq.291.1583004326792; Sat, 29 Feb 2020 11:25:26 -0800 (PST) Received: from ?IPv6:2601:646:c200:1ef2:a821:5843:fca0:b0a5? ([2601:646:c200:1ef2:a821:5843:fca0:b0a5]) by smtp.gmail.com with ESMTPSA id u7sm15221299pfh.128.2020.02.29.11.25.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Feb 2020 11:25:26 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [patch 4/8] x86/entry: Move irq tracing on syscall entry to C-code Date: Sat, 29 Feb 2020 11:25:24 -0800 Message-Id: <4EFF3B04-2C8A-4D63-BB63-B5804EBFFE2F@amacapital.net> References: <87lfolfo79.fsf@nanos.tec.linutronix.de> Cc: Peter Zijlstra , Andy Lutomirski , LKML , x86@kernel.org, Steven Rostedt , Brian Gerst , Juergen Gross , Paolo Bonzini , Arnd Bergmann , "Paul E. McKenney" In-Reply-To: <87lfolfo79.fsf@nanos.tec.linutronix.de> To: Thomas Gleixner X-Mailer: iPhone Mail (17D50) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Feb 29, 2020, at 6:44 AM, Thomas Gleixner wrote: >=20 > =EF=BB=BFThomas Gleixner writes: >> Andy Lutomirski writes: >>>>> On Feb 26, 2020, at 12:17 AM, Peter Zijlstra wr= ote: >>>>> =EF=BB=BFOn Tue, Feb 25, 2020 at 09:43:46PM -0800, Andy Lutomirski wro= te: >>>>>> 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. >>>>>>=20 >>>>>> Did you perhaps mean to do this *after* enter_from_user_mode()? >>>>>=20 >>>>> 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. >>>>>=20 >>>>> Specifically for #PF, because we need read_cr2() before this. See late= r >>>>> patches. >>>=20 >>> Indeed. I=E2=80=99m fine with this patch, but I still don=E2=80=99t unde= rstand what >>> the changelog is about. >>=20 >> Yeah, the changelog is not really helpful. Let me fix that. >>=20 >>> And I=E2=80=99m still rather baffled by most of the notrace annotations i= n the >>> series. >>=20 >> 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. >>=20 >> 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. >=20 > I have second thoughts vs. tracing in this context. >=20 > 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? I think that everything using the tracing code, including BPF, should either= do its own rcuidle stuff or explicitly not execute if we=E2=80=99re not in C= ONTEXT_KERNEL. That is, we probably need to patch BPF. >=20 > Is that really safe _before_ context tracking has updated RCU state? >=20 > Thanks, >=20 > tglx >=20 >=20