From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Chris Mason <chris.mason@fusionio.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Mark Brown <broonie@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>
Subject: Re: [GIT PULL] Btrfs
Date: Mon, 18 Nov 2013 10:35:55 +0100 [thread overview]
Message-ID: <20131118093555.GA4192@osiris> (raw)
In-Reply-To: <20131117093604.GT2008@redhat.com>
On Sun, Nov 17, 2013 at 11:36:04AM +0200, Gleb Natapov wrote:
> On Fri, Nov 15, 2013 at 03:57:23PM +0100, Heiko Carstens wrote:
> > On Fri, Nov 15, 2013 at 02:42:08PM +0100, Geert Uytterhoeven wrote:
> > > I was just going to comment that
> > >
> > > + const void *zero_page = (const void *) page_to_phys(ZERO_PAGE(0));
> > >
> > > won't fly. You can't just cast a physical address to "void *".
> >
> > Ouch.. I think that only works on s390 because we have a 1:1 mapping for
> > physical to virtual addresses in kernel space due to our split address spaces.
> >
> > So for btrfs and kvm it should be page_to_virt(), and for the dma_map_single()
> > case I have no idea. :)
> Can you send updated patch for kvm please?
See below. page_to_virt() is only defined for a couple of architectures, so I
used __va(page_to_phys()) instead.
I tested the patch on s390 only...
>From b19687bad7e878aaed6edb786a22c6b05e886b97 Mon Sep 17 00:00:00 2001
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Date: Mon, 18 Nov 2013 10:05:57 +0100
Subject: [PATCH] kvm: kvm_clear_guest_page(): fix empty_zero_page usage
Using the address of 'empty_zero_page' as source address in order to clear
a page is wrong. On some architectures empty_zero_page is only the pointer
to the struct page of the empty_zero_page.
Therefore the clear page operation would copy the contents of a couple of
struct pages instead of clearing a page.
For kvm only arm64 is affected by this bug.
To fix this use the ZERO_PAGE macro instead which will return the struct
page address of the empty_zero_page on all architectures.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
virt/kvm/kvm_main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 662f34c3287e..a0aa84b5941a 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1615,8 +1615,9 @@ EXPORT_SYMBOL_GPL(kvm_read_guest_cached);
int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len)
{
- return kvm_write_guest_page(kvm, gfn, (const void *) empty_zero_page,
- offset, len);
+ const void *zero_page = (const void *) __va(page_to_phys(ZERO_PAGE(0)));
+
+ return kvm_write_guest_page(kvm, gfn, zero_page, offset, len);
}
EXPORT_SYMBOL_GPL(kvm_clear_guest_page);
--
1.8.3.4
next prev parent reply other threads:[~2013-11-18 9:37 UTC|newest]
Thread overview: 126+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-14 17:19 [GIT PULL] Btrfs Chris Mason
2013-11-15 11:32 ` Heiko Carstens
2013-11-15 12:21 ` Chris Mason
2013-11-15 13:40 ` Chris Mason
2013-11-15 13:42 ` Geert Uytterhoeven
2013-11-15 14:57 ` Heiko Carstens
2013-11-17 9:36 ` Gleb Natapov
2013-11-18 9:35 ` Heiko Carstens [this message]
2013-11-18 10:30 ` Will Deacon
-- strict thread matches above, loose matches on Subject: below --
2017-06-10 13:00 Chris Mason
2017-05-09 17:56 Chris Mason
2017-05-09 18:01 ` Chris Mason
2017-04-28 0:26 Chris Mason
2017-04-14 18:28 Chris Mason
2017-03-31 21:05 Chris Mason
2017-03-23 15:09 Chris Mason
2017-03-02 20:19 Chris Mason
2017-02-25 0:56 Chris Mason
2017-02-11 13:18 Chris Mason
2017-01-27 19:37 Chris Mason
2016-12-16 17:01 Chris Mason
2016-11-04 17:28 Chris Mason
2016-10-28 14:08 Chris Mason
2016-10-14 20:31 Chris Mason
2016-10-11 15:46 Chris Mason
2016-09-23 20:01 Chris Mason
2016-09-09 17:46 Chris Mason
2016-09-03 13:54 Chris Mason
2016-08-26 23:36 Chris Mason
2016-08-10 12:10 Chris Mason
2016-08-04 19:12 Chris Mason
2016-07-31 13:55 Chris Mason
2016-06-18 13:01 Chris Mason
2016-06-10 20:01 Chris Mason
2016-06-03 20:57 Chris Mason
2016-05-27 17:44 Chris Mason
2016-05-21 14:18 Chris Mason
2016-04-08 20:43 Chris Mason
2016-04-01 22:45 Chris Mason
2016-03-22 0:24 Chris Mason
2016-03-22 1:16 ` Linus Torvalds
2016-03-22 2:15 ` Chris Mason
2016-03-22 2:24 ` Chris Mason
2016-03-22 2:38 ` Linus Torvalds
2016-03-04 18:51 Chris Mason
2016-02-19 19:08 Chris Mason
2016-02-12 16:43 Chris Mason
2016-01-29 18:42 Chris Mason
2016-01-22 16:34 Chris Mason
2016-01-17 23:30 Chris Mason
2016-01-18 10:25 ` Martin Steigerwald
2016-01-18 10:52 ` Holger Hoffstätte
2015-12-18 17:28 Chris Mason
2015-11-27 21:13 Chris Mason
2015-11-13 20:37 Chris Mason
2015-11-06 18:44 Chris Mason
2015-10-23 12:47 Chris Mason
2015-10-16 17:34 Chris Mason
2015-10-09 17:42 Chris Mason
2015-09-25 17:35 Chris Mason
2015-09-11 18:44 Chris Mason
2015-08-08 19:41 Chris Mason
2015-07-31 18:21 Chris Mason
2015-07-17 19:38 Chris Mason
2015-07-10 19:15 Chris Mason
2015-06-29 21:11 Chris Mason
2015-05-23 1:14 Chris Mason
2015-05-26 12:33 ` Josh Boyer
2015-05-26 12:54 ` Chris Mason
2015-06-02 14:02 ` Josh Boyer
2015-06-26 14:21 ` David Sterba
2015-03-06 21:45 Chris Mason
2015-02-26 2:01 Chris Mason
2015-02-19 20:36 Chris Mason
2015-02-20 10:09 ` Markus Trippelsdorf
2014-11-09 1:17 Chris Mason
2014-10-11 0:41 Chris Mason
2014-08-14 17:59 Chris Mason
2014-08-14 18:10 ` Linus Torvalds
2014-08-14 18:17 ` Chris Mason
2014-07-20 14:33 Chris Mason
2014-07-04 14:42 Chris Mason
2014-06-20 15:53 Chris Mason
2014-05-20 19:25 Chris Mason
2014-04-26 23:31 Chris Mason
2014-02-16 13:13 Chris Mason
2014-02-09 19:13 Chris Mason
2014-02-04 17:59 Chris Mason
2014-01-30 21:52 Chris Mason
2014-02-02 0:15 ` David Rientjes
2014-02-02 1:28 ` Filipe David Manana
2014-02-02 2:40 ` David Rientjes
2014-02-02 8:09 ` Chris Samuel
2014-02-03 17:54 ` David Sterba
2014-02-03 18:18 ` Chris Mason
2014-02-04 19:50 ` Greg KH
2014-02-04 19:52 ` Chris Mason
2013-12-12 21:57 Chris Mason
2013-11-21 18:35 Chris Mason
2013-11-15 15:19 Chris Mason
2013-11-15 16:11 ` Geert Uytterhoeven
2013-10-18 23:24 Chris Mason
2013-10-12 1:01 Chris Mason
2013-10-05 17:36 Chris Mason
2013-09-22 20:50 Chris Mason
2013-09-12 15:36 Chris Mason
2013-09-12 20:38 ` Josh Boyer
2013-09-13 6:44 ` Geert Uytterhoeven
2013-09-13 11:53 ` Josh Boyer
2013-09-13 12:15 ` Russell King
2013-09-13 12:36 ` Geert Uytterhoeven
2013-09-13 15:06 ` Josh Boyer
2013-09-13 15:38 ` Josh Boyer
2013-09-13 15:58 ` Russell King
2013-09-14 9:33 ` Heiko Carstens
2013-09-13 13:07 ` Ric Wheeler
2013-09-13 14:11 ` Hugo Mills
2013-08-10 12:28 Chris Mason
2013-07-09 19:18 Chris Mason
2013-06-14 1:29 Chris Mason
2013-05-09 19:26 Chris Mason
2013-03-02 15:15 Chris Mason
2013-03-02 15:41 ` Liu Bo
2013-03-03 0:45 ` Linus Torvalds
2013-03-03 1:10 ` Chris Mason
2012-10-09 21:05 Chris Mason
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=20131118093555.GA4192@osiris \
--to=heiko.carstens@de.ibm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=chris.mason@fusionio.com \
--cc=dulshani.gunawardhana89@gmail.com \
--cc=geert@linux-m68k.org \
--cc=gleb@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).