public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Dan Raymond <draymond@foxvalley.net>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	hpa@zytor.com
Subject: Re: [PATCH v1] arch/x86: port I/O tracing on x86
Date: Tue, 19 Sep 2023 21:43:37 +0200	[thread overview]
Message-ID: <20230919194337.GC424@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <14c27df7-12a3-e432-a741-17672185c092@foxvalley.net>

On Mon, Sep 18, 2023 at 11:55:10AM -0600, Dan Raymond wrote:
> Add support for port I/O tracing on x86.  Memory mapped I/O tracing is
> available on x86 via CONFIG_MMIOTRACE but that relies on page faults
> so it doesn't work with port I/O.  This feature uses tracepoints in a
> similar manner as CONFIG_TRACE_MMIO_ACCESS.
> 
> Signed-off-by: Dan Raymond <draymond@foxvalley.net>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/x86/include/asm/shared/io.h | 11 +++++++
>  arch/x86/lib/Makefile            |  1 +
>  arch/x86/lib/trace_portio.c      | 18 ++++++++++++
>  include/trace/events/portio.h    | 49 ++++++++++++++++++++++++++++++++
>  4 files changed, 79 insertions(+)
>  create mode 100644 arch/x86/lib/trace_portio.c
>  create mode 100644 include/trace/events/portio.h
> 
> diff --git a/arch/x86/include/asm/shared/io.h b/arch/x86/include/asm/shared/io.h
> index c0ef921c0586..e7ef4212e00b 100644
> --- a/arch/x86/include/asm/shared/io.h
> +++ b/arch/x86/include/asm/shared/io.h
> @@ -2,13 +2,23 @@
>  #ifndef _ASM_X86_SHARED_IO_H
>  #define _ASM_X86_SHARED_IO_H
>  
> +#include <linux/instruction_pointer.h>
>  #include <linux/types.h>
>  
> +#if defined(CONFIG_TRACEPOINTS) && !defined(BOOT_COMPRESSED_MISC_H) && !defined(BOOT_BOOT_H)
> +extern void do_trace_portio_read(u32 value, u16 port, char width, long ip_addr);
> +extern void do_trace_portio_write(u32 value, u16 port, char width, long ip_addr);
> +#else
> +static inline void do_trace_portio_read(u32 value, u16 port, char width, long ip_addr) {}
> +static inline void do_trace_portio_write(u32 value, u16 port, char width, long ip_addr) {}
> +#endif
> +
>  #define BUILDIO(bwl, bw, type)						\
>  static inline void __out##bwl(type value, u16 port)			\
>  {									\
>  	asm volatile("out" #bwl " %" #bw "0, %w1"			\
>  		     : : "a"(value), "Nd"(port));			\
> +	do_trace_portio_write(value, port, #bwl[0], _THIS_IP_);		\
>  }									\
>  									\
>  static inline type __in##bwl(u16 port)					\
> @@ -16,6 +26,7 @@ static inline type __in##bwl(u16 port)					\
>  	type value;							\
>  	asm volatile("in" #bwl " %w1, %" #bw "0"			\
>  		     : "=a"(value) : "Nd"(port));			\
> +	do_trace_portio_read(value, port, #bwl[0], _THIS_IP_);		\
>  	return value;							\
>  }

No, very much no.

This sticks tracing in the very rawest of raw output paths. This means I
can no longer use early_console->write() to print to my
early_serial_console.

That is the one and only fully reliably output path we have. You're not
sticking tracing in it.

  parent reply	other threads:[~2023-09-19 19:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 17:55 [PATCH v1] arch/x86: port I/O tracing on x86 Dan Raymond
2023-09-19 17:26 ` kernel test robot
2023-09-19 19:30   ` Dan Raymond
2023-09-20  0:31     ` Dan Raymond
2023-09-19 17:26 ` kernel test robot
2023-09-19 19:43 ` Peter Zijlstra [this message]
2023-09-19 19:56   ` Dan Raymond
2023-09-19 21:12     ` Peter Zijlstra
2023-09-19 21:31       ` Dan Raymond
2023-09-19 22:43         ` Dan Raymond
2023-09-21 17:07           ` Dan Raymond
2023-09-25 21:10 ` Dan Raymond

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230919194337.GC424@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=draymond@foxvalley.net \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox