Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 770055

Summary: guest can't start nomarly after change the max memmory with the command setmaxmem.
Product: Red Hat Enterprise Linux 6 Reporter: Luwen Su <lsu>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, bsarathy, juzhang, mkenneth, tburke, virt-maint
Target Milestone: rc   
Target Release: 6.3   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-02 08:03:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Luwen Su 2011-12-23 08:24:26 UTC
Description:
guest can't start nomarly after change the max memmory with the command setmaxmem.
Like do this use setmaxmem set the guest's memory
1G --> 4G  start normally
4G --> 400MB start normally
400MB --> 4G guest kernel panic 


How reproduce:
100%

Version:
libvirt-0.9.8-1.el6.x86_64
qemu-kvm-0.12.1.2-2.209.el6.x86_64
kernel-2.6.32-220.el6.x86_64
---------------------------------------------------------------------------------
Steps:
1. Have a healthy shut down guest.

[root@timesu tmp]# virsh dominfo rhel6
Id:             -
Name:           rhel6
UUID:           075d6f58-cb21-2cbc-796c-60b389457912
OS Type:        hvm
State:          shut off
CPU(s):         2
Max memory:     1048576 kB
Used memory:    1048576 kB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0

[root@timesu ~]# free
             total       used       free     shared    buffers     cached
Mem:       7949448    1297032    6652416          0     182496     522712
-/+ buffers/cache:     591824    7357624
Swap:            0          0          0


Note:My guest have 1G memory with both Max and Used.It's important for the step next.
--------------------------------------------------------------------------------------

2.Set the guest's Max memory to 4G and make sure it can start normally.

[root@timesu tmp]# virsh setmaxmem rhel6 4194300
[root@timesu tmp]# virsh start rhel6
Domain rhel6 started

[root@timesu tmp]# virsh dominfo rhel6
Id:             53
Name:           rhel6
UUID:           075d6f58-cb21-2cbc-796c-60b389457912
OS Type:        hvm
State:          running
CPU(s):         2
CPU time:       12.7s
Max memory:     4194300 kB
Used memory:    1048576 kB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c746,c927 (enforcing)

[root@timesu ~]# free
             total       used       free     shared    buffers     cached
Mem:       7949448    1986112    5963336          0     182496     522388
-/+ buffers/cache:    1281228    6668220
Swap:            0          0          0


[root@timesu tmp]# virsh destroy rhel6
Domain rhel6 destroyed

----------------------------------------------------------------------------------

3. set the guest's Max memory to 400M and make sure it can start normally.
   And make sure set 400M not 800M or bigger too.
   I will explain the reason in Additional info.

[root@timesu tmp]# virsh setmaxmem rhel6 419430

[root@timesu tmp]# virsh start rhel6
Domain rhel6 started

[root@timesu tmp]# virsh dominfo rhel6
Id:             54
Name:           rhel6
UUID:           075d6f58-cb21-2cbc-796c-60b389457912
OS Type:        hvm
State:          running
CPU(s):         2
CPU time:       19.7s
Max memory:     419430 kB
Used memory:    419432 kB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c471,c643 (enforcing)

[root@timesu ~]# free
             total       used       free     shared    buffers     cached
Mem:       7949448    1362224    6587224          0     182496     523288
-/+ buffers/cache:     656440    7293008
Swap:            0          0          0


[root@timesu tmp]# virsh destroy rhel6
Domain rhel6 destroyed

Note:Here is a question.
     when the guest fully started , i use dominfo to get the information above.
     the Used is bigger than the Max.But the guest works fine.


------------------------------------------------------------------------------------

4.set the guest's Max memory to 4G and I hope it can start normally - -.

[root@timesu tmp]# virsh setmaxmem rhel6 4194300

[root@timesu tmp]# virsh start rhel6
Domain rhel6 started

[root@timesu tmp]# virsh dominfo rhel6
Id:             55
Name:           rhel6
UUID:           075d6f58-cb21-2cbc-796c-60b389457912
OS Type:        hvm
State:          running
CPU(s):         2
CPU time:       42.1s
Max memory:     4194300 kB
Used memory:    465916 kB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c279,c620 (enforcing)

[root@timesu ~]# free
             total       used       free     shared    buffers     cached
Mem:       7949448    2034736    5914712          0     182496     522888
-/+ buffers/cache:    1329352    6620096
Swap:            0          0          0

================================================================================
At this time , the guest was hung.There was NO error log in libvirt.log and the rhel6.log.
================================================================================
[root@timesu tmp]# virsh destroy rhel6
Domain rhel6 destroyed

Note:I upload a snapshot of my guest when it hung in attachment.

--------------------------------------------------------------------------------------

PS: For restore the guest , you can do this.
[root@timesu tmp]# virsh setmaxmem rhel6 1024100

[root@timesu tmp]# virsh start rhel6
Domain rhel6 started

[root@timesu tmp]# virsh dominfo rhel6
Id:             56
Name:           rhel6
UUID:           075d6f58-cb21-2cbc-796c-60b389457912
OS Type:        hvm
State:          running
CPU(s):         2
CPU time:       9.8s
Max memory:     1024100 kB
Used memory:    419432 kB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c626,c822 (enforcing)

Now it becomes healthy again.If you want to hung it again , just repeat the step 2-4.

--------------------------------------------------------------------------------
Actual result
the guest can't start normally.
--------------------------------------------------------------------------------
Expect result
the guest can start normally.
--------------------------------------------------------------------------------
Additional info:
For step 3:If set max's memory to 800M , the guest can work well.
           For reproduce the issue , you need change the max's by a wide margin.
           I don't know the accurate value, but 400M to 4G is enough to reproduce the problem.
--------------------------------------------------------------------------------
Here is the guest's qemu log when it hung:
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.2.0 -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -name rhel6 -uuid 075d6f58-cb21-2cbc-796c-60b389457912 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/rhel6.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -drive file=/var/lib/libvirt/images/rhel6.img,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=26,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:48:c7:68,bus=pci.0,addr=0x7 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -device usb-tablet,id=input0 -vnc 127.0.0.1:0 -vga cirrus -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
char device redirected to /dev/pts/1
qemu: terminating on signal 15 from pid 25848

Comment 2 Dor Laor 2012-01-02 08:03:12 UTC
Seems like you booted a 4G guest and allowed it only 400M using the balloon driver. You can't expect the VM to live w/ any number of RAM.