On Tue, Mar 09, 2010 at 07:22:51PM +0200, Avi Kivity wrote: > On 03/09/2010 06:25 PM, Gleb Natapov wrote: > >On Tue, Mar 09, 2010 at 04:43:59PM +0200, Avi Kivity wrote: > >>On 03/09/2010 04:09 PM, Gleb Natapov wrote: > >>>Provide get_cached_descriptor(), set_cached_descriptor(), > >>>get_segment_selector(), set_segment_selector(), get_gdt(), > >>>write_std() callbacks. > >>> > >>>Signed-off-by: Gleb Natapov<gleb@xxxxxxxxxx> > >>>--- > >>> arch/x86/include/asm/kvm_emulate.h | 16 +++++ > >>> arch/x86/kvm/x86.c | 130 +++++++++++++++++++++++++++++++---- > >>> 2 files changed, 131 insertions(+), 15 deletions(-) > >>> > >>>diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h > >>>index 032d02f..e881618 100644 > >>>--- a/arch/x86/include/asm/kvm_emulate.h > >>>+++ b/arch/x86/include/asm/kvm_emulate.h > >>>@@ -63,6 +63,15 @@ struct x86_emulate_ops { > >>> unsigned int bytes, struct kvm_vcpu *vcpu, u32 *error); > >>> > >>> /* > >>>+ * write_std: Write bytes of standard (non-emulated/special) memory. > >>>+ * Used for descriptor writing. > >>>+ * @addr: [IN ] Linear address to which to write. > >>>+ * @val: [OUT] Value write to memory, zero-extended to 'u_long'. > >>>+ * @bytes: [IN ] Number of bytes to write to memory. > >>>+ */ > >>>+ int (*write_std)(unsigned long addr, void *val, > >>>+ unsigned int bytes, struct kvm_vcpu *vcpu, u32 *error); > >>Descriptor writes need an atomic kvm_set_guest_bit(), no? > >> > >It is? atomic against what? Current code just write whole descriptor > >using write_std(). > > These are accessed bit changes, and are done atomically in the same > way as a page table walk sets the accessed and dirty bit. > Presumably the atomic operation is to allow the kernel to scan > segments and swap them out if they are not used. > We can use cmpxchg callback for that, no? -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html