public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Andy Lutomirski <luto@kernel.org>
Cc: x86@kernel.org, Dave Hansen <dave.hansen@intel.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] x86/fpu: Rename "dynamic" XSTATEs to "independent"
Date: Fri, 11 Jun 2021 10:01:20 +0200	[thread overview]
Message-ID: <YMMYUGW9f7CUJ+oz@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1eecb0e4f3e07828ebe5d737ec77dc3b708fad2d.1623388344.git.luto@kernel.org>

On Thu, Jun 10, 2021 at 10:13:36PM -0700, Andy Lutomirski wrote:
> The salient feature of "dynamic" XSTATEs is that they are not part of the
> main task XSTATE buffer.  The fact that they are dynamically allocated is
> irrelevant and will become quite confusing when user math XSTATEs start
> being dynamically allocated.  Rename them to "independent" because they
> are independent of the main XSTATE code.
> 
> This is just a search-and-replace with some whitespace updates to keep
> things aligned.
> 
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
> ---
>  arch/x86/events/intel/lbr.c       |  6 +--
>  arch/x86/include/asm/fpu/xstate.h | 14 +++----
>  arch/x86/kernel/fpu/xstate.c      | 62 +++++++++++++++----------------
>  3 files changed, 41 insertions(+), 41 deletions(-)
> 
> diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
> index 76dbab6ac9fb..0189807fc3c1 100644
> --- a/arch/x86/events/intel/lbr.c
> +++ b/arch/x86/events/intel/lbr.c
> @@ -491,7 +491,7 @@ static void intel_pmu_arch_lbr_xrstors(void *ctx)
>  {
>  	struct x86_perf_task_context_arch_lbr_xsave *task_ctx = ctx;
>  
> -	copy_kernel_to_dynamic_supervisor(&task_ctx->xsave, XFEATURE_MASK_LBR);
> +	copy_kernel_to_independent_supervisor(&task_ctx->xsave, XFEATURE_MASK_LBR);
>  }
>  
>  static __always_inline bool lbr_is_reset_in_cstate(void *ctx)
> @@ -576,7 +576,7 @@ static void intel_pmu_arch_lbr_xsaves(void *ctx)
>  {
>  	struct x86_perf_task_context_arch_lbr_xsave *task_ctx = ctx;
>  
> -	copy_dynamic_supervisor_to_kernel(&task_ctx->xsave, XFEATURE_MASK_LBR);
> +	copy_independent_supervisor_to_kernel(&task_ctx->xsave, XFEATURE_MASK_LBR);
>  }
>  
>  static void __intel_pmu_lbr_save(void *ctx)
> @@ -978,7 +978,7 @@ static void intel_pmu_arch_lbr_read_xsave(struct cpu_hw_events *cpuc)
>  		intel_pmu_store_lbr(cpuc, NULL);
>  		return;
>  	}
> -	copy_dynamic_supervisor_to_kernel(&xsave->xsave, XFEATURE_MASK_LBR);
> +	copy_independent_supervisor_to_kernel(&xsave->xsave, XFEATURE_MASK_LBR);
>  
>  	intel_pmu_store_lbr(cpuc, xsave->lbr.entries);
>  }

Yesterday tglx proposed the *save*_to_{user,kernel}() and
*rstor*_from_{user,kernel}() namespace for pretty much every other such
function.

And while I agree that independent_supervisor beats dynamic_supervisor
for a name, they're both stupid long :-(

I don't suppose we can simply use xsaves_to_kernel()
xstrors_from_kernel() and add some magic to their respective mask
handling to ensure that a mask belongs to only 1 (of 3) types.

	int types = 0;

	if (mask & xfeatures_mask_user())
		type++;
	if (mask & xfeatures_mask_supervisor())
		types++;
	if (mask & xfeatures_mask_independent())
		types++;

	if (WARN_ON_ONCE(type != 1))
		return;

?


  reply	other threads:[~2021-06-11  8:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  5:13 [PATCH 0/2] x86/fpu: Clean up "dynamic" APIs Andy Lutomirski
2021-06-11  5:13 ` [PATCH 1/2] x86/fpu: Rename "dynamic" XSTATEs to "independent" Andy Lutomirski
2021-06-11  8:01   ` Peter Zijlstra [this message]
2021-06-11 13:30     ` Thomas Gleixner
2021-06-23 22:09   ` [tip: x86/fpu] " tip-bot2 for Andy Lutomirski
2021-06-11  5:13 ` [PATCH 2/2] x86/fpu: Improve FPU APIs for independent features Andy Lutomirski

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=YMMYUGW9f7CUJ+oz@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=dave.hansen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.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