From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH] kvm: get rid of srcu idx Date: Tue, 26 Oct 2010 08:58:20 +0200 Message-ID: <20101026065820.GJ2343@redhat.com> References: <20101024171610.GA24375@redhat.com> <20101025135229.GA3392@amt.cnet> <20101025132058.GA18082@redhat.com> <20101025201356.GA18436@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, Avi Kivity To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:20804 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755914Ab0JZG6V (ORCPT ); Tue, 26 Oct 2010 02:58:21 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9Q6wLhx005821 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 26 Oct 2010 02:58:21 -0400 Content-Disposition: inline In-Reply-To: <20101025201356.GA18436@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Oct 25, 2010 at 06:13:56PM -0200, Marcelo Tosatti wrote: > On Mon, Oct 25, 2010 at 03:20:59PM +0200, Michael S. Tsirkin wrote: > > On Mon, Oct 25, 2010 at 11:52:29AM -0200, Marcelo Tosatti wrote: > > > On Sun, Oct 24, 2010 at 07:16:10PM +0200, Michael S. Tsirkin wrote: > > > > srcu_idx is easy to misuse as it can not be used > > > > in nested srcu_read_lock calls. Switch to local > > > > index to make correctness easier to verify. > > > > > > > > Signed-off-by: Michael S. Tsirkin > > > > > > > > --- > > > > > > Looks good to me. > > > > > > Not needed for -stable, i don't see a problem with the current > > > code? > > > > It's just that I can not convince myself current code never nestes > > read_locks with srcu_idx. I used to see host crashes under migration > > stress they seem gone now but did not retest - could be just luck. > > Well, you just changed where srcu index is saved. I don't see how it > could make a difference in practice. > If there is nested call to srcu read lock if srcu_idx is stored in vcpu nested call will override previous srcu_idx value and srcu unlock will not be called on it, but it will be called twice on new srcu_idx value. If srcu_idx is saved on stack this will not happen, no? -- Gleb.