From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH][retry 1] Add support for Pause Filtering to AMD SVM Date: Mon, 11 May 2009 17:01:49 +0200 Message-ID: <1242054109.11251.276.camel@twins> References: <200905050909.58583.mark.langsdorf@amd.com> <20090507135522.GJ4059@amd.com> <200905071000.14038.mark.langsdorf@amd.com> <4A02FECC.6060609@redhat.com> <20090511141503.GC6175@elte.hu> <4A083539.407@redhat.com> <20090511143320.GE6175@elte.hu> <4A083B69.6010702@redhat.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Ingo Molnar , Mark Langsdorf , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Avi Kivity Return-path: Received: from viefep19-int.chello.at ([62.179.121.39]:25505 "EHLO viefep19-int.chello.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757232AbZEKPDk (ORCPT ); Mon, 11 May 2009 11:03:40 -0400 In-Reply-To: <4A083B69.6010702@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, 2009-05-11 at 17:51 +0300, Avi Kivity wrote: > Ingo Molnar wrote: > > * Avi Kivity wrote: > > > > > >>> I.e. this is a somewhat poor solution as far as scheduling goes. > >>> But i'm wondering what the CPU side does. Can REP-NOP really take > >>> thousands of cycles? If yes, under what circumstances? > >>> > >> The guest is running rep-nop in a loop while trying to acquire a > >> spinlock. The hardware detects this (most likely, repeated > >> rep-nop with the same rip) and exits. We can program the loop > >> count; obviously if we're spinning for only a short while it's > >> better to keep spinning while hoping the lock will be released > >> soon. > >> > >> The idea is to detect that the guest is not making forward > >> progress and yield. If I could tell the scheduler, you may charge > >> me a couple of milliseconds, I promise not to sue, that would be > >> ideal. [...] > >> > > > > Ok, with such a waiver, who could refuse? > > > > This really needs a new kernel-internal scheduler API though, which > > does a lot of fancy things to do: > > > > se->vruntime += 1000000; > > > > i.e. add 1 msec worth of nanoseconds to the task's timeline. (first > > remove it from the rbtree, then add it back, and nice-weight it as > > well) > > I suspected it would be as simple as this. Is that thread guaranteed to run as SCHED_OTHER?