Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp837308ybk; Wed, 20 May 2020 13:18:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPKgrb/fgYGVVv7PaUhKaGpaTUrV0GivHYIfQufJHWdshZxbc3CHaPuBph0RvAiBJRz32o X-Received: by 2002:a17:906:abce:: with SMTP id kq14mr695878ejb.187.1590005894238; Wed, 20 May 2020 13:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590005894; cv=none; d=google.com; s=arc-20160816; b=jnvggMvtJIpM8Wju5D3LEeonVTgDmUkRL/quNzVsE7Hu0+Om+vLPpNwUCOHcS4I64u /oaujWC6dHth8uf68tCeRQ2cH7vLHlTJzWZL5Ow3uWxajlNo5UWAHIQwXBxYsn/Yf+Ht XIa6fQxIj6QupQ4S14JM08gYrMGBG9fcryrxh6LNdUMo2dPapAfgrO89rowDUT8sjYkS dvCApQndrWSIEUy1f1/db3HNvs5lrgwsV+O9EyB1rsO+edKsl7PrvT6oz3uOKriyyPz5 sP9gJfQaKCXW96ypcvhU+v7bQUmKsHjwh1G9qlk4u/7e1dXyt7rzzPCtPZUC/qGWb3cA kw3Q== 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=jNCjRptabh6f7dGyAbYdK74F2n0Wz/7WyriwNjKrYLo=; b=aK0u9djAb3xlMx8vvYrRltH61nM8qG19y3T2NRnBeVkv/UMGMGcpDl9TtQyKh2Q+oJ 1+GdI2DA4wWe+7ovkrqS3VRorIwACUh5XoL87H/nANfFCOOO2V7S4vQOKIYW/pLeyEmq MS78jxibk3g2HP4Oee3ezTMjIwSQpe4siKuLP/ctpmu4pUZXdl7lGipUvsRrbrQlVtAL 7boe4KuEQ9HN4aHs+kMxRpPdMdN5o7em7pZmq4dc76IzY0ubCuMmGsv9osau7BsYUyTa tchaCIBdzl4yWhmLOFJxh/ZYVHw6b6aI//+XZZdtYB6rfu04d+uyTm/ojMjjSnAM78HV nMNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=ivjriBhP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id me17si2244851ejb.410.2020.05.20.13.17.50; Wed, 20 May 2020 13:18:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=ivjriBhP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727067AbgETUON (ORCPT + 99 others); Wed, 20 May 2020 16:14:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726970AbgETUOM (ORCPT ); Wed, 20 May 2020 16:14:12 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 609DCC061A0E for ; Wed, 20 May 2020 13:14:11 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id 145so2096035pfw.13 for ; Wed, 20 May 2020 13:14:11 -0700 (PDT) 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=jNCjRptabh6f7dGyAbYdK74F2n0Wz/7WyriwNjKrYLo=; b=ivjriBhPfAPW1WSo2qqkeu94jowUi6nmAulGkKdEMSYXycw4lYLpAifIExWjnM04yR f7kqfS1Sax+wy0NqUUYQAT14DdKtsrsgZagfy1LYait88OZadQFM6NFX791z9ql3WjM/ mf5LF1IJ6f2yEHzlZuJagXi0OB10O2PNJrinD4zMF+/529iQ1+la1L1DuFkkMPiggGu/ GDzeTddXQ0mBYAIWTfn7q75JsrjVBqw+flSsCnjnmXplGveBSXePO/IsSumKp1vLgurJ PbD5Sd3csw1XvTq5DmIZx8qYkdi3nqfoXof/Gonqg0AUudeQjADtHY+2AMKsi2vPGw08 esUQ== 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=jNCjRptabh6f7dGyAbYdK74F2n0Wz/7WyriwNjKrYLo=; b=QeqQmT3wjPqqB+u5UrDQ20uGy3/zf99RpmcgWH1TWNQQjBCIba8hPz7H1mW7WgKjV5 FZQs2JgsN1aNuntfEIW8sgJGI/96V93ATGZE9iJNWQp8cpxBrAgOeqkkD76P4x2zQoEH CCmQH9Q1QLXUchHKrVetVLVqlieJEWgFAuX9+VgpS9cy3IhuXL6/ljqunn4bHU1nR1F+ 4sULI+5zi8KOJ0us0CZte5Dg1M7gAg/pTysGGhmXX5w5aOEy1d+CMctDkp/rqlXGk9Q8 E8KutEcqSqM1S3Et4tfUrEL5pklDAXEJesm4BSzJutI/9Zuqkv0sK+VJ/Ka/V3tsbh99 EHSA== X-Gm-Message-State: AOAM530U7F4NTtKP/IuDRsG+FA2q9aLskdh9vsb43+RJsJXgZQw/evCI +WmqcuNLF4OB5Q5V5OBLNAtHTg== X-Received: by 2002:a62:2f43:: with SMTP id v64mr5848809pfv.170.1590005650687; Wed, 20 May 2020 13:14:10 -0700 (PDT) Received: from ?IPv6:2601:646:c200:1ef2:6953:ad9a:addc:d616? ([2601:646:c200:1ef2:6953:ad9a:addc:d616]) by smtp.gmail.com with ESMTPSA id d2sm2730544pfa.164.2020.05.20.13.14.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 May 2020 13:14:09 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [patch V6 04/37] x86: Make hardware latency tracing explicit Date: Wed, 20 May 2020 13:14:07 -0700 Message-Id: References: <87imgqv055.fsf@nanos.tec.linutronix.de> Cc: Peter Zijlstra , LKML , x86@kernel.org, "Paul E. McKenney" , Andy Lutomirski , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Steven Rostedt , Joel Fernandes , Boris Ostrovsky , Juergen Gross , Brian Gerst , Mathieu Desnoyers , Josh Poimboeuf , Will Deacon , Tom Lendacky , Wei Liu , Michael Kelley , Jason Chen CJ , Zhao Yakui In-Reply-To: <87imgqv055.fsf@nanos.tec.linutronix.de> To: Thomas Gleixner X-Mailer: iPhone Mail (17E262) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 20, 2020, at 1:10 PM, Thomas Gleixner wrote: >=20 > =EF=BB=BFPeter Zijlstra writes: >>> On Mon, May 18, 2020 at 10:05:56AM +0200, Thomas Gleixner wrote: >>> Peter Zijlstra writes: >>>> On Sat, May 16, 2020 at 01:45:51AM +0200, Thomas Gleixner wrote: >>>>> --- a/arch/x86/kernel/nmi.c >>>>> +++ b/arch/x86/kernel/nmi.c >>>>> @@ -334,6 +334,7 @@ static noinstr void default_do_nmi(struc >>>>> __this_cpu_write(last_nmi_rip, regs->ip); >>>>>=20 >>>>> instrumentation_begin(); >>>>> + ftrace_nmi_handler_enter(); >>>>>=20 >>>>> handled =3D nmi_handle(NMI_LOCAL, regs); >>>>> __this_cpu_add(nmi_stats.normal, handled); >>>>> @@ -420,6 +421,7 @@ static noinstr void default_do_nmi(struc >>>>> unknown_nmi_error(reason, regs); >>>>>=20 >>>>> out: >>>>> + ftrace_nmi_handler_exit(); >>>>> instrumentation_end(); >>>>> } >>>>=20 >>>> Yeah, so I'm confused about this and the previous patch too. Why not >>>> do just this? Remove that ftrace_nmi_handler.* crud from >>>> nmi_{enter,exit}() and stick it here? Why do we needs the >>>> nmi_{enter,exit}_notrace() thing? >>>=20 >>> Because you then have to fixup _all_ architectures which use >>> nmi_enter/exit(). >>=20 >> We probably have to anyway. But I can do that later I suppose. >=20 > Second thoughts. For #DB and #INT3 we can just keep nmi_enter(), needs > just annotation in nmi_enter() around that trace muck. >=20 > For #NMI and #MCE I rather avoid the early trace call and do it once we > have reached "stable" state, i.e. avoid it in the whole nested NMI mess. >=20 >=20 What=E2=80=99s the issue? The actual meat is mostly in the asm for NMI, and= for MCE it=E2=80=99s just the sync-all-the-cores thing. The actual simultan= eous NMI-and-MCE case is utterly busted regardless, and I=E2=80=99ve been th= inking about how to fix it. It won=E2=80=99t be pretty, but nmi_enter() will= have nothing to do with it.=