* merge kvm_flush_remote_tlbs when modifing shadow pte
@ 2007-12-17 21:53 Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A028595A0-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Dong, Eddie @ 2007-12-17 21:53 UTC (permalink / raw)
To: kvm-devel
[-- Attachment #1: Type: text/plain, Size: 685 bytes --]
host side TLB flush can be merged together if multiple
spte need to be write-protected.
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index 92ac0d1..749db46 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -524,9 +524,9 @@ static void rmap_write_protect(struct kvm *kvm, u64
gfn)
rmap_printk("rmap_write_protect: spte %p %llx\n", spte,
*spte);
if (is_writeble_pte(*spte))
set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK);
- kvm_flush_remote_tlbs(kvm);
spte = rmap_next(kvm, rmapp, spte);
}
+ kvm_flush_remote_tlbs(kvm);
}
#ifdef MMU_DEBUG
[-- Attachment #2: tlb-clean1.patch --]
[-- Type: application/octet-stream, Size: 632 bytes --]
host side TLB flush can be merged together if multiple
spte need to be write-protected.
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index 92ac0d1..749db46 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -524,9 +524,9 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte);
if (is_writeble_pte(*spte))
set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK);
- kvm_flush_remote_tlbs(kvm);
spte = rmap_next(kvm, rmapp, spte);
}
+ kvm_flush_remote_tlbs(kvm);
}
#ifdef MMU_DEBUG
[-- Attachment #3: Type: text/plain, Size: 308 bytes --]
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: merge kvm_flush_remote_tlbs when modifing shadow pte
[not found] ` <10EA09EFD8728347A513008B6B0DA77A028595A0-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-12-17 23:19 ` Avi Kivity
[not found] ` <47670419.8060302-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2007-12-17 23:19 UTC (permalink / raw)
To: Dong, Eddie; +Cc: kvm-devel
Dong, Eddie wrote:
> host side TLB flush can be merged together if multiple
> spte need to be write-protected.
>
> Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
> index 92ac0d1..749db46 100644
> --- a/drivers/kvm/mmu.c
> +++ b/drivers/kvm/mmu.c
> @@ -524,9 +524,9 @@ static void rmap_write_protect(struct kvm *kvm, u64
> gfn)
> rmap_printk("rmap_write_protect: spte %p %llx\n", spte,
> *spte);
> if (is_writeble_pte(*spte))
> set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK);
> - kvm_flush_remote_tlbs(kvm);
> spte = rmap_next(kvm, rmapp, spte);
> }
> + kvm_flush_remote_tlbs(kvm);
> }
>
I think this can be improved; in case we don't touch the shadow pte at
all, there is no need to flush the tlbs.
Also, please pull from kvm.git; things have moved around (mmu.c is now
in arch/x86/kvm/).
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: merge kvm_flush_remote_tlbs when modifing shadow pte
[not found] ` <47670419.8060302-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-12-18 1:12 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A028596B5-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Dong, Eddie @ 2007-12-18 1:12 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel
[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]
>Dong, Eddie wrote:
>> host side TLB flush can be merged together if multiple
>> spte need to be write-protected.
>>
>> Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>>
>> diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
>> index 92ac0d1..749db46 100644
>> --- a/drivers/kvm/mmu.c
>> +++ b/drivers/kvm/mmu.c
>> @@ -524,9 +524,9 @@ static void rmap_write_protect(struct
>kvm *kvm, u64
>> gfn)
>> rmap_printk("rmap_write_protect: spte %p %llx\n", spte,
>> *spte);
>> if (is_writeble_pte(*spte))
>> set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK);
>> - kvm_flush_remote_tlbs(kvm);
>> spte = rmap_next(kvm, rmapp, spte);
>> }
>> + kvm_flush_remote_tlbs(kvm);
>> }
>>
>
>
>I think this can be improved; in case we don't touch the shadow pte at
>all, there is no need to flush the tlbs.
>
>Also, please pull from kvm.git; things have moved around (mmu.c is now
>in arch/x86/kvm/).
>
>
Sure, rebased.
thx,eddie
[-- Attachment #2: tlb-clean1.patch2 --]
[-- Type: application/octet-stream, Size: 1131 bytes --]
commit 799271f149506598750e312ae83e719618ea247e
Author: root <root@vt32-pae.(none)>
Date: Tue Dec 18 06:08:27 2007 +0800
host side TLB flush can be merged together if multiple
spte need to be write-protected.
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 401eb7c..9a57e1a 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -513,6 +513,7 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
{
unsigned long *rmapp;
u64 *spte;
+ int write_protected = 0;
gfn = unalias_gfn(kvm, gfn);
rmapp = gfn_to_rmap(kvm, gfn);
@@ -522,11 +523,14 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
BUG_ON(!spte);
BUG_ON(!(*spte & PT_PRESENT_MASK));
rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte);
- if (is_writeble_pte(*spte))
+ if (is_writeble_pte(*spte)) {
set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK);
- kvm_flush_remote_tlbs(kvm);
+ write_protected = 1;
+ }
spte = rmap_next(kvm, rmapp, spte);
}
+ if (write_protected)
+ kvm_flush_remote_tlbs(kvm);
}
#ifdef MMU_DEBUG
[-- Attachment #3: Type: text/plain, Size: 308 bytes --]
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: merge kvm_flush_remote_tlbs when modifing shadow pte
[not found] ` <10EA09EFD8728347A513008B6B0DA77A028596B5-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-12-18 15:26 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2007-12-18 15:26 UTC (permalink / raw)
To: Dong, Eddie; +Cc: kvm-devel
Dong, Eddie wrote:
>> Dong, Eddie wrote:
>>
>>> host side TLB flush can be merged together if multiple
>>> spte need to be write-protected.
>>>
>>> Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>>>
>>> diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
>>> index 92ac0d1..749db46 100644
>>> --- a/drivers/kvm/mmu.c
>>> +++ b/drivers/kvm/mmu.c
>>> @@ -524,9 +524,9 @@ static void rmap_write_protect(struct
>>>
>> kvm *kvm, u64
>>
>>> gfn)
>>> rmap_printk("rmap_write_protect: spte %p %llx\n", spte,
>>> *spte);
>>> if (is_writeble_pte(*spte))
>>> set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK);
>>> - kvm_flush_remote_tlbs(kvm);
>>> spte = rmap_next(kvm, rmapp, spte);
>>> }
>>> + kvm_flush_remote_tlbs(kvm);
>>> }
>>>
>>>
>> I think this can be improved; in case we don't touch the shadow pte at
>> all, there is no need to flush the tlbs.
>>
>> Also, please pull from kvm.git; things have moved around (mmu.c is now
>> in arch/x86/kvm/).
>>
>>
>>
> Sure, rebased.
> thx,eddie
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-12-18 15:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-17 21:53 merge kvm_flush_remote_tlbs when modifing shadow pte Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A028595A0-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-12-17 23:19 ` Avi Kivity
[not found] ` <47670419.8060302-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-18 1:12 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A028596B5-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-12-18 15:26 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox