public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: jeremy@goop.org, patches@x86-64.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [3/40] i386: use paravirt_nop to consistently mark no-op operations
Date: Mon, 30 Apr 2007 12:27:35 +0200 (CEST)	[thread overview]
Message-ID: <20070430102735.DA522151D2@wotan.suse.de> (raw)
In-Reply-To: <200704301227.598020000@suse.de>


From: Jeremy Fitzhardinge <jeremy@goop.org>
Add a _paravirt_nop function for use as a stub for no-op operations,
and paravirt_nop #defined void * version to make using it easier
(since all its uses are as a void *).

This is useful to allow the patcher to automatically identify noop
operations so it can simply nop out the callsite.


Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
[mingo] but only as a cleanup of the current open-coded (void *) casts.
My problem with this is that it loses the types. Not that there is much
to check for, but still, this adds some assumptions about how function
calls look like

---
 arch/i386/kernel/paravirt.c |   24 ++++++++++++------------
 include/asm-i386/paravirt.h |    3 +++
 2 files changed, 15 insertions(+), 12 deletions(-)

===================================================================
Index: linux/arch/i386/kernel/paravirt.c
===================================================================
--- linux.orig/arch/i386/kernel/paravirt.c
+++ linux/arch/i386/kernel/paravirt.c
@@ -35,7 +35,7 @@
 #include <asm/timer.h>
 
 /* nop stub */
-static void native_nop(void)
+void _paravirt_nop(void)
 {
 }
 
