From patchwork Fri May 12 23:57:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 13239990 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 4C35EC77B7C for ; Fri, 12 May 2023 23:58:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A58026B0071; Fri, 12 May 2023 19:58:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A08056B0072; Fri, 12 May 2023 19:58:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F6C46B0074; Fri, 12 May 2023 19:58:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8083D6B0071 for ; Fri, 12 May 2023 19:58:15 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 54058C0F5E for ; Fri, 12 May 2023 23:58:15 +0000 (UTC) X-FDA: 80783269350.12.C663F5F Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf09.hostedemail.com (Postfix) with ESMTP id A59E2140003 for ; Fri, 12 May 2023 23:58:13 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="MH/xgRcl"; spf=pass (imf09.hostedemail.com: domain of 3lNJeZAMKCN0OBBFNNFKD.BNLKHMTW-LLJU9BJ.NQF@flex--pcc.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3lNJeZAMKCN0OBBFNNFKD.BNLKHMTW-LLJU9BJ.NQF@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=1683935893; 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=2B9ylj6BFfnRpivqhld1/fhZhP2W8ss3stfOx6ALHRA=; b=GR9oHBqFsp4EngDqmmXB2PDH55VBj7SgCiU4JeSo/X9psWxaAaDMqRE5LYTwBeR/o8vgS9 86gzeUKjyFR9yRS8lp50+vKGFmf5oBf7qbaGUkc4ItNsRB3BBtMIyDS4WPrTYGPYgYF2A7 S1ec3xkb7JVEKqNtrk0AITxl0+VgXh0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683935893; a=rsa-sha256; cv=none; b=UnI1WS5DFj7kHbQFcYj6se1AoKYjS0AfTM35QTOTOtkOmtnQM0iOLmH0SfjfuLtaWywc3G 71lbQSMoj5jsKmuG94AFCXNm2Mqzag0NVl3aDywDu1E8t2uQZpbb0C9NnuO4TPM3dDk73Z 9dtTDQtu6O2eBQsVax+pronqCw8jp20= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="MH/xgRcl"; spf=pass (imf09.hostedemail.com: domain of 3lNJeZAMKCN0OBBFNNFKD.BNLKHMTW-LLJU9BJ.NQF@flex--pcc.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3lNJeZAMKCN0OBBFNNFKD.BNLKHMTW-LLJU9BJ.NQF@flex--pcc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-b8f32cc8c31so19318992276.2 for ; Fri, 12 May 2023 16:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683935892; x=1686527892; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=2B9ylj6BFfnRpivqhld1/fhZhP2W8ss3stfOx6ALHRA=; b=MH/xgRcl+oUPdxpSL89+G1Evz0eAj37oZvyPdlEMzSK1W1bXq+MdFgI5o0PFEYAlrO 84MDZRwz1cr6sqxQFVeYXxgCRAiORqaDDNQL7zorctuToCxpbKuXepJ7AKbwyEawuaKO XQl82PD3sX+QBkC3xy7I+TlYA/iQK9Bitn3+jhNRz+kcr4U8pUaiTj3lELHkiqAXaJx9 WfElw7DOVD034UIRYtbMCksCxNLOtIskaVofeeGZGVhH2M4NcSVX2TPPAklY8Sf9/7Cd GL45qL8Ne0EeZ2bnWg1kgrhJ43j5rMQBBv5Twk/6UdsKtfLGHSNBixyjLoymaxL9gi+F raeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683935892; x=1686527892; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2B9ylj6BFfnRpivqhld1/fhZhP2W8ss3stfOx6ALHRA=; b=TYnVSVRt+xxq6CTG0saTQHsonpOuASrE9Yo4Ur7pTfP85m2NzsII/rg1zeq/uMH4jR dmtmpVpOiNtZOjgZR178Vyke4mL9nl9+51c2RMiIqEo26OlRhyH6NhYzlHaekt85adNl 2eRSgxcsw+zwYqlYY9fGuWAAEe3p5pHOnxepEh5WayReAODv36YLllNi7kEaRlmyaX4d eoPn+CMZsBCatAt97j04mm7ATnK5MvhTOUyHm88M6s6gvget1WYFbz6E/K7AZLAyPtlb w5XJlXTyh75htgmACjWStukjhajE+d+X5b9TvWcZPqr5Lf6rMTqdHqM3Bd7ag1wpynFz J6ww== X-Gm-Message-State: AC+VfDzHW5LRHN7YomxyzWwSekI6fJwNdXSAZnWxZkgQ3NTqtksHIext z5NqXm0HyTtUTb3XnLFOi33LLWQ= X-Google-Smtp-Source: ACHHUZ6Xqq7MGiMsUQfneARzg6AUQPg2lvYwWTI9d6Hj3TtAyRo8Lm8UF/z4RPzRYWDX4z/Wbww4swU= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2d3:205:ff6:108b:739d:6a1c]) (user=pcc job=sendgmr) by 2002:a05:6902:154b:b0:ba6:db51:a7e4 with SMTP id r11-20020a056902154b00b00ba6db51a7e4mr2646213ybu.11.1683935892703; Fri, 12 May 2023 16:58:12 -0700 (PDT) Date: Fri, 12 May 2023 16:57:49 -0700 Message-Id: <20230512235755.1589034-1-pcc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog Subject: [PATCH 0/3] 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: mi9j68anab7petoqj31p8cwwos39gxm3 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A59E2140003 X-Rspam-User: X-HE-Tag: 1683935893-429604 X-HE-Meta: U2FsdGVkX1+lrgs3h45bkIt1L9XzhkMqTXasuyHj0G8VF9a16yRdm1P3Km51P0/roZRhYUAB0B5aAwr0cI60iyO5a3N1xAEIJ9JPDZ48qrO0VseAD2Vh4SZisY/rZqdPgF5YvyoM4JHOVwqDx0Y379C/t42CCab86ql64zhvUBwnxfV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dhsA2oQe9Xnq1/SYKhWeD4Ry4f/71EHt5P0V7wI5EDY10kaSwtJlvRUq8dELHzXD0gOOsgvD2ouTsFOxS/Lc8yyBKzT61rcsC4t9oH/AIpOrnOHCNU0in712a0Qc+HCT61lwEiuHBq54l02m7nz46nu8/y0KIMsds5ddxaK5mwKm8gKs+hq7QTxv9X/QppKIXcNWJPwepXBzne1M3iR674mrI2txb34/36OXORQ5ElF/+jkOzoqjZ/Eug7BTvLs0DYIMBqkgn8JeiPfRRBF8nvwU0xzdd0YvbP/H3NZxPRqst2QLawRGtS3ocAM2rgsRUht8wQFIIChE23K9NmdUrKZ3bZOe2X2vz5e3gjX3V6U0AjQcsiZkR0qOELiZDAsUXWdTaEElax3WHp9OZKl+aMz5iG/K6AM/UgWN5g7AdAfwuyx2gwYMCnxvym26JWmiNo/e9u+ZPbhKVQEqOmZB/u/Y2 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/ Peter Collingbourne (3): mm: Move arch_do_swap_page() call to before swap_free() mm: Call arch_swap_restore() from arch_do_swap_page() and deprecate the latter 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 +++---- include/linux/pgtable.h | 26 +++++++++++++------------- mm/memory.c | 26 +++++++++++++------------- 6 files changed, 36 insertions(+), 73 deletions(-)