From: Avi Kivity <avi@qumranet.com>
To: Ben-Ami Yassour <benami@il.ibm.com>
Cc: kvm@vger.kernel.org, Muli Ben-Yehuda <muli@il.ibm.com>,
Amit Shah <amit.shah@qumranet.com>
Subject: Re: KVM: PCIPT: direct mmio
Date: Thu, 05 Jun 2008 16:20:09 +0300 [thread overview]
Message-ID: <4847E809.1070607@qumranet.com> (raw)
In-Reply-To: <alpine.DEB.1.10.0806050055310.2737@cluwyn.haifa.ibm.com>
Ben-Ami Yassour wrote:
>
>>> + if (len > 0) {
>>> + ptr = mmap(NULL, len, prot, MAP_ANONYMOUS | MAP_SHARED, -1,
>>> 0);
>>> + if (ptr == MAP_FAILED) {
>>> + fprintf(stderr, "create_userspace_phys_mem: %s",
>>> + strerror(errno));
>>> + return 0;
>>> + }
>>
>> You're using 'len == 0' here to change the semantics of the function.
>> It would be better to have two different APIs (perhaps sharing some of
>> the implementation by calling a helper).
>>
>
> Actually, this is a fix of a bug that is probably exposed only by the
> direct mmio code.
> Here is the problem (in the existing code):
> kvm_destroy_phys_mem calls kvm_create_phys_mem(kvm, phys_start, 0, 0, 0);
> kvm_create_phys_mem calls kvm_create_userspace_phys_mem which is calling
>
> mmap(NULL, len, prot, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
> if (ptr == MAP_FAILED)
>
> now, if len = 0 it fails.
>
What's the point of a zero length memslot? I seem to remember this
conversation in the past.
> We could have sent is as a separate patch,
> and we could have made more changes to fix it differently,
> for example, not to let kvm_destroy_phys_mem call kvm_create_phys_mem
> (which seems strange in general...).
Yeah. Perhaps a common helper.
> We wanted to minimize the amount of changes that we make, so we choose
> this option.
>
> What do you recommend?
Send patches that fix the current broken code and prepare the way for
the real changes.
This way its easy to review both the fixes to the existing code and the
new functionality.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2008-06-05 13:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <OF02BEEB69.3AC5BC32-ONC225745E.007719ED-C225745E.00772C47@il.ibm.com>
2008-06-04 22:01 ` KVM: PCIPT: direct mmio Ben-Ami Yassour
2008-06-05 13:20 ` Avi Kivity [this message]
2008-06-03 11:21 Ben-Ami Yassour
2008-06-04 14:16 ` Avi Kivity
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=4847E809.1070607@qumranet.com \
--to=avi@qumranet.com \
--cc=amit.shah@qumranet.com \
--cc=benami@il.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=muli@il.ibm.com \
/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