Skip to contentSkip to conversation

x86/paravirt: Kill some unused patching functions

RFC PATCH In review Borislav Petkov 3 participants 4 messages Nov 3, 2015 – Nov 7, 2015

Subsystems (3)
lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

RFC PATCH 1/1 x86/paravirt: Kill some unused patching functions

From: Borislav Petkov <[email protected]>

paravirt_patch_ignore() is completely unused and paravirt_patch_nop() doesn't do a whole lot. Remove them both.

Cc Andrew Morton <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Chris Wright <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jeremy Fitzhardinge <[email protected]>
Cc Juergen Gross <[email protected]>
Cc "Peter Zijlstra (Intel)" <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/include/asm/paravirt_types.h |  2 --
 arch/x86/kernel/paravirt.c            | 13 +------------
 2 files changed, 1 insertion(+), 14 deletions(-)
arch/x86/include/asm/paravirt_types.h +0 -2
index 31247b5bff7c..e1f31dfc3b31 100644
@@ -402,10 +402,8 @@ extern struct pv_lock_ops pv_lock_ops;
 	__visible extern const char start_##ops##_##name[], end_##ops##_##name[];	\
 	asm(NATIVE_LABEL("start_", ops, name) code NATIVE_LABEL("end_", ops, name))
 
-unsigned paravirt_patch_nop(void);
 unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len);
 unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len);
-unsigned paravirt_patch_ignore(unsigned len);
 unsigned paravirt_patch_call(void *insnbuf,
 			     const void *target, u16 tgt_clobbers,
 			     unsigned long addr, u16 site_clobbers,
arch/x86/kernel/paravirt.c +1 -12
index c2130aef3f9d..4f32a10979db 100644
@@ -74,16 +74,6 @@ void __init default_banner(void)
 /* Undefined instruction for dealing with missing ops pointers. */
 static const unsigned char ud2a[] = { 0x0f, 0x0b };
 
-unsigned paravirt_patch_nop(void)
-{
-	return 0;
-}
-
-unsigned paravirt_patch_ignore(unsigned len)
-{
-	return len;
-}
-
 struct branch {
 	unsigned char opcode;
 	u32 delta;
@@ -152,8 +142,7 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
 		/* If there's no function, patch it with a ud2a (BUG) */
 		ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a));
 	else if (opfunc == _paravirt_nop)
-		/* If the operation is a nop, then nop the callsite */
-		ret = paravirt_patch_nop();
+		ret = 0;
 
 	/* identity functions just return their single argument */
 	else if (opfunc == _paravirt_ident_32)
Signature · 1 line
2.3.5
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

paravirt_patch_ignore() is completely unused and paravirt_patch_nop() doesn't do a whole lot. Remove them both.

Quoted 64 lines
Cc Andrew Morton <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Chris Wright <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jeremy Fitzhardinge <[email protected]>
Cc Juergen Gross <[email protected]>
Cc "Peter Zijlstra (Intel)" <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
  arch/x86/include/asm/paravirt_types.h |  2 --
  arch/x86/kernel/paravirt.c            | 13 +------------
  2 files changed, 1 insertion(+), 14 deletions(-)
arch/x86/include/asm/paravirt_types.h +0 -2
index 31247b5bff7c..e1f31dfc3b31 100644
@@ -402,10 +402,8 @@ extern struct pv_lock_ops pv_lock_ops;
  	__visible extern const char start_##ops##_##name[], end_##ops##_##name[];	\
  	asm(NATIVE_LABEL("start_", ops, name) code NATIVE_LABEL("end_", ops, name))
 
-unsigned paravirt_patch_nop(void);
  unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len);
  unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len);
-unsigned paravirt_patch_ignore(unsigned len);
  unsigned paravirt_patch_call(void *insnbuf,
  			     const void *target, u16 tgt_clobbers,
  			     unsigned long addr, u16 site_clobbers,
arch/x86/kernel/paravirt.c +1 -12
index c2130aef3f9d..4f32a10979db 100644
@@ -74,16 +74,6 @@ void __init default_banner(void)
  /* Undefined instruction for dealing with missing ops pointers. */
  static const unsigned char ud2a[] = { 0x0f, 0x0b };
 
-unsigned paravirt_patch_nop(void)
-{
-	return 0;
-}
-
-unsigned paravirt_patch_ignore(unsigned len)
-{
-	return len;
-}
-
  struct branch {
  	unsigned char opcode;
  	u32 delta;
@@ -152,8 +142,7 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
  		/* If there's no function, patch it with a ud2a (BUG) */
  		ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a));
  	else if (opfunc == _paravirt_nop)
-		/* If the operation is a nop, then nop the callsite */
-		ret = paravirt_patch_nop();
+		ret = 0;
 
  	/* identity functions just return their single argument */
  	else if (opfunc == _paravirt_ident_32)
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Borislav Petkov
Quoted 6 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

