From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756501AbcGGLJb (ORCPT ); Thu, 7 Jul 2016 07:09:31 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:60949 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750817AbcGGLJa (ORCPT ); Thu, 7 Jul 2016 07:09:30 -0400 Date: Thu, 7 Jul 2016 13:09:21 +0200 From: Peter Zijlstra To: Wanpeng Li Cc: Paolo Bonzini , Pan Xinhui , linux-s390 , Davidlohr Bueso , mpe@ellerman.id.au, boqun.feng@gmail.com, will.deacon@arm.com, "linux-kernel@vger.kernel.org" , Waiman Long , virtualization@lists.linux-foundation.org, Ingo Molnar , Paul Mackerras , benh@kernel.crashing.org, schwidefsky@de.ibm.com, Paul McKenney , linuxppc-dev@lists.ozlabs.org, kvm Subject: Re: [PATCH v2 0/4] implement vcpu preempted check Message-ID: <20160707110921.GI30927@twins.programming.kicks-ass.net> References: <1467124991-13164-1-git-send-email-xinhui.pan@linux.vnet.ibm.com> <20160706065255.GH30909@twins.programming.kicks-ass.net> <14a24854-9787-e4a1-c9a8-76eba4e97301@redhat.com> <8e8edf1b-b64b-3c44-b580-b9271663844c@redhat.com> <20160707094215.GT30921@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160707094215.GT30921@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 07, 2016 at 11:42:15AM +0200, Peter Zijlstra wrote: > I suspect you want something like so; except this has holes in. > > We clear KVM_ST_PAD_PREEMPT before disabling preemption and we set it > after enabling it, this means that if we get preempted in between, the > vcpu is reported as running even though it very much is not. > > Fixing that requires much larger surgery. Note that this same hole is already a 'problem' for steal time accounting. The thread can accrue further delays (iow steal time) after we've called record_steal_time(). These delays will go unaccounted. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH v2 0/4] implement vcpu preempted check Date: Thu, 7 Jul 2016 13:09:21 +0200 Message-ID: <20160707110921.GI30927@twins.programming.kicks-ass.net> References: <1467124991-13164-1-git-send-email-xinhui.pan@linux.vnet.ibm.com> <20160706065255.GH30909@twins.programming.kicks-ass.net> <14a24854-9787-e4a1-c9a8-76eba4e97301@redhat.com> <8e8edf1b-b64b-3c44-b580-b9271663844c@redhat.com> <20160707094215.GT30921@twins.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: linux-s390 , Davidlohr Bueso , benh@kernel.crashing.org, kvm , mpe@ellerman.id.au, boqun.feng@gmail.com, will.deacon@arm.com, "linux-kernel@vger.kernel.org" , Waiman Long , virtualization@lists.linux-foundation.org, Ingo Molnar , Paul Mackerras , Pan Xinhui , schwidefsky@de.ibm.com, Paolo Bonzini , Paul McKenney , linuxppc-dev@lists.ozlabs.org To: Wanpeng Li Return-path: Content-Disposition: inline In-Reply-To: <20160707094215.GT30921@twins.programming.kicks-ass.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: kvm.vger.kernel.org On Thu, Jul 07, 2016 at 11:42:15AM +0200, Peter Zijlstra wrote: > I suspect you want something like so; except this has holes in. > > We clear KVM_ST_PAD_PREEMPT before disabling preemption and we set it > after enabling it, this means that if we get preempted in between, the > vcpu is reported as running even though it very much is not. > > Fixing that requires much larger surgery. Note that this same hole is already a 'problem' for steal time accounting. The thread can accrue further delays (iow steal time) after we've called record_steal_time(). These delays will go unaccounted.