qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 19/43] postcopy: OS support test


From: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PATCH v2 19/43] postcopy: OS support test
Date: Tue, 12 Aug 2014 09:18:01 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

* zhanghailiang (address@hidden) wrote:
> On 2014/8/11 22:29, Dr. David Alan Gilbert (git) wrote:
> >From: "Dr. David Alan Gilbert"<address@hidden>
> >

<snip>

> >+    testarea2 = mmap(NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE |
> >+                                     MAP_ANONYMOUS, -1, 0);
> >+    if (!testarea2) {
> >+        perror("postcopy_ram_hosttest: Failed to map second test area");
> 
> Before return, should we munmap testarea?
> BTW, i think it is better to use goto statement,
> which we can handle the error cases together!

Yes, thank you for spotting this; I'll fix it in my next version.

Dave

> 
> Best regards,
> zhanghailiang
> >+        return -1;
> >+    }
> >+    g_assert(((size_t)testarea2&  (pagesize-1)) == 0);
> >+    *(char *)testarea = 0; /* Force the map of the new page */
> >+    if (syscall(__NR_remap_anon_pages, testarea2, testarea, pagesize, 0) !=
> >+        pagesize) {
> >+        perror("postcopy_ram_hosttest: remap_anon_pages not available");
> >+        munmap(testarea, pagesize);
> >+        munmap(testarea2, pagesize);
> >+        return -1;
> >+    }
> >+
> >+    munmap(testarea, pagesize);
> >+    munmap(testarea2, pagesize);
> >+    return 0;
> >+}
> >+
> >+#else
> >+/* No target OS support, stubs just fail */
> >+
> >+int postcopy_ram_hosttest(void)
> >+{
> >+    error_report("postcopy_ram_hosttest: No OS support");
> >+    return -1;
> >+}
> >+
> >+#endif
> >+
> 
> 
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK



reply via email to

[Prev in Thread] Current Thread [Next in Thread]