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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89658C43334 for ; Thu, 14 Jul 2022 14:29:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD3D09401AB; Thu, 14 Jul 2022 10:29:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5D059401A5; Thu, 14 Jul 2022 10:29:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FF199401AB; Thu, 14 Jul 2022 10:29:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8ACA29401A5 for ; Thu, 14 Jul 2022 10:29:14 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6019F35680 for ; Thu, 14 Jul 2022 14:29:14 +0000 (UTC) X-FDA: 79685937828.21.BC631EB Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by imf26.hostedemail.com (Postfix) with ESMTP id F1CAB140068 for ; Thu, 14 Jul 2022 14:29:13 +0000 (UTC) Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-31c8bb90d09so18711797b3.8 for ; Thu, 14 Jul 2022 07:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=YlzZEqFoTc04SaZBu+v7x99uaEOuP4naXZYf5VPkZpc=; b=O/YzZ0aJNVY0Olu0WGI7mfps/K+hxAP/Q5ehQ9uy5W5FbDiZYpkflfBu66QtnT5UoT 8WQvvcRBZO6qpjjuim4qUGZXrVSNYwib4GqhQtoMwFWNWN8ljQGo8/Zx5TSMD/YRMibi KDyRYOewJNHyW3I8zqJkngwbgp5d60pPZAuOkLQncEQ2Sn5BP9CGJqMGZSvydpEL0SQS 1OizMwLX+6/HdbP/BabSv9/AJ7qi7gzdd+jL5bqY97w82jLciJkdq/rb9ngfNgaZvO2l XF5cCgws4GpWiY+gcMhgP7UbUmYV7WEusKRh1sxJDzMsS3CDl1up9yBfhXijAFZPycRB +u+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=YlzZEqFoTc04SaZBu+v7x99uaEOuP4naXZYf5VPkZpc=; b=NblVyBr4YUAsO0OUcT7VaKumN8YttB1yBGjzmDMz0KnqhBgfts9lpAiTnBcsX6by40 f+ky+rVJPHDG0F6IIhQB3yTmREfO4Ka5VUEzvuF+nWhUAWS0b+d5SXuMOGr4S4/jOBKo oAiOfE93w/oyUXwAwkPfyyVJGQ0GqQdj2UfMDxjyIGgi23SaQl2XQRBTdYmQtY+nGpci De+X9NO+xGcgUAweuV9eA5w9flYbxodeuPVAM/8xDES34UFJNRgQCdCwJLBu+04qwCYJ vZaojlUZZTYOxIqFsHGRHTc/fZioXwWLUNtAOebFEMV9XqVg3A03afvGamxCLIGGjI8o w/EQ== X-Gm-Message-State: AJIora/t+OY48NdWVEACW2ZEW+LRdUr00cpRFGfs4W/9qqguLXgWNWjq vIZJPK/jdkoM8rP8STSQMsbPD93vuel6kyOS1qTLww== X-Google-Smtp-Source: AGRyM1vmdPBPDNRzF1/taI9PrebdFz2nDxBIOBFxahbjY1dlb1Sm6VY7LTHE55gzvKHxyFa+dJlJ43zOPZNBDS/L1RE= X-Received: by 2002:a81:1216:0:b0:31d:b19e:b72b with SMTP id 22-20020a811216000000b0031db19eb72bmr10102575yws.265.1657808952998; Thu, 14 Jul 2022 07:29:12 -0700 (PDT) MIME-Version: 1.0 References: <20220622162230.83474-1-kirill.shutemov@linux.intel.com> <20220622162230.83474-7-kirill.shutemov@linux.intel.com> <20220712171445.74b46mgdxgaub3qj@black.fi.intel.com> In-Reply-To: <20220712171445.74b46mgdxgaub3qj@black.fi.intel.com> From: Alexander Potapenko Date: Thu, 14 Jul 2022 16:28:36 +0200 Message-ID: Subject: Re: [PATCHv4 6/8] x86/mm: Provide ARCH_GET_UNTAG_MASK and ARCH_ENABLE_TAGGED_ADDR To: "Kirill A. Shutemov" Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , "the arch/x86 maintainers" , Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657808954; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YlzZEqFoTc04SaZBu+v7x99uaEOuP4naXZYf5VPkZpc=; b=Qj78/A17ELL5czA2zWltQF841DuIZxT4Y/V1ANTKaRX0ue8N4HG4A5kyPFARClEGjK5MiI R/sREaKLmzlSv9HWHva1NddpbKLF16kjzdY2VgdBOhokIv20ZcmZ9yS2opkAaLDRPm37sR LNBmky0/T5rCpfy8u97w5521f+B2L5M= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657808954; a=rsa-sha256; cv=none; b=BUmWlvdqFRAkVuCglqBkFKi1mLwP7Xo8wB+i3ECLYFTHfUbxjQGbmAen5zQ+vJxSZSw0Nh vSFQWChniS/R7VH1dHe9fmDb9dDMEPbAoJC7reKY1Srpkz7hUskWiRCr/WVh1dZ3+Cfpp+ 5KiEX0IuPE+HkM4nN2QbGGjsD1ZRTuc= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="O/YzZ0aJ"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of glider@google.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=glider@google.com X-Stat-Signature: mnfqz76yayrt8ddswrrnrpfsk4fju9ra X-Rspamd-Queue-Id: F1CAB140068 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="O/YzZ0aJ"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of glider@google.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=glider@google.com X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1657808953-444116 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jul 12, 2022 at 7:14 PM Kirill A. Shutemov wrote: > > On Tue, Jul 12, 2022 at 03:12:01PM +0200, Alexander Potapenko wrote: > > On Wed, Jun 22, 2022 at 6:22 PM Kirill A. Shutemov > > wrote: > > > > > > Add a couple of arch_prctl() handles: > > > > > > - ARCH_ENABLE_TAGGED_ADDR enabled LAM. The argument is required numb= er > > > of tag bits. It is rounded up to the nearest LAM mode that can > > > provide it. For now only LAM_U57 is supported, with 6 tag bits. > > > > > > - ARCH_GET_UNTAG_MASK returns untag mask. It can indicates where tag > > > bits located in the address. > > > > > Am I right that the desired way to detect the presence of LAM without > > enabling it is to check that arch_prctl(ARCH_GET_UNTAG_MASK, ...) > > returns zero? > > Returns -1UL, but yes. No, I meant the return value of arch_prctl(), but in fact neither seems to be true. Right now e.g. for the 5.17 kernel arch_prctl(ARCH_GET_UNTAG_MASK, &bits) returns -EINVAL regardless of the underlying hardware. A new kernel with your patches will return 0 and set bits=3D-1UL on both non-LAM and LAM-enabled machines. How can we distinguish those? > > > > One would expect that `arch_prctl(ARCH_ENABLE_TAGGED_ADDR, 0)` > > disables tagging for the current process. > > Shouldn't this workflow be supported as well? > > Is there an use-case for it? > > I would rather keep the interface minimal. We can always add this in the > future if an use-case comes. As discussed offline, we don't have a use-case for this yet, so I don't ins= ist. > -- > Kirill A. Shutemov --=20 Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Stra=C3=9Fe, 33 80636 M=C3=BCnchen Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg