mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Glauber de Oliveira Costa <gcosta@redhat.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	rusty@rustcorp.com.au, ak@suse.de, mingo@elte.hu,
	chrisw@sous-sol.org, avi@qumranet.com, anthony@codemonkey.ws,
	virtualization@lists.linux-foundation.org, lguest@ozlabs.org,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 25/25] [PATCH] add paravirtualization support for x86_64
Date: Wed, 08 Aug 2007 23:35:52 -0700	[thread overview]
Message-ID: <46BAB5C8.5090906@goop.org> (raw)
In-Reply-To: <11865468513077-git-send-email-gcosta@redhat.com>

Glauber de Oliveira Costa wrote:
> +static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len)
> +{
> +	const unsigned char *start, *end;
> +	unsigned ret;
> +
> +	switch(type) {
> +#define SITE(x)	case PARAVIRT_PATCH(x):	start = start_##x; end = end_##x; goto patch_site
> +		SITE(irq_disable);
> +		SITE(irq_enable);
> +		SITE(restore_fl);
> +		SITE(save_fl);
> +		SITE(iret);
> +		SITE(sysret);
> +		SITE(swapgs);
> +		SITE(read_cr2);
> +		SITE(read_cr3);
> +		SITE(write_cr3);
> +		SITE(clts);
> +		SITE(flush_tlb_single);
> +		SITE(wbinvd);
> +#undef SITE
> +
> +	patch_site:
> +		ret = paravirt_patch_insns(insns, len, start, end);
> +		break;
> +
> +	case PARAVIRT_PATCH(make_pgd):
> +	case PARAVIRT_PATCH(pgd_val):
> +	case PARAVIRT_PATCH(make_pte):
> +	case PARAVIRT_PATCH(pte_val):
> +	case PARAVIRT_PATCH(make_pmd):
> +	case PARAVIRT_PATCH(pmd_val):
> +	case PARAVIRT_PATCH(make_pud):
> +	case PARAVIRT_PATCH(pud_val):
> +		/* These functions end up returning what
> +		   they're passed in the first argument */
>   

Is this still true with 64-bit?  Either way, I don't think its worth
having this here.  The damage to codegen around all those sites has
already happened, and the additional cost of a noop direct call is
pretty trivial.  I think this is a nanooptimisation which risks more
problems than it could possibly be worth.

> +	case PARAVIRT_PATCH(set_pte):
> +	case PARAVIRT_PATCH(set_pmd):
> +	case PARAVIRT_PATCH(set_pud):
> +	case PARAVIRT_PATCH(set_pgd):
> +		/* These functions end up storing the second
> +		 * argument in the location pointed by the first */
> +		ret = paravirt_patch_store_reg(insns, len);
> +		break;
>   

Ditto, really.  Do this in a later patch if it actually seems to help.

> +unsigned paravirt_patch_copy_reg(void *site, unsigned len)
> +{
> +	unsigned char *mov = site;
> +	if (len < 3)
> +		return len;
> +
> +	/* This is mov %rdi, %rax */
> +	*mov++ = 0x48;
> +	*mov++ = 0x89;
> +	*mov   = 0xf8;
> +	return 3;
> +}
> +
> +unsigned paravirt_patch_store_reg(void *site, unsigned len)
> +{
> +	unsigned char *mov = site;
> +	if (len < 3)
> +		return len;
> +
> +	/* This is mov %rsi, (%rdi) */
> +	*mov++ = 0x48;
> +	*mov++ = 0x89;
> +	*mov   = 0x37;
> +	return 3;
> +}
>   

These seem excessively special-purpose.  Are their only uses the ones I
commented on above.

> +/*
> + * integers must be use with care here. They can break the PARAVIRT_PATCH(x)
> + * macro, that divides the offset in the structure by 8, to get a number
> + * associated with the hook. Dividing by four would be a solution, but it
> + * would limit the future growth of the structure if needed.
>   

Why not just stick them at the end of the structure?


    J


  parent reply	other threads:[~2007-08-09  6:37 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08  4:18 Introducing paravirt_ops " Glauber de Oliveira Costa
2007-08-08  4:18 ` [PATCH 1/25] [PATCH] header file move Glauber de Oliveira Costa
2007-08-08  4:18   ` [PATCH 2/25] [PATCH] tlb flushing routines Glauber de Oliveira Costa
2007-08-08  4:18     ` [PATCH 3/25] [PATCH] irq_flags / halt routines Glauber de Oliveira Costa
2007-08-08  4:18       ` [PATCH 4/25] [PATCH] Add debugreg/load_rsp native hooks Glauber de Oliveira Costa
2007-08-08  4:18         ` [PATCH 5/25] [PATCH] native versions for system.h functions Glauber de Oliveira Costa
2007-08-08  4:18           ` [PATCH 6/25] [PATCH] add native_apic read and write functions, as well as boot clocks ones Glauber de Oliveira Costa
2007-08-08  4:18             ` [PATCH 7/25] [PATCH] interrupt related native paravirt functions Glauber de Oliveira Costa
2007-08-08  4:18               ` [PATCH 8/25] [PATCH] use macro for sti/cli in spinlock definitions Glauber de Oliveira Costa
2007-08-08  4:18                 ` [PATCH 9/25] [PATCH] report ring kernel is running without paravirt Glauber de Oliveira Costa
2007-08-08  4:18                   ` [PATCH 10/25] [PATCH] export math_state_restore Glauber de Oliveira Costa
2007-08-08  4:18                     ` [PATCH 11/25] [PATCH] introduce paravirt_release_pgd() Glauber de Oliveira Costa
2007-08-08  4:18                       ` [PATCH 12/25] [PATCH] native versions for set pagetables Glauber de Oliveira Costa
2007-08-08  4:19                         ` [PATCH 13/25] [PATCH] turn msr.h functions into native versions Glauber de Oliveira Costa
2007-08-08  4:19                           ` [PATCH 14/25] [PATCH] add native functions for descriptors handling Glauber de Oliveira Costa
2007-08-08  4:19                             ` [PATCH 15/25] [PATCH] get rid of inline asm for load_cr3 Glauber de Oliveira Costa
2007-08-08  4:19                               ` [PATCH 16/25] [PATCH] introducing paravirt_activate_mm Glauber de Oliveira Costa
2007-08-08  4:19                                 ` [PATCH 17/25] [PATCH] turn page operations into native versions Glauber de Oliveira Costa
2007-08-08  4:19                                   ` [PATCH 18/25] [PATCH] turn priviled operations into macros in entry.S Glauber de Oliveira Costa
2007-08-08  4:19                                     ` [PATCH 19/25] [PATCH] time-related functions paravirt provisions Glauber de Oliveira Costa
2007-08-08  4:19                                       ` [PATCH 20/25] [PATCH] replace syscall_init Glauber de Oliveira Costa
2007-08-08  4:19                                         ` [PATCH 21/25] [PATCH] export cpu_gdt_descr Glauber de Oliveira Costa
2007-08-08  4:19                                           ` [PATCH 22/25] [PATCH] turn priviled operation into a macro Glauber de Oliveira Costa
2007-08-08  4:19                                             ` [PATCH 23/25] [PATCH] paravirt hooks for arch initialization Glauber de Oliveira Costa
2007-08-08  4:19                                               ` [PATCH 24/25] [PATCH] provide paravirt patching function Glauber de Oliveira Costa
2007-08-08  4:19                                                 ` [PATCH 25/25] [PATCH] add paravirtualization support for x86_64 Glauber de Oliveira Costa
2007-08-08 10:00                                                   ` Andi Kleen
2007-08-08 11:58                                                     ` Steven Rostedt
2007-08-08 14:49                                                     ` Glauber de Oliveira Costa
2007-08-08 23:18                                                       ` Rusty Russell
2007-08-09  0:24                                                         ` Andi Kleen
2007-08-09  0:44                                                           ` Rusty Russell
2007-08-09  5:38                                                             ` Jeremy Fitzhardinge
2007-08-09  6:53                                                     ` Jeremy Fitzhardinge
2007-08-09 14:26                                                       ` Andi Kleen
2007-08-09 14:37                                                         ` Steven Rostedt
2007-08-09 15:09                                                           ` Jeremy Fitzhardinge
2007-08-09  6:35                                                   ` Jeremy Fitzhardinge [this message]
2007-08-09  7:02                                                     ` Glauber de Oliveira Costa
2007-08-09  7:02                                                       ` Jeremy Fitzhardinge
2007-08-09  7:07                                                         ` Glauber de Oliveira Costa
2007-08-09  7:12                                                           ` Jeremy Fitzhardinge
2007-08-09 12:30                                                             ` Steven Rostedt
2007-08-09 14:26                                                             ` Andi Kleen
2007-08-08  9:44                                               ` [PATCH 23/25] [PATCH] paravirt hooks for arch initialization Andi Kleen
2007-08-08 14:08                                                 ` Glauber de Oliveira Costa
2007-08-08 14:13                                                   ` Andi Kleen
2007-08-09 17:43                                                 ` Jeremy Fitzhardinge
2007-08-09 18:03                                                   ` Alan Cox
2007-08-10 18:08                                                     ` Glauber de Oliveira Costa
2007-08-10 18:25                                                       ` Alan Cox
2007-08-10 18:51                                                       ` Jeremy Fitzhardinge
2007-08-10 19:17                                                         ` Glauber de Oliveira Costa
2007-08-10 20:01                                                           ` Jeremy Fitzhardinge
2007-08-10 20:13                                                             ` Glauber de Oliveira Costa
2007-08-10 20:30                                                               ` Jeremy Fitzhardinge
2007-08-08 11:32                                           ` [PATCH 21/25] [PATCH] export cpu_gdt_descr Arjan van de Ven
2007-08-08 14:24                                             ` Glauber de Oliveira Costa
2007-08-08  9:38                                     ` [PATCH 18/25] [PATCH] turn priviled operations into macros in entry.S Andi Kleen
2007-08-08 11:52                                       ` Steven Rostedt
2007-08-08 12:24                                         ` Andi Kleen
2007-08-08 12:37                                           ` Steven Rostedt
2007-08-08 13:52                                             ` Andi Kleen
2007-08-08 13:23                                               ` Steven Rostedt
2007-08-08 13:26                                                 ` Steven Rostedt
2007-08-08 13:30                                                   ` Andi Kleen
2007-08-08 13:47                                                     ` Steven Rostedt
2007-08-08 14:03                                                       ` Andi Kleen
2007-08-08 17:07                                                         ` Steven Rostedt
2007-08-09  5:21                                                       ` Jeremy Fitzhardinge
2007-08-09 12:17                                                         ` Steven Rostedt
2007-08-08 13:29                                                 ` Andi Kleen
2007-08-08 14:01                                                   ` Steven Rostedt
2007-08-08 14:00                                         ` Glauber de Oliveira Costa
2007-08-08 13:58                                       ` Glauber de Oliveira Costa
2007-08-08 14:11                                         ` Andi Kleen
2007-08-08 14:53                                           ` Glauber de Oliveira Costa
2007-08-08  9:25                           ` [PATCH 13/25] [PATCH] turn msr.h functions into native versions Andi Kleen
2007-08-08 14:19                             ` Glauber de Oliveira Costa
2007-08-08 14:23                               ` Andi Kleen
2007-08-09  5:52               ` [PATCH 7/25] [PATCH] interrupt related native paravirt functions Jeremy Fitzhardinge
2007-08-08  7:29           ` [PATCH 5/25] [PATCH] native versions for system.h functions Glauber de Oliveira Costa
2007-08-08  9:16         ` [PATCH 4/25] [PATCH] Add debugreg/load_rsp native hooks Andi Kleen
2007-08-09  5:47           ` Jeremy Fitzhardinge
2007-08-09  5:49           ` Glauber de Oliveira Costa
2007-08-08  9:14       ` [PATCH 3/25] [PATCH] irq_flags / halt routines Andi Kleen
2007-08-08 14:10         ` Glauber de Oliveira Costa
2007-08-08 14:14           ` Andi Kleen
2007-08-08 14:23             ` Glauber de Oliveira Costa
2007-08-09  7:29         ` Glauber de Oliveira Costa
2007-08-08 14:53 ` Introducing paravirt_ops for x86_64 Nakajima, Jun
2007-08-08 14:58   ` Glauber de Oliveira Costa
2007-08-09  0:28     ` Nakajima, Jun
2007-08-09  0:31       ` Glauber de Oliveira Costa
2007-08-09  5:35     ` Jeremy Fitzhardinge
2007-08-09 12:46       ` [Lguest] " Steven Rostedt

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=46BAB5C8.5090906@goop.org \
    --to=jeremy@goop.org \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=anthony@codemonkey.ws \
    --cc=avi@qumranet.com \
    --cc=chrisw@sous-sol.org \
    --cc=gcosta@redhat.com \
    --cc=lguest@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.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

Powered by JetHome