From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Huth Date: Mon, 21 Sep 2015 06:50:34 +0000 Subject: Re: [PATCH] KVM: PPC: Take the kvm->srcu lock in kvmppc_h_logical_ci_load/store() Message-Id: <55FFA8BA.5040800@redhat.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="0p8NogWRw1siIh8poUkC1ResxW5sW0JTJ" List-Id: References: <1442559448-1947-1-git-send-email-thuth@redhat.com> <20150921013708.GF20331@voom.fritz.box> In-Reply-To: <20150921013708.GF20331@voom.fritz.box> To: David Gibson Cc: kvm-ppc@vger.kernel.org, Paul Mackerras , Alexander Graf , kvm@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0p8NogWRw1siIh8poUkC1ResxW5sW0JTJ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 21/09/15 03:37, David Gibson wrote: > On Fri, Sep 18, 2015 at 08:57:28AM +0200, Thomas Huth wrote: >> Access to the kvm->buses (like with the kvm_io_bus_read() and -write()= >> functions) has to be protected via the kvm->srcu lock. >> The kvmppc_h_logical_ci_load() and -store() functions are missing >> this lock so far, so let's add it there, too. >> This fixes the problem that the kernel reports "suspicious RCU usage" >> when lock debugging is enabled. >> >> Fixes: 99342cf8044420eebdf9297ca03a14cb6a7085a1 >> Signed-off-by: Thomas Huth >=20 > Nice catch. Looks like I missed this because the places > kvm_io_bus_{read,write}() are called on x86 are buried about 5 layers > below where the srcu lock is taken :/. AFAIK the philosophy for taking the srcu lock is completely different between powerpc and x86. On powerpc it is only taken when needed (and released immediately afterwards), while the x86 code tries to hold it the whole time while not being in the guest and not being in userspace. See vcpu_enter_guest() in the x86 code for example, the lock is dropped before entering the guest, and taken again before leaving this function. Thomas --0p8NogWRw1siIh8poUkC1ResxW5sW0JTJ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJV/6i6AAoJEC7Z13T+cC21eboP/0M3UNq+384y6yFgZ5Aukjhe LywdtPyT5WXh1E2zXYPaSFfKTNL/AxRCwP0tlgWbmqBWDFGXbYNkoY2m1i+5OZe0 vhATbuxIqUgCHQpxjS5ko6HziFyR5T1DRUi3eTDmiRCAkn0wtEUUXJ+nb5jcIWU+ 7xczyctK9PonVlrNYwQ4ydhtcqzlJbxXMDGz++0F2UWPPy6JlESM3tuYazJIxKef SrL5JyBCD6EPUt4KJC2WakDiTUSWvZ5a14t/KbfwDpsTaGEP6VSf9ggLHEZSMIfn 9QMTZ7RAGKiXCqdPmEtsiveAMV8d50bOi3VQzkoG+NGrzIeZGj5AtefTRwgVb6bX gAUqIKU1gqL7ziWtodf/XBtHaToPBui3QHg5xIIiukzJEHU2ERNOCYDY0Ww9YApG LRujedPin58df1l9CsDfoIm3fWlPMFfBPrzO27CB9qt7LycxLGsYuy9iTkyMmWqy GE8PrmM4maVAgl+60dZy1n/ONWfpp8DxOcQ6uk9c9VaNHqVmh/xgCg+MALQdmVTg qFN3E/JNgGTEygKhdMJeIq6FclPP28mil/QTzqH8yhRKVHrcdZ+lrkEWpJ7tpmHX OlfP/X+bTLC+WTo0fHEcxSFRuMtW2YqCCgAyJ3wyybzxDT+p6G1w7VR0wH9iCrBq doXUFx8u6AwcVwe+zhEK =7Bvc -----END PGP SIGNATURE----- --0p8NogWRw1siIh8poUkC1ResxW5sW0JTJ-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Huth Subject: Re: [PATCH] KVM: PPC: Take the kvm->srcu lock in kvmppc_h_logical_ci_load/store() Date: Mon, 21 Sep 2015 08:50:34 +0200 Message-ID: <55FFA8BA.5040800@redhat.com> References: <1442559448-1947-1-git-send-email-thuth@redhat.com> <20150921013708.GF20331@voom.fritz.box> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0p8NogWRw1siIh8poUkC1ResxW5sW0JTJ" Cc: kvm-ppc@vger.kernel.org, Paul Mackerras , Alexander Graf , kvm@vger.kernel.org To: David Gibson Return-path: Received: from mx1.redhat.com ([209.132.183.28]:36944 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752419AbbIUGui (ORCPT ); Mon, 21 Sep 2015 02:50:38 -0400 In-Reply-To: <20150921013708.GF20331@voom.fritz.box> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0p8NogWRw1siIh8poUkC1ResxW5sW0JTJ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 21/09/15 03:37, David Gibson wrote: > On Fri, Sep 18, 2015 at 08:57:28AM +0200, Thomas Huth wrote: >> Access to the kvm->buses (like with the kvm_io_bus_read() and -write()= >> functions) has to be protected via the kvm->srcu lock. >> The kvmppc_h_logical_ci_load() and -store() functions are missing >> this lock so far, so let's add it there, too. >> This fixes the problem that the kernel reports "suspicious RCU usage" >> when lock debugging is enabled. >> >> Fixes: 99342cf8044420eebdf9297ca03a14cb6a7085a1 >> Signed-off-by: Thomas Huth >=20 > Nice catch. Looks like I missed this because the places > kvm_io_bus_{read,write}() are called on x86 are buried about 5 layers > below where the srcu lock is taken :/. AFAIK the philosophy for taking the srcu lock is completely different between powerpc and x86. On powerpc it is only taken when needed (and released immediately afterwards), while the x86 code tries to hold it the whole time while not being in the guest and not being in userspace. See vcpu_enter_guest() in the x86 code for example, the lock is dropped before entering the guest, and taken again before leaving this function. Thomas --0p8NogWRw1siIh8poUkC1ResxW5sW0JTJ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJV/6i6AAoJEC7Z13T+cC21eboP/0M3UNq+384y6yFgZ5Aukjhe LywdtPyT5WXh1E2zXYPaSFfKTNL/AxRCwP0tlgWbmqBWDFGXbYNkoY2m1i+5OZe0 vhATbuxIqUgCHQpxjS5ko6HziFyR5T1DRUi3eTDmiRCAkn0wtEUUXJ+nb5jcIWU+ 7xczyctK9PonVlrNYwQ4ydhtcqzlJbxXMDGz++0F2UWPPy6JlESM3tuYazJIxKef SrL5JyBCD6EPUt4KJC2WakDiTUSWvZ5a14t/KbfwDpsTaGEP6VSf9ggLHEZSMIfn 9QMTZ7RAGKiXCqdPmEtsiveAMV8d50bOi3VQzkoG+NGrzIeZGj5AtefTRwgVb6bX gAUqIKU1gqL7ziWtodf/XBtHaToPBui3QHg5xIIiukzJEHU2ERNOCYDY0Ww9YApG LRujedPin58df1l9CsDfoIm3fWlPMFfBPrzO27CB9qt7LycxLGsYuy9iTkyMmWqy GE8PrmM4maVAgl+60dZy1n/ONWfpp8DxOcQ6uk9c9VaNHqVmh/xgCg+MALQdmVTg qFN3E/JNgGTEygKhdMJeIq6FclPP28mil/QTzqH8yhRKVHrcdZ+lrkEWpJ7tpmHX OlfP/X+bTLC+WTo0fHEcxSFRuMtW2YqCCgAyJ3wyybzxDT+p6G1w7VR0wH9iCrBq doXUFx8u6AwcVwe+zhEK =7Bvc -----END PGP SIGNATURE----- --0p8NogWRw1siIh8poUkC1ResxW5sW0JTJ--