Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1129853rwd; Thu, 8 Jun 2023 12:37:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/KHJzR9agbHBhhI5M4pm6d8LqFPDrM548kHE94Ezm2SojQ5080pfj1+zniWqeP6/U1QDt X-Received: by 2002:a05:6a00:2e01:b0:64a:7723:fe04 with SMTP id fc1-20020a056a002e0100b0064a7723fe04mr7577625pfb.4.1686253027207; Thu, 08 Jun 2023 12:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686253027; cv=none; d=google.com; s=arc-20160816; b=n69IuW1EI0UXlsDfagEIjVjA0YSFUrPJtQ24COsoFXQU2Sk21/LoOa6mI7/CGZlRs1 SQixQEubGGWmnKdteyDJW2EgOOBgjCICBB19Y4xj0wE9MedgVW5y1fOG/0lUWpaTNzpP U78d/5yZes7zIOQB5vg3aiZzohO0Q4V6uXZWSKFFrjLkhmFl1MoOGxswr2K85d3fx5bM fu1W/gHKrMKm6MZy75yC6AfdJIPFWdFj/htI7di8f9CJ3DNZ09pwAdmi3O9VZFd22VgP ODte/TG5lQ52mulWBm9J/aiSlDp/Tf46I2GUzLWKL7E5H6jFZe4uBalIx5jQcwamiOig lnJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=htP458HkQOxv1YJRD6pA18DA04i7K6/u04f92CnMfB0=; b=l5FvAYnBTyjPMTcjUx5f+FHwuvOHiJKF/ziH3Yz1FdeXWM6srBuXqtRexOE7lr4V/3 9uKXqjtiTnlobyy/68Pz2iSxX0pBceVEpBmDczbCq9rTcGbatExN3nKWE61GlyuubUiP BUNOlhemFR9pbT2baHDmBxKKiSHbUNfkiVh1X+CiNf/pbv9UP3WQ8bcmcaXvBUhLuJQy 6wU9PsQxWOjEdFGIlSq2eQYjZbB05WoYlULhD9mU2W9/d0rQQQ7vmEvy7c3B8od3pHp+ FfHssRvzQVNIWK3ow/dn2dKI00+kIW0bD/V1hJPldIWrdqefPmQ1+KU0Y9wyLC6Ga65l URlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=WqCUQyh4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m28-20020a638c1c000000b00543c6a8c7c8si1439861pgd.583.2023.06.08.12.36.54; Thu, 08 Jun 2023 12:37:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=WqCUQyh4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232957AbjFHT3Y (ORCPT + 99 others); Thu, 8 Jun 2023 15:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbjFHT3V (ORCPT ); Thu, 8 Jun 2023 15:29:21 -0400 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FC562113 for ; Thu, 8 Jun 2023 12:29:19 -0700 (PDT) Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6b2b7ca1c5eso58482a34.0 for ; Thu, 08 Jun 2023 12:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686252558; x=1688844558; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=htP458HkQOxv1YJRD6pA18DA04i7K6/u04f92CnMfB0=; b=WqCUQyh4fb72P3Kw38oeD34IYgDMZUJWpeeOOH7KwWFkTIkJBfiV3ibZz3gZzYLVxl lU1gDOTGIJCl22/qWpu3I54yHV8hXoWsW3bLvMizUe696eD4+w5NMItSw+ZsMJ2if+3a 8lw8VtiSVvPlHQ/Z7+Qgoipy0NwOKSeRkxeZtlOJSgMtgwHhJFZs8ezKvYFf04NNKV0B o9SvBbVJSNYcgeP1FcAifK+xGopk05Di+EjON5dZeXWscPS5ozLfdvYQvh8DkNTWidtB R65qDn5ks7oQgy0HqDzv818p/gf4omkafkLcO+z9CO+/iNtMlszDRH4pSfFhaygbIVXY l7fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686252558; x=1688844558; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=htP458HkQOxv1YJRD6pA18DA04i7K6/u04f92CnMfB0=; b=gclMxU0Pxq/0/HAXLqxeS685cIQiGMv2GLex5yHL82e1qhE3PJWbrFqJJW1vW/Bp+S XjsiQ00p9MtDLs35d0E8CBkj9EimFK5hNrc4KaTJAj43IUeDodqKgERKSaWcUnprK1pw +TcVInsIsu8UxYqNDFf1rkWcjXDE9W4NGEeR0kh2xJHMq6dHl9mFfv6oINeaMOgeW9ci GQMQwztLgM02/ghqFdfPlJ6ZBio8IfzqySw5ekVuRX5GQii4zS+8nzRCWyqAS2azoGgS rSm2IUgD4sPuePKh4MhSDrdxNheFQsg5N80sUxO0tNwPhwpszf38Al4ujVzAR8BYmG8F IFfQ== X-Gm-Message-State: AC+VfDz5q9347ED5MWxxma0GsgC/mv73WrLKdQifohgSgYCTWAHBOwVJ bOza2bcQa1LXk3tauF2/gf2Ffg== X-Received: by 2002:a05:6830:86:b0:6b2:94a2:2236 with SMTP id a6-20020a056830008600b006b294a22236mr9332824oto.29.1686252558452; Thu, 08 Jun 2023 12:29:18 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id o199-20020a2573d0000000b00bb09977b0basm455193ybc.6.2023.06.08.12.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 12:29:17 -0700 (PDT) Date: Thu, 8 Jun 2023 12:29:13 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Peter Zijlstra , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Greg Ungerer , Michal Simek , Thomas Bogendoerfer , Helge Deller , John David Anglin , "Aneesh Kumar K.V" , Michael Ellerman , Alexandre Ghiti , Palmer Dabbelt , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , John Paul Adrian Glaubitz , "David S. Miller" , Chris Zankel , Max Filippov , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 16/23] s390: gmap use pte_unmap_unlock() not spin_unlock() In-Reply-To: Message-ID: <78873af-e1ec-4f9-47ac-483940ac6daa@google.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pte_alloc_map_lock() expects to be followed by pte_unmap_unlock(): to keep balance in future, pass ptep as well as ptl to gmap_pte_op_end(), and use pte_unmap_unlock() instead of direct spin_unlock() (even though ptep ends up unused inside the macro). Signed-off-by: Hugh Dickins Acked-by: Alexander Gordeev --- arch/s390/mm/gmap.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index 3a2a31a15ea8..f4b6fc746fce 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -895,12 +895,12 @@ static int gmap_pte_op_fixup(struct gmap *gmap, unsigned long gaddr, /** * gmap_pte_op_end - release the page table lock - * @ptl: pointer to the spinlock pointer + * @ptep: pointer to the locked pte + * @ptl: pointer to the page table spinlock */ -static void gmap_pte_op_end(spinlock_t *ptl) +static void gmap_pte_op_end(pte_t *ptep, spinlock_t *ptl) { - if (ptl) - spin_unlock(ptl); + pte_unmap_unlock(ptep, ptl); } /** @@ -1011,7 +1011,7 @@ static int gmap_protect_pte(struct gmap *gmap, unsigned long gaddr, { int rc; pte_t *ptep; - spinlock_t *ptl = NULL; + spinlock_t *ptl; unsigned long pbits = 0; if (pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID) @@ -1025,7 +1025,7 @@ static int gmap_protect_pte(struct gmap *gmap, unsigned long gaddr, pbits |= (bits & GMAP_NOTIFY_SHADOW) ? PGSTE_VSIE_BIT : 0; /* Protect and unlock. */ rc = ptep_force_prot(gmap->mm, gaddr, ptep, prot, pbits); - gmap_pte_op_end(ptl); + gmap_pte_op_end(ptep, ptl); return rc; } @@ -1154,7 +1154,7 @@ int gmap_read_table(struct gmap *gmap, unsigned long gaddr, unsigned long *val) /* Do *NOT* clear the _PAGE_INVALID bit! */ rc = 0; } - gmap_pte_op_end(ptl); + gmap_pte_op_end(ptep, ptl); } if (!rc) break; @@ -1248,7 +1248,7 @@ static int gmap_protect_rmap(struct gmap *sg, unsigned long raddr, if (!rc) gmap_insert_rmap(sg, vmaddr, rmap); spin_unlock(&sg->guest_table_lock); - gmap_pte_op_end(ptl); + gmap_pte_op_end(ptep, ptl); } radix_tree_preload_end(); if (rc) { @@ -2156,7 +2156,7 @@ int gmap_shadow_page(struct gmap *sg, unsigned long saddr, pte_t pte) tptep = (pte_t *) gmap_table_walk(sg, saddr, 0); if (!tptep) { spin_unlock(&sg->guest_table_lock); - gmap_pte_op_end(ptl); + gmap_pte_op_end(sptep, ptl); radix_tree_preload_end(); break; } @@ -2167,7 +2167,7 @@ int gmap_shadow_page(struct gmap *sg, unsigned long saddr, pte_t pte) rmap = NULL; rc = 0; } - gmap_pte_op_end(ptl); + gmap_pte_op_end(sptep, ptl); spin_unlock(&sg->guest_table_lock); } radix_tree_preload_end(); @@ -2495,7 +2495,7 @@ void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigned long bitmap[4], continue; if (ptep_test_and_clear_uc(gmap->mm, vmaddr, ptep)) set_bit(i, bitmap); - spin_unlock(ptl); + pte_unmap_unlock(ptep, ptl); } } gmap_pmd_op_end(gmap, pmdp); -- 2.35.3