public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Dave Hansen <dave@sr71.net>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	dave.hansen@linux.intel.com,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andy Lutomirski <luto@kernel.org>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Quentin Casasnovas <quentin.casasnovas@oracle.com>
Subject: Re: [RFC][PATCH] x86, fpu: trace points
Date: Thu, 12 Nov 2015 09:31:13 +0100	[thread overview]
Message-ID: <20151112083113.GA15533@gmail.com> (raw)
In-Reply-To: <20151110204424.268C1A2E@viggo.jf.intel.com>


* Dave Hansen <dave@sr71.net> wrote:

> 
> From: Dave Hansen <dave.hansen@linux.intel.com>
> 
> I've been carrying this patch around for a bit and it's helped me
> solve at least a couple FPU-related issues.  It's a _bit_ of a
> hack and probably too indiscriminate for mainline.
> 
> But, I'd be really interested to get something similar in to
> mainline.
> 
> How do folks feel about this as it stands?  Could we do something
> more structured?
> 
> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
> ---
> 
>  b/arch/x86/include/asm/fpu/internal.h |    5 +
>  b/arch/x86/include/asm/trace/fpu.h    |  115 ++++++++++++++++++++++++++++++++++
>  b/arch/x86/kernel/fpu/core.c          |   18 +++++
>  b/arch/x86/kernel/fpu/signal.c        |    2 
>  b/arch/x86/kvm/x86.c                  |    6 -
>  5 files changed, 143 insertions(+), 3 deletions(-)

It certainly looks good to me!

Which bit do you consider a hack? It's a pretty straightforward set of 
tracepoints.

> +DECLARE_EVENT_CLASS(fpu_state_event,
> +
> +	TP_PROTO(struct fpu *fpu),
> +	TP_ARGS(fpu),
> +
> +	TP_STRUCT__entry(
> +		__field(struct fpu *, fpu)
> +		__field(bool, fpregs_active)
> +		__field(bool, fpstate_active)
> +		__field(int, counter)
> +		__field(u64, xfeatures)
> +		__field(u64, xcomp_bv)
> +	),

The only detail I'd change is that I'd make the tracepoint names explicitly 
x86-ish, i.e. I'd rename the event class to 'x86_fpu'. (No need to put 
'state_event' into the class name, all tracepoints are events and we obviously 
trace some sort of state.)

Likewise I'd name the tracepoints themselves along the 'x86_fpu_*' pattern.

> +	TP_fast_assign(
> +		__entry->fpu = fpu;
> +		__entry->fpregs_active = fpu->fpregs_active;
> +		__entry->fpstate_active = fpu->fpstate_active;
> +		__entry->counter = fpu->counter;

Nit: my pet peeve about vertically aligning initializations, like you did it just 
a bit further down:

> +		if (cpu_has_xsave) {
> +			__entry->xfeatures = fpu->state.xsave.header.xfeatures;
> +			__entry->xcomp_bv  = fpu->state.xsave.header.xcomp_bv;
> +		}
> +	),
> +	TP_printk("fpu: %p fpregs_active: %d fpstate_active: %d counter: %d xfeatures: %llx xcomp_bv: %llx",

... and here I'd make the trace message "x86/fpu: ", to make it obvious and easy 
to parse. The events are very x86 specific in any case.

Thanks,

	Ingo

      reply	other threads:[~2015-11-12  8:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 20:44 [RFC][PATCH] x86, fpu: trace points Dave Hansen
2015-11-12  8:31 ` Ingo Molnar [this message]

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=20151112083113.GA15533@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave@sr71.net \
    --cc=dvlasenk@redhat.com \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=oleg@redhat.com \
    --cc=quentin.casasnovas@oracle.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --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