Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3657420rwd; Mon, 22 May 2023 18:12:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/Y0DK1xdL2yf0QJo3bCxeIlXbpSHmWB2/3ezgOJyPMQe5wPJSpHrMVpdd9hYLDRD39LEa X-Received: by 2002:a17:903:1206:b0:1ab:74c:bdf2 with SMTP id l6-20020a170903120600b001ab074cbdf2mr17248016plh.28.1684804319749; Mon, 22 May 2023 18:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684804319; cv=none; d=google.com; s=arc-20160816; b=WxTNDoDxfnVfje3/Q1fgTxqNyirTva+FpH9sWKDzOBdtp8EJIyXgPjx968VkVfGbZ7 U2Be0rC52cj/K00VQzjUa2uVVTr8qyMce5+RAbmkMRqmKAV/4asEuMVJBj/yyZt9B1r7 rQ25g5Qimj/5E7qrJAbQXq0nUMRmO8a2nW2mWyEiYIr7A//UOc48frRI4cLUj0cn9zll Y3/qthYqeUczRxI2gkQkrFHCgPnzsNeUv51seImTySta37yq7KTc9uA0LNYyrQEpzfhy 64TEYS27reTJah1kuub8igaXBpKuNQ9NEefllti8heiWHbfIcOocruV41eof+Z+NjvZv JMcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=SK35moxCE6AhlCZl4FimQ53XrewZjdQKUPUW9jfTNhI=; b=fcd6cwPXCN8bj8UpQdXR606JLOf6sJ1o9T+5PCWanYeb6xd6Kj2NTABlzRu6O/Wqmm FfDsMs629boyx9hc0tOrZlGqz1nUd7Mk5w/YcXu+kVayOpD6BpR0myTqqoUXCp+nuc/m A3l4oEKjCqWCqohdrmHYS+6a/URnADlMW9Lakv93es4TJhyGTTy8Jqbb9ap9uK8bYkrc Rldc92xuh6VZityJ539pGze6/focVwhdJEUFE1EX20ySSupZsd8d069LPzUcckU+cKHt seWNuYr3mj9mLg4lEsaVcdvKp6uxO1L0zIXl5kStFCkb8q1IpGnrQ+mzY5lVD8N9Xj9i v4sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=JF9VmGvn; 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 t14-20020a170902b20e00b001a95929ca08si5318856plr.533.2023.05.22.18.11.45; Mon, 22 May 2023 18:11:59 -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=JF9VmGvn; 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 S235178AbjEWAvx (ORCPT + 99 others); Mon, 22 May 2023 20:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235155AbjEWAvi (ORCPT ); Mon, 22 May 2023 20:51:38 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56D3455A9 for ; Mon, 22 May 2023 17:44:54 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-561eb6c66f6so58230817b3.0 for ; Mon, 22 May 2023 17:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684802595; x=1687394595; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=SK35moxCE6AhlCZl4FimQ53XrewZjdQKUPUW9jfTNhI=; b=JF9VmGvn6ME+aV3DWd+moD6DHriILl/eHSLrRAVbk557Nfyq2aEPhsaPiGBpDbWYew xfxlvpIcDqTn+OyodXR//4275XAoEeYjxwdP8/SeVRQSlV9QMoEG8a3I0GYpUHbADTXi BO0ai4br/mZs2NpalBibKFHY6KZ4WD2OYLEBP5rVthGV4zZXo73DugZVaCiFg4N10L5J y3ow4VUMSVguwSU9N8aUagGsIBAOX6iR6VVTKqq5fCbzvHjN3f3blh1NFR8W7EXCmsJj sFhkDMgC+eXM3eLCgw3471dz7sjLpCIriVTG3t6mKGIBUQCgosKE3bott3R7ljUVNJdY TnpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684802595; x=1687394595; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SK35moxCE6AhlCZl4FimQ53XrewZjdQKUPUW9jfTNhI=; b=N6XWR515mEelrHyqBaXRqgFZ0/PhZpLS9ucoVwmZonLknH0wEKQuCRHwtt0Z12ygzi 75AlaPFOQKDBLa1e+mAfbx16NdVg939PtxhsYOXd3QcSKrMrWBzi6oU51YrV5rj5T68I tLYzEJC5UnHUZIk2cs+YAM6krlURHDAxY9KtEdgxCgLI17f2u5vftNvyoce387H9cMYd wdyNcar5REJtMf32hhGs8Ogxs4dzHTIiKiTZOiVGkguLcIVVGo8PKxt4Hw/PTTqDQD4M p0UG17ZzfZKXxuxdt71rev2IYKR/72s33hzmPiJQqydZcWX82K/Hr9rIEpY6hxCzBt+m iwUw== X-Gm-Message-State: AC+VfDztJc/DilLFCrtMGTe8lgExRRI0j0CylK3HnD8WLJ2VEf7f3c3N HGLl7diRj82l1vDtif5peyXOzXU= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2d3:205:3d33:90fe:6f02:afdd]) (user=pcc job=sendgmr) by 2002:a81:e508:0:b0:552:b607:634b with SMTP id s8-20020a81e508000000b00552b607634bmr7917763ywl.4.1684802594841; Mon, 22 May 2023 17:43:14 -0700 (PDT) Date: Mon, 22 May 2023 17:43:07 -0700 Message-Id: <20230523004312.1807357-1-pcc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.40.1.698.g37aff9b760-goog Subject: [PATCH v4 0/3] mm: Fix bug affecting swapping in MTE tagged pages From: Peter Collingbourne To: Catalin Marinas Cc: Peter Collingbourne , "=?UTF-8?q?Qun-wei=20Lin=20=28=E6=9E=97=E7=BE=A4=E5=B4=B4=29?=" , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "surenb@google.com" , "david@redhat.com" , "=?UTF-8?q?Chinwen=20Chang=20=28=E5=BC=B5=E9=8C=A6=E6=96=87=29?=" , "kasan-dev@googlegroups.com" , "=?UTF-8?q?Kuan-Ying=20Lee=20=28=E6=9D=8E=E5=86=A0=E7=A9=8E=29?=" , "=?UTF-8?q?Casper=20Li=20=28=E6=9D=8E=E4=B8=AD=E6=A6=AE=29?=" , "gregkh@linuxfoundation.org" , vincenzo.frascino@arm.com, Alexandru Elisei , will@kernel.org, eugenis@google.com, Steven Price Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham 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 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()"). - Patch 1 fixes the bug itself, but still requires architectures to restore metadata in both arch_swap_restore() and set_pte_at(). - Patch 2 makes it so that architectures only need to restore metadata in arch_swap_restore(). - Patch 3 changes arm64 to remove support for restoring metadata in set_pte_at(). [1] https://lore.kernel.org/all/5050805753ac469e8d727c797c2218a9d780d434.camel@mediatek.com/ v4: - Rebased onto v6.4-rc3 - Reverted change to arch/arm64/mm/mteswap.c; this change was not valid because swapcache pages can have arch_swap_restore() called on them multiple times v3: - Added patch to call arch_swap_restore() from unuse_pte() - Rebased onto arm64/for-next/fixes v2: - Call arch_swap_restore() directly instead of via arch_do_swap_page() Peter Collingbourne (3): mm: Call arch_swap_restore() from do_swap_page() mm: Call arch_swap_restore() from unuse_pte() arm64: mte: Simplify swap tag restoration logic arch/arm64/include/asm/mte.h | 4 ++-- arch/arm64/include/asm/pgtable.h | 14 ++---------- arch/arm64/kernel/mte.c | 37 ++++++-------------------------- mm/memory.c | 7 ++++++ mm/swapfile.c | 7 ++++++ 5 files changed, 25 insertions(+), 44 deletions(-) -- 2.40.1.698.g37aff9b760-goog