From patchwork Tue May 16 02:35:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 13242481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CBC0C77B7D for ; Tue, 16 May 2023 02:35:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B41DF900003; Mon, 15 May 2023 22:35:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF202900002; Mon, 15 May 2023 22:35:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99248900003; Mon, 15 May 2023 22:35:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8697B900002 for ; Mon, 15 May 2023 22:35:23 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 57AD416146F for ; Tue, 16 May 2023 02:35:23 +0000 (UTC) X-FDA: 80794551726.28.75283D9 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf15.hostedemail.com (Postfix) with ESMTP id 9ABABA0006 for ; Tue, 16 May 2023 02:35:21 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="qg1/oXxW"; spf=pass (imf15.hostedemail.com: domain of 36OtiZAMKCHUiVVZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--pcc.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=36OtiZAMKCHUiVVZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--pcc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684204521; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=9idPu53ZjVHtwYigNYCClhylP4MevS6nQx9iaoA1FqE=; b=G80r65yrEFbxF29lrd6XklO1KE9IIassqX1v2Arfm/red2vzBMeqhkZfsyCc3Ndins6myW S+Xu0ZniAHS/tx6dKV+R2VsTIqrtYDotwbQAvYpvTLewCpkVbMEJOujMntnNVIPGm8iJ0p l9WQqBgiJ5Egf6XGOXlRu/etra7e/8A= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="qg1/oXxW"; spf=pass (imf15.hostedemail.com: domain of 36OtiZAMKCHUiVVZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--pcc.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=36OtiZAMKCHUiVVZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--pcc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684204521; a=rsa-sha256; cv=none; b=pRf1z6FUfrO+Qt5vPIrM18Gt3ZwEExbakPzaguCZIOIAZd/raZot2sQs5ELvlq+PiLnfVi lDJpMhVrBnWPKxUT3x4nAxu2yyg6wjrKYd+g24T7zVuuCOSVXh6rCSMkU0rkQTEZN7xqzv bVJN/Xe5GiRTFlMJLy3v1ggWk9KMGio= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-ba802c775caso1838607276.2 for ; Mon, 15 May 2023 19:35:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684204520; x=1686796520; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=9idPu53ZjVHtwYigNYCClhylP4MevS6nQx9iaoA1FqE=; b=qg1/oXxW4HMIEgzqfnFQltjTLrihl9n8+ZqSP2kxW3MUyySEJep6tZEI0JAp2d2Ov4 vqPhyhZVxB50nViGKe3SSdGBMiIyAeNywyKZakLWog1hEmPCYMUjvQw/Vx+RcjwtSSCW RTFesV5A/gVb7ZHHlX9moH2DQvP+U2oGZPMsfStL2GZ/hIfQp54Tl+zXMhAbbh5mZohK vZlzAMNjC0oBGwNVPe/VV3bXPcx36IK9qzqt61WEofdqh2C7U/G3YJmdpUMQhSAr38KR h3xmrYYTXbvTbG81E49RACeVJkzvkoDx70wyFJmq7L26xzqeZHedYFCioT2FurgwftFY zteg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684204520; x=1686796520; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9idPu53ZjVHtwYigNYCClhylP4MevS6nQx9iaoA1FqE=; b=cddMHVMBtyCfugI+tVTm0VdNYNL3bx9+BlbiyB95hYH3BlHqIWOFSzqFzA0hgCet81 nfTDVLxxbwO6l5bEd8qJ6Yg9hgzFPuRnVbhF/z6rVHtN6Y6/JLr9aujuSnSCYY+6X/R5 mYhUSCH1MFPUnoomZtrB2u00fAAmvC0EOraJl3jFn22jf4wk5S3VXXT9c84Mu2ophMQ7 3M24MZ8tC9v30tFu9hBUH9gtf+SOw2YJCUeFoljxpa0qz9SbfL6ZLTpHHsCOdz/IuEfL rDadn8oEQn/cU74eHWSvigmBirSUblLAM1AkVjT8fNjBGPl4Pk1DJxa2yRzlFd/TEHoJ ro2A== X-Gm-Message-State: AC+VfDwz8MMqqQn3e0ZFqGsLmgUdK9+3ilKeLXmvJ31QnFQ2MizlszSI WbbXAE7jF5WN7x2zKEpluD2iUOg= X-Google-Smtp-Source: ACHHUZ7hY7nEFfNjcj6aemkZbM6LRWtQddySi4jNsUgtytp5xn1nzuPtZhOti+EOFgfx7N2fNayWk+U= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2d3:205:c825:9c0b:b4be:8ee4]) (user=pcc job=sendgmr) by 2002:a25:6542:0:b0:b95:4128:bff6 with SMTP id z63-20020a256542000000b00b954128bff6mr21566342ybb.1.1684204520689; Mon, 15 May 2023 19:35:20 -0700 (PDT) Date: Mon, 15 May 2023 19:35:11 -0700 Message-Id: <20230516023514.2643054-1-pcc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog Subject: [PATCH v2 0/2] mm: Fix bug affecting swapping in MTE tagged pages From: Peter Collingbourne To: Catalin Marinas Cc: Peter Collingbourne , " =?utf-8?b?UXVuLXdlaSBMaW4gKA==?= =?utf-8?b?5p6X576k5bS0KQ==?= " , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "surenb@google.com" , "david@redhat.com" , " =?utf-8?b?Q2hpbndlbiBDaGFuZyAo?= =?utf-8?b?5by16Yym5paHKQ==?= " , "kasan-dev@googlegroups.com" , " =?utf-8?b?S3Vhbi1ZaW5nIExlZSAo5p2O5Yag56mOKQ==?= " , " =?utf-8?b?Q2FzcGVyIExpICjmnY7kuK3mpq4p?= " , "gregkh@linuxfoundation.org" , vincenzo.frascino@arm.com, Alexandru Elisei , will@kernel.org, eugenis@google.com, Steven Price X-Stat-Signature: 5n485rbzcr6t3wh8c9yaxqjw873rgnnq X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9ABABA0006 X-Rspam-User: X-HE-Tag: 1684204521-98452 X-HE-Meta: U2FsdGVkX1903yyLHmbUP3h37XFTx+GTklOzPyRu3fo0ty9B0WoqS2juctNA6Opa7i6PIISuPnqh1gpBAnbsKrFdMUAarvkKGvcxNRhEsXSFtWmjGN31aBByIQIVIvXJBeDKldg3Y/BbMoRsZLurv8sP2c37njbV/5jStIF30y104dbGKkLbd/RnelzkXa04Qu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qoCnPXWNW0HqydF5aVRUbQi3ZHAwakOMjXGNWlooRUaVXf9QYbqHUETgLDPKWXnyGHEVM7aX0Iz8UAvd0wH/EoP2m0wek8lVzkM8Ye/tbrRRPoGzdBncYtNRxDrWoZFfhtIR6X7cb4vLL3quSXxFcrKFyqxh2k12NUwfmvW3JZVVmCYBYO4b6M9Jd6QboksWtiJb84hYyIIdJ/NSfgW8du6cElOsOf97SwAuqLnMe1pPIuvSm6UUeP03HnPO0CFKn++9o7L9Jxz080UtoTzPb1TOgmwEW0koB3l05bXTKDNpQ2MEHggVtlOQBc04vQJWcuIJqd34nUCIbOWJkikFPTMi73Dbh1yBtVSW737EjLXWEPK+G5NWtrW99vzbdDOmyA4hH4z/KGEEstuff3aU4Xziw0wgKNDmFgvMnbb4u3sxQ8fBKoKfnZlMbjN X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This patch series reworks the logic that handles swapping in page metadata to fix a reported bug [1] where metadata can sometimes not be swapped in correctly after commit c145e0b47c77 ("mm: streamline COW logic in do_swap_page()"). [1] https://lore.kernel.org/all/5050805753ac469e8d727c797c2218a9d780d434.camel@mediatek.com/ v2: - Call arch_swap_restore() directly instead of via arch_do_swap_page() Peter Collingbourne (2): mm: Call arch_swap_restore() from do_swap_page() arm64: mte: Simplify swap tag restoration logic and fix uninitialized tag issue arch/arm64/include/asm/mte.h | 4 ++-- arch/arm64/include/asm/pgtable.h | 14 ++------------ arch/arm64/kernel/mte.c | 32 +++----------------------------- arch/arm64/mm/mteswap.c | 7 +++---- mm/memory.c | 7 +++++++ 5 files changed, 17 insertions(+), 47 deletions(-)