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 9214BECAAD5 for ; Mon, 5 Sep 2022 13:45:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B54C28D0097; Mon, 5 Sep 2022 09:45:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B04EC8D0076; Mon, 5 Sep 2022 09:45:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A4BB8D0097; Mon, 5 Sep 2022 09:45:06 -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 871EE8D0076 for ; Mon, 5 Sep 2022 09:45:06 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5F3FA141897 for ; Mon, 5 Sep 2022 13:45:06 +0000 (UTC) X-FDA: 79878153012.18.DDF535C Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by imf09.hostedemail.com (Postfix) with ESMTP id DE9AE140081 for ; Mon, 5 Sep 2022 13:45:05 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id C6DD13200928; Mon, 5 Sep 2022 09:45:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 05 Sep 2022 09:45:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1662385502; x=1662471902; bh=yg aFQaIZgsPlCvGxBshcdt6jZDFSv4YrxILywAef6b8=; b=coAufvSS5LgJkML+Dv lLyuYw/AKPUQP2GvZSgAeHrLKFkSEk7QGwlbpqCnjpNDhZ5daNWM3UWOwuTRi0sM OfPO6MYqRUwp5K1W6cUpk6E3txlJW3bicoPGdy87xLZjYNbFr53oLPH1Gz01lAXd /YUBGMSj9mvU8WjO5VcIFlTYFZmrqo/tEBrrnOEMQHYAZIPj44qYeHD2r/VIZwdw 6ZlIrOSlimsg5hCebvtECkBDm4HV7UvLngpOh6mxYH3IwVf2ACsdd5SbAPXHrXLs atHkg579fM+vVpMQukXWDOoYtUd811JHAo0YySqXs6O5pqZMYfqMAzewAmVvKDzC 3zyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1662385502; x=1662471902; bh=ygaFQaIZgsPlCvGxBshcdt6jZDFS v4YrxILywAef6b8=; b=nFm8Mfc2DXB+9ZyKKBwZh78iHFJRJHN93G1ikx6tfDsi Lvq8gtE+UpIavRFvoMwU8zNPmUbQRtXXwnT6KN8zOFGK72WXFJZPEcl7OS5LqKqo fBDpgAdXHvsMvpou52fDMLmS6DsPCsUao7RqeDFOGI6dJ47MWQzwc1dok0w6OoUV ppyijT6WzohX3BlO+ndF3YBsM9nf55We/O64qtdHwSnhL6udto8m7dDu7WdF21vS pll2lZ/pXkgEjVRsgM1qRGL3l4r91QIEywa0AyOIQcFe6JEBmRx3TB/3y/OiYH/Z X8evXWjq/DN7R42/3DcSS5SL8GQiF1GUieA8HBOoCQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeliedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdttddttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpeelgffhfeetlefhveffleevfffgtefffeelfedu udfhjeduteeggfeiheefteehjeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhirhhilhhl sehshhhuthgvmhhovhdrnhgrmhgv X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 5 Sep 2022 09:45:01 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id CC4821040BF; Mon, 5 Sep 2022 16:44:57 +0300 (+03) Date: Mon, 5 Sep 2022 16:44:57 +0300 From: "Kirill A. Shutemov" To: Bharata B Rao Cc: ananth.narayan@amd.com, "Kirill A. Shutemov" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Alexander Potapenko , Taras Madan , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv8 00/11] Linear Address Masking enabling Message-ID: <20220905134457.a2f7uluq42frsgwe@box.shutemov.name> References: <20220830010104.1282-1-kirill.shutemov@linux.intel.com> <20220904010001.knlcejmw4lg2uzy3@box.shutemov.name> <64519d0b-b696-db47-52c2-303451e10c09@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <64519d0b-b696-db47-52c2-303451e10c09@amd.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662385506; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ygaFQaIZgsPlCvGxBshcdt6jZDFSv4YrxILywAef6b8=; b=b5WdpAjqSnguniM1moAikdZkED1WtDCrkBReB/TfBPrQDRsU+n+bK7LAt6WhPTLD2xqJz+ v87VAmqGnDGLX93kFW0DuI1lL8ILLYF7ewHnn7+A5EaBHbrh0Zkmyw3IxnIZOFHkXTzTqy IPMimFcQ2aMmOnSp6fIrY02BnJN0vDU= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm3 header.b=coAufvSS; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=nFm8Mfc2; spf=pass (imf09.hostedemail.com: domain of kirill@shutemov.name designates 64.147.123.24 as permitted sender) smtp.mailfrom=kirill@shutemov.name; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662385506; a=rsa-sha256; cv=none; b=ylGx4+yofmrPPpjikwuiBbtaP8Ov5x6fKJili+sOj/vvfem08nt4UJSmUCsV/0Lh4ZTxnU mLgNw8En2J65sDvYM1Cc/IV9yVKPXdS5MnCO6O2dia1RLlj2xQqRqdZFJzVpMEXUmMGOou DOJyAJeRsllx5oYfeyrkD8e3URUYf9g= X-Rspam-User: X-Stat-Signature: gfstrsz9y3ser7k77xxbi85rhsth7yxp X-Rspamd-Queue-Id: DE9AE140081 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm3 header.b=coAufvSS; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=nFm8Mfc2; spf=pass (imf09.hostedemail.com: domain of kirill@shutemov.name designates 64.147.123.24 as permitted sender) smtp.mailfrom=kirill@shutemov.name; dmarc=none X-Rspamd-Server: rspam04 X-HE-Tag: 1662385505-537912 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 Mon, Sep 05, 2022 at 10:35:44AM +0530, Bharata B Rao wrote: > Hi Kirill, > > On 9/4/2022 6:30 AM, Kirill A. Shutemov wrote: > > On Tue, Aug 30, 2022 at 04:00:53AM +0300, Kirill A. Shutemov wrote: > >> Linear Address Masking[1] (LAM) modifies the checking that is applied to > >> 64-bit linear addresses, allowing software to use of the untranslated > >> address bits for metadata. > >> > >> The patchset brings support for LAM for userspace addresses. Only LAM_U57 at > >> this time. > >> > >> Please review and consider applying. > >> > >> git://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git lam > > > > +Bharata, Ananth. > > > > Do you folks have any feedback on the patchset? > > > > Looks like AMD version of the tagged pointers feature does not get > > traction as of now, but I want to be sure that the interface introduced > > here can be suitable for your future plans. > > > > Do you see anything in the interface that can prevent it to be extended to > > the AMD feature? > > The arch_prctl() extensions is generic enough that it should be good. > > The untagged_addr() macro looks like this from one of the callers: > > start = untagged_addr(mm, start); > ffffffff814d39bb: 48 8b 8d 40 ff ff ff mov -0xc0(%rbp),%rcx > ffffffff814d39c2: 48 89 f2 mov %rsi,%rdx > ffffffff814d39c5: 48 c1 fa 3f sar $0x3f,%rdx > ffffffff814d39c9: 48 0b 91 50 03 00 00 or 0x350(%rcx),%rdx > ffffffff814d39d0: 48 21 f2 and %rsi,%rdx > ffffffff814d39d3: 49 89 d6 mov %rdx,%r14 > > Can this overhead of a few additional instructions be removed for > platforms that don't have LAM feature? I haven't measured how much > overhead this effectively contributes to in real, but wonder if it is > worth optimizing for non-LAM platforms. I'm not sure how the optimization should look like. I guess we can stick static_cpu_has() there, but I'm not convinced that adding jumps there will be beneficial. -- Kiryl Shutsemau / Kirill A. Shutemov