From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Paul E. McKenney" Subject: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper Date: Sun, 29 May 2011 08:31:30 -0700 Message-ID: <20110529153130.GG2668@linux.vnet.ibm.com> References: <20110526230923.GB15983@Krystal> <1306491547.3217.9.camel@lappy> <20110527103657.GA25748@elte.hu> <1306511560.3217.23.camel@lappy> <20110527171040.GC4356@elte.hu> <1306527578.3217.26.camel@lappy> <20110528152408.GA27104@elte.hu> <1306611908.3282.7.camel@lappy> <4DE1EC05.3040001@redhat.com> <20110529071948.GA20686@elte.hu> Reply-To: paulmck@linux.vnet.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , Sasha Levin , Mathieu Desnoyers , Pekka Enberg , john@jfloren.net, kvm@vger.kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com To: Ingo Molnar Return-path: Received: from e4.ny.us.ibm.com ([32.97.182.144]:47061 "EHLO e4.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513Ab1E2Pbf (ORCPT ); Sun, 29 May 2011 11:31:35 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p4TFARhX009343 for ; Sun, 29 May 2011 11:10:27 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p4TFVYqe059968 for ; Sun, 29 May 2011 11:31:34 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p4TFVXlN031642 for ; Sun, 29 May 2011 11:31:34 -0400 Content-Disposition: inline In-Reply-To: <20110529071948.GA20686@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, May 29, 2011 at 09:19:48AM +0200, Ingo Molnar wrote: > > * Avi Kivity wrote: > > > Yes, this is equivalent to the kernel's stop_machine_run(). It's a > > heavyweight method but it should work just fine. > > Yeah. It is fine for reconfiguration/configuration-only kind of write > paths - i.e. the mmio lookup path should be ok. > > There's only one thing i'd like to warn about: please still shape it > as a br_read_lock()/unlock(), br_write_lock()/unlock() operation. > > This way all the SMP read paths remain identified properly, even if > br_write_lock() does a stop_machine_run() equivalent. This still > leaves options open for an easy conversion to rwlock or urcu (should > any particular write path become more than just occasional). This is very important even if no write path ever becomes more than just occasional. If you don't mark the read paths like Ingo suggests, your one-year-from-now self will be very annoyed at you, as the code will be quite difficult to understand. And anyone else trying to read your code will be even more annoyed. ;-) Thanx, Paul