- return error when appropriate from increase_memory_reservation
PATCH 1/1 - return error when appropriate from increase_memory_reservation
This patch fixes a case in increasing a memory reservation where you do not get the pages nor do you get an error. While an argument might be made that checking the page count independently is workable, it does seem reasonable to have the operation return a failure in the cases where it doesn't do what was asked. Right now, it mostly returns the correct status. This patch just adds another instance of this.
And, while-I-was-there, I've been generating linker maps for qemu in my own builds. It's harmless, until you need it and then it's valuable. Tweak the Makefile to create the map.
Signature · 5 lines
------------------------------------------------------------------------ Ben Thomas Virtual Iron Software [email protected] Tower 1, Floor 2 978-849-1214 900 Chelmsford Street Lowell, MA 01851
tools/ioemu/target-i386-dm/Makefile +1 -1
@@ -323,7 +323,7 @@ endif endif $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a - $(CC) $(CFLAGS) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS) $(VL_LIBS) -lpthread + $(CC) $(CFLAGS) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS) $(VL_LIBS) -lpthread -Wl,-Map,qemu-dm.map -Wl,--cref vnc.o: vnc.c keyboard_rdesktop.c $(CC) $(CFLAGS) $(DEFINES) $(VNC_CFLAGS) -c -o $@ $<
xen/common/memory.c +3 -0
@@ -348,6 +348,9 @@ long do_memory_op(unsigned long cmd, GUEbreak ; } +if (rc < reservation.nr_extents && !preempted) +return -ENOMEM ; +if (unlikely (reservation.domid !=DOMID_SELF ) )put_domain (d);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · Ben Thomas
This patch fixes a case in increasing a memory reservation where you do not get the pages nor do you get an error. While an argument might be made that checking the page count independently is workable, it does seem reasonable to have the operation return a failure in the cases where it doesn't do what was asked. Right now, it mostly returns the correct status. This patch just adds another instance of this.
No. In cases where it fails it does not undo its partial work. The current return lets the caller know how much work was done so that appropriate action can be taken. The callers need fixing -- there aren't that many. Only increase_reservation or populate_physmap can fail, unless the caller is buggy, so they are the only ones that really need fixing. The others should probably BUG_ON() or assert or print an error in the caller though.
Quoted 3 lines
And, while-I-was-there, I've been generating linker maps for qemu in my own builds. It's harmless, until you need it and then it's valuable. Tweak the
Makefileto create the map.
I'll take that as a separate patch.
Thanks,
Keir
You're right - I was fixing this too quickly. The issue I was encountering is that xc_domain_memory_increase_reservation may return 0(success) when no pages have been reserved. Put this in a loop and you get, well, interesting results.
There are several possible solutions for this, all done at that level. However, it isn't clear to me at this moment what the best and most correct solution would be. So, I'm going to put this off for now and continue to use a different approach.
Thanks,
-b
Quoted 23 lines · Keir Fraser
Quoted 6 lines · Ben Thomas
This patch fixes a case in increasing a memory reservation where you do not get the pages nor do you get an error. While an argument might be made that checking the page count independently is workable, it does seem reasonable to have the operation return a failure in the cases where it doesn't do what was asked. Right now, it mostly returns the correct status. This patch just adds another instance of this.
No. In cases where it fails it does not undo its partial work. The current return lets the caller know how much work was done so that appropriate action can be taken. The callers need fixing -- there aren't that many. Only
increase_reservationorpopulate_physmapcan fail, unless the caller is buggy, so they are the only ones that really need fixing. The others should probablyBUG_ON()or assert or print an error in the caller though.Quoted 3 lines
And, while-I-was-there, I've been generating linker maps for qemu in my own builds. It's harmless, until you need it and then it's valuable. Tweak the
Makefileto create the map.I'll take that as a separate patch.
Thanks,
Keir
Signature · 5 lines
------------------------------------------------------------------------ Ben Thomas Virtual Iron Software [email protected] Tower 1, Floor 2 978-849-1214 900 Chelmsford Street Lowell, MA 01851