From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752571AbcEXBOK (ORCPT ); Mon, 23 May 2016 21:14:10 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:35030 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751829AbcEXBOI (ORCPT ); Mon, 23 May 2016 21:14:08 -0400 Subject: Re: [PATCH v2] KVM: halt-polling: poll if emulated lapic timer will fire soon To: David Matlack References: <1463664426-2991-1-git-send-email-wanpeng.li@hotmail.com> <19b83265-26bd-47cd-71e9-fc04ee7fff2d@gmail.com> <4b5e2981-17a3-788b-0dac-c2f125765de3@gmail.com> Cc: Wanpeng Li , "linux-kernel@vger.kernel.org" , kvm list , Wanpeng Li , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Christian Borntraeger From: Yang Zhang Message-ID: <1f925ff3-b654-e22e-9b60-23a26694aa89@gmail.com> Date: Tue, 24 May 2016 09:13:59 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/5/24 2:04, David Matlack wrote: > On Sun, May 22, 2016 at 6:26 PM, Yang Zhang wrote: >> On 2016/5/21 2:37, David Matlack wrote: >>> >>> It's not obvious to me why polling for a timer interrupt would improve >>> context switch latency. Can you explain a bit more? >> >> >> We have a workload which using high resolution timer(less than 1ms) inside >> guest. It rely on the timer to wakeup itself. Sometimes the timer is >> expected to fired just after the VCPU is blocked due to execute halt >> instruction. But the thread who is running in the CPU will turn off the >> hardware interrupt for long time due to disk access. This will cause the >> timer interrupt been blocked until the interrupt is re-open. > > Does this happen on the idle thread (swapper)? If not, halt-polling > may not help; it only polls if there are no other runnable threads. Yes, there is no runnable task inside guest. > >> For optimization, we let VCPU to poll for a while if the next timer will >> arrive soon before schedule out. And the result shows good when running >> several workloads inside guest. > > Thanks for the explanation, I appreciate it. > >> >> -- >> best regards >> yang -- best regards yang