From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Huth Subject: Documentation of the kvm->srcu lock Date: Mon, 9 Sep 2013 14:00:32 +0200 Message-ID: <20130909140032.3fb22a4a@thhw500> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Return-path: Received: from e06smtp18.uk.ibm.com ([195.75.94.114]:38129 "EHLO e06smtp18.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752397Ab3IIMAi (ORCPT ); Mon, 9 Sep 2013 08:00:38 -0400 Received: from /spool/local by e06smtp18.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 9 Sep 2013 12:53:19 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id B8FE4219005C for ; Mon, 9 Sep 2013 13:00:34 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r89C0MG966781216 for ; Mon, 9 Sep 2013 12:00:22 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r89C0YuY004127 for ; Mon, 9 Sep 2013 06:00:34 -0600 Received: from thhw500 (dyn-9-152-224-53.boeblingen.de.ibm.com [9.152.224.53]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r89C0Ygp004108 for ; Mon, 9 Sep 2013 06:00:34 -0600 Sender: kvm-owner@vger.kernel.org List-ID: Hi all! I am quite new to KVM, and I recently had to struggle with the kvm->srcu lock a little bit ... documentation for this lock seems to be quite sparse, I've only found some descriptions in mailing list archives (the description at the following URL is quite good: http://www.mail-archive.com/kvm@vger.kernel.org/msg90003.html ). So I wonder whether it would be helpful for others, too, if some information about this lock was added to the documentation file Documentation/virtual/kvm/locking.txt for example? I'd like to suggest the following text as a first draft (using some information from the URL above): Name: kvm->srcu Type: srcu lock Arch: any Protects: - kvm->memslots - kvm->buses Comment: The srcu read lock must be held while accessing memslots (e.g. when using gfn_to_* functions) and while accessing in-kernel MMIO/PIO address->device structure mapping (kvm->buses). The srcu index can be stored in kvm_vcpu->srcu_idx per vcpu if it is needed by multiple functions. What do you think? Since I am not an expert in this area, extension and/or corrections are very welcome! Regards, Thomas