All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christoph Egger" <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] Bugfix: Don't use function pointers to inline functions
Date: Thu, 30 Nov 2006 11:31:28 +0100	[thread overview]
Message-ID: <200611301131.28678.Christoph.Egger@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]


Hi!

There's code, which use inline functions on function pointers.
This is IMO a bug.

The issue has been found by gcc 4.1.1 on Gentoo Linux when compiling
a x86_64 hypervisor with -O0.
gcc link error messages are attached.

The xen_shadow.diff patch  fixes the issue.
Further, I had to move vmx_update_host_cr3() from 
xen/include/asm-x86/hvm/vmx/vmx.h to xen/arch/x86/hvm/vmx/vmx.c  or gcc 
complains in xen/arch/x86/hvm/vmx/io.c that
"vmx_update_host_cr3() is defined but not used" otherwise.

Please apply.


[-- Attachment #2: link_error.txt --]
[-- Type: text/plain, Size: 2373 bytes --]

/usr/src/xen-unstable.hg/xen/arch/x86/built_in.o: In function `vmx_setup_hvm_funcs':
/usr/src/xen-unstable.hg/xen/arch/x86/hvm/vmx/vmx.c:654: undefined reference to `vmx_update_host_cr3'
/usr/src/xen-unstable.hg/xen/arch/x86/hvm/vmx/vmx.c:654: relocation truncated to fit: R_X86_64_PC32 against undefined symbol `vmx_update_host_cr3'
/usr/src/xen-unstable.hg/xen/arch/x86/built_in.o: In function `sh_map_and_validate_gl4e__shadow_4_guest_4':
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2391: undefined reference to `shadow_l4_index'
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2391: relocation truncated to fit: R_X86_64_PC32 against undefined symbol `shadow_l4_index'
/usr/src/xen-unstable.hg/xen/arch/x86/built_in.o: In function `sh_map_and_validate_gl3e__shadow_4_guest_4':
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2407: undefined reference to `shadow_l3_index'
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2407: relocation truncated to fit: R_X86_64_PC32 against undefined symbol `shadow_l3_index'
/usr/src/xen-unstable.hg/xen/arch/x86/built_in.o: In function `sh_map_and_validate_gl2e__shadow_4_guest_4':
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2422: undefined reference to `shadow_l2_index'
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2422: relocation truncated to fit: R_X86_64_PC32 against undefined symbol `shadow_l2_index'
/usr/src/xen-unstable.hg/xen/arch/x86/built_in.o: In function `sh_map_and_validate_gl2e__shadow_3_guest_3':
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2422: undefined reference to `shadow_l2_index'
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2422: relocation truncated to fit: R_X86_64_PC32 against undefined symbol `shadow_l2_index'
/usr/src/xen-unstable.hg/xen/arch/x86/built_in.o: In function `sh_map_and_validate_gl2he__shadow_3_guest_3':
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2433: undefined reference to `shadow_l2_index'
/usr/src/xen-unstable.hg/xen/arch/x86/mm/shadow/multi.c:2433: relocation truncated to fit: R_X86_64_PC32 against undefined symbol `shadow_l2_index'
make[2]: *** [/usr/src/xen-unstable.hg/xen/xen-syms] Error 1
make[2]: Leaving directory `/usr/src/xen-unstable.hg/xen/arch/x86'
make[1]: *** [/usr/src/xen-unstable.hg/xen/xen] Error 2
make[1]: Leaving directory `/usr/src/xen-unstable.hg/xen'


[-- Attachment #3: xen_shadow.diff --]
[-- Type: text/x-diff, Size: 2109 bytes --]

diff -r d1b0a5adaeab xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Wed Nov 29 23:40:40 2006 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Nov 30 11:13:37 2006 +0100
@@ -628,6 +628,13 @@ static int vmx_pae_enabled(struct vcpu *
 {
     unsigned long cr4 = v->arch.hvm_vmx.cpu_shadow_cr4;
     return (vmx_paging_enabled(v) && (cr4 & X86_CR4_PAE));
+}
+
+/* Works only for vcpu == current */
+static void vmx_update_host_cr3(struct vcpu *v)
+{
+    ASSERT(v == current);
+    __vmwrite(HOST_CR3, v->arch.cr3);
 }
 
 /* Setup HVM interfaces */
diff -r d1b0a5adaeab xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 29 23:40:40 2006 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Thu Nov 30 11:13:37 2006 +0100
@@ -581,7 +581,7 @@ guest_index(void *ptr)
     return (u32)((unsigned long)ptr & ~PAGE_MASK) / sizeof(guest_l1e_t);
 }
 
-static inline u32
+static u32
 shadow_l1_index(mfn_t *smfn, u32 guest_index)
 {
 #if (GUEST_PAGING_LEVELS == 2) && (SHADOW_PAGING_LEVELS != 2)
@@ -593,7 +593,7 @@ shadow_l1_index(mfn_t *smfn, u32 guest_i
 #endif
 }
 
-static inline u32
+static u32
 shadow_l2_index(mfn_t *smfn, u32 guest_index)
 {
 #if (GUEST_PAGING_LEVELS == 2) && (SHADOW_PAGING_LEVELS != 2)
@@ -613,13 +613,13 @@ shadow_l2_index(mfn_t *smfn, u32 guest_i
 
 #if GUEST_PAGING_LEVELS >= 4
 
-static inline u32
+static u32
 shadow_l3_index(mfn_t *smfn, u32 guest_index)
 {
     return guest_index;
 }
 
-static inline u32
+static u32
 shadow_l4_index(mfn_t *smfn, u32 guest_index)
 {
     return guest_index;
diff -r d1b0a5adaeab xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h	Wed Nov 29 23:40:40 2006 +0000
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h	Thu Nov 30 11:13:37 2006 +0100
@@ -272,13 +272,6 @@ static inline int vmx_lme_is_set(struct 
     return efer & EFER_LME;
 }
 
-/* Works only for vcpu == current */
-static inline void vmx_update_host_cr3(struct vcpu *v)
-{
-    ASSERT(v == current);
-    __vmwrite(HOST_CR3, v->arch.cr3);
-}
-
 static inline int vmx_pgbit_test(struct vcpu *v)
 {
     unsigned long cr0 = v->arch.hvm_vmx.cpu_shadow_cr0;

[-- Attachment #4: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2006-11-30 10:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-30 10:31 Christoph Egger [this message]
2006-11-30 12:56 ` [PATCH] Bugfix: Don't use function pointers to inline functions Jan Beulich

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=200611301131.28678.Christoph.Egger@amd.com \
    --to=christoph.egger@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.