From: Scott Wood <scottwood@freescale.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: kvm <kvm@vger.kernel.org>,
qemu-devel Developers <qemu-devel@nongnu.org>,
Alexander Graf <agraf@suse.de>, David Gibson <dwg@au1.ibm.com>,
"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>
Subject: Re: [Qemu-devel] qemu-kvm: Role of flush_icache_range on PPC
Date: Wed, 28 Sep 2011 12:27:25 -0500 [thread overview]
Message-ID: <4E8358FD.6030408@freescale.com> (raw)
In-Reply-To: <4E83330C.2080901@siemens.com>
On 09/28/2011 09:45 AM, Jan Kiszka wrote:
> On 2011-09-28 16:26, Alexander Graf wrote:
>>
>> On 28.09.2011, at 16:23, Jan Kiszka wrote:
>>
>>> Alex,
>>>
>>> we have this diff in qemu-kvm:
>>>
>>> diff --git a/exec.c b/exec.c
>>> index c1e045d..f188549 100644
>>> --- a/exec.c
>>> +++ b/exec.c
>>> @@ -3950,6 +3955,11 @@ void cpu_physical_memory_rw(target_phys_addr_t
>>> addr, uint8_t *buf,
>>> cpu_physical_memory_set_dirty_flags(
>>> addr1, (0xff& ~CODE_DIRTY_FLAG));
>>> }
>>> + /* qemu doesn't execute guest code directly, but kvm does
>>> + therefore flush instruction caches */
>>> + if (kvm_enabled())
>>> + flush_icache_range((unsigned long)ptr,
>>> + ((unsigned long)ptr)+l);
>>> qemu_put_ram_ptr(ptr);
>>> }
>>> } else {
Been meaning to send a poke about this one:
http://patchwork.ozlabs.org/patch/90403/
I've seen issues with this when the executable images are initially
loaded by qemu.
>>> flush_icache_range() is doing something only on PPC hosts. So do we need
>>> this upstream?
>>
>> This makes sure that when device emulation overwrites code that is
>> already present in the cache of a CPU, it gets flushed from the
>> icache. I'm fairly sure we want that :). But let's ask Ben and David
>> as well.
>
> /me wondered which write scenario precisely needs this. It could only be
> something synchronous /wrt to some VCPU.
Why would it need to be synchronous? Even if it's asynchronous emulated
DMA, we don't want it sitting around only in a data cache that
instruction fetches won't snoop.
> Which operations could trigger
> such a write? Does PPC inject software breakpoints in form of trap
> operations or so?
It's not implemented yet in mainline for powerpc (we have something
internal that is on the backlog of things to be cleaned up and sent
out), but this is what we'd do for kvm_arch_insert_sw_breakpoint().
-Scott
next prev parent reply other threads:[~2011-09-28 17:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-28 14:23 [Qemu-devel] qemu-kvm: Role of flush_icache_range on PPC Jan Kiszka
2011-09-28 14:26 ` Alexander Graf
2011-09-28 14:45 ` Jan Kiszka
2011-09-28 14:49 ` Jan Kiszka
2011-09-28 14:57 ` Alexander Graf
2011-09-28 17:27 ` Scott Wood [this message]
2011-09-28 21:02 ` Benjamin Herrenschmidt
2011-09-28 21:20 ` Scott Wood
2011-09-28 21:34 ` Benjamin Herrenschmidt
2011-09-28 20:58 ` Benjamin Herrenschmidt
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=4E8358FD.6030408@freescale.com \
--to=scottwood@freescale.com \
--cc=agraf@suse.de \
--cc=dwg@au1.ibm.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 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).