public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Xin Li <xin3.li@intel.com>, linux-kernel@vger.kernel.org, x86@kernel.org
Cc: mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	hpa@zytor.com, peterz@infradead.org, brgerst@gmail.com,
	chang.seok.bae@intel.com
Subject: Re: [PATCH v3 4/6] x86/gsseg: move local_irq_save/restore() into asm_load_gs_index()
Date: Sat, 15 Oct 2022 10:51:54 +0200	[thread overview]
Message-ID: <8735bpbhat.ffs@tglx> (raw)
In-Reply-To: <20221013200134.1487-5-xin3.li@intel.com>

On Thu, Oct 13 2022 at 13:01, Xin Li wrote:
> From: "H. Peter Anvin (Intel)" <hpa@zytor.com>
>
> The need to disable/enable interrupts around asm_load_gs_index() is a
> consequence of the implementation. Prepare for using the LKGS
> instruction, which is locally atomic and therefore doesn't need
> interrupts disabled.

*Shudder*. We want less ASM not more.

>  static inline void native_load_gs_index(unsigned int selector)
>  {
> -	unsigned long flags;
> -
> -	local_irq_save(flags);
>  	asm_load_gs_index(selector);
> -	local_irq_restore(flags);
>  }

static inline void native_load_gs_index(unsigned int selector)
{
	unsigned long flags;

        if (cpu_feature_enabled(LKGS)) {
              native_lkgs(selector);
        } else {
	      local_irq_save(flags);
              asm_load_gs_index(selector);
	      local_irq_restore(flags);
       }
}

For paravirt enabled kernels we want during feature detection:

        if (cpu_feature_enabled(LKGS)))
        	pv_ops.cpu.load_gs_index = native_lkgs;

No?

Thanks,

        tglx

  reply	other threads:[~2022-10-15  8:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 20:01 [PATCH v3 0/6] Enable LKGS instruction Xin Li
2022-10-13 20:01 ` [PATCH v3 1/6] x86/cpufeature: add cpu feature bit for LKGS Xin Li
2022-10-13 20:01 ` [PATCH v3 2/6] x86/opcode: add LKGS instruction to x86-opcode-map Xin Li
2022-10-13 20:01 ` [PATCH v3 3/6] x86/gsseg: make asm_load_gs_index() take an u16 Xin Li
2022-10-14 12:28   ` David Laight
2022-10-15  0:13     ` Li, Xin3
2022-10-15  2:41     ` H. Peter Anvin
2022-10-17  7:49       ` David Laight
2022-10-17 18:39         ` H. Peter Anvin
2022-10-13 20:01 ` [PATCH v3 4/6] x86/gsseg: move local_irq_save/restore() into asm_load_gs_index() Xin Li
2022-10-15  8:51   ` Thomas Gleixner [this message]
2022-10-18 17:25     ` Li, Xin3
2022-10-18 18:13       ` H. Peter Anvin
2022-10-18 21:29         ` Li, Xin3
2022-10-13 20:01 ` [PATCH v3 5/6] x86/gsseg: move load_gs_index() to its own header file Xin Li
2022-10-13 20:01 ` [PATCH v3 6/6] x86/gsseg: use the LKGS instruction if available for load_gs_index() Xin Li

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=8735bpbhat.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=chang.seok.bae@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --cc=xin3.li@intel.com \
    /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