From mboxrd@z Thu Jan 1 00:00:00 1970 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 8C59FC25B06 for ; Wed, 10 Aug 2022 19:32:18 +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=LA8qGnN5OFcDY3xIXEZown/IE+F218Jv8wfk862/PEE=; b=naK V1cFa9tHUAT/dOm7TVm4swu9SoACuHIopgBxZdZhfWeXdkyJB1N8tAacTsKJacGSA4QNvXPZVC2E7 d4KofYIP1KwtjngkLgPNwBBv2B4cMDbqllf276moEGdkeNo1PxEFY47tiMc7Gd/Vs63H9j2nVn1yR SCtUSib82UL4LtayiOY5VjxPN0jirELCyvVQChKiaDmgFRcKwaMBmtoh6nhdK1GZcg7rw+QHm75JY TYBZkokObsizuQGo/UlVMs1l473Uh5Q/HhIIEQsrMxgbHn+oiei1PgDZ4MIbjDI0B9VXRJr70uqpK dQadUko4lge54p40Y5bL4DTiUzqj/rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLrPg-00EBfD-7X; Wed, 10 Aug 2022 19:30:44 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLrPc-00EBcS-ET for linux-arm-kernel@lists.infradead.org; Wed, 10 Aug 2022 19:30:41 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-31f63772b89so132173357b3.6 for ; Wed, 10 Aug 2022 12:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc; bh=1di/tt6ciXP+w3o/5q4XLldJe644DuKYm0Az9ViiC4I=; b=AzSz35DDsHcjaP6qfQYWUXAmnpUTMzrq+S9wxbQ6YASgGJtYseIgCVALZTXZLBBh6h TlI8UPji2eQtQQDx15SApQOZMsowyWhCJXr5ElbnZqyt+LK01lN5p+hCZ6qEoenAAIDz q+OnhuChs9jcmHZkPQdyMp8lm+MgdnNY2m71pkhUYIcfuKr48YUXdx3TUqzmK8aBLnTG iqfu++8u/0bPEgzUSjEbVUcXxEoKE4GQctSb/3U7n5tr/b8DgFKFKc2wjZV73qxA6Rq6 wlU2R3O5jN/lb80Hp8mxAtDf00IzDPcteKaMzuTRhWBhqlsTMSGVlQPSz1iqW45o9U1e NxGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc; bh=1di/tt6ciXP+w3o/5q4XLldJe644DuKYm0Az9ViiC4I=; b=Eu76jiCNXSOb04nMfHsvvGe5MmmE2mFfLaOO2tHW2Jb+BRHoCZMgyQ8/dUzxbHXJZ2 EhVEEDLQI8lpam1kNciCacr52zttYWWIyKBCwJG26HwmqXuK47ut/B32bB/n24gPgFGA 5wKD2YoZWAbX4nNx2d2iVD5kZ2F6eh8c2W8Pbf47a5ZVr8iI6YlZwPVXhenI2ETev09v ygQqJJFXrs4GA13Q0ba40lhe8Kgx0IVKuXaqS2rUYBXN3pFRA1Mp0C9XxclPbuQzgM1S +P8GSwgnEKkReDrRaaUyh3cQfivKkEcjPYdwHgLz9vF2eFEkOrQpRp/GzTOu93tpL2cn VgJQ== X-Gm-Message-State: ACgBeo16qGt+S/0MuD0uIh09TzhvTFbNT1pp9JPjaeREr2PUgEWAoErs 6PKh1IkYTM1x+swhM71W0xpqItIfdaT3ZUaKHBX16yRxKCBV2wpt9t/Gicw3frEwzSrHlkuCd78 LZhRQYn4ysgpWy4VLjuHPWcfWCZanA9w9Rw0Pd/Up71R95Yf35ejNpaYbYmqWcaXr6k1v3AIz X-Google-Smtp-Source: AA6agR4MYoEAPEEGe/xF/Ddp+XkcPsty64vZpHzAiVCbe2OV1iXIkQhzrbTI7V5lKnz380bWoms/WIc= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:200:4d8b:fb2a:2ecb:c2bb]) (user=pcc job=sendgmr) by 2002:a25:790d:0:b0:670:6032:b1df with SMTP id u13-20020a25790d000000b006706032b1dfmr25551772ybc.629.1660159837207; Wed, 10 Aug 2022 12:30:37 -0700 (PDT) Date: Wed, 10 Aug 2022 12:30:26 -0700 Message-Id: <20220810193033.1090251-1-pcc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog Subject: [PATCH v3 0/7] KVM: arm64: permit MAP_SHARED mappings with MTE enabled From: Peter Collingbourne To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: Peter Collingbourne , Cornelia Huck , Catalin Marinas , Will Deacon , Marc Zyngier , Evgenii Stepanov , kvm@vger.kernel.org, Steven Price , Vincenzo Frascino X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_123040_509271_7B20FF4E X-CRM114-Status: GOOD ( 23.93 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This patch series allows VMMs to use shared mappings in MTE enabled guests. The first four patches are based on the series that Catalin sent out, whose cover letter [1] I quote from below: > This series aims to fix the races between initialising the tags on a > page and setting the PG_mte_tagged flag. Currently the flag is set > either before or after that tag initialisation and this can lead to CoW > copying stale tags. The first patch moves the flag setting after the > tags have been initialised, solving the CoW issue. However, concurrent > mprotect() on a shared mapping may (very rarely) lead to valid tags > being zeroed. > > The second skips the sanitise_mte_tags() call in kvm_set_spte_gfn(), > deferring it to user_mem_abort(). The outcome is that no > sanitise_mte_tags() can be simplified to skip the pfn_to_online_page() > check and only rely on VM_MTE_ALLOWED vma flag that can be checked in > user_mem_abort(). > > The third and fourth patches use PG_arch_3 as a lock for page tagging, > based on Peter Collingbourne's idea of a two-bit lock. > > I think the first patch can be queued but the rest needs some in depth > review and test. With this series (if correct) we could allos MAP_SHARED > on KVM guest memory but this is to be discussed separately as there are > some KVM ABI implications. I rebased Catalin's series onto -next, addressed the issues that I identified in the review and added the proposed userspace enablement patches after the series. [1] https://lore.kernel.org/all/20220705142619.4135905-1-catalin.marinas@arm.com/ Catalin Marinas (3): arm64: mte: Fix/clarify the PG_mte_tagged semantics KVM: arm64: Simplify the sanitise_mte_tags() logic arm64: mte: Lock a page for MTE tag initialisation Peter Collingbourne (4): mm: Add PG_arch_3 page flag KVM: arm64: unify the tests for VMAs in memslots when MTE is enabled KVM: arm64: permit all VM_MTE_ALLOWED mappings with MTE enabled Documentation: document the ABI changes for KVM_CAP_ARM_MTE Documentation/virt/kvm/api.rst | 5 ++- arch/arm64/include/asm/mte.h | 62 +++++++++++++++++++++++++++++++ arch/arm64/include/asm/pgtable.h | 3 +- arch/arm64/kernel/cpufeature.c | 4 +- arch/arm64/kernel/elfcore.c | 2 +- arch/arm64/kernel/hibernate.c | 2 +- arch/arm64/kernel/mte.c | 17 ++++++--- arch/arm64/kvm/guest.c | 18 +++++---- arch/arm64/kvm/mmu.c | 55 +++++++++++---------------- arch/arm64/mm/copypage.c | 6 ++- arch/arm64/mm/fault.c | 4 +- arch/arm64/mm/mteswap.c | 5 ++- fs/proc/page.c | 1 + include/linux/kernel-page-flags.h | 1 + include/linux/page-flags.h | 1 + include/trace/events/mmflags.h | 7 ++-- mm/huge_memory.c | 1 + tools/vm/page-types.c | 2 + 18 files changed, 137 insertions(+), 59 deletions(-) -- 2.37.1.559.g78731f0fdb-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel