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=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 C4E3EC2B9F4 for ; Fri, 25 Jun 2021 12:03:27 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 911D861621 for ; Fri, 25 Jun 2021 12:03:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 911D861621 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6Nl42OBnJw4IOFP3BMSkaY3faZU2C7rTGLUwZZ5siWE=; b=Z/1nYnf7Co8Bwi i0ZKmfYp3+XluU6VhCwBZ9Oj4H3W7tOxwe5q4sfsqwMURFC0At30ydz9W2Iz0i3yN4VngmqWfbeSC UKxEcbOG8DwA5/e6uq4O1wdOqyOmxk1Z6tDFNJ0xtmbjBr+r8B+mJ6VOgqpb5Nz/oBKYyoQ7kZDR4 NuLJl57WEnYwFkD7cnshQhl+lM4M/EJPvKXu+LpBvqxjbL+R0h0hDKeA0h2qqyAq/FTCF0euru++d bV2E2j1WRB/NlHuSrSD45H+flwlC+ryzvr5NpfEf7xL68ZOQ4eh5fveX9ucCGDQFtkEHv8UuWtd1T 9nIsQtDVT71+hWsgjvUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwkWm-001O28-IH; Fri, 25 Jun 2021 12:01:44 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwkWj-001O1k-Bm for linux-arm-kernel@lists.infradead.org; Fri, 25 Jun 2021 12:01:42 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id DA90B61621; Fri, 25 Jun 2021 12:01:39 +0000 (UTC) Date: Fri, 25 Jun 2021 13:01:37 +0100 From: Catalin Marinas To: Szabolcs Nagy Cc: Peter Collingbourne , Will Deacon , Vincenzo Frascino , Evgenii Stepanov , Linux ARM , Tejas Belagod Subject: Re: [PATCH v5] arm64: mte: allow async MTE to be upgraded to sync on a per-CPU basis Message-ID: <20210625120137.GC20835@arm.com> References: <20210617215829.GD25403@willie-the-truck> <20210618150953.GH16116@arm.com> <20210621123936.GB29283@willie-the-truck> <20210621151858.GC11552@arm.com> <20210621173902.GA29713@willie-the-truck> <20210621185036.GD11552@arm.com> <20210623085530.GF13058@arm.com> <20210624165228.GB25097@arm.com> <20210625092253.GJ13058@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210625092253.GJ13058@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210625_050141_463932_D2695E44 X-CRM114-Status: GOOD ( 31.10 ) 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 On Fri, Jun 25, 2021 at 10:22:53AM +0100, Szabolcs Nagy wrote: > The 06/24/2021 17:52, Catalin Marinas wrote: > > Thanks. Is there any MTE support in mainline glibc? If not, we may have > > another chance of adjusting the ABI. > > glibc exposed heap tagging via an env var mechanism that can change > between glibc releases, i.e. not abi stable, and we have no real > contract about how the prctl can be used on top of glibc (see e.g. the > multi-thread issue). > > we don't expect the async mode to be very useful on glibc based linux > systems. > > changing async mode is unlikely to affect anything in userspace at > this point. Thanks, that's useful. I guess since the _MTAG_ENABLE tunable is not ABI, the user app can't rely on what the glibc has configured. Arguably, since it's driven from outside the application (env), we could say the same for sysfs, though for the glibc case, the user app is still be able to override it before the first thread is created (or per-thread). I assume glibc only issues the prctl() once, not for every new thread. > > The proposed interface is sysfs. I think that's not relevant to the user > > application since it wouldn't have control over it anyway. What's > > visible is that it cannot rely on the mode it requested, not even for > > the lifetime of a thread (as it may migrate between CPUs). Do you see > > any issues with this? For Android, it's probably fine but if other > > programs cannot cope (or need the specific mode requested), we'd need a > > new control (for opt-in or opt-out). > > i don't see any issues with changing async mode. > > i assume the prctl get operation would return whatever was the prctl > setting for the thread and not try to expose the per cpu architectural > state. Yes. > i assume async vs sync fault can be distinguished via the > SEGV_MTE{A,S}ERR si_code. Indeed. So we can document that the mode requested by the app is an indication, the system may change it to another value (and back-port documentation to 5.10). If we get a request from developers to honour a specific mode, we can add a new PR_MTE_TCF_EXACT bit or something but it's not essential we do it now. So if we allow the kernel to change the user requested mode (via sysfs), I think we still have two more issues to clarify: 1. Do we allow only "upgrade" (for some meaning of this) or sysfs can downgrade to a less strict mode. I'd go for upgrade here to a stricter check as in Peter's patch. 2. Should the sysfs upgrade the PR_MTE_TCF_NONE? _MTAG_ENABLE does that, so I'd say yes. Any other thoughts are welcome. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel