From: Dave Scott <Dave.Scott@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Stefano Stabellini <Stefano.Stabellini@citrix.com>,
David Vrabel <david.vrabel@citrix.com>,
Ian Jackson <Ian.Jackson@citrix.com>
Subject: Re: [PATCH] linux_gntshr_munmap: munmap takes a length, not a page count
Date: Wed, 3 Sep 2014 16:49:58 +0000 [thread overview]
Message-ID: <83BA6B8C-3438-460F-8757-D9F22D4F85D0@citrix.com> (raw)
In-Reply-To: <10A87768-4C5B-4870-939A-55E9B6E83977@citrix.com>
On 3 Sep 2014, at 16:48, David Scott <dave.scott@citrix.com> wrote:
>
> On 3 Sep 2014, at 15:01, Ian Campbell <Ian.Campbell@citrix.com> wrote:
>
>> On Mon, 2014-09-01 at 13:16 +0100, David Scott wrote:
>>> This fixes a bug where if a client shares more than 1 page, the
>>> munmap call fails to clean up everything. A process which does
>>> a lot of sharing and unsharing can run out of resources.
>>
>> The doc comment on xc_gntshr_munmap does say count is in pages, so your
>> change is correct but all of the in tree callers seem to pass a number
>> of bytes not a number of pages. i.e. everything in tools/libvchan passes
>> n*PAGE_SIZE.
>
> Good point.
>
>> So I don't think this change is complete without also updating those.
>
> I’ll resubmit with the in-tree callers fixed.
Also it looks like xc_gnttab_munmap (gnttab not gntshr) uses pages in both the API and implementation, but libvchan is supplying bytes. I’ll fix vchan here too.
Dave
>
> Thanks,
> Dave
>
>>
>> Ian.
>>
>>>
>>> Signed-off-by: David Scott <dave.scott@citrix.com>
>>> ---
>>> tools/libxc/xc_linux_osdep.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c
>>> index 86bff3e..a19e4b6 100644
>>> --- a/tools/libxc/xc_linux_osdep.c
>>> +++ b/tools/libxc/xc_linux_osdep.c
>>> @@ -847,7 +847,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 = {
>>
>>
>
next prev parent reply other threads:[~2014-09-03 16:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-01 12:16 [PATCH] linux_gntshr_munmap: munmap takes a length, not a page count David Scott
2014-09-03 0:24 ` Stefano Stabellini
2014-09-03 14:01 ` Ian Campbell
2014-09-03 14:15 ` David Vrabel
2014-09-03 14:17 ` Ian Campbell
2014-09-03 14:21 ` David Vrabel
2014-09-03 14:31 ` Ian Campbell
2014-09-03 14:38 ` Andrew Cooper
2014-09-03 15:48 ` Dave Scott
2014-09-03 16:49 ` Dave Scott [this message]
2014-09-03 17:34 ` [PATCH v2] " David Scott
2014-09-10 14:09 ` 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=83BA6B8C-3438-460F-8757-D9F22D4F85D0@citrix.com \
--to=dave.scott@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@citrix.com \
--cc=Stefano.Stabellini@citrix.com \
--cc=david.vrabel@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).