Re: [kvm-devel] [PATCH 3/4] [PATCH] kvmclock: allow it to be turned off

2008-03-06 Thread Glauber Costa
Avi Kivity wrote:
 Glauber Costa wrote:
 Use the lower 3 lower bits of the system time msr to turn off the clock.
 This means that all clock registration has to be aligned in a 4-byte 
 boundary

   
 
 3 bits - 8 bytes.
dohh!! true
/me ashamed.

 How about just using just bit 0 as an enable bit (not a disable bit).  
 That means the default value of zero means the clock is disabled, and 
 that we have a couple of more bits to enable future features.

Apart from the fact that it will break every single guest out there, 
that's ok. As I said: these things are so early, that maybe we can pay 
this price. Your call.

 Signed-off-by: Glauber Costa [EMAIL PROTECTED]
 ---
  arch/x86/kvm/x86.c |5 +
  1 files changed, 5 insertions(+), 0 deletions(-)

 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
 index 6abd784..7ce14ce 100644
 --- a/arch/x86/kvm/x86.c
 +++ b/arch/x86/kvm/x86.c
 @@ -591,6 +591,11 @@ int kvm_set_msr_common(struct kvm_vcpu *
  if (vcpu-arch.time_page)
  kvm_release_page_dirty(vcpu-arch.time_page);
  
 +/* 4-byte unaligned accesses are invalid */
 +if (data  0x7) {
 +vcpu-arch.time_page = NULL;
 +break;
 +}
  vcpu-arch.time = data  PAGE_MASK;
  vcpu-arch.time_offset = data  ~PAGE_MASK;
  
   
 
 


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 3/4] [PATCH] kvmclock: allow it to be turned off

2008-03-06 Thread Avi Kivity
Glauber Costa wrote:
 Apart from the fact that it will break every single guest out there, 
 that's ok. As I said: these things are so early, that maybe we can pay 
 this price. Your call.
   

Which guests?  kvmclock is only in kvm.git, and I don't think any distro 
is based on that.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 3/4] [PATCH] kvmclock: allow it to be turned off

2008-03-05 Thread Glauber Costa
Use the lower 3 lower bits of the system time msr to turn off the clock.
This means that all clock registration has to be aligned in a 4-byte boundary

Signed-off-by: Glauber Costa [EMAIL PROTECTED]
---
 arch/x86/kvm/x86.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 6abd784..7ce14ce 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -591,6 +591,11 @@ int kvm_set_msr_common(struct kvm_vcpu *
if (vcpu-arch.time_page)
kvm_release_page_dirty(vcpu-arch.time_page);
 
+   /* 4-byte unaligned accesses are invalid */
+   if (data  0x7) {
+   vcpu-arch.time_page = NULL;
+   break;
+   }
vcpu-arch.time = data  PAGE_MASK;
vcpu-arch.time_offset = data  ~PAGE_MASK;
 
-- 
1.4.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 3/4] [PATCH] kvmclock: allow it to be turned off

2008-03-05 Thread Avi Kivity
Glauber Costa wrote:
 Use the lower 3 lower bits of the system time msr to turn off the clock.
 This means that all clock registration has to be aligned in a 4-byte boundary

   

3 bits - 8 bytes.

How about just using just bit 0 as an enable bit (not a disable bit).  
That means the default value of zero means the clock is disabled, and 
that we have a couple of more bits to enable future features.

 Signed-off-by: Glauber Costa [EMAIL PROTECTED]
 ---
  arch/x86/kvm/x86.c |5 +
  1 files changed, 5 insertions(+), 0 deletions(-)

 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
 index 6abd784..7ce14ce 100644
 --- a/arch/x86/kvm/x86.c
 +++ b/arch/x86/kvm/x86.c
 @@ -591,6 +591,11 @@ int kvm_set_msr_common(struct kvm_vcpu *
   if (vcpu-arch.time_page)
   kvm_release_page_dirty(vcpu-arch.time_page);
  
 + /* 4-byte unaligned accesses are invalid */
 + if (data  0x7) {
 + vcpu-arch.time_page = NULL;
 + break;
 + }
   vcpu-arch.time = data  PAGE_MASK;
   vcpu-arch.time_offset = data  ~PAGE_MASK;
  
   


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel