virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [RFC, PATCH 1/5] Paravirt_ops full patching.patch
@ 2007-04-20  1:52 Zachary Amsden
  2007-04-20  1:58 ` Jeremy Fitzhardinge
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zachary Amsden @ 2007-04-20  1:52 UTC (permalink / raw)
  To: Andrew Morton, Andi Kleen, Jeremy Fitzhardinge, Rusty Russell,
	Chris Wright, Ingo Molnar, Petr Vandrovec, Pratap Subrahmanyam,
	Dan Hecht, Dan Arai, Virtualization Mailing List, Chaz Masden,
	Zachary Amsden

Add 5-argument handling for paravirt ops patching of PAE functions.

Signed-off-by: Zachary Amsden <zach@vmware.com>

diff -r dbe11208916f include/asm-i386/paravirt.h
--- a/include/asm-i386/paravirt.h	Thu Apr 19 11:40:55 2007 -0700
+++ b/include/asm-i386/paravirt.h	Thu Apr 19 12:04:16 2007 -0700
@@ -308,10 +308,9 @@ unsigned paravirt_patch_insns(void *site
  * return value handling from within these macros.  This is fairly
  * cumbersome.
  *
- * There are 5 sets of PVOP_* macros for dealing with 0-4 arguments.
- * It could be extended to more arguments, but there would be little
- * to be gained from that.  For each number of arguments, there are
- * the two VCALL and CALL variants for void and non-void functions.
+ * There are 5 sets of PVOP_* macros for dealing with 0-5 arguments.
+ * For each number of arguments, there are the two VCALL and CALL
+ * variants for void and non-void functions.
  *
  * When there is a return value, the invoker of the macro must specify
  * the return type.  The macro then uses sizeof() on that type to
@@ -405,6 +404,21 @@ unsigned paravirt_patch_insns(void *site
 		    "0" ((u32)(arg1)), "1" ((u32)(arg2)),		\
 		    "2" ((u32)(arg3)), [_arg4] "mr" ((u32)(arg4)))
 
+#define PVOP_CALL5(rettype, op, arg1, arg2, arg3, arg4, arg5)		\
+	__PVOP_CALL(rettype, op,					\
+		    "push %[_arg5]; push %[_arg4];",			\
+		    "lea 8(%%esp),%%esp;",				\
+		    "0" ((u32)(arg1)), "1" ((u32)(arg2)),		\
+		    "2" ((u32)(arg3)), [_arg4] "mr" ((u32)(arg4)),	\
+		    [_arg5] "mr" ((u32)(arg5)))
+#define PVOP_VCALL5(op, arg1, arg2, arg3, arg4, arg5)			\
+	__PVOP_VCALL(op,						\
+		    "push %[_arg5]; push %[_arg4];",			\
+		    "lea 8(%%esp),%%esp;",				\
+		    "0" ((u32)(arg1)), "1" ((u32)(arg2)),		\
+		    "2" ((u32)(arg3)), [_arg4] "mr" ((u32)(arg4)),	\
+		    [_arg5] "mr" ((u32)(arg5)))
+
 static inline int paravirt_enabled(void)
 {
 	return paravirt_ops.paravirt_enabled;
@@ -644,11 +658,11 @@ static inline void set_iopl_mask(unsigne
 
 /* The paravirtualized I/O functions */
 static inline void slow_down_io(void) {
-	paravirt_ops.io_delay();
+	PVOP_VCALL0(io_delay);
 #ifdef REALLY_SLOW_IO
-	paravirt_ops.io_delay();
-	paravirt_ops.io_delay();
-	paravirt_ops.io_delay();
+	PVOP_VCALL0(io_delay);
+	PVOP_VCALL0(io_delay);
+	PVOP_VCALL0(io_delay);
 #endif
 }
 
@@ -824,8 +838,7 @@ static inline void set_pte_at(struct mm_
 static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
 			      pte_t *ptep, pte_t pteval)
 {
-	/* 5 arg words */
-	paravirt_ops.set_pte_at(mm, addr, ptep, pteval);
+	PVOP_VCALL5(mm, addr, ptep, pteval.pte_low, pteval.pte_high);
 }
 
 static inline void set_pte_atomic(pte_t *ptep, pte_t pteval)
@@ -836,8 +849,7 @@ static inline void set_pte_present(struc
 static inline void set_pte_present(struct mm_struct *mm, unsigned long addr,
 				   pte_t *ptep, pte_t pte)
 {
-	/* 5 arg words */
-	paravirt_ops.set_pte_present(mm, addr, ptep, pte);
+	PVOP_VCALL5(mm, addr, ptep, pte.pte_low, pte.pte_high);
 }
 
 static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC, PATCH 1/5] Paravirt_ops full patching.patch
  2007-04-20  1:52 [RFC, PATCH 1/5] Paravirt_ops full patching.patch Zachary Amsden
@ 2007-04-20  1:58 ` Jeremy Fitzhardinge
  2007-04-20  2:29 ` Rusty Russell
  2007-04-20  4:43 ` Jeremy Fitzhardinge
  2 siblings, 0 replies; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2007-04-20  1:58 UTC (permalink / raw)
  To: Zachary Amsden
  Cc: Andrew Morton, Petr Vandrovec, Chaz Masden,
	Virtualization Mailing List, Chris Wright, Andi Kleen,
	Ingo Molnar

Zachary Amsden wrote:
> Add 5-argument handling for paravirt ops patching of PAE functions.
>
> Signed-off-by: Zachary Amsden <zach@vmware.com>
>
> diff -r dbe11208916f include/asm-i386/paravirt.h
> --- a/include/asm-i386/paravirt.h	Thu Apr 19 11:40:55 2007 -0700
> +++ b/include/asm-i386/paravirt.h	Thu Apr 19 12:04:16 2007 -0700
> @@ -308,10 +308,9 @@ unsigned paravirt_patch_insns(void *site
>   * return value handling from within these macros.  This is fairly
>   * cumbersome.
>   *
> - * There are 5 sets of PVOP_* macros for dealing with 0-4 arguments.
> - * It could be extended to more arguments, but there would be little
> - * to be gained from that.  For each number of arguments, there are
> - * the two VCALL and CALL variants for void and non-void functions.
> + * There are 5 sets of PVOP_* macros for dealing with 0-5 arguments.
> + * For each number of arguments, there are the two VCALL and CALL
> + * variants for void and non-void functions.
>   *
>   * When there is a return value, the invoker of the macro must specify
>   * the return type.  The macro then uses sizeof() on that type to
> @@ -405,6 +404,21 @@ unsigned paravirt_patch_insns(void *site
>  		    "0" ((u32)(arg1)), "1" ((u32)(arg2)),		\
>  		    "2" ((u32)(arg3)), [_arg4] "mr" ((u32)(arg4)))
>  
> +#define PVOP_CALL5(rettype, op, arg1, arg2, arg3, arg4, arg5)		\
> +	__PVOP_CALL(rettype, op,					\
> +		    "push %[_arg5]; push %[_arg4];",			\
> +		    "lea 8(%%esp),%%esp;",				\
> +		    "0" ((u32)(arg1)), "1" ((u32)(arg2)),		\
> +		    "2" ((u32)(arg3)), [_arg4] "mr" ((u32)(arg4)),	\
> +		    [_arg5] "mr" ((u32)(arg5)))
>   

Won't work if arg4 is a stack-relative addressing mode.  That was the
main reason I avoided 5-arg patching.  I guess using "r" as the arg4
constraint would work, but register pressure is getting pretty tight.

    J

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC, PATCH 1/5] Paravirt_ops full patching.patch
  2007-04-20  1:52 [RFC, PATCH 1/5] Paravirt_ops full patching.patch Zachary Amsden
  2007-04-20  1:58 ` Jeremy Fitzhardinge
@ 2007-04-20  2:29 ` Rusty Russell
  2007-04-20  4:43 ` Jeremy Fitzhardinge
  2 siblings, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2007-04-20  2:29 UTC (permalink / raw)
  To: Zachary Amsden
  Cc: Andrew Morton, Chaz Masden, Virtualization Mailing List,
	Petr Vandrovec, Chris Wright, Andi Kleen, Ingo Molnar

On Thu, 2007-04-19 at 18:52 -0700, Zachary Amsden wrote:
> Add 5-argument handling for paravirt ops patching of PAE functions.

This seems like overkill: I don't know of any modules which frob ptes...

The rest look fine (I particularly like the getting rid of kernel_rpl:
we didn't use it everywhere anyway).

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC, PATCH 1/5] Paravirt_ops full patching.patch
  2007-04-20  1:52 [RFC, PATCH 1/5] Paravirt_ops full patching.patch Zachary Amsden
  2007-04-20  1:58 ` Jeremy Fitzhardinge
  2007-04-20  2:29 ` Rusty Russell
@ 2007-04-20  4:43 ` Jeremy Fitzhardinge
  2 siblings, 0 replies; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2007-04-20  4:43 UTC (permalink / raw)
  To: Zachary Amsden
  Cc: Andrew Morton, Petr Vandrovec, Chaz Masden,
	Virtualization Mailing List, Chris Wright, Andi Kleen,
	Ingo Molnar

Zachary Amsden wrote:
> - * There are 5 sets of PVOP_* macros for dealing with 0-4 arguments.
> - * It could be extended to more arguments, but there would be little
> - * to be gained from that.  For each number of arguments, there are
> - * the two VCALL and CALL variants for void and non-void functions.
> + * There are 5 sets of PVOP_* macros for dealing with 0-5 arguments.
>   

s/5/6/

    J

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-20  4:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-20  1:52 [RFC, PATCH 1/5] Paravirt_ops full patching.patch Zachary Amsden
2007-04-20  1:58 ` Jeremy Fitzhardinge
2007-04-20  2:29 ` Rusty Russell
2007-04-20  4:43 ` Jeremy Fitzhardinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).