All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@elte.hu>,
	kvm-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [kvm-devel] [PATCH][RFC] kvm-scheduler integration
Date: Tue, 10 Jul 2007 10:19:15 +0300	[thread overview]
Message-ID: <469332F3.1000808@qumranet.com> (raw)
In-Reply-To: <1184050055.6005.523.camel@localhost.localdomain>

Rusty Russell wrote:
> On Tue, 2007-07-10 at 08:53 +0300, Avi Kivity wrote:
>   
>> Rusty Russell wrote:
>>     
>>> No; this is a "I'm doing something magic and need to know before someone
>>> else takes the CPU".  Almost by definition, you cannot have two of them
>>> at the same time.  Let someone else try that if and when...
>>>       
>> Why can't you have two of them?  Say I'm writing a module to utilize
>> branch recording to be able to debug a process in reverse (of course
>> that doesn't really need sched hooks; let's pretend it does).  Why can't
>> I debug a process that uses kvm?
>>
>> More importantly, now the two subsystems have to know about each other
>> so they don't step on each other's toes.
>>     
>
> Exactly, if we have two at the same time, they need to know about each
> other.  Providing infrastructure which lets them avoid thinking about it
> is the wrong direction.
>   

With a kvm-specific hook, they can't stop on each other (there can only 
be one).
With a list, they don't stomp on each other.
With a struct preempt_ops but no list, as you propose, they can and will 
stomp on each other.

>   
>>> But KVM-specific code in the scheduler is just wrong, and I think we all
>>> know that.
>>>       
>> Even if I eradicate all mention of kvm from the patch, it's still kvm
>> specific.  kvm at least is sensitive to the exact point where we switch
>> in (it wants interrupts enabled) and it expects certain parameters to
>> the callbacks.  If $new_abuser needs other conditions or parameters,
>> which is quite likely IMO as it will most likely have to do with
>> hardware, then we will need to update the hooks anyway.
>>     
>
> If it's not general, then this whole approach is wrong: put it in
> arch/*/kernel/process.c:__switch_to and finish_arch_switch.  

I imagine other kvm ports will also need this.  It's not arch specific, 
just kvm specific (but that's not really fair: other archs might want 
the switch in another place, or they might not need it after all).

I guess I can put it in arch specific code, but that means both i386 and 
x86_64.

Once we have another user we can try to generalize it.

> The
> congruent case which comes to mind is lazy FPU handling.
>   

That one has preempt_ops in hardware: cr0.ts and #NM.

> Which brings us to the question: why do you want interrupts enabled?
>   

The sched in hook (vcpu_load) sometimes needs to issue an IPI in order 
to flush the VT registers from another cpu into memory.

-- 
error compiling committee.c: too many arguments to function


WARNING: multiple messages have this Message-ID (diff)
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH][RFC] kvm-scheduler integration
Date: Tue, 10 Jul 2007 10:19:15 +0300	[thread overview]
Message-ID: <469332F3.1000808@qumranet.com> (raw)
In-Reply-To: <1184050055.6005.523.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

Rusty Russell wrote:
> On Tue, 2007-07-10 at 08:53 +0300, Avi Kivity wrote:
>   
>> Rusty Russell wrote:
>>     
>>> No; this is a "I'm doing something magic and need to know before someone
>>> else takes the CPU".  Almost by definition, you cannot have two of them
>>> at the same time.  Let someone else try that if and when...
>>>       
>> Why can't you have two of them?  Say I'm writing a module to utilize
>> branch recording to be able to debug a process in reverse (of course
>> that doesn't really need sched hooks; let's pretend it does).  Why can't
>> I debug a process that uses kvm?
>>
>> More importantly, now the two subsystems have to know about each other
>> so they don't step on each other's toes.
>>     
>
> Exactly, if we have two at the same time, they need to know about each
> other.  Providing infrastructure which lets them avoid thinking about it
> is the wrong direction.
>   

With a kvm-specific hook, they can't stop on each other (there can only 
be one).
With a list, they don't stomp on each other.
With a struct preempt_ops but no list, as you propose, they can and will 
stomp on each other.

>   
>>> But KVM-specific code in the scheduler is just wrong, and I think we all
>>> know that.
>>>       
>> Even if I eradicate all mention of kvm from the patch, it's still kvm
>> specific.  kvm at least is sensitive to the exact point where we switch
>> in (it wants interrupts enabled) and it expects certain parameters to
>> the callbacks.  If $new_abuser needs other conditions or parameters,
>> which is quite likely IMO as it will most likely have to do with
>> hardware, then we will need to update the hooks anyway.
>>     
>
> If it's not general, then this whole approach is wrong: put it in
> arch/*/kernel/process.c:__switch_to and finish_arch_switch.  

