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 7A58FECAAD5 for ; Mon, 5 Sep 2022 14:30:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91CC48D0098; Mon, 5 Sep 2022 10:30:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CC9C8D0076; Mon, 5 Sep 2022 10:30:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76C208D0098; Mon, 5 Sep 2022 10:30:48 -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 640158D0076 for ; Mon, 5 Sep 2022 10:30:48 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2464A1A0DDC for ; Mon, 5 Sep 2022 14:30:48 +0000 (UTC) X-FDA: 79878268176.26.537774F Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id 31F1DC0066 for ; Mon, 5 Sep 2022 14:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=gxQZxrz6/Rmgmd2QHgOZBnPfQnJH2I/vdis+B00Izpw=; b=H8IdYE3vM9OygIjH6gEddeQqWy wURL43ZQ8U8kNWUwDEejjJPrHRXxZ3ggxQZHq4KAiC+aNGO6znvPOaVK763MokIv2Ymd7//zyP9vk ypyMIL2g+qmFvJseRroyyJoznSlSMDojJqRhjwfuaCh0CJ9F7+51GyIP2KQjgLo0SQWPq47nRXjoP r7aJklZmeKbW9hwHotZwKhDj0LwH/PIPGyD7nJUOap0F/vQX583rwsco63KLWhQEF4GOog+upEduo 0vzd96rSxr2J8B1Y6LLoChzTkeZtXn0POrp7MciofPpcZGGELp+yWmQXIECm7c/6LnGkIMahLSdSR lVUBnHwQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVD7M-009YGc-Tu; Mon, 05 Sep 2022 14:30:29 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8BE993002A3; Mon, 5 Sep 2022 16:30:25 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6E2032B954D28; Mon, 5 Sep 2022 16:30:25 +0200 (CEST) Date: Mon, 5 Sep 2022 16:30:25 +0200 From: Peter Zijlstra To: "Kirill A. Shutemov" Cc: Bharata B Rao , ananth.narayan@amd.com, "Kirill A. Shutemov" , Dave Hansen , Andy Lutomirski , 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: References: <20220830010104.1282-1-kirill.shutemov@linux.intel.com> <20220904010001.knlcejmw4lg2uzy3@box.shutemov.name> <64519d0b-b696-db47-52c2-303451e10c09@amd.com> <20220905134457.a2f7uluq42frsgwe@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220905134457.a2f7uluq42frsgwe@box.shutemov.name> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662388247; a=rsa-sha256; cv=none; b=b1rSlSXPupesJAM+7NRNelVYhgs71iR+mQ2J8ZOuqTvSQJNNSP3AgOr+p/vobUwEBQoTKn oeGBHVroZ7UFDqfCvgLkA/CGcC8yfRqqou6y3O52DaNm2g2QNcqbY5S23CqZBbM/7kbsUC uZ65GhkLebc6p1lvnfz4Hm4OekvYd4E= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=H8IdYE3v; spf=none (imf10.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662388247; 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=gxQZxrz6/Rmgmd2QHgOZBnPfQnJH2I/vdis+B00Izpw=; b=VQmoMbEuE9N1Kdm+4rjaYkh9uC1UYFmIPtnCxUiJyRn9Y5Ecb4AIQ5PAneuQkTRSSkpxfl IqTURU22HcmIZbzz6eRHgCJ0PR6iJaJv7KRenbfPaaXxJnFeNkjo/wfu5whCrfS6tsAGP/ 4eVp+G7a3SrYhcTt2pywY8Fbr5JNT60= X-Stat-Signature: 9gpjjes45wohdopy7zm4rz49h17rndao X-Rspamd-Queue-Id: 31F1DC0066 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=H8IdYE3v; spf=none (imf10.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam03 X-HE-Tag: 1662388247-846463 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 04:44:57PM +0300, Kirill A. Shutemov wrote: > 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. I suppose the critical bit is the memory load. That can stall and then you're sad. A jump_label is easy enough to add.