Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3220671rwb; Mon, 5 Sep 2022 08:11:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Dm/bqNgs0N6plf95v+cPzIqLb1rn294zXSQDMOrOk5XXfps9aE9CzxfFM3dyMVNoj/6LR X-Received: by 2002:a17:907:a0c7:b0:734:e049:1af6 with SMTP id hw7-20020a170907a0c700b00734e0491af6mr35689985ejc.439.1662390675920; Mon, 05 Sep 2022 08:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662390675; cv=none; d=google.com; s=arc-20160816; b=Mhp07zXLPrLXV3MEiTtRs+uApXzo1/i5HdbLJCgzd1r3yWOzOwD332V86TaDc4x9X9 BjQ1hfLDVRhLcIIcd77S06MuUi5xRFK+sYx23Jhk8d/OfIFj32LikOeREAL98yJv8HNp ZJbI5x5uI2l5hHlV8rj4CmmR6NL70Yr0G8TlrB5fRgxXAwtA2ZY1QCcP1uT+TBtFdmnb 6O/XXmx9mgzNjTLwIZgGrsRxv54/uJejppXI4NUpgDIndXMkNHg8VwnMQqKDlugAZQKX npcEcw++nRHOLkb9cbe/r3bPkOed4PvU//1J8DaXNGqvYbJGm6q4rUt9nUdyZGskEkLB n0Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gxQZxrz6/Rmgmd2QHgOZBnPfQnJH2I/vdis+B00Izpw=; b=p7NHwcE+/AEXmwKVv3wOlRUed4lms6ZZxoI8lhmHd5EG/t5QfwRGBEnd2vtMe5o0IE s+sEASFG0Mq+GoTLwGtP22kh9dIDrjrytkzAq/WtJHcLnWXXAVTLD4phf1ZI+vvLE+yK Vy7JfXbmaRnJwRuKJ4VZ+2L/TsYxDJF/i0GcogfZgCwZcIj6i61Mvy/nnq4iLsAGPsh/ 7LVyovxEYjd0EWaMtG74etkh2aEtPPYoBY0I72Ezs5mA+rDhp93Qw0qbJPiGVzYX3r8t ltlBzZZKGjt+CEE1czpPaqgLCLMAIbzJqwFikU/GP7s0FFanV4gsrm44L306LEEmVWna Nqqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=H8IdYE3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt20-20020a1709072d9400b007314bba0e9bsi8790379ejc.353.2022.09.05.08.10.45; Mon, 05 Sep 2022 08:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=H8IdYE3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238081AbiIEOa7 (ORCPT + 99 others); Mon, 5 Sep 2022 10:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237386AbiIEOa4 (ORCPT ); Mon, 5 Sep 2022 10:30:56 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 502DE252BF for ; Mon, 5 Sep 2022 07:30:55 -0700 (PDT) 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> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.