From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: %fs PDA & KVM Date: Sun, 11 Mar 2007 14:38:53 +0200 Message-ID: <45F3F85D.7000509@qumranet.com> References: <20070311122441.GA10774@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Ingo Molnar Return-path: In-Reply-To: <20070311122441.GA10774-X9Un+BFzKDI@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Ingo Molnar wrote: > hm, i just noticed that in vmx_vcpu_run() KVM restores %fs quite late. > > This is a bit awkward under v2.6.21 x86 because there we use %fs for the > KERNEL_PDA area. Things like 'current' rely on it. So maybe we should > just do this unconditionally in assembly: > > movl $(__KERNEL_PDA), %edx; > movl %edx, %fs > Sure, but with %dx instead of %edx, please. > it's also a problem with -rt too, which has that whole codepath up to > the load_fs() call preemptible. > > i'm also wondering about this bit: > > kvm_run->exit_type = 0; > if (fail) { > kvm_run->exit_type = KVM_EXIT_TYPE_FAIL_ENTRY; > kvm_run->exit_reason = vmcs_read32(VM_INSTRUCTION_ERROR); > kvm_cr3_cache_sync(vcpu); > r = 0; > } else { > if (fs_gs_ldt_reload_needed) { > load_ldt(ldt_sel); > load_fs(fs_sel); > > are you sure we dont need an FS reload in the 'fail' case? > The manual is not explicit about it, but I think that an entry failure during loading of guest state _can_ cause fs to be loaded, so yes, that path is missing the segment reloads. Non -rt kvm cannot preempt there even with CONFIG_PREEMPT=y. Can interrupts reference current? If so, that fix is needed badly for .21. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV