Bug 674516

Summary: xenctx shows nonsensical values for 32-on-64 and HVM domains
Product: Red Hat Enterprise Linux 5 Reporter: Paolo Bonzini <pbonzini>
Component: xenAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 5.6CC: drjones, jarod, jlv, jzheng, leiwang, minovotn, mjenner, mrezanin, mshao, pbonzini, xen-maint, yuzhou
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: xen-3.0.3-125.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 674514 Environment:
Last Closed: 2011-07-21 09:18:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 674514    
Bug Blocks: 514500, 626806    
Attachments:
Description Flags
Fix xenctx for 32-on-64 and HVM domains none

Description Paolo Bonzini 2011-02-02 09:39:11 UTC
+++ This bug was initially created as a clone of Bug #674514 +++

This requires backporting:

- c/s 19168 and 19169 for the hypervisor

- c/s 19170 for libxc 

- c/s 18962, c/s 18963, c/s 19171, c/s 19453 for xenctx.

This is also required to block 32-on-64 ballooning while it's not implemented

Comment 1 Michal Novotny 2011-02-02 10:47:10 UTC
Well, the mentioned c/s 19170 is OK for xc_domain.c part of the patch but xc_pagetab.c expects also c/s 18962 merged before that so I guess c/s 18962 and 19170 are for libxc and c/s 18963, c/s 19171, c/s 19453 for xenctx.

Without implementing this into the hypervisor the user-space stack cannot be compiled.

Since I'm working on this right now I'm taking the bug.

Michal

Comment 2 Paolo Bonzini 2011-02-02 11:07:34 UTC
Notice that the changes to the hypervisor public include files need to be done in the userspace xen package too.

Regarding c/s 19170, the changes to xc_domain.c and xc_pagetab.c are not separate in this case (they could be separated if your aim was to fix 626806 only).

Comment 3 Michal Novotny 2011-02-02 18:11:46 UTC
Well, the required changesets to be backported are:

libxc: c/s 17880, c/s 18962, c/s 19169 and c/s 19170
xenctx: c/s 15547, c/s 16757, c/s 18963, c/s 19171 and c/s 19453

so total count of 9 patches (c/s 17880, c/s 18962, c/s 19169 and c/s 19170, c/s 15547, c/s 16757, c/s 18963, c/s 19171 and c/s 19453).

I'm currently working on it and I'll post the patch soon since it's almost done (except some issues on ia64).

Michal

Comment 4 Michal Novotny 2011-02-03 15:27:07 UTC
Well, ok, those ia64 things requires also many other backporting since the infrastructure changed a lot in c/s 15047, 15102, 15125 and also for 32-on-64 bit c/s 19179 is required so the list of patches to be backported is starting to be pretty big.

Michal

Comment 5 Michal Novotny 2011-02-03 17:47:33 UTC
Well, it's not all since I'm still having some issues when compiling it on ia64 platform, I've found out at least 2 new changesets that are responsible just for fixing this on ia64, they are c/s 19052 and c/s 17882. Apparently even upstream had issues with that and so the patches were coming after those patches. Unfortunately since it's not working on all architectures yet I'm unable to send the patch series and I need to investigate this further.

Michal

Comment 6 Paolo Bonzini 2011-02-04 12:42:42 UTC
Do not backport the ia64 changes, you can figure out the context without backporting all that stuff.

You're right about 16757 and 19179 though.

Comment 7 Michal Novotny 2011-02-04 15:00:29 UTC
Well, for backporting with ia64 stuff it required to backport c/s 15047, 15102, 15125, 15547, 15995, 16757, 17880, 18962, 18963, 18997, 19169, 19170, 19171, 19179, 19453, 19052 and 17882 however when the ia64 stuff backporting is not needed there and just non-ia64 stuff should be backported this could take some time since the infrastructure changed a lot to support both 32-on-64 and HVM domains which made it fail when just backporting non-ia64 stuff so it can take some time to investigate this further and make it working since even not touching ia64 stuff is not enough because some of the changesets required change the infrastructure shared between all the architectures so backporting only non-ia64 stuff makes it unable to compile on ia64.

Michal

Comment 8 Michal Novotny 2011-02-04 15:06:03 UTC
(In reply to comment #6)
> Do not backport the ia64 changes, you can figure out the context without
> backporting all that stuff.
> 
> You're right about 16757 and 19179 though.

So I'll try backporting non-ia64 pieces of these and compiling it on all platforms per each patch/changeset applied to solve the issues immediately:

- c/s 19170 for libxc

- c/s 19171 for xen public headers (required)

- c/s 16757, 18962, c/s 18963, c/s 19171, c/s 19453 and c/s 19179 for xenctx.

Michal

Comment 9 Michal Novotny 2011-02-23 11:59:50 UTC
Created attachment 480430 [details]
Fix xenctx for 32-on-64 and HVM domains

This is the patch to fix the xenctx tool to show valid values for both 32-on-64 and HVM domains. It has been tested on RHEL-5 x86_64 dom0 for RHEL-5 both 32-bit and 64-bit PV and HVM guests and also on RHEL-5 i386 dom0 for 32-bit PV and HVM guests and it was showing the values correctly. Also, a compability patch has been added to use the old behavior when you're running new user-space but old hypervisor that doesn't support required hypercall yet.

Michal

Comment 24 Miroslav Rezanina 2011-03-03 09:56:17 UTC
Original serie change ABI so it is needed to fix it.

Comment 32 Jinxin Zheng 2011-05-09 11:15:11 UTC
This is the xenctx output for 32 bit PV and HVM on kernel-xen -238 and xen
-120:

PV:

rip: 00010000 
rsp: c04057280061000b
rax: 00010000 rbx: 69c0708fbc rcx: c062157c00610703 rdx: c04056ec00610304
rsi: c04056f800610005 rdi: c040570400610006 rbp: 124600000061
 r8: c062155800610401  r9: c040556800610000 r10: 00000000 r11: 7b0000007b
r12: c04013a701000000 r13: 00000020 r14: 00000001 r15: 00000000
 cs: 00000009  ds: 0000040e  fs: 0000000f  gs: 00000010

HVM:

rip: c0403c4b 
rsp: c0708fd4
rax: 00000000 rbx: 00000000 rcx: c0403c1a rdx: c0708000
rsi: c0638c23 rdi: c18088c4 rbp: 00000020
 r8: 00000000  r9: 00000000 r10: 00000000 r11: 00000000
r12: 00000000 r13: 00000000 r14: 00000000 r15: 00000000
 cs: 00000060  ds: 00000000  fs: 00000000  gs: 00000000

We can see the 64-bit register (rip,rsp,...) values are printed.

After upgrade to kernel-xen -259 and xen -130, the xenctx outputs 32-bit
registers (eax,ebx,...) now:

PV:

cs:eip: 0061:c0456b68 
flags: 00001246 i z p
ss:esp: 0069:c0e55e34
eax: 00000012 ebx: c0697000 ecx: c069700c edx: 00000003
esi: c1600a40 edi: c069700c ebp: 00000000
 ds:     007b  es:     007b  fs:     0000  gs:     0000

Stack:
--

HVM:

cs:eip: 0060:c0403c4b 
flags: 00000246 i z p
ss:esp: 0068:c0708fd4
eax: 00000000 ebx: 00000000 ecx: c0403c1a edx: c0708000
esi: c0638c23 edi: c18088c4 ebp: 00000020
 ds:     0000  es:     0000  fs:     0000  gs:     0000

Stack:
 c0403d12 c0638c45 c070d9fa 00006e44 00000000 c078ce20 02010800 00099800
 c06fa800 00880007 00000000

Code:
Code (instr addr c0403c4b)
0c fd eb 14 fa 89 e0 25 00 f0 ff ff 8b 40 08 a8 08 75 04 fb f4 <eb> 01 fb 89 e2
81 e2 00 f0 ff ff 

Call Trace:
  [<c0403c4b>]  <--
  [<c0403d12>] 
  [<c0638c45>] 
  [<c070d9fa>] 
  [<c078ce20>] 
  [<c06fa800>] 


so this is verified together with bug 674514.

Comment 33 errata-xmlrpc 2011-07-21 09:18:05 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1070.html

Comment 34 errata-xmlrpc 2011-07-21 12:07:24 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1070.html