Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4398335imm; Tue, 7 Aug 2018 00:28:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdxHr5nQwP7eN7It9MT9Ik2gGu8FSa6T/4Z8YZAaMVBKNsy66AanG+3CCESTFu0w9LSQwG7 X-Received: by 2002:a17:902:ab94:: with SMTP id f20-v6mr16665219plr.231.1533626886296; Tue, 07 Aug 2018 00:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533626886; cv=none; d=google.com; s=arc-20160816; b=FTCXO33yS3+FMmfNPxntUb8P6iM0nmRCfa02UQUihM4UsFlUBYIRsMcRK8FSHo7hYv 9+RSFdirfodkhu/ClZImwcwmm8B2G2Z0qg/2h7HczJAc4N1ID4UrMM+OOB6ULR3mFmjd zwcBI669GeXAmlF5faeLkyCFkiQgm11mWSgzSoG1RDhynmjMJcOXLO5bcWOgaBqsbBPY aY91v6dKtWwXjUtfQONl6mQPnEGYfbfjVy2mH33Gnu5R9rjZeFo1+vpzfMh3UliuHSl3 6MB1wpdR+TX91iMB0yH08n1ijwN5EIVGavQrd06kk6zdDMU1IdW2g2RbuPXSkxtYc1mu mzVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:mime-version :user-agent:date:autocrypt:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=3VuoQQmSCK+dJ6d5q6rLMe+U4+9LQDs2DOzGPVeM1gU=; b=AFD3ZDUVkDggA9zo+4yLVwJRv52ujBBw4GdphKpA1tiMBFJ9Wsj0mlEsRAhWakR5SR RPWHvGXY1w9BYsCKUDyWTp+M9ykskO5C6IVrhSYWK+DSWJc9fhFpfCsKatPTzNGqTnTC 89ewBvyH8hGlmHLlpCVzg2n1T0gjGHqTP4eSP4sZy0ADvcU/okRJWxNo+JfDuuByCI5J 9sxgztBb29F+RmPA087Kq7TtokexeWu9IW9aMc0hCM3kZutAzm2+hxNR0fEWrnQj2acM /fRVLpmDPpxyRWSVuxaZvsEhURoXDVA/4TSz6m3T9WnvB+IuOr0ueBnwr2rDJ2JxvayB BikQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17-v6si725240pgp.289.2018.08.07.00.27.51; Tue, 07 Aug 2018 00:28:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388894AbeHGJjc (ORCPT + 99 others); Tue, 7 Aug 2018 05:39:32 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48622 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388495AbeHGJjc (ORCPT ); Tue, 7 Aug 2018 05:39:32 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w777OFDI121930 for ; Tue, 7 Aug 2018 03:26:28 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kq3bgqwv8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 07 Aug 2018 03:26:28 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Aug 2018 08:26:22 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 7 Aug 2018 08:26:19 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w777QIdT16187474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Aug 2018 07:26:18 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CCD14C040; Tue, 7 Aug 2018 10:26:27 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2BEBB4C04A; Tue, 7 Aug 2018 10:26:27 +0100 (BST) Received: from [9.152.224.110] (unknown [9.152.224.110]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 7 Aug 2018 10:26:27 +0100 (BST) Subject: Re: [PATCH] s390x/mm: avoid taking the table lock in gmap_pmd_op_walk() To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: linux-s390@vger.kernel.org, Heiko Carstens , Martin Schwidefsky , Cornelia Huck , Christian Borntraeger References: <20180806155407.15252-1-david@redhat.com> From: Janosch Frank Openpgp: preference=signencrypt Autocrypt: addr=frankja@linux.ibm.com; prefer-encrypt=mutual; keydata= xsFNBFfqIWIBEAC9u1ku3alDY4YilAfKidqWZ46kCnu7WPXkdcgH3ww/9CcgIDoeSr90SnaU T9gQRO92ESh2OO0ff3RMfmQpPG7hiv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QkSzAMAAAoJEBcO/8Q8ZEV5R+oQAJgaEDxy1cpGmGva0s0Oxvia s5b4+otopF5pnlElTZcqWY1bx3vh2c5NZjCCubY1tb8548x6IprwAYtpmx3XlOXb12Jki/HT qHgeSscyleLbneNO+s8LfhJKY15smPqVKG6leCbtIpliZ0TI2Zif+gYvDZRruHYgHwi9bQzH +wEVDrgess/1dDq3Pt+W7NRhFoKKq7ZQOYkyHE1qdck/cGvq4/XCL9np7+3CBEql+QOtuR2o AdES5cnZwKm7peagQBEaFqgni26de11pW294pJRG0U36mSqxEoyqe97vKUYzsdy1hPPbOPfy 7img6Ifh6WL1b4FIIn9TFbooQ1WRSQvbOzxL+E2x+vmEPfNxpzAuuS+ASLJ6Zv9QCOUAvzBn Lfg7BvkfUhALMIZnAoyYmxutcWL4XYYAvMG13l8hFYpoQcF4WEnUoP0UuNwXmR4QZvOuiE8u CyL9U2LEYbrPVTIsEtUVmDlCyD1Kq+6LE3aU+n06soITGp9a3/WNLpXUbUYfzRvYJ3p6jssI Pe50r3yPfdgbWIWzeWuLimNVTlbIZAi1Y0VIdCDbDQpXl2DDTB9zZw2yz0kRKxasMCAEsvlA CT0NLoyQplUjM1ir5e6QTwy9+v3niCCesupe7owsFfrg/YZsE9jCy8vWgdPjSnRJkwQqV2Fw lFM6NIuMAY1Y Date: Tue, 7 Aug 2018 09:26:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180806155407.15252-1-david@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NYEbmNmPHBKnRu7s81gJEZlYf8ulhXisU" X-TM-AS-GCONF: 00 x-cbid: 18080707-0028-0000-0000-000002E73EE3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080707-0029-0000-0000-000023A04208 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-07_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808070076 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --NYEbmNmPHBKnRu7s81gJEZlYf8ulhXisU Content-Type: multipart/mixed; boundary="yvfh2izJUHpnV2mDovhO9V9zuNv9hvTaZ"; protected-headers="v1" From: Janosch Frank To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: linux-s390@vger.kernel.org, Heiko Carstens , Martin Schwidefsky , Cornelia Huck , Christian Borntraeger Message-ID: Subject: Re: [PATCH] s390x/mm: avoid taking the table lock in gmap_pmd_op_walk() References: <20180806155407.15252-1-david@redhat.com> In-Reply-To: <20180806155407.15252-1-david@redhat.com> --yvfh2izJUHpnV2mDovhO9V9zuNv9hvTaZ Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 06.08.2018 17:54, David Hildenbrand wrote: > Right now we temporarily take the page table lock in gmap_pmd_op_walk()= > even though we know we won't need it (if we can never have 1mb pages > mapped into the gmap). >=20 > So let's special case this, so > gmap_protect_range()/gmap_sync_dirty_log_pmd() will not take the lock i= n > case huge pages are not allowed. So, let's make this a special case >=20 > gmap_protect_range() is called quite frequently for managing shadow > page tables in vSIE environments. >=20 > Signed-off-by: David Hildenbrand If you make the patch title more specific: Reviewed-by: Janosch Frank I considered getting rid of the last unlock with the !large check, but in theory somebody could run a VM with the HPAGE CAP and 4k pages which would then result in havoc if we wouldn't also adapt gmap_pmd_op_end. > --- > arch/s390/mm/gmap.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c > index bb44990c8212..d4fa0a4514e0 100644 > --- a/arch/s390/mm/gmap.c > +++ b/arch/s390/mm/gmap.c > @@ -905,10 +905,16 @@ static inline pmd_t *gmap_pmd_op_walk(struct gmap= *gmap, unsigned long gaddr) > pmd_t *pmdp; > =20 > BUG_ON(gmap_is_shadow(gmap)); > - spin_lock(&gmap->guest_table_lock); > pmdp =3D (pmd_t *) gmap_table_walk(gmap, gaddr, 1); > + if (!pmdp) > + return NULL; > =20 > - if (!pmdp || pmd_none(*pmdp)) { > + /* without huge pages, there is no need to take the table lock */ > + if (!gmap->mm->context.allow_gmap_hpage_1m) > + return pmd_none(*pmdp) ? NULL : pmdp; > + > + spin_lock(&gmap->guest_table_lock); > + if (pmd_none(*pmdp)) { > spin_unlock(&gmap->guest_table_lock); > return NULL; > } >=20 --yvfh2izJUHpnV2mDovhO9V9zuNv9hvTaZ-- --NYEbmNmPHBKnRu7s81gJEZlYf8ulhXisU 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 iQIcBAEBCAAGBQJbaUmZAAoJEBcO/8Q8ZEV5DDcQAJwnfenMm7pE7WAaj9j1RPSR UYKSoDenhCkNNvZdGPOr+JHo9YjuHSA3i7KXZ+PaxlpWfDd9Ok1R6geC2tCzpQey Dr8fO0eeS2+9pemMNMbKYL5pVtvviy/9hxAsT92JOmiUMmIiVJjx8rUQBXWCKVGp ksdgI9VOq6520CJEeLXJ0N5zXUxWq06gWvP+X5j5QojoQL4Vq21QVuH8yeogIL02 3jocS7K+OmR66ShA+od8LM/yuoK+wuv/l38ifdlGXPistSip2cHnCNQfQeY4DqnU zA57mPcd64balRRBoZGBMDi9X4sJK7WOiccSIdrZLvNlfUxYJrF6Wbumm+oNNxew iI3dpKzsiFA0VE3jTgYFB4tsXtmhDx+ATly4sXgaH82kq2lU6Dj/Q6eZVypZsCwb wEVy0Dy9LUjHH8n0YfAVNXOjFdguZpzG5p6TQA6mzrrVPqSlQ4LO1FVyI/bvmAw7 xGmwLEQfMzf4uXtupEZeZH/X5JLkVqVX03nxjT3qs4SEMWiYe3J31AIy0wAm5gpO hL+c/J3aiRdJnB59lDVbFhr4lZx3gxKiQ3HTSx/GymYYUy0s0arLqmmSn/50TRNX UVrDbQWTXDu6z/LEo2AYRLiOzgVh/cVpb3taHalskS2rumQUO84JdzLbEF46iqAH DD6xt8Qo31l7rLyS7zMC =4uOv -----END PGP SIGNATURE----- --NYEbmNmPHBKnRu7s81gJEZlYf8ulhXisU--