I imagine other kvm ports will also need this.  It's not arch specific, 
just kvm specific (but that's not really fair: other archs might want 
the switch in another place, or they might not need it after all).

I guess I can put it in arch specific code, but that means both i386 and 
x86_64.

Once we have another user we can try to generalize it.

> The
> congruent case which comes to mind is lazy FPU handling.
>   

That one has preempt_ops in hardware: cr0.ts and #NM.

> Which brings us to the question: why do you want interrupts enabled?
>   

The sched in hook (vcpu_load) sometimes needs to issue an IPI in order 
to flush the VT registers from another cpu into memory.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  reply	other threads:[~2007-07-10  7:19 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-08 12:58 [PATCH][RFC] kvm-scheduler integration Avi Kivity
2007-07-08 12:58 ` Avi Kivity
2007-07-08 13:09 ` Ingo Molnar
2007-07-08 13:09   ` Ingo Molnar
2007-07-08 13:16   ` Avi Kivity
2007-07-08 13:36     ` Ingo Molnar
2007-07-08 13:35 ` Ingo Molnar
2007-07-08 13:35   ` Ingo Molnar
2007-07-08 13:41   ` Avi Kivity
2007-07-08 13:41     ` Avi Kivity
2007-07-08 13:48     ` Ingo Molnar
2007-07-08 13:48       ` Ingo Molnar
2007-07-08 13:53       ` Avi Kivity
2007-07-08 13:53         ` Avi Kivity
2007-07-08 13:59         ` Ingo Molnar
2007-07-08 13:59           ` Ingo Molnar
2007-07-08 15:13           ` Avi Kivity
2007-07-08 15:13             ` Avi Kivity
2007-07-10 11:18           ` Avi Kivity
2007-07-10 11:18             ` Avi Kivity
2007-07-10 11:30             ` Ingo Molnar
2007-07-10 11:30               ` Ingo Molnar
2007-07-08 23:32       ` [kvm-devel] " Rusty Russell
2007-07-08 23:32         ` Rusty Russell
2007-07-09  6:39         ` [kvm-devel] " Avi Kivity
2007-07-09  6:39           ` Avi Kivity
2007-07-10  1:09           ` [kvm-devel] " Rusty Russell
2007-07-10  1:09             ` Rusty Russell
2007-07-10  5:53             ` [kvm-devel] " Avi Kivity
2007-07-10  5:53               ` Avi Kivity
2007-07-10  6:47               ` [kvm-devel] " Rusty Russell
2007-07-10  6:47                 ` Rusty Russell
2007-07-10  7:19                 ` Avi Kivity [this message]
2007-07-10  7:19                   ` Avi Kivity
2007-07-10  8:01                   ` [kvm-devel] " Rusty Russell
2007-07-10  8:01                     ` Rusty Russell
2007-07-10  8:24                     ` [kvm-devel] " Avi Kivity
2007-07-10  8:24                       ` Avi Kivity
2007-07-11  5:50                   ` [kvm-devel] " Avi Kivity
2007-07-11  5:50                     ` Avi Kivity
2007-07-08 19:07 ` Andi Kleen
2007-07-09  6:41   ` Avi Kivity
2007-07-09  6:41     ` Avi Kivity
2007-07-09  8:50 ` Shaohua Li
2007-07-09  8:50   ` Shaohua Li
2007-07-09  9:46   ` Avi Kivity
2007-07-09  9:46     ` Avi Kivity
2007-07-09 10:21     ` Avi Kivity
2007-07-09 10:21       ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=469332F3.1000808@qumranet.com \
    --to=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.