From: Peter Xu <peterx@redhat.com>
To: Gal Hammer <ghammer@redhat.com>
Cc: QEMU Devel Mailing List <qemu-devel@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] Windows balloon driver PFN issue
Date: Tue, 27 Feb 2018 10:59:41 +0800 [thread overview]
Message-ID: <20180227025941.GQ18962@xz-mi> (raw)
In-Reply-To: <CAA2ifQzRFsZ_=mr9WrFjieTS7YuzQdz5xhoEWOE-5pWWBhBD7Q@mail.gmail.com>
On Mon, Feb 26, 2018 at 10:54:11AM +0200, Gal Hammer wrote:
> Hi Peter,
>
> On Fri, Feb 2, 2018 at 12:11 PM, Peter Xu <peterx@redhat.com> wrote:
> > On Thu, Feb 01, 2018 at 02:48:20PM +0200, Michael S. Tsirkin wrote:
> >
> > [...]
> >
> >> > > > > PFN is GPA>>12. Do you have more than 1<<44 bytes of memory in this VM then?
> >> > > >
> >> > > > No. But isn't it still not good to drop the page at offset zero (and
> >> > > > drop it NNN times)?
> >> > >
> >> > > Absolutely - looks like a bug. I just don't know why does this happen.
> >> >
> >> > IMHO if we are using a PFN array like this:
> >> >
> >> > u64 pfn_array[];
> >> >
> >> > In the windows guest driver, then we'll see this (as mentioned
> >> > above). But for sure this is wild guess of mine.
> >>
> >> I don't see code like this anywhere in the windows balloon
> >> driver. It's here:
> >> https://github.com/virtio-win/kvm-guest-drivers-windows.git
> >
> > Thanks for the pointer. I had a quick glance, the PFN array is
> > defined as:
> >
> > PPFN_NUMBER pfns_table;
> >
> > But I don't know what's sizeof(PPFN_NUMBER). :(
>
> sizeof(PPFN_NUMBER) = sizeof(void*)
>
> PFN_NUMBER is of an unsigned long type. Although it doesn't matter, as
> a pointer to it is always the same size, 4 bytes in a 32-bit CPU and 8
> bytes in 64-bit one.
Ah, it's not really PPFN_NUMBER that matters, it should be
PFN_NUMBER. This is how the PFNs are copied in windows driver:
RtlCopyMemory(ctx->pfns_table, MmGetMdlPfnArray(pPageMdl),
ctx->num_pfns * sizeof(PFN_NUMBER));
I don't know these APIs, but it looks like MmGetMdlPfnArray() is
returning an PFN_NUMBER array.
And I don't know how the balloon spec says, but in QEMU it's always
using uint32_t as PFN. See virtio_balloon_handle_output():
while (iov_to_buf(elem->out_sg, elem->out_num, offset, &pfn, 4) == 4)
So I guess only if sizeof(PFN_NUMBER)==4 is true on both 32/64 bits
platforms of windows, otherwise there might be a problem.
Thanks,
--
Peter Xu
prev parent reply other threads:[~2018-02-27 3:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 9:28 [Qemu-devel] Windows balloon driver PFN issue Peter Xu
2018-01-31 14:03 ` Michael S. Tsirkin
2018-02-01 2:18 ` Peter Xu
2018-02-01 2:24 ` Michael S. Tsirkin
2018-02-01 2:33 ` Peter Xu
2018-02-01 12:48 ` Michael S. Tsirkin
2018-02-02 10:11 ` Peter Xu
[not found] ` <CAA2ifQzRFsZ_=mr9WrFjieTS7YuzQdz5xhoEWOE-5pWWBhBD7Q@mail.gmail.com>
2018-02-27 2:59 ` Peter Xu [this message]
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=20180227025941.GQ18962@xz-mi \
--to=peterx@redhat.com \
--cc=ghammer@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.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.