From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 15/24] KVM: x86 emulator: Provide more callbacks for x86 emulator. Date: Tue, 09 Mar 2010 19:22:51 +0200 Message-ID: <4B9683EB.8010806@redhat.com> References: <1268143762-4000-1-git-send-email-gleb@redhat.com> <1268143762-4000-16-git-send-email-gleb@redhat.com> <4B965EAF.10505@redhat.com> <20100309162515.GC9066@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:14135 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754031Ab0CIRWy (ORCPT ); Tue, 9 Mar 2010 12:22:54 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o29HMqrS011712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Mar 2010 12:22:53 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o29HMqGQ031422 for ; Tue, 9 Mar 2010 12:22:52 -0500 In-Reply-To: <20100309162515.GC9066@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 >>> --- >>> 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. -- error compiling committee.c: too many arguments to function