Skip to contentSkip to conversation

Trivial patches for 22 July to 3 August 2012

GIT PULL In review Stefan Hajnoczi 4 participants 12 messages Aug 3, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

This pull request subsumes the currently pending request from 1 August. Patches from Amos Kong, Peter Cong, and Tyler Hall have been added.

The following changes since commit 02d2bd5d57812154cfb978bc2098cf49d551583d:

Replace 'struct siginfo' with 'siginfo_t'. (2012-08-01 08:54:07 -0500)

are available in the git repository at:

git://github.com/stefanha/qemu.git trivial-patches

for you to fetch changes up to 48110429ef7a4ecb1665e88ce58ba2ebd9664e4f:

exec.c: Remove out of date comment (2012-08-03 10:56:07 +0100)

----------------------------------------------------------------
Amos Kong (2):
remove unused include of error.h
socket: clean up redundant assignment

Jan Kiszka (2):
usb: Clean common object and dependency files
qom: Clean libuser object and dependency files

Peter Maydell (1):
exec.c: Remove out of date comment

Tyler Hall (2):
exec.c: Fix off-by-one error in register_subpage exec.c: Use subpages for large unaligned mappings

 Makefile       |    4 ++--
 exec.c         |   23 ++++++++++-------------
 qemu-sockets.c |    1 -
 qemu_socket.h  |    1 -
 4 files changed, 12 insertions(+), 17 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/7 usb: Clean common object and dependency files

From: Jan Kiszka <[email protected]>

---
 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 621cb86..d872d46 100644
@@ -216,7 +216,7 @@ clean:
 	rm -Rf .libs
 	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d qapi/*.o qapi/*.d qga/*.o qga/*.d
 	rm -f qom/*.o qom/*.d
-	rm -f usb/*.o usb/*.d hw/*.o hw/*.d
+	rm -f hw/usb/*.o hw/usb/*.d hw/*.o hw/*.d
 	rm -f qemu-img-cmds.h
 	rm -f trace/*.o trace/*.d
 	rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/7 qom: Clean libuser object and dependency files

In reply to Stefan Hajnoczi

From: Jan Kiszka <[email protected]>

---
 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index d872d46..000b46c 100644
@@ -215,7 +215,7 @@ clean:
 	rm -f *.o *.d *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
 	rm -Rf .libs
 	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d qapi/*.o qapi/*.d qga/*.o qga/*.d
-	rm -f qom/*.o qom/*.d
+	rm -f qom/*.o qom/*.d libuser/qom/*.o libuser/qom/*.d
 	rm -f hw/usb/*.o hw/usb/*.d hw/*.o hw/*.d
 	rm -f qemu-img-cmds.h
 	rm -f trace/*.o trace/*.d
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/7 remove unused include of error.h

In reply to Stefan Hajnoczi

From: Amos Kong <[email protected]>

---
 qemu_socket.h |    1 -
 1 file changed, 1 deletion(-)
qemu_socket.h +0 -1
index 4689ff3..1a2f517 100644
@@ -27,7 +27,6 @@ int inet_aton(const char *cp, struct in_addr *ia);
 #endif /* !_WIN32 */
 
 #include "qemu-option.h"
-#include "error.h"
 #include "qerror.h"
 
 /* misc helpers */
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [Qemu-devel] [PATCH 3/7] remove unused include of error.h

Quoted 13 lines · On Fri, 3 Aug 2012 11:51:02 +0100 Stefan Hajnoczi…

From: Amos Kong <[email protected]>

---
 qemu_socket.h |    1 -
 1 file changed, 1 deletion(-)
qemu_socket.h +0 -0
index 4689ff3..1a2f517 100644

qemu_socket.h int inet_aton(const char *cp, struct in_addr *ia); · line 30

Quoted 5 lines
qemu_socket.h +0 -1
@@ -27,7 +27,6 @@ int inet_aton(const char *cp, struct in_addr *ia);
 #endif /* !_WIN32 */
 
 #include "qemu-option.h"