@@ -207,7 +207,7 @@ struct paravirt_ops paravirt_ops = {
 
  	.patch = native_patch,
 	.banner = default_banner,
-	.arch_setup = native_nop,
+	.arch_setup = paravirt_nop,
 	.memory_setup = machine_specific_memory_setup,
 	.get_wallclock = native_get_wallclock,
 	.set_wallclock = native_set_wallclock,
@@ -263,25 +263,25 @@ struct paravirt_ops paravirt_ops = {
 	.setup_boot_clock = setup_boot_APIC_clock,
 	.setup_secondary_clock = setup_secondary_APIC_clock,
 #endif
-	.set_lazy_mode = (void *)native_nop,
+	.set_lazy_mode = paravirt_nop,
 
 	.flush_tlb_user = native_flush_tlb,
 	.flush_tlb_kernel = native_flush_tlb_global,
 	.flush_tlb_single = native_flush_tlb_single,
 
-	.map_pt_hook = (void *)native_nop,
+	.map_pt_hook = paravirt_nop,
 
-	.alloc_pt = (void *)native_nop,
-	.alloc_pd = (void *)native_nop,
-	.alloc_pd_clone = (void *)native_nop,
-	.release_pt = (void *)native_nop,
-	.release_pd = (void *)native_nop,
+	.alloc_pt = paravirt_nop,
+	.alloc_pd = paravirt_nop,
+	.alloc_pd_clone = paravirt_nop,
+	.release_pt = paravirt_nop,
+	.release_pd = paravirt_nop,
 
 	.set_pte = native_set_pte,
 	.set_pte_at = native_set_pte_at,
 	.set_pmd = native_set_pmd,
-	.pte_update = (void *)native_nop,
-	.pte_update_defer = (void *)native_nop,
+	.pte_update = paravirt_nop,
+	.pte_update_defer = paravirt_nop,
 #ifdef CONFIG_X86_PAE
 	.set_pte_atomic = native_set_pte_atomic,
 	.set_pte_present = native_set_pte_present,
@@ -293,7 +293,7 @@ struct paravirt_ops paravirt_ops = {
 	.irq_enable_sysexit = native_irq_enable_sysexit,
 	.iret = native_iret,
 
-	.startup_ipi_hook = (void *)native_nop,
+	.startup_ipi_hook = paravirt_nop,
 };
 
 /*
Index: linux/include/asm-i386/paravirt.h
===================================================================
--- linux.orig/include/asm-i386/paravirt.h
+++ linux/include/asm-i386/paravirt.h
@@ -434,6 +434,9 @@ static inline void pmd_clear(pmd_t *pmdp
 #define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
 #define arch_flush_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
 
+void _paravirt_nop(void);
+#define paravirt_nop	((void *)_paravirt_nop)
+
 /* These all sit in the .parainstructions section to tell us what to patch. */
 struct paravirt_patch {
 	u8 *instr; 		/* original instructions */

  parent reply	other threads:[~2007-04-30 10:30 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30 10:27 [PATCH] [0/40] x86 candidate patches for review V: paravirt patches Andi Kleen
2007-04-30 10:27 ` [PATCH] [1/40] x86_64: update MAINTAINERS Andi Kleen
2007-04-30 10:27 ` [PATCH] [2/40] i386: Remove CONFIG_DEBUG_PARAVIRT Andi Kleen
2007-04-30 10:27 ` Andi Kleen [this message]
2007-04-30 10:27 ` [PATCH] [4/40] i386: Add pagetable accessors to pack and unpack pagetable entries Andi Kleen
2007-04-30 10:27 ` [PATCH] [5/40] i386: Hooks to set up initial pagetable Andi Kleen
2007-04-30 10:27 ` [PATCH] [6/40] i386: Allocate a fixmap slot Andi Kleen
2007-04-30 10:27 ` [PATCH] [7/40] i386: Allow paravirt backend to choose kernel PMD sharing Andi Kleen
2007-04-30 10:27 ` [PATCH] [8/40] x86: add hooks to intercept mm creation and destruction Andi Kleen
2007-04-30 10:27 ` [PATCH] [9/40] i386: rename struct paravirt_patch to paravirt_patch_site for clarity Andi Kleen
2007-04-30 10:27 ` [PATCH] [10/40] i386: Use patch site IDs computed from offset in paravirt_ops structure Andi Kleen
2007-04-30 10:27 ` [PATCH] [11/40] i386: Fix patch site clobbers to include return register Andi Kleen
2007-04-30 10:27 ` [PATCH] [12/40] i386: Consistently wrap paravirt ops callsites to make them patchable Andi Kleen
2007-04-30 10:27 ` [PATCH] [13/40] i386: Document asm-i386/paravirt.h Andi Kleen
2007-04-30 10:27 ` [PATCH] [14/40] i386: add common patching machinery Andi Kleen
2007-04-30 10:27 ` [PATCH] [15/40] i386: add flush_tlb_others paravirt_op Andi Kleen
2007-04-30 10:27 ` [PATCH] [16/40] i386: revert map_pt_hook Andi Kleen
2007-04-30 10:27 ` [PATCH] [17/40] i386: add kmap_atomic_pte for mapping highpte pages Andi Kleen
2007-04-30 10:27 ` [PATCH] [18/40] i386: flush lazy mmu updates on kunmap_atomic Andi Kleen
2007-04-30 10:27 ` [PATCH] [19/40] i386: fix paravirt-documentation Andi Kleen
2007-04-30 11:07   ` [patches] " Nigel Cunningham
2007-04-30 15:30     ` Jeremy Fitzhardinge
2007-04-30 15:37     ` Andi Kleen
2007-04-30 10:27 ` [PATCH] [20/40] i386: Clean up paravirt patchable wrappers Andi Kleen
2007-04-30 10:27 ` [PATCH] [21/40] i386: drop unused ptep_get_and_clear Andi Kleen
2007-04-30 10:27 ` [PATCH] [22/40] x86: deflate stack usage in lib/inflate.c Andi Kleen
2007-04-30 10:27 ` [PATCH] [23/40] x86_64: deflate inflate_dynamic too Andi Kleen
2007-04-30 10:27 ` [PATCH] [24/40] i386: Page-align the GDT Andi Kleen
2007-04-30 10:27 ` [PATCH] [25/40] i386: Convert PDA into the percpu section Andi Kleen
2007-04-30 10:28 ` [PATCH] [26/40] i386: cleanups to help using per-cpu variables from asm Andi Kleen
2007-04-30 10:28 ` [PATCH] [27/40] i386: Define per_cpu_offset Andi Kleen
2007-04-30 10:28 ` [PATCH] [28/40] i386: Fix UP gdt bugs Andi Kleen
2007-04-30 10:28 ` [PATCH] [29/40] i386: map enough initial memory to create lowmem mappings Andi Kleen
2007-04-30 10:28 ` [PATCH] [30/40] x86: update for i386 and x86-64 check_bugs Andi Kleen
2007-04-30 10:28 ` [PATCH] [31/40] i386: In compat mode, the return value here was uninitialized Andi Kleen
2007-04-30 10:28 ` [PATCH] [32/40] i386: kRemove a warning about unused variable in !CONFIG_ACPI compilation Andi Kleen
2007-04-30 10:28 ` [PATCH] [33/40] i386: Allow boot-time disable of paravirt_ops patching Andi Kleen
2007-04-30 10:28 ` [PATCH] [34/40] i386: Clean up arch/i386/kernel/cpu/mcheck/p4.c Andi Kleen
2007-04-30 10:28 ` [PATCH] [35/40] i386: Now that the VDSO can be relocated, we can support it in VMI configurations Andi Kleen
2007-04-30 10:28 ` [PATCH] [36/40] i386: Implement vmi_kmap_atomic_pte Andi Kleen
2007-04-30 10:28 ` [PATCH] [37/40] i386: Convert VMI timer to use clock events Andi Kleen
2007-04-30 10:28 ` [PATCH] [38/40] x86: Jeremy Fitzhardinge <jeremy@goop.org> Andi Kleen
2007-04-30 10:28 ` [PATCH] [39/40] i386: Export paravirt_ops for non GPL modules too Andi Kleen
2007-04-30 10:50   ` Christoph Hellwig
2007-04-30 11:00     ` Andi Kleen
2007-04-30 11:15       ` Jan Engelhardt
2007-04-30 11:19         ` Andi Kleen
2007-04-30 12:28           ` Peter Zijlstra
2007-04-30 13:40             ` Andi Kleen
2007-04-30 20:37             ` [PATCH] [39/40] i386: Export paravirt_ops for non GPL modulestoo David Schwartz
2007-04-30 11:04     ` [PATCH] [39/40] i386: Export paravirt_ops for non GPL modules too Jan Engelhardt
2007-04-30 14:55     ` Alan Cox
2007-04-30 16:30       ` Andi Kleen
2007-04-30 21:30       ` Jeremy Fitzhardinge
2007-04-30 10:28 ` [PATCH] [40/40] i386: Clean up ELF note generation Andi Kleen

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=20070430102735.DA522151D2@wotan.suse.de \
    --to=ak@suse.de \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@x86-64.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