Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1380850ybf; Sun, 1 Mar 2020 08:01:37 -0800 (PST) X-Google-Smtp-Source: APXvYqz7kDtqmOcrrU6eZ+B7rB7BVKtbt8xflRO8u8rWcLmCcloyTNw+wsjt2LAigBMknEcSiFeP X-Received: by 2002:a9d:5885:: with SMTP id x5mr9962246otg.132.1583078497805; Sun, 01 Mar 2020 08:01:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583078497; cv=none; d=google.com; s=arc-20160816; b=oWjLz4o8pzN93+J20lKR/LaUtvlhqscjZcyi8pgugP18FQPzbogiYOOrSFg/1oSD5z KaiUThay2Fl/p06Y1yqDVCbJnQlQo6zfOJ7HimugvFyvuZuGsasjA6kDKUYz5XRqCjdx uR792z2iSTAISwxOYYb3HMXHr1DoSNq4pXVjTWyrHEcPgT1ASCkt5casr+S7fDGQgTTR jGCaIUyq8Txui68B4mWYNJO6se7Mzz9RIcCRI8mSjYOPHI0uvm/9rSjRGuCZAGuTd825 hb0cFu7Uy6q8z03UlGoJC0mQN2Ze3vtpKfw8Ve5l6B2/YYJfSRxhMOVCe6+Y1cdZGXJE uqJw== 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=7LHF2a2ImVJ3H/bfldcs5WqfIQBgu2Zph2kP/82e0q4=; b=Y6y3stSbM9dKDULcuqNTyXz8pa04lanVIZE6q99kvKtTWd1qo/QXF7osIjGn2UU7Kl DtFAzggmEPNnX0Z3gW8JAJvjlRFzIETB3IWtZio6MpOY0T+ma5yipFIbhIoXWOwDG5Z0 lC5ia3VyImscqeXrmId703HcJv+CM5TK9tNpSa0EWtGiri/F/BLXb/VayLLre3d3TfO9 I5mvO+xCoTGjlicinRY1mT9uM1v2645LwWn1nk+YnwPTgS04O9h/jdLeYMbwIHeuXlsS 4abB2Oo6FJLwPsMNfw+ut5eeoU0Amn2subimwjnNlLt+PkarN8FCtSzC6GIjLnEyNP5W UPyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rkVGb1M0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si5103281oti.306.2020.03.01.08.01.25; Sun, 01 Mar 2020 08:01:37 -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=@kernel.org header.s=default header.b=rkVGb1M0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726720AbgCAQAP (ORCPT + 99 others); Sun, 1 Mar 2020 11:00:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:37096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbgCAQAP (ORCPT ); Sun, 1 Mar 2020 11:00:15 -0500 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 90C0D24699 for ; Sun, 1 Mar 2020 16:00:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583078414; bh=6efDZnmGDkJL77bmpEcO3rXxowZRDGagRBQHbPMJzkQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rkVGb1M0gWa9aItjisU6DZW23p/pFOObZSdHAA7CP3t2H2C8vgYED2qlRl5fiRyWk jFufCtEArscTQyaWSBZYGY4V6Oz+1DZhcPtlWENncqPbt+B39FmkMnOx++4XBfRMzG CV98dwGd1FkqWaFTpUP9yGyvw6GVTOVeMDMfbDPA= Received: by mail-wr1-f47.google.com with SMTP id z15so9418929wrl.1 for ; Sun, 01 Mar 2020 08:00:14 -0800 (PST) X-Gm-Message-State: APjAAAVuZe0U+rGknjAvemQMy/p6icaj4CJhtpLY+OeUuPijlFXzv713 0aHPxBBA6yrFVCaoNpTLSpbYkfSb3+HeX7n8pl666Q== X-Received: by 2002:adf:df0c:: with SMTP id y12mr16702017wrl.257.1583078412945; Sun, 01 Mar 2020 08:00:12 -0800 (PST) MIME-Version: 1.0 References: <87imjofkhx.fsf@nanos.tec.linutronix.de> <87d09wf6dw.fsf@nanos.tec.linutronix.de> In-Reply-To: <87d09wf6dw.fsf@nanos.tec.linutronix.de> From: Andy Lutomirski Date: Sun, 1 Mar 2020 08:00:01 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 4/8] x86/entry: Move irq tracing on syscall entry to C-code To: Thomas Gleixner Cc: Steven Rostedt , Peter Zijlstra , Andy Lutomirski , LKML , X86 ML , Brian Gerst , Juergen Gross , Paolo Bonzini , Arnd Bergmann , "Paul E. McKenney" 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 Sun, Mar 1, 2020 at 7:21 AM Thomas Gleixner wrote: > > Andy Lutomirski writes: > >> On Mar 1, 2020, at 2:16 AM, Thomas Gleixner wrote: > >> Ok, but for the time being anything before/after CONTEXT_KERNEL is unsafe > >> except trace_hardirq_off/on() as those trace functions do not allow to > >> attach anything AFAICT. > > > > Can you point to whatever makes those particular functions special? I > > failed to follow the macro maze. > > Those are not tracepoints and not going through the macro maze. See > kernel/trace/trace_preemptirq.c That has: void trace_hardirqs_on(void) { if (this_cpu_read(tracing_irq_cpu)) { if (!in_nmi()) trace_irq_enable_rcuidle(CALLER_ADDR0, CALLER_ADDR1); tracer_hardirqs_on(CALLER_ADDR0, CALLER_ADDR1); this_cpu_write(tracing_irq_cpu, 0); } lockdep_hardirqs_on(CALLER_ADDR0); } EXPORT_SYMBOL(trace_hardirqs_on); NOKPROBE_SYMBOL(trace_hardirqs_on); But this calls trace_irq_enable_rcuidle(), and that's the part of the macro maze I got lost in. I found: #ifdef CONFIG_TRACE_IRQFLAGS DEFINE_EVENT(preemptirq_template, irq_disable, TP_PROTO(unsigned long ip, unsigned long parent_ip), TP_ARGS(ip, parent_ip)); DEFINE_EVENT(preemptirq_template, irq_enable, TP_PROTO(unsigned long ip, unsigned long parent_ip), TP_ARGS(ip, parent_ip)); #else #define trace_irq_enable(...) #define trace_irq_disable(...) #define trace_irq_enable_rcuidle(...) #define trace_irq_disable_rcuidle(...) #endif But the DEFINE_EVENT doesn't have the "_rcuidle" part. And that's where I got lost in the macro maze. I looked at the gcc asm output, and there is, indeed: # ./include/trace/events/preemptirq.h:40: DEFINE_EVENT(preemptirq_template, irq_enable, with a bunch of asm magic that looks like it's probably a tracepoint. I still don't quite see where the "_rcuidle" went. But I also don't see why this is any different from any other tracepoint. --Andy