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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9941EC4361B for ; Mon, 7 Dec 2020 19:05:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C38AB238E4 for ; Mon, 7 Dec 2020 19:05:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C38AB238E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmLoi-0002Sh-5T for qemu-devel@archiver.kernel.org; Mon, 07 Dec 2020 14:05:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmLn8-0001hd-Iu for qemu-devel@nongnu.org; Mon, 07 Dec 2020 14:03:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:44610) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmLn5-0004Wt-PK for qemu-devel@nongnu.org; Mon, 07 Dec 2020 14:03:22 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C803238E3; Mon, 7 Dec 2020 19:03:17 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kmLn0-00GqYW-Qe; Mon, 07 Dec 2020 19:03:15 +0000 Date: Mon, 07 Dec 2020 19:03:13 +0000 Message-ID: <874kkx5thq.wl-maz@kernel.org> From: Marc Zyngier To: Catalin Marinas Subject: Re: [PATCH v5 0/2] MTE support for KVM guest In-Reply-To: <20201207163405.GD1526@gaia> References: <20201119153901.53705-1-steven.price@arm.com> <20201119184248.4bycy6ouvaxqdiiy@kamzik.brq.redhat.com> <46fd98a2-ee39-0086-9159-b38c406935ab@arm.com> <0d0eb6da6a11f76d10e532c157181985@kernel.org> <20201207163405.GD1526@gaia> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: catalin.marinas@arm.com, steven.price@arm.com, peter.maydell@linaro.org, haibo.xu@linaro.org, linux-kernel@vger.kernel.org, quintela@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, dgilbert@redhat.com, tglx@linutronix.de, will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Dave.Martin@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Received-SPF: pass client-ip=198.145.29.99; envelope-from=maz@kernel.org; helo=mail.kernel.org X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Juan Quintela , QEMU Developers , Dave Martin , Richard Henderson , lkml - Kernel Mailing List , Steven Price , arm-mail-list , Haibo Xu , Thomas Gleixner , Will Deacon , kvmarm , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Mon, 07 Dec 2020 16:34:05 +0000, Catalin Marinas wrote: > > On Mon, Dec 07, 2020 at 04:05:55PM +0000, Marc Zyngier wrote: > > What I'd really like to see is a description of how shared memory > > is, in general, supposed to work with MTE. My gut feeling is that > > it doesn't, and that you need to turn MTE off when sharing memory > > (either implicitly or explicitly). > > The allocation tag (in-memory tag) is a property assigned to a physical > address range and it can be safely shared between different processes as > long as they access it via pointers with the same allocation tag (bits > 59:56). The kernel enables such tagged shared memory for user processes > (anonymous, tmpfs, shmem). I think that's one case where the shared memory scheme breaks, as we have two kernels in charge of their own tags, and they obviously can't be synchronised > What we don't have in the architecture is a memory type which allows > access to tags but no tag checking. To access the data when the tags > aren't known, the tag checking would have to be disabled via either a > prctl() or by setting the PSTATE.TCO bit. I guess that's point (3) in Steven's taxonomy. It still a bit ugly to fit in an existing piece of userspace, specially if it wants to use MTE for its own benefit. > The kernel accesses the user memory via the linear map using a match-all > tag 0xf, so no TCO bit toggling. For user, however, we disabled such > match-all tag and it cannot be enabled at run-time (at least not easily, > it's cached in the TLB). However, we already have two modes to disable > tag checking which Qemu could use when migrating data+tags. I wonder whether we will have to have something kernel side to dump/reload tags in a way that matches the patterns used by live migration. M. -- Without deviation from the norm, progress is not possible.