From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leonardo Bras Subject: Re: [PATCH v6 01/11] asm-generic/pgtable: Adds generic functions to track lockless pgtable walks Date: Thu, 06 Feb 2020 23:19:45 -0300 Message-ID: References: <20200206030900.147032-1-leonardo@linux.ibm.com> <20200206030900.147032-2-leonardo@linux.ibm.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-A/nJhzVPw0FwclUgBET/" Return-path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47878 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726597AbgBGCUw (ORCPT ); Thu, 6 Feb 2020 21:20:52 -0500 In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Arnd Bergmann , Andrew Morton , "Aneesh Kumar K.V" , Nicholas Piggin , Steven Price , Robin Murphy , Mahesh Salgaonkar , Balbir Singh , Reza Arbab , Thomas Gleixner , Allison Randal , Greg Kroah-Hartman , Mike Rapoport , Michal Suchanek Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org --=-A/nJhzVPw0FwclUgBET/ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Christophe, thanks for the feedback! On Thu, 2020-02-06 at 06:54 +0100, Christophe Leroy wrote: > > A memory barrier was also added just to make sure there is no speculati= ve > > read outside the interrupt disabled area. Other than that, it is not > > supposed to have any change of behavior from current code. >=20 > Is that speculative barrier necessary for all architectures ? Does it=20 > impact performance ? Shouldn't this be another patch ? It makes sense, better keep the code as much as possible as it was. If any arch finds this barrier needed, it can implement it's own version of this function (or another patch to add this to generic, if proved to be needed in every arch). > > +#ifndef __HAVE_ARCH_LOCKLESS_PGTBL_WALK_CONTROL > > +/* > > + * begin_lockless_pgtbl_walk: Must be inserted before a function call = that does > > + * lockless pagetable walks, such as __find_linux_pte() > > + */ > > +static inline > > +unsigned long begin_lockless_pgtbl_walk(void) >=20 > What about keeping the same syntax as local_irq_save(), something like: >=20 > #define begin_lockless_pgtbl_walk(flags) \ > do { > local_irq_save(flags); > smp_mb(); > } while (0) >=20 Makes sense. But wouldn't inlining have the same code output?=20 Best regards, Leonardo Bras --=-A/nJhzVPw0FwclUgBET/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEMdeUgIzgjf6YmUyOlQYWtz9SttQFAl48yUEACgkQlQYWtz9S ttRXxxAAhPXA0Cd48ZAtBfcOadiRsa1Amc03sprshQLV/+pQx2/U47Nl7YqtozUl pxTnysv8mkdxPHoYnQk5XDRSxTLewF+w3F9hTFAfOM6F3UIA2bUsby0SPIR/04a0 1enrJ6U1qElB8wk/8Ncur2YVPzFgKmgpQI+i1n7NrGIuN2mHmmzrM3OLZf3H0BpL 3jKzZWwIoa3waO81mtVyij8gctwpk2bzoUJGs6XsvBKZMCbZdiZVyWedn5kEpM5m an0wmHQdta85iK9XysKm55Oe0PYhmm0K9pH4sNYFWuMcC2oKtyizbiV3wq3sjpau XSg/9koTmUowiQzTIUoCYut0UxuLjD0WfzzoR1EKcb07dFCMwkjn9jDHOQW9eSMo 9PhMEgZ2i1n463YUxhpUYXbZkqML+IQ6VLc4ZgyJdj7c+RVJSbT4GOwxBABnN58p iEFNVDmoS1+CVUq3Ysvsw2KtM2oGxsn7sx/69KesxEHXiytgs7afyOYacGV0fx5R OXuNlW3g5ODGdayMcXbEXY0C492e07CnMvTZvbMhwGs7YeIZUb+JfMwFpQAeSP1w XOYl4h9YxS1sgB2gUSZc0ETfXDeeOxB9RZ1j817ySEMfn/XCUjyexOnsqBnNGbpM AcWwHPwmdCYOKyWFTcej/u/8fxGkYgYZldd/GxcYTGaFy8IudyM= =E/z0 -----END PGP SIGNATURE----- --=-A/nJhzVPw0FwclUgBET/-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: Subject: Re: [PATCH v6 01/11] asm-generic/pgtable: Adds generic functions to track lockless pgtable walks From: Leonardo Bras Date: Thu, 06 Feb 2020 23:19:45 -0300 In-Reply-To: References: <20200206030900.147032-1-leonardo@linux.ibm.com> <20200206030900.147032-2-leonardo@linux.ibm.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-A/nJhzVPw0FwclUgBET/" MIME-Version: 1.0 To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Arnd Bergmann , Andrew Morton , "Aneesh Kumar K.V" , Nicholas Piggin , Steven Price , Robin Murphy , Mahesh Salgaonkar , Balbir Singh , Reza Arbab , Thomas Gleixner , Allison Randal , Greg Kroah-Hartman , Mike Rapoport , Michal Suchanek Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org List-ID: Message-ID: <20200207021945.5R_XnERUqVFZp9c5FdL9JfVRNQW6gc4soTO2Xgm_xz8@z> --=-A/nJhzVPw0FwclUgBET/ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Christophe, thanks for the feedback! On Thu, 2020-02-06 at 06:54 +0100, Christophe Leroy wrote: > > A memory barrier was also added just to make sure there is no speculati= ve > > read outside the interrupt disabled area. Other than that, it is not > > supposed to have any change of behavior from current code. >=20 > Is that speculative barrier necessary for all architectures ? Does it=20 > impact performance ? Shouldn't this be another patch ? It makes sense, better keep the code as much as possible as it was. If any arch finds this barrier needed, it can implement it's own version of this function (or another patch to add this to generic, if proved to be needed in every arch). > > +#ifndef __HAVE_ARCH_LOCKLESS_PGTBL_WALK_CONTROL > > +/* > > + * begin_lockless_pgtbl_walk: Must be inserted before a function call = that does > > + * lockless pagetable walks, such as __find_linux_pte() > > + */ > > +static inline > > +unsigned long begin_lockless_pgtbl_walk(void) >=20 > What about keeping the same syntax as local_irq_save(), something like: >=20 > #define begin_lockless_pgtbl_walk(flags) \ > do { > local_irq_save(flags); > smp_mb(); > } while (0) >=20 Makes sense. But wouldn't inlining have the same code output?=20 Best regards, Leonardo Bras --=-A/nJhzVPw0FwclUgBET/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEMdeUgIzgjf6YmUyOlQYWtz9SttQFAl48yUEACgkQlQYWtz9S ttRXxxAAhPXA0Cd48ZAtBfcOadiRsa1Amc03sprshQLV/+pQx2/U47Nl7YqtozUl pxTnysv8mkdxPHoYnQk5XDRSxTLewF+w3F9hTFAfOM6F3UIA2bUsby0SPIR/04a0 1enrJ6U1qElB8wk/8Ncur2YVPzFgKmgpQI+i1n7NrGIuN2mHmmzrM3OLZf3H0BpL 3jKzZWwIoa3waO81mtVyij8gctwpk2bzoUJGs6XsvBKZMCbZdiZVyWedn5kEpM5m an0wmHQdta85iK9XysKm55Oe0PYhmm0K9pH4sNYFWuMcC2oKtyizbiV3wq3sjpau XSg/9koTmUowiQzTIUoCYut0UxuLjD0WfzzoR1EKcb07dFCMwkjn9jDHOQW9eSMo 9PhMEgZ2i1n463YUxhpUYXbZkqML+IQ6VLc4ZgyJdj7c+RVJSbT4GOwxBABnN58p iEFNVDmoS1+CVUq3Ysvsw2KtM2oGxsn7sx/69KesxEHXiytgs7afyOYacGV0fx5R OXuNlW3g5ODGdayMcXbEXY0C492e07CnMvTZvbMhwGs7YeIZUb+JfMwFpQAeSP1w XOYl4h9YxS1sgB2gUSZc0ETfXDeeOxB9RZ1j817ySEMfn/XCUjyexOnsqBnNGbpM AcWwHPwmdCYOKyWFTcej/u/8fxGkYgYZldd/GxcYTGaFy8IudyM= =E/z0 -----END PGP SIGNATURE----- --=-A/nJhzVPw0FwclUgBET/--