Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp675288pxb; Thu, 9 Sep 2021 09:28:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZYsBrcAWYAIsdMi7fQ6fbS3iLQKk0mLEsVUW4OrAXYS7zeWYIGtcT5yJ3lfO6uc9WEzGT X-Received: by 2002:a05:600c:28f:: with SMTP id 15mr3355842wmk.90.1631204929495; Thu, 09 Sep 2021 09:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631204929; cv=none; d=google.com; s=arc-20160816; b=KZP4G7I7s3/mK4FUK2NqujuFWg22nOHyNJstm4vP0mGDIvB7fB7hKCBGGOs2VUWDsd 5VSMgJ4a4mm5u6oeWsyHWsFwOy6owF5Yjiu1uQStW04i5jMpsRdfLjDsmFKZ1jl6Ix1T NUd5stVkByuBNGNGaoA9omOEgM306XOhHSTI+s/vH7sZJPKKgZbZ5QvzO005tgBKaoeL Sw0XZwbcsuqfKKvDDg1OHtU1CW5WIUxlXhYmHDHQXSBnYWSgDtD7HS2UO/GSIk6YBhhk HooTdzTWokZ0Psz6fYrtvRDktoitQMoS+11DdvZYGNUTqNwWWQdCnRf9Pi8Es08I3wA7 60uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6g4VWCrzU/h/qyBDenztolU1cZPMwHWOEhuFKokN2bQ=; b=opfVmJM8QiK2Ko6RXXHVsIZJJVnKBFpgXXHuTzs/dUIOvIPRAW8PV0cEywM275fXCO TekBWGMdj+IxKUDUVEXBx9ciunsF1Z1Tq5shR7OCbhTQA8w4QmiDjmHz551YZiJKoj7b vwqDZqdIPnI5NlGdvvpe/ubhCQjJ+P51fyHTS1VmVKB0Z0egu1iCMpZJ7hCn995Jlw2b 3WlB5gP2ZFFH1VDNi5C4fm7R4D+k5rKBmkKcpNec73+nwJGdMFGlreU14JYPRSelnfZ7 hVUYr3e33cHGSBcFJjSVoNV1cD5WAwU15aaJ1Uvowxp90JzW6yKZkabhZrlK+AV1uhDS q3fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R1i6yFak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si2470327edy.383.2021.09.09.09.28.23; Thu, 09 Sep 2021 09:28:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R1i6yFak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238744AbhIIQZT (ORCPT + 99 others); Thu, 9 Sep 2021 12:25:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43542 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237070AbhIIQYx (ORCPT ); Thu, 9 Sep 2021 12:24:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631204623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6g4VWCrzU/h/qyBDenztolU1cZPMwHWOEhuFKokN2bQ=; b=R1i6yFakVicAUrI63EBOIv1baOvwT0jH7oCltH3/DZKmnXx2/p9eWyujEbRzS8SZkznwCP NzcHpft1yRR2XaEvW3GCimqSCb8Q/ee1FSYKgc2H/KjtFI+rum0YS8qlsXifHi2qqq1shX cDC5WL5YOt10OubD27EcJ17OuybXoBw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-572-0MTA3mPBNC2oDkUS9eTzCg-1; Thu, 09 Sep 2021 12:23:42 -0400 X-MC-Unique: 0MTA3mPBNC2oDkUS9eTzCg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C8E91092872; Thu, 9 Sep 2021 16:23:18 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.192.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id F00B818FD2; Thu, 9 Sep 2021 16:23:14 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-s390@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Christian Borntraeger , Janosch Frank , Cornelia Huck , Claudio Imbrenda , Heiko Carstens , Vasily Gorbik , Niklas Schnelle , Gerald Schaefer , Ulrich Weigand Subject: [PATCH resend RFC 7/9] s390/mm: no need for pte_alloc_map_lock() if we know the pmd is present Date: Thu, 9 Sep 2021 18:22:46 +0200 Message-Id: <20210909162248.14969-8-david@redhat.com> In-Reply-To: <20210909162248.14969-1-david@redhat.com> References: <20210909162248.14969-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pte_map_lock() is sufficient. Signed-off-by: David Hildenbrand --- arch/s390/mm/pgtable.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 5fb409ff7842..4e77b8ebdcc5 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c @@ -814,10 +814,7 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, } spin_unlock(ptl); - ptep = pte_alloc_map_lock(mm, pmdp, addr, &ptl); - if (unlikely(!ptep)) - return -EFAULT; - + ptep = pte_offset_map_lock(mm, pmdp, addr, &ptl); new = old = pgste_get_lock(ptep); pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT | PGSTE_ACC_BITS | PGSTE_FP_BIT); @@ -912,10 +909,7 @@ int reset_guest_reference_bit(struct mm_struct *mm, unsigned long addr) } spin_unlock(ptl); - ptep = pte_alloc_map_lock(mm, pmdp, addr, &ptl); - if (unlikely(!ptep)) - return -EFAULT; - + ptep = pte_offset_map_lock(mm, pmdp, addr, &ptl); new = old = pgste_get_lock(ptep); /* Reset guest reference bit only */ pgste_val(new) &= ~PGSTE_GR_BIT; @@ -977,10 +971,7 @@ int get_guest_storage_key(struct mm_struct *mm, unsigned long addr, } spin_unlock(ptl); - ptep = pte_alloc_map_lock(mm, pmdp, addr, &ptl); - if (unlikely(!ptep)) - return -EFAULT; - + ptep = pte_offset_map_lock(mm, pmdp, addr, &ptl); pgste = pgste_get_lock(ptep); *key = (pgste_val(pgste) & (PGSTE_ACC_BITS | PGSTE_FP_BIT)) >> 56; paddr = pte_val(*ptep) & PAGE_MASK; -- 2.31.1