From: Jan Kiszka <jan.kiszka@siemens.com>
To: Alexander Graf <agraf@suse.de>
Cc: "qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
qemu-devel Developers <qemu-devel@nongnu.org>,
kvm <kvm@vger.kernel.org>, David Gibson <dwg@au1.ibm.com>
Subject: Re: qemu-kvm: Role of flush_icache_range on PPC
Date: Wed, 28 Sep 2011 16:49:03 +0200 [thread overview]
Message-ID: <4E8333DF.1080504@siemens.com> (raw)
In-Reply-To: <4E83330C.2080901@siemens.com>
On 2011-09-28 16:45, 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 {
>>>
>>>
>>> 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. Which operations could trigger
> such a write? Does PPC inject software breakpoints in form of trap
> operations or so?
>
> Mmm, according to our ancient recordings, the hunk above was once
> introduced for the sake of IA64: 9dc99a2823. I skipped it in my removal
> patch as it has some non-IA64 effect, at least potentially.
Correction: It was introduced by 6d3295f7c8, but generalized with
f067512c06. That former commit talks about DMA operations on IA64 that
also updates/drops the icache in reality.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Alexander Graf <agraf@suse.de>
Cc: "qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
qemu-devel Developers <qemu-devel@nongnu.org>,
kvm <kvm@vger.kernel.org>, David Gibson <dwg@au1.ibm.com>
Subject: Re: [Qemu-devel] qemu-kvm: Role of flush_icache_range on PPC
Date: Wed, 28 Sep 2011 16:49:03 +0200 [thread overview]
Message-ID: <4E8333DF.1080504@siemens.com> (raw)
In-Reply-To: <4E83330C.2080901@siemens.com>
On 2011-09-28 16:45, 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 {
>>>
>>>
>>> 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. Which operations could trigger
> such a write? Does PPC inject software breakpoints in form of trap
> operations or so?
>
> Mmm, according to our ancient recordings, the hunk above was once
> introduced for the sake of IA64: 9dc99a2823. I skipped it in my removal
> patch as it has some non-IA64 effect, at least potentially.
Correction: It was introduced by 6d3295f7c8, but generalized with
f067512c06. That former commit talks about DMA operations on IA64 that
also updates/drops the icache in reality.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2011-09-28 14:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-28 14:23 qemu-kvm: Role of flush_icache_range on PPC Jan Kiszka
2011-09-28 14:23 ` [Qemu-devel] " Jan Kiszka
2011-09-28 14:26 ` Alexander Graf
2011-09-28 14:26 ` [Qemu-devel] " Alexander Graf
2011-09-28 14:45 ` Jan Kiszka
2011-09-28 14:45 ` [Qemu-devel] " Jan Kiszka
2011-09-28 14:49 ` Jan Kiszka [this message]
2011-09-28 14:49 ` Jan Kiszka
2011-09-28 14:57 ` Alexander Graf
2011-09-28 14:57 ` [Qemu-devel] " Alexander Graf
2011-09-28 17:27 ` Scott Wood
2011-09-28 17:27 ` [Qemu-devel] " Scott Wood
2011-09-28 21:02 ` Benjamin Herrenschmidt
2011-09-28 21:02 ` [Qemu-devel] " Benjamin Herrenschmidt
2011-09-28 21:20 ` Scott Wood
2011-09-28 21:20 ` [Qemu-devel] " Scott Wood
2011-09-28 21:34 ` Benjamin Herrenschmidt
2011-09-28 21:34 ` [Qemu-devel] " Benjamin Herrenschmidt
2011-09-28 20:58 ` Benjamin Herrenschmidt
2011-09-28 20:58 ` [Qemu-devel] " 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=4E8333DF.1080504@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=agraf@suse.de \
--cc=dwg@au1.ibm.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 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.