Re: Bhyve: Investigating poor guest performance when host is busy

2015-04-02 Thread Jia-Shiun Li
On Wed, Apr 1, 2015 at 8:06 AM, Peter Grehan  wrote:

> 1. Can anyone tell me what the cause might be? What may be happening?
>> 2. Do you know if there is currently any work in investigation this
>> problem? Or anything related?
>> 3. Is Gang Scheduling or Coscheduling implemented in FreeBSD?
>> 4. Do you know of any other solution to this kind of problem?
>> 5. Can you recommend me any papers/videos/links in anyway related to this?
>>
>
>  I answered these in the FreeBSD forums post, but reproduced again here
> for the list:
>
>  1. The main issue is 'lock holder preemption', where a vCPU that is
> holding a spinlock has been pre-empted by the host scheduler, resulting in
> other vCPUs that are trying to acquire that lock to spin for full quantums.
>
> Booting is a variant of this for FreeBSD since the AP spins on a memory
> location waiting for a BSP to start up.
>
> 2. There's some minor investigation going on.
>
> 3. No.
>
> 4. I don't know that 'classic' gang scheduling is the answer (see 5). What
> has been thought of for bhyve at least is to a) have the concept of vCPU
> 'groups' in the scheduler, b) provide metrics to assist the scheduler in
> trying to spread out threads associated with a vCPU group so they don't end
> up on the same physical CPU (avoidance of lock-holder preemption), and c)
> implement pause-loop exits (see the Intel SDM, 24.6.13) in the hypervisor
> and provide that information to the scheduler so it can give a temporary
> priority boost to vCPUs that have been preempted but aren't currently
> running.
>
> 5. The classic reference on this is VMWare's scheduler paper:
> www.vmware.com/files/pdf/techpaper/VMware-vSphere-CPU-Sched-Perf.pdf
>

I am seeing similar behavior on Windows host w/ vmware workstation
recently. Guest boots several times slower than before. And console message
apparently scrolls slower after APs were all started. Booting natively is
not slow as much.

Guess that's related to recent SMP changes to bring APs online early?
Wondering if APs can be halted or be brought up later after kernel can
really begin to schedule tasks onto them.


-Jia-Shiun
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: Bhyve: Investigating poor guest performance when host is busy

2015-03-31 Thread Peter Grehan

1. Can anyone tell me what the cause might be? What may be happening?
2. Do you know if there is currently any work in investigation this
problem? Or anything related?
3. Is Gang Scheduling or Coscheduling implemented in FreeBSD?
4. Do you know of any other solution to this kind of problem?
5. Can you recommend me any papers/videos/links in anyway related to this?


 I answered these in the FreeBSD forums post, but reproduced again here 
for the list:


 1. The main issue is 'lock holder preemption', where a vCPU that is 
holding a spinlock has been pre-empted by the host scheduler, resulting 
in other vCPUs that are trying to acquire that lock to spin for full 
quantums.


Booting is a variant of this for FreeBSD since the AP spins on a memory 
location waiting for a BSP to start up.


2. There's some minor investigation going on.

3. No.

4. I don't know that 'classic' gang scheduling is the answer (see 5). 
What has been thought of for bhyve at least is to a) have the concept of 
vCPU 'groups' in the scheduler, b) provide metrics to assist the 
scheduler in trying to spread out threads associated with a vCPU group 
so they don't end up on the same physical CPU (avoidance of lock-holder 
preemption), and c) implement pause-loop exits (see the Intel SDM, 
24.6.13) in the hypervisor and provide that information to the scheduler 
so it can give a temporary priority boost to vCPUs that have been 
preempted but aren't currently running.


5. The classic reference on this is VMWare's scheduler paper: 
www.vmware.com/files/pdf/techpaper/VMware-vSphere-CPU-Sched-Perf.pdf


later,

Peter.

___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Bhyve: Investigating poor guest performance when host is busy

2015-03-31 Thread Stefan Andritoiu
Problem intro:
- Started a make -j 20 buildworld on the host to peg the cpus
- Started a 2 and 4 vcpu FreeBSD guest and time how long it takes to boot up
- Started a 1 vcpu FreeBSD guest and time how long it takes to boot
up. It is always much faster than the 2 or 4 vcpus.

My suspicion:
I suspect that the ULE scheduler makes some bad decisions with
scheduling because it is not aware that bhyve threads are actually
running vcpus on top of them, and Lock-holder-preemption may occur.
The classic way to solve this is with gang scheduling to ensure that
all vcpus are running simultaneously.

1. Can anyone tell me what the cause might be? What may be happening?
2. Do you know if there is currently any work in investigation this
problem? Or anything related?
3. Is Gang Scheduling or Coscheduling implemented in FreeBSD?
4. Do you know of any other solution to this kind of problem?
5. Can you recommend me any papers/videos/links in anyway related to this?

I'm sorry if the question seem vague. But I don't understand the
problem so well either and I'm relatively new to FreeBSD
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"