mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@kernel.org>
To: "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 5/9] x86/desc: add native_[ig]dt_invalidate() to <asm/desc.h>
Date: Sat, 15 May 2021 08:29:39 -0700	[thread overview]
Message-ID: <b844acb0-bfe6-0987-5a24-a7800b70d5ed@kernel.org> (raw)
In-Reply-To: <20210515014400.2999028-6-hpa@zytor.com>

On 5/14/21 6:43 PM, H. Peter Anvin wrote:
> From: "H. Peter Anvin (Intel)" <hpa@zytor.com>
> 
> In some places, we want the native forms of descriptor table
> invalidation. Rather than open-coding them, add explicitly native
> functions to invalidate the GDT and IDT.
> 
> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
> ---
>  arch/x86/include/asm/desc.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
> index b8429ae50b71..aa366b2bbc41 100644
> --- a/arch/x86/include/asm/desc.h
> +++ b/arch/x86/include/asm/desc.h
> @@ -224,6 +224,21 @@ static inline void store_idt(struct desc_ptr *dtr)
>  	asm volatile("sidt %0":"=m" (*dtr));
>  }
>  
> +static const struct desc_ptr __invalid_gdt_idt_ptr __maybe_unused = {
> +	.address = 0,
> +	.size = 0
> +};

I'm not convinced that putting this in a header is really a great idea.
How about:

> +
> +static inline void native_gdt_invalidate(void)
> +{
        const struct desc_ptr ... = ...;

> +	native_load_gdt(&__invalid_gdt_idt_ptr);
> +}

That should generate two PUSH instructions and may well result in a
smaller binary :)

--Andy

  reply	other threads:[~2021-05-15 15:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15  1:43 [PATCH v2 0/8] x86/irq: trap and interrupt cleanups H. Peter Anvin
2021-05-15  1:43 ` [PATCH v2 1/9] x86/traps: add X86_NR_HW_TRAPS to <asm/trapnr.h> H. Peter Anvin
2021-05-15  1:43 ` [PATCH v2 2/9] x86/irqvector: add NR_EXTERNAL_VECTORS and NR_SYSTEM_VECTORS H. Peter Anvin
2021-05-15  1:43 ` [PATCH v2 3/9] x86/irq: remove unused vectors from <asm/irq_vectors.h> H. Peter Anvin
2021-05-15  1:43 ` [PATCH v2 4/9] x86/idt: remove address argument to idt_invalidate() H. Peter Anvin
2021-05-15 15:27   ` Andy Lutomirski
2021-05-15  1:43 ` [PATCH v2 5/9] x86/desc: add native_[ig]dt_invalidate() to <asm/desc.h> H. Peter Anvin
2021-05-15 15:29   ` Andy Lutomirski [this message]
2021-05-15  1:43 ` [PATCH v2 6/9] x86/kexec: set_[gi]dt() -> native_[gi]dt_invalidate() in machine_kexec_*.c H. Peter Anvin
2021-05-15 15:30   ` Andy Lutomirski
2021-05-15  1:43 ` [PATCH v2 7/9] x86/irq: WARN_ONCE() if irq_move_cleanup is called on a pending interrupt H. Peter Anvin
2021-05-15  6:24   ` H. Peter Anvin
2021-05-15  9:59   ` [PATCH v2.1 7/8] " H. Peter Anvin
2021-05-15  1:44 ` [PATCH v2 8/9] x86/irq: merge and functionalize common code in DECLARE/DEFINE_IDTENTRY_* H. Peter Anvin

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=b844acb0-bfe6-0987-5a24-a7800b70d5ed@kernel.org \
    --to=luto@kernel.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®