-#include "error.h"
 #include "qerror.h"

nack on this one, as it's dropping the wrong file.

qemu_socket.h declares functions that take an Error argument, so it has to include error.h.

However, qerror.h should be dropped and any build breakage should be fixed by including qerror.h in the .c files it's missing.

Quoted 2 lines
qemu_socket.h +0 -0
 /* misc helpers */
#5 lore raw

Re: [Qemu-devel] [PATCH 3/7] remove unused include of error.h

Quoted 24 lines · Luiz Capitulino
Quoted 13 lines · On Fri, 3 Aug 2012 11:51:02 +0100 Stefan Hajnoczi…

From: Amos Kong <[email protected]>

---
 qemu_socket.h |    1 -
 1 file changed, 1 deletion(-)
qemu_socket.h +0 -0
index 4689ff3..1a2f517 100644

qemu_socket.h int inet_aton(const char *cp, struct in_addr *ia); · line 30

Quoted 5 lines
qemu_socket.h +0 -1
@@ -27,7 +27,6 @@ int inet_aton(const char *cp, struct in_addr *ia);
 #endif /* !_WIN32 */
 
 #include "qemu-option.h"
-#include "error.h"
 #include "qerror.h"

nack on this one, as it's dropping the wrong file.

Quoted 5 lines

qemu_socket.h declares functions that take an Error argument, so it has to include error.h.

However, qerror.h should be dropped and any build breakage should be fixed by including qerror.h in the .c files it's missing.

Okay, let's drop this patch. I build tested it across all targets, so at least it doesn't break anything.

Stefan

#6 lore raw

PATCH 4/7 socket: clean up redundant assignment

In reply to Stefan Hajnoczi

From: Amos Kong <[email protected]>

---
 qemu-sockets.c |    1 -
 1 file changed, 1 deletion(-)
qemu-sockets.c +0 -1
index 668fa93..beb2bb6 100644
@@ -284,7 +284,6 @@ int inet_connect_opts(QemuOpts *opts, Error **errp)
                         inet_strfamily(e->ai_family),
                         e->ai_canonname, uaddr, uport, strerror(errno));
             closesocket(sock);
-            sock = -1;
             continue;
         }
         freeaddrinfo(res);
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH 5/7 exec.c: Fix off-by-one error in register_subpage

In reply to Stefan Hajnoczi

From: Tyler Hall <[email protected]>

subpage_register() expects "end" to be the last byte in the mapping. Registering a non-page-aligned memory region that extends up to or beyond a page boundary causes subpage_register() to silently fail through the (end >= PAGE_SIZE) check.

This bug does not cause noticeable problems for mappings that do not extend to a page boundary, though they do register an extra byte.

---
 exec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
exec.c +1 -1
index feb4795..27b100c 100644
@@ -2271,7 +2271,7 @@ static void register_subpage(MemoryRegionSection *section)
         subpage = container_of(existing->mr, subpage_t, iomem);
     }
     start = section->offset_within_address_space & ~TARGET_PAGE_MASK;
-    end = start + section->size;
+    end = start + section->size - 1;
     subpage_register(subpage, start, end, phys_section_add(section));
 }
 
Signature · 1 line
1.7.10.4
#8 lore raw

PATCH 6/7 exec.c: Use subpages for large unaligned mappings

In reply to Stefan Hajnoczi

From: Tyler Hall <[email protected]>

Registering a multi-page memory region that is non-page-aligned results in a subpage from the start to the page boundary, some number of full pages, and possibly another subpage from the last page boundary to the end. The full pages will have a value for offset_within_region that is not a multiple of TARGET_PAGE_SIZE. Accesses through softmmu are unable to handle this and will segfault.

Handling full pages through subpages is not optimal, but only non-page-aligned mappings take the penalty.

---
 exec.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
exec.c +9 -4
index 27b100c..e6ac3e7 100644
@@ -2305,10 +2305,15 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section,
         remain.offset_within_address_space += now.size;
         remain.offset_within_region += now.size;
     }
-    now = remain;
-    now.size &= TARGET_PAGE_MASK;
-    if (now.size) {
-        register_multipage(&now);
+    while (remain.size >= TARGET_PAGE_SIZE) {
+        now = remain;
+        if (remain.offset_within_region & ~TARGET_PAGE_MASK) {
+            now.size = TARGET_PAGE_SIZE;
+            register_subpage(&now);
+        } else {
+            now.size &= TARGET_PAGE_MASK;
+            register_multipage(&now);
+        }
         remain.size -= now.size;
         remain.offset_within_address_space += now.size;
         remain.offset_within_region += now.size;
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH 7/7 exec.c: Remove out of date comment

In reply to Stefan Hajnoczi

From: Peter Maydell <[email protected]>

Remove an out of date comment: this comment used to be attached to cpu_register_physical_memory_log(), before commit 0f0cb164 accidentally inserted a couple of other functions between the comment and its function. It is in any case obsolete since (a) the function arguments it refers to have been replaced with a single MemoryRegionSection* argument and
(b) the inability to handle regions whose offset_within_address_space and offset_within_region aren't equally aligned was fixed as part of the rewrite of this code.

---
 exec.c |    8 --------
 1 file changed, 8 deletions(-)
exec.c +0 -8
index e6ac3e7..a42a0b5 100644
@@ -2240,14 +2240,6 @@ static void phys_sections_clear(void)
     phys_sections_nb = 0;
 }
 
-/* register physical memory.
-   For RAM, 'size' must be a multiple of the target page size.
-   If (phys_offset & ~TARGET_PAGE_MASK) != 0, then it is an
-   io memory page.  The address used when calling the IO function is
-   the offset from the start of the region, plus region_offset.  Both
-   start_addr and region_offset are rounded down to a page boundary
-   before calculating this offset.  This should not be a problem unless
-   the low bits of start_addr and region_offset differ.  */
 static void register_subpage(MemoryRegionSection *section)
 {
     subpage_t *subpage;
Signature · 1 line
1.7.10.4
#10 lore raw
In reply to Stefan Hajnoczi
Quoted 7 lines · Stefan Hajnoczi

This pull request subsumes the currently pending request from 1 August. Patches from Amos Kong, Peter Cong, and Tyler Hall have been added.

The following changes since commit 02d2bd5d57812154cfb978bc2098cf49d551583d:

Replace 'struct siginfo' with 'siginfo_t'. (2012-08-01 08:54:07 -0500)

Quoted 7 lines

are available in the git repository at:

git://github.com/stefanha/qemu.git trivial-patches

for you to fetch changes up to 48110429ef7a4ecb1665e88ce58ba2ebd9664e4f:

exec.c: Remove out of date comment (2012-08-03 10:56:07 +0100)

Luiz pointed out an issue with Amos' #include "error.h" removal patch.
I have dropped it and the new HEAD is at
c308efe63a875eb0d839f7490e69e58e4595466c.

Thanks,
Stefan

#11 lore raw
Quoted 13 lines · Stefan Hajnoczi
Quoted 11 lines · Stefan Hajnoczi

This pull request subsumes the currently pending request from 1 August. Patches from Amos Kong, Peter Cong, and Tyler Hall have been added.

The following changes since commit 02d2bd5d57812154cfb978bc2098cf49d551583d:

Replace 'struct siginfo' with 'siginfo_t'. (2012-08-01 08:54:07 -0500)

are available in the git repository at:

git://github.com/stefanha/qemu.git trivial-patches

Quoted 8 lines
Quoted 3 lines

for you to fetch changes up to 48110429ef7a4ecb1665e88ce58ba2ebd9664e4f:

exec.c: Remove out of date comment (2012-08-03 10:56:07 +0100)

Luiz pointed out an issue with Amos' #include "error.h" removal patch.
I have dropped it and the new HEAD is at
c308efe63a875eb0d839f7490e69e58e4595466c.

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 2 lines

Thanks,
Stefan