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: 13242485 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33556C7EE22 for ; Tue, 16 May 2023 02:35:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version: Message-Id:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Sj0ARIU1O3kUd8+9PU4060f80jTtmZ75Wd+JJAHzGp8=; b=QVc i+haCwFJGtwCD7YLwIxpoc5pX9IroeQfLNu7C19b5qZskfj9qnjEVFaZwAIXtJW828FfeMbX0pt4z OVMuOrkNRO2G81ZNlv0mJzn9riTBnXa0H0DDdL0seiWmi5HXOROQ8KsS2rF5ezNSRTx6Ao3TeizEp 6QwXEb+3Zye1JN0Vmbz/rvTrFwcQcJH0jh4WrPImATPZj6xvChJET0EbjymnEKVALHsWQ7TWy6zOl uRv9YVUVbDH053dbLPEV87JrqMvov27EVQOxEhd0mtbEdhEsrVpvmBLr/5InIS4AbiFpre1DCbmVP RtnBNUOiLrW0JlZA2VZJ6KXnsQTknJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pykXB-0049Mb-0T; Tue, 16 May 2023 02:35:29 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pykX7-0049Jn-39 for linux-arm-kernel@lists.infradead.org; Tue, 16 May 2023 02:35:27 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-b9963a72fd9so29633022276.0 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=EIV20aS6HWLBQPkTi4zkVEwi5cEiLbLElEAQNQ+XKKuNaf2499uio2O5xOjX3jnoNX L3QNM1kIhwAOVCQ80B+Sds3h1jc+f1nW5LGJfYNApsMjrSOXghJ81hD+LaCx6I5caGd2 G4RvdvYwgTHcmN5ZKJQOPkRHajzOHhrtL49taSqwThuMFgDdJ6MqMyV4d5/55CC8bvSu udqbWUhyrwUOO1A+330LQzJvr2kwe2GdbYx8nq5OKLM9hFDY4xr3CIFF5sVhf/S6eE+T R7MN9jd1QxmxAVLy0TCuEDSlwaVkaSZgJbAw7mjqqCBmQnC0BFP/42R/oLzhIGM43q+8 VQGg== X-Gm-Message-State: AC+VfDwug4b7WkQqp5Am40dc+r6rwBXIB2m3t0C4yjsn+kZuQruDlYK5 2WUoUmd+w3y95F3MTg/xZXRWZ4I= 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230515_193526_016320_C5F4E73A X-CRM114-Status: UNSURE ( 8.44 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(-)