paravirt_patch_ignore() is completely unused and paravirt_patch_nop() doesn't do a whole lot. Remove them both.

Quoted 64 lines
Cc Andrew Morton <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Chris Wright <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jeremy Fitzhardinge <[email protected]>
Cc Juergen Gross <[email protected]>
Cc "Peter Zijlstra (Intel)" <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
  arch/x86/include/asm/paravirt_types.h |  2 --
  arch/x86/kernel/paravirt.c            | 13 +------------
  2 files changed, 1 insertion(+), 14 deletions(-)
arch/x86/include/asm/paravirt_types.h +0 -2
index 31247b5bff7c..e1f31dfc3b31 100644
@@ -402,10 +402,8 @@ extern struct pv_lock_ops pv_lock_ops;
  	__visible extern const char start_##ops##_##name[], end_##ops##_##name[];	\
  	asm(NATIVE_LABEL("start_", ops, name) code NATIVE_LABEL("end_", ops, name))
 
-unsigned paravirt_patch_nop(void);
  unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len);
  unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len);
-unsigned paravirt_patch_ignore(unsigned len);
  unsigned paravirt_patch_call(void *insnbuf,
  			     const void *target, u16 tgt_clobbers,
  			     unsigned long addr, u16 site_clobbers,
arch/x86/kernel/paravirt.c +1 -12
index c2130aef3f9d..4f32a10979db 100644
@@ -74,16 +74,6 @@ void __init default_banner(void)
  /* Undefined instruction for dealing with missing ops pointers. */
  static const unsigned char ud2a[] = { 0x0f, 0x0b };
 
-unsigned paravirt_patch_nop(void)
-{
-	return 0;
-}
-
-unsigned paravirt_patch_ignore(unsigned len)
-{
-	return len;
-}
-
  struct branch {
  	unsigned char opcode;
  	u32 delta;
@@ -152,8 +142,7 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
  		/* If there's no function, patch it with a ud2a (BUG) */
  		ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a));
  	else if (opfunc == _paravirt_nop)
-		/* If the operation is a nop, then nop the callsite */
-		ret = paravirt_patch_nop();
+		ret = 0;
 
  	/* identity functions just return their single argument */
  	else if (opfunc == _paravirt_ident_32)
#3 lore raw
In reply to Borislav Petkov
x86/paravirt: Kill some unused patching functions
Commit-ID:  79f1d836925c545b4612f7ed19423f0950978b5e
Gitweb:     http://git.kernel.org/tip/79f1d836925c545b4612f7ed19423f0950978b5e
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 3 Nov 2015 10:18:49 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 7 Nov 2015 18:09:35 +0100

x86/paravirt: Kill some unused patching functions

paravirt_patch_ignore() is completely unused and paravirt_patch_nop() doesn't do a whole lot. Remove them both.

---
 arch/x86/include/asm/paravirt_types.h |  2 --
 arch/x86/kernel/paravirt.c            | 13 +------------
 2 files changed, 1 insertion(+), 14 deletions(-)
arch/x86/include/asm/paravirt_types.h +0 -2
index 31247b5..e1f31df 100644
@@ -402,10 +402,8 @@ extern struct pv_lock_ops pv_lock_ops;
 	__visible extern const char start_##ops##_##name[], end_##ops##_##name[];	\
 	asm(NATIVE_LABEL("start_", ops, name) code NATIVE_LABEL("end_", ops, name))
 
-unsigned paravirt_patch_nop(void);
 unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len);
 unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len);
-unsigned paravirt_patch_ignore(unsigned len);
 unsigned paravirt_patch_call(void *insnbuf,
 			     const void *target, u16 tgt_clobbers,
 			     unsigned long addr, u16 site_clobbers,
arch/x86/kernel/paravirt.c +1 -12
index c2130ae..4f32a10 100644
@@ -74,16 +74,6 @@ void __init default_banner(void)
 /* Undefined instruction for dealing with missing ops pointers. */
 static const unsigned char ud2a[] = { 0x0f, 0x0b };
 
-unsigned paravirt_patch_nop(void)
-{
-	return 0;
-}
-
-unsigned paravirt_patch_ignore(unsigned len)
-{
-	return len;
-}
-
 struct branch {
 	unsigned char opcode;
 	u32 delta;
@@ -152,8 +142,7 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
 		/* If there's no function, patch it with a ud2a (BUG) */
 		ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a));
 	else if (opfunc == _paravirt_nop)
-		/* If the operation is a nop, then nop the callsite */
-		ret = paravirt_patch_nop();
+		ret = 0;
 
 	/* identity functions just return their single argument */
 	else if (opfunc == _paravirt_ident_32)