From: Marek Marczykowski <marmarek@invisiblethingslab.com>
To: Marek Marczykowski <marmarek@invisiblethingslab.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>, xen-devel@lists.xen.org
Subject: Re: [PATCH] libxc: fix xc_gntshr_munmap semantic
Date: Fri, 26 Apr 2013 16:01:45 +0200 [thread overview]
Message-ID: <517A88C9.7090705@invisiblethingslab.com> (raw)
In-Reply-To: <20130426134535.5BA912AE@duch.mimuw.edu.pl>
[-- Attachment #1.1: Type: text/plain, Size: 2869 bytes --]
CC'ed Ian.
On 26.04.2013 14:40, Marek Marczykowski wrote:
> "count" parameter should be pages count (as stated in comment in
> xenctrl.h), not bytes count.
> This patch fixes also the only user of this function (in xen sources) -
> libvchan.
>
> Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
> ---
> tools/libvchan/init.c | 4 ++--
> tools/libvchan/io.c | 10 ++++++----
> tools/libxc/xc_linux_osdep.c | 2 +-
> 3 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c
> index 0c7cff6..f0d2505 100644
> --- a/tools/libvchan/init.c
> +++ b/tools/libvchan/init.c
> @@ -129,9 +129,9 @@ out:
> return ring_ref;
> out_unmap_left:
> if (pages_left)
> - xc_gntshr_munmap(ctrl->gntshr, ctrl->read.buffer, pages_left * PAGE_SIZE);
> + xc_gntshr_munmap(ctrl->gntshr, ctrl->read.buffer, pages_left);
> out_ring:
> - xc_gntshr_munmap(ctrl->gntshr, ring, PAGE_SIZE);
> + xc_gntshr_munmap(ctrl->gntshr, ring, 1);
> ring_ref = -1;
> ctrl->ring = NULL;
> ctrl->write.order = ctrl->read.order = 0;
> diff --git a/tools/libvchan/io.c b/tools/libvchan/io.c
> index 3c8d236..3040099 100644
> --- a/tools/libvchan/io.c
> +++ b/tools/libvchan/io.c
> @@ -324,16 +324,18 @@ void libxenvchan_close(struct libxenvchan *ctrl)
> if (!ctrl)
> return;
> if (ctrl->read.order >= PAGE_SHIFT)
> - munmap(ctrl->read.buffer, 1 << ctrl->read.order);
> + xc_gntshr_munmap(ctrl->gntshr, ctrl->read.buffer,
> + 1 << (ctrl->read.order - PAGE_SHIFT));
> if (ctrl->write.order >= PAGE_SHIFT)
> - munmap(ctrl->write.buffer, 1 << ctrl->write.order);
> + xc_gntshr_munmap(ctrl->gntshr, ctrl->write.buffer,
> + 1 << (ctrl->write.order - PAGE_SHIFT));
> if (ctrl->ring) {
> if (ctrl->is_server) {
> ctrl->ring->srv_live = 0;
> - xc_gntshr_munmap(ctrl->gntshr, ctrl->ring, PAGE_SIZE);
> + xc_gntshr_munmap(ctrl->gntshr, ctrl->ring, 1);
> } else {
> ctrl->ring->cli_live = 0;
> - xc_gnttab_munmap(ctrl->gnttab, ctrl->ring, PAGE_SIZE);
> + xc_gnttab_munmap(ctrl->gnttab, ctrl->ring, 1);
> }
> }
> if (ctrl->event) {
> diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c
> index 36832b6..3c43fca 100644
> --- a/tools/libxc/xc_linux_osdep.c
> +++ b/tools/libxc/xc_linux_osdep.c
> @@ -825,7 +825,7 @@ static void *linux_gntshr_share_pages(xc_gntshr *xch, xc_osdep_handle h,
> static int linux_gntshr_munmap(xc_gntshr *xcg, xc_osdep_handle h,
> void *start_address, uint32_t count)
> {
> - return munmap(start_address, count);
> + return munmap(start_address, count * XC_PAGE_SIZE);
> }
>
> static struct xc_osdep_ops linux_gntshr_ops = {
>
--
Best Regards / Pozdrawiam,
Marek Marczykowski
Invisible Things Lab
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 553 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-04-26 14:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 11:07 bug in xc_gntshr_munmap? Marek Marczykowski
2013-04-26 13:34 ` Ian Campbell
2013-04-26 13:41 ` Marek Marczykowski
2013-04-26 12:40 ` [PATCH] libxc: fix xc_gntshr_munmap semantic Marek Marczykowski
2013-04-26 14:01 ` Marek Marczykowski [this message]
2013-04-26 14:44 ` Ian Campbell
2013-04-26 15:15 ` Daniel De Graaf
2013-04-26 15:26 ` Ian Campbell
2013-04-26 16:17 ` Daniel De Graaf
2013-04-30 10:39 ` Ian Campbell
2013-04-30 13:21 ` Daniel De Graaf
2013-04-30 14:00 ` Ian Campbell
2013-04-30 14:19 ` Daniel De Graaf
2013-04-30 14:29 ` Ian Campbell
2013-04-26 13:49 ` bug in xc_gntshr_munmap? Ian Campbell
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=517A88C9.7090705@invisiblethingslab.com \
--to=marmarek@invisiblethingslab.com \
--cc=Ian.Campbell@citrix.com \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.