From: Sergej Proskurin <proskurin@sec.in.tum.de>
To: Razvan Cojocaru <rcojocaru@bitdefender.com>,
xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Tamas K Lengyel <tamas@tklengyel.com>,
Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH v2 25/25] arm/altp2m: Add test of xc_altp2m_change_gfn.
Date: Tue, 2 Aug 2016 11:50:52 +0200 [thread overview]
Message-ID: <dabdadae-3e5e-a7e3-36de-bc16534d0540@sec.in.tum.de> (raw)
In-Reply-To: <8b74cee1-c72b-a875-4516-fb05bb1f038e@bitdefender.com>
Hi Razvan,
On 08/02/2016 11:14 AM, Razvan Cojocaru wrote:
> On 08/01/2016 08:10 PM, Sergej Proskurin wrote:
>> This commit extends xen-access by a simple test of the functionality
>> provided by "xc_altp2m_change_gfn". The idea is to dynamically remap a
>> trapping gfn to another mfn, which holds the same content as the
>> original mfn.
>>
>> Signed-off-by: Sergej Proskurin <proskurin@sec.in.tum.de>
>> ---
>> Cc: Razvan Cojocaru <rcojocaru@bitdefender.com>
>> Cc: Tamas K Lengyel <tamas@tklengyel.com>
>> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
>> Cc: Wei Liu <wei.liu2@citrix.com>
>> ---
>> tools/tests/xen-access/xen-access.c | 135 +++++++++++++++++++++++++++++++++++-
>> 1 file changed, 132 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c
>> index eafd7d6..39b7ddf 100644
>> --- a/tools/tests/xen-access/xen-access.c
>> +++ b/tools/tests/xen-access/xen-access.c
>> @@ -38,6 +38,7 @@
>> #include <sys/mman.h>
>> #include <sys/poll.h>
>>
>> +#define XC_WANT_COMPAT_MAP_FOREIGN_API
>> #include <xenctrl.h>
>> #include <xenevtchn.h>
>> #include <xen/vm_event.h>
>> @@ -49,6 +50,8 @@
>> #define START_PFN 0ULL
>> #endif
>>
>> +#define INVALID_GFN ~(0UL)
>> +
>> #define DPRINTF(a, b...) fprintf(stderr, a, ## b)
>> #define ERROR(a, b...) fprintf(stderr, a "\n", ## b)
>> #define PERROR(a, b...) fprintf(stderr, a ": %s\n", ## b, strerror(errno))
>> @@ -72,9 +75,14 @@ typedef struct xenaccess {
>> xen_pfn_t max_gpfn;
>>
>> vm_event_t vm_event;
>> +
>> + unsigned int ap2m_idx;
>> + xen_pfn_t gfn_old;
>> + xen_pfn_t gfn_new;
>> } xenaccess_t;
>>
>> static int interrupted;
>> +static int gfn_changed = 0;
>> bool evtchn_bind = 0, evtchn_open = 0, mem_access_enable = 0;
>>
>> static void close_handler(int sig)
>> @@ -82,6 +90,94 @@ static void close_handler(int sig)
>> interrupted = sig;
>> }
>>
>> +static int copy_gfn(xc_interface *xch, domid_t domain_id,
>> + xen_pfn_t dst_gfn, xen_pfn_t src_gfn)
>> +{
>> + void *src_vaddr = NULL;
>> + void *dst_vaddr = NULL;
>> +
>> + src_vaddr = xc_map_foreign_range(xch, domain_id, XC_PAGE_SIZE,
>> + PROT_READ, src_gfn);
>> + if ( src_vaddr == MAP_FAILED || src_vaddr == NULL)
>> + {
>> + return -1;
>> + }
> Please don't use scopes for single return statements (i.e. no { ... }
> around them).
>
I will adapt the scopes to the coding style, thank you. These are
leftovers from my test outputs.
>> +
>> + dst_vaddr = xc_map_foreign_range(xch, domain_id, XC_PAGE_SIZE,
>> + PROT_WRITE, dst_gfn);
>> + if ( dst_vaddr == MAP_FAILED || dst_vaddr == NULL)
>> + {
>> + return -1;
>> + }
> But if this failed and the first one succeeds, shouldn't we munmap() the
> first one before the return?
>
You are absolutely right. I will adapt the implementation accordingly.
Thank you very much.
Best regards,
~Sergej
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-02 9:51 UTC|newest]
Thread overview: 159+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-01 17:10 [PATCH v2 00/25] arm/altp2m: Introducing altp2m to ARM Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 01/25] arm/altp2m: Add first altp2m HVMOP stubs Sergej Proskurin
2016-08-03 16:54 ` Julien Grall
2016-08-04 16:01 ` Sergej Proskurin
2016-08-04 16:04 ` Julien Grall
2016-08-04 16:22 ` Sergej Proskurin
2016-08-04 16:51 ` Julien Grall
2016-08-05 6:55 ` Sergej Proskurin
2016-08-09 19:16 ` Tamas K Lengyel
2016-08-10 9:52 ` Julien Grall
2016-08-10 14:49 ` Tamas K Lengyel
2016-08-11 8:17 ` Julien Grall
2016-08-11 14:41 ` Tamas K Lengyel
2016-08-12 8:10 ` Julien Grall
2016-08-01 17:10 ` [PATCH v2 02/25] arm/altp2m: Add HVMOP_altp2m_get_domain_state Sergej Proskurin
2016-08-01 17:21 ` Andrew Cooper
2016-08-01 17:34 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 03/25] arm/altp2m: Add struct vttbr Sergej Proskurin
2016-08-03 17:04 ` Julien Grall
2016-08-03 17:05 ` Julien Grall
2016-08-04 16:11 ` Sergej Proskurin
2016-08-04 16:15 ` Julien Grall
2016-08-06 8:54 ` Sergej Proskurin
2016-08-06 13:20 ` Julien Grall
2016-08-06 13:48 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 04/25] arm/altp2m: Move hostp2m init/teardown to individual functions Sergej Proskurin
2016-08-03 17:40 ` Julien Grall
2016-08-05 7:26 ` Sergej Proskurin
2016-08-05 9:16 ` Julien Grall
2016-08-06 8:43 ` Sergej Proskurin
2016-08-06 13:26 ` Julien Grall
2016-08-06 13:50 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 05/25] arm/altp2m: Rename and extend p2m_alloc_table Sergej Proskurin
2016-08-03 17:57 ` Julien Grall
2016-08-06 8:57 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 06/25] arm/altp2m: Cosmetic fixes - function prototypes Sergej Proskurin
2016-08-03 18:02 ` Julien Grall
2016-08-06 9:00 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 07/25] arm/altp2m: Add altp2m init/teardown routines Sergej Proskurin
2016-08-03 18:12 ` Julien Grall
2016-08-05 6:53 ` Sergej Proskurin
2016-08-05 9:20 ` Julien Grall
2016-08-06 8:30 ` Sergej Proskurin
2016-08-09 9:44 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 08/25] arm/altp2m: Add HVMOP_altp2m_set_domain_state Sergej Proskurin
2016-08-03 18:41 ` Julien Grall
2016-08-06 9:03 ` Sergej Proskurin
2016-08-06 9:36 ` Sergej Proskurin
2016-08-06 14:18 ` Julien Grall
2016-08-06 14:21 ` Julien Grall
2016-08-11 9:08 ` Julien Grall
2016-08-01 17:10 ` [PATCH v2 09/25] arm/altp2m: Add altp2m table flushing routine Sergej Proskurin
2016-08-03 18:44 ` Julien Grall
2016-08-06 9:45 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 10/25] arm/altp2m: Add HVMOP_altp2m_create_p2m Sergej Proskurin
2016-08-03 18:48 ` Julien Grall
2016-08-06 9:46 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 11/25] arm/altp2m: Add HVMOP_altp2m_destroy_p2m Sergej Proskurin
2016-08-04 11:46 ` Julien Grall
2016-08-06 9:54 ` Sergej Proskurin
2016-08-06 13:36 ` Julien Grall
2016-08-06 13:51 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 12/25] arm/altp2m: Add HVMOP_altp2m_switch_p2m Sergej Proskurin
2016-08-04 11:51 ` Julien Grall
2016-08-06 10:13 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 13/25] arm/altp2m: Make p2m_restore_state ready for altp2m Sergej Proskurin
2016-08-04 11:55 ` Julien Grall
2016-08-06 10:20 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 14/25] arm/altp2m: Make get_page_from_gva " Sergej Proskurin
2016-08-04 11:59 ` Julien Grall
2016-08-06 10:38 ` Sergej Proskurin
2016-08-06 13:45 ` Julien Grall
2016-08-06 16:58 ` Sergej Proskurin
2016-08-11 8:33 ` Julien Grall
2016-08-01 17:10 ` [PATCH v2 15/25] arm/altp2m: Extend __p2m_lookup Sergej Proskurin
2016-08-04 12:04 ` Julien Grall
2016-08-06 10:44 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 16/25] arm/altp2m: Make p2m_mem_access_check ready for altp2m Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 17/25] arm/altp2m: Cosmetic fixes - function prototypes Sergej Proskurin
2016-08-04 12:06 ` Julien Grall
2016-08-06 10:46 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 18/25] arm/altp2m: Add HVMOP_altp2m_set_mem_access Sergej Proskurin
2016-08-04 14:19 ` Julien Grall
2016-08-06 11:03 ` Sergej Proskurin
2016-08-06 14:26 ` Julien Grall
2016-08-01 17:10 ` [PATCH v2 19/25] arm/altp2m: Add altp2m_propagate_change Sergej Proskurin
2016-08-04 14:50 ` Julien Grall
2016-08-06 11:26 ` Sergej Proskurin
2016-08-06 13:52 ` Julien Grall
2016-08-06 17:06 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 20/25] arm/altp2m: Add altp2m paging mechanism Sergej Proskurin
2016-08-04 13:50 ` Julien Grall
2016-08-06 12:51 ` Sergej Proskurin
2016-08-06 14:14 ` Julien Grall
2016-08-06 17:28 ` Sergej Proskurin
2016-08-04 16:59 ` Julien Grall
2016-08-06 12:57 ` Sergej Proskurin
2016-08-06 14:21 ` Julien Grall
2016-08-06 17:35 ` Sergej Proskurin
2016-08-10 9:32 ` Sergej Proskurin
2016-08-11 8:47 ` Julien Grall
2016-08-11 17:13 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 21/25] arm/altp2m: Add HVMOP_altp2m_change_gfn Sergej Proskurin
2016-08-04 14:04 ` Julien Grall
2016-08-06 13:45 ` Sergej Proskurin
2016-08-06 14:34 ` Julien Grall
2016-08-06 17:42 ` Sergej Proskurin
2016-08-11 9:21 ` Julien Grall
2016-08-01 17:10 ` [PATCH v2 22/25] arm/altp2m: Adjust debug information to altp2m Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 23/25] arm/altp2m: Extend libxl to activate altp2m on ARM Sergej Proskurin
2016-08-02 11:59 ` Wei Liu
2016-08-02 14:07 ` Sergej Proskurin
2016-08-11 16:00 ` Wei Liu
2016-08-15 16:07 ` Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 24/25] arm/altp2m: Extend xen-access for " Sergej Proskurin
2016-08-01 17:10 ` [PATCH v2 25/25] arm/altp2m: Add test of xc_altp2m_change_gfn Sergej Proskurin
2016-08-02 9:14 ` Razvan Cojocaru
2016-08-02 9:50 ` Sergej Proskurin [this message]
2016-08-01 18:15 ` [PATCH v2 00/25] arm/altp2m: Introducing altp2m to ARM Julien Grall
2016-08-01 19:20 ` Tamas K Lengyel
2016-08-01 19:55 ` Julien Grall
2016-08-01 20:35 ` Sergej Proskurin
2016-08-01 20:41 ` Tamas K Lengyel
2016-08-02 7:38 ` Julien Grall
2016-08-02 11:17 ` George Dunlap
2016-08-02 15:48 ` Tamas K Lengyel
2016-08-02 16:05 ` George Dunlap
2016-08-02 16:09 ` Tamas K Lengyel
2016-08-02 16:40 ` Julien Grall
2016-08-02 17:01 ` Tamas K Lengyel
2016-08-02 17:22 ` Tamas K Lengyel
2016-08-02 16:00 ` Tamas K Lengyel
2016-08-02 16:11 ` Julien Grall
2016-08-02 16:22 ` Tamas K Lengyel
2016-08-01 23:14 ` Andrew Cooper
2016-08-02 7:34 ` Julien Grall
2016-08-02 16:08 ` Andrew Cooper
2016-08-02 16:30 ` Tamas K Lengyel
2016-08-03 11:53 ` Julien Grall
2016-08-03 12:00 ` Andrew Cooper
2016-08-03 12:13 ` Julien Grall
2016-08-03 12:18 ` Andrew Cooper
2016-08-03 12:45 ` Sergej Proskurin
2016-08-03 14:08 ` Julien Grall
2016-08-03 14:17 ` Sergej Proskurin
2016-08-03 16:01 ` Tamas K Lengyel
2016-08-03 16:24 ` Julien Grall
2016-08-03 16:42 ` Tamas K Lengyel
2016-08-03 16:51 ` Julien Grall
2016-08-03 17:30 ` Andrew Cooper
2016-08-03 17:43 ` Tamas K Lengyel
2016-08-03 17:45 ` Julien Grall
2016-08-03 17:51 ` Tamas K Lengyel
2016-08-03 17:56 ` Julien Grall
2016-08-03 18:11 ` Tamas K Lengyel
2016-08-03 18:16 ` Julien Grall
2016-08-03 18:21 ` Tamas K Lengyel
2016-08-04 11:13 ` George Dunlap
2016-08-08 4:44 ` Tamas K Lengyel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dabdadae-3e5e-a7e3-36de-bc16534d0540@sec.in.tum.de \
--to=proskurin@sec.in.tum.de \
--cc=ian.jackson@eu.citrix.com \
--cc=rcojocaru@bitdefender.com \
--cc=tamas@tklengyel.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).