From patchwork Wed May 17 02:21:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 13244074 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 E6AFEC7EE24 for ; Wed, 17 May 2023 02:21:48 +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=99hBR/0KrHO26pi+pazFxSj6mP0bWjusIDqmRtaHMQs=; b=vHa uwu5bQvrskTWl9q3o6jqzDXOs8s2HIvAgqygXnWoE2w3TbDEavgZANELQEAD60ve6NUU5+uADThj8 nsv6pWlTZmeNJS6J69HjfdPiBmj7LeRtZchDOAOFqvFUimBGxrmgVJsyLaTKEOHUYC+A2J0TzhbmK vyXqmO94imxTzoTQLctFp6dk1KbisRGBuHMPJjUA71PI7ukeFdzpj3XGEWXeopiqFtHFHria9YEm6 gHXtgsvkbN6CVC/eiji0pGhfG1EWwGGb/mNKcarmErVGUEZZlbf6g5THQcbyOiDHYzy8gGdut7Duu ygXUVu3djOmT0sFF0wLzwXqLc0afSqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pz6nA-007oGn-01; Wed, 17 May 2023 02:21:28 +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 1pz6n7-007oFk-2A for linux-arm-kernel@lists.infradead.org; Wed, 17 May 2023 02:21:27 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-ba7831dfe95so226922276.2 for ; Tue, 16 May 2023 19:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684290083; x=1686882083; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=DbvIotRGfeUI08jv8AEiwlw+JO4JY4xCfZlRx6U3EOo=; b=KUAjUFSPrTObC3hg/4eFzGEAYHdVyshHZdyrXJc5KM2+ApESlbodJxFclR3YXvSKuy kLOT6ZdR4Ohc4e6WLZv+NG13YniC23eIgKsDzKhXjT4gOGcOJ2uRdUt0pqfkKLiCkksk lkw8+v3lrxIgT5X4LzGBewpBv4Dud1I+wY37cJ3oSnYl/yPDUDK/Up98aTyjDQ04NhMP jTiiQChMP2VXsYI8jCvRhbkJjo5tai4Kx77eSn2JI3ORttioIag8vv05s95dP3/TmsMw MbTWpSFmhHnKx78X/4B6zv31Tl0ERVcNveLr1aTw7w/wCj644yKhpI3JdT9AtVh1ISco lYhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684290083; x=1686882083; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=DbvIotRGfeUI08jv8AEiwlw+JO4JY4xCfZlRx6U3EOo=; b=kRswvTYPRptveUYmIMHHiDf24eBQRmUTiMfJ78Vfo+Zd3VBJFDwQOR31zOVR2Iprky 50taTYKXMMSEayRbdQevosKS5GtY/yvC8EzF+Tak6ZQD2RSJJa+4e/jXCjawDU73cWi1 YvTiTeRYtIS5oyeF2huWClctkCdJ3iokU9bhgmc8gK38DRxagmJOc5ZVUIAhhgwe6qBC RAvozP4GX6C9FHdGDxl/7RBwGMmsZgjcaIciD5cX2b96bi+fYaAT/3KUULMitlfJOcNx BOJd9cvBUUGyXUBrKP6Uyl3U+ltOji+B12n+NFug06guVPniBeyEcgb0lt9G/2v1yHnd AH5g== X-Gm-Message-State: AC+VfDwT3CoNqIhy09M+2GSMzRIpJVI652jeFb1g1yn3zffJyw7uqE7W BZ0yJeIdzbe/cYJaCjRS98fyKhs= X-Google-Smtp-Source: ACHHUZ4fdjqimU4JmDpRktxQF9oQ9T6d7e3Yb7VykHUg7Ik7O9Au34ajlZWnInBmmASi8g9Q5p5F+oI= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2d3:205:b3a7:7c59:b96b:adaa]) (user=pcc job=sendgmr) by 2002:a25:7708:0:b0:ba8:1b23:8e66 with SMTP id s8-20020a257708000000b00ba81b238e66mr1996246ybc.9.1684290083311; Tue, 16 May 2023 19:21:23 -0700 (PDT) Date: Tue, 16 May 2023 19:21:10 -0700 Message-Id: <20230517022115.3033604-1-pcc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog Subject: [PATCH v3 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230516_192125_716080_21C737F3 X-CRM114-Status: UNSURE ( 9.76 ) 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()"). - 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/ 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 ++++++-------------------------- arch/arm64/mm/mteswap.c | 7 +++--- mm/memory.c | 7 ++++++ mm/swapfile.c | 7 ++++++ 6 files changed, 28 insertions(+), 48 deletions(-)