Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1745478ybk; Sat, 16 May 2020 22:45:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnBvxGsatpErrl6vYuK8fegWDq1KDkFe7A0y/WI9Qy9STQIVvzthlxQFDTBf3qJlWaI6bm X-Received: by 2002:a17:906:7717:: with SMTP id q23mr10194090ejm.38.1589694320375; Sat, 16 May 2020 22:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589694320; cv=none; d=google.com; s=arc-20160816; b=v1RjiUsetoYzvxZZKTsU8FCNC5VCujUT6Kp27qX5B6taQ8XNEVWJ5+6/dR2pjyN11J qJQpLdbL9F4t5mihUQM+lAASOAYIBHQNtlkFdWR256C+sTRQj21chc+7YuFBkSyQGcMX 4nuUAqfL9/6kAby8JYlnMoL6V+1l7uyAoEZO2ocBMMzhqh+zqUcA8f07pUm5nSmHMdGs SSW2lw9i02SQFXddnYqBDeTKAEycWP9NHX5MLhM1HD1PpMOdQtV/JBiqavVXn2xbzyUm ayO36NtHZ+BOpsQ4fPWf072IENIeBExCekerm++VlyNltuVAA8GsHp/Azvo48jIIkwIn WzUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=CRlrIsU2x1lv7UvabOcNJcSMz0QnZNq7nzOp5DbZxk0=; b=zBtCvJ8QGFmAvoYPPC46LY/NLi+O/yHF9YmRv+PcaRQdWvQEdn8sCTNcPig9tDd+Hj 5LZQOmJln6dFwgqXlUkGODR4XjSXSfb1PW2WtSE7jqu9cSLBjgEr6t+nUR08Y/pNl6mr uNOEw86IdqirSt9an1UmDeVzGdx/g2oUM0VnQIzkK88XcKfepFFvN88CV2z3xNQts/MK 0yHsQ03C0zdBpp+v7cn6bt3geva15pmJOkqktzfz1dMU1rupdqIzOiOQdgKpcKjc5oyg QTmXjU8zd2OFOwf/wlzmnZW+mn0ivewyiC5hTB1u0ez1n/BleDcSwK21/3KK6NyC9PT7 H/OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EEzGI5OS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb13si5156825edb.107.2020.05.16.22.44.30; Sat, 16 May 2020 22:45:20 -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=@kernel.org header.s=default header.b=EEzGI5OS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726637AbgEQFhK (ORCPT + 99 others); Sun, 17 May 2020 01:37:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:52320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbgEQFhK (ORCPT ); Sun, 17 May 2020 01:37:10 -0400 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EF9D7207F5 for ; Sun, 17 May 2020 05:37:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589693830; bh=Q5JOORAgFjJINGCBacajTvqUgliOjpbJB0rVNrTkx9g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=EEzGI5OSGU5h+W2756RDp09wHippUuEcC9xLRJN//nAKhepuqaIGXAzl26DN+g7w5 fUV7cmCV1qwnKGsOFUkD2c3YHPbxGoLX73IMVEbwyv6zVqD9X36I2ZQo7PaB4p2jbT 5iZ49nJRgktGbYropGbit/4q90e+/X0sb+KlAAyc= Received: by mail-wr1-f52.google.com with SMTP id l11so8007284wru.0 for ; Sat, 16 May 2020 22:37:09 -0700 (PDT) X-Gm-Message-State: AOAM531cM8mIAugFSQYV6vB6tLqiNs1bpZ12cPyQakDxPBeNRzApU5IF nDfn3ogqtiZ11zc/7LwL5SuPRT76ynE1B5qxkHoamA== X-Received: by 2002:adf:a389:: with SMTP id l9mr12959069wrb.18.1589693828439; Sat, 16 May 2020 22:37:08 -0700 (PDT) MIME-Version: 1.0 References: <20200515234547.710474468@linutronix.de> <20200515235124.783722942@linutronix.de> In-Reply-To: <20200515235124.783722942@linutronix.de> From: Andy Lutomirski Date: Sat, 16 May 2020 22:36:57 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch V6 04/37] x86: Make hardware latency tracing explicit To: Thomas Gleixner Cc: LKML , X86 ML , "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 , "Peter Zijlstra (Intel)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 15, 2020 at 5:10 PM Thomas Gleixner wrote: > > > The hardware latency tracer calls into trace_sched_clock and ends up in > various instrumentable functions which is problemeatic vs. the kprobe > handling especially the text poke machinery. It's invoked from > nmi_enter/exit(), i.e. non-instrumentable code. > > Use nmi_enter/exit_notrace() instead. These variants do not invoke the > hardware latency tracer which avoids chasing down complex callchains to > make them non-instrumentable. > > The real interesting measurement is the actual NMI handler. Add an explicit > invocation for the hardware latency tracer to it. > > #DB and #BP are uninteresting as they really should not be in use when > analzying hardware induced latencies. > > @@ -849,7 +851,7 @@ static void noinstr handle_debug(struct > static __always_inline void exc_debug_kernel(struct pt_regs *regs, > unsigned long dr6) > { > - nmi_enter(); > + nmi_enter_notrace(); Why can't exc_debug_kernel() handle instrumentation? We shouldn't recurse into #DB since we've already cleared DR7, right?