From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/2] Add MSR Bitmap support in VMX Date: Fri, 03 Aug 2007 19:10:38 +0300 Message-ID: <46B3537E.30302@qumranet.com> References: <97D612E30E1F88419025B06CB4CF1BE10318605D@scsmsx412.amr.corp.intel.com> <46B22134.7080807@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090608030104060506020709" Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: "Li, Xin B" Return-path: In-Reply-To: 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 This is a multi-part message in MIME format. --------------090608030104060506020709 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Li, Xin B wrote: >> -----Original Message----- >> From: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org >> [mailto:kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of >> Ulrich Drepper >> Sent: Friday, August 03, 2007 2:24 AM >> To: Nakajima, Jun >> Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org >> Subject: Re: [kvm-devel] [PATCH 2/2] Add MSR Bitmap support in VMX >> >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Nakajima, Jun wrote: >> >>>> Looking at the Linux context switch code, it can bang on MSR_FS_BASE >>>> >>> and >>> >>>> MSR_KERNEL_GS_BASE. A high context switch rate between >>>> >> threads (which >> >>>> use %gs or %fs) can show an improvement with this. Things >>>> >> like kbuild >> >>>> probably won't as they use single threaded processes. >>>> >>> Right. >>> >> In Linux there is no difference between single- and multi-threaded >> processes when it comes to setting up segment registers. Every x86-64 >> process uses %fs for TLS and every x86 process uses %gs. There are >> always variables accessed this way (errno, for instance). >> >> > > I have to say, the benefit form _no_ VMExits on these VMExits are not so > obviously, because each context switch invloves a guest CR3 update, then > a page fault vmexit is triggered and a shadow handling is involved, > which is the major cost of guest context switch. > A small test program demonstrates the benefit. In thread mode, it takes 5 seconds without the patch and 3 seconds with the patch applied (200K and ~0 exits/sec). In fork mode, it takes 10 seconds without the patch and 7.2 seconds with the patch (420K and 280K exits/sec). Note that with this test there are no page fault exits, only cr and msr exits (with the threaded mode avoiding the cr exit). So the patch is quite measurable on microbenchmarks -- in threaded mode we're at native performance. -- error compiling committee.c: too many arguments to function --------------090608030104060506020709 Content-Type: text/x-csrc; name="cswitch.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cswitch.c" #include #include #include static int p1[2], p2[2]; #define N 1000000 void *server(void *_) { char buf; while (read(p1[0], &buf, 1) == 1) write(p2[1], &buf, 1); } void client() { char buf; int i; for (i = 0; i < N; ++i) { write(p1[1], &buf, 1); read(p2[0], &buf, 1); } } int main(int ac, char **av) { pthread_t thread; pipe(p1); pipe(p2); if (ac < 2 || strcmp(av[1], "fork") != 0) pthread_create(&thread, NULL, server, NULL); else if (fork() == 0) { server(NULL); return 0; } client(); return 0; } --------------090608030104060506020709 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ --------------090608030104060506020709 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --------------090608030104060506